From 854ac947d84a3093a67af6714f11378990e1a916 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Mon, 24 Jun 2019 13:01:21 +0100 Subject: [PATCH] Unique text domains --- composer.json | 3 +- .../class-wc-rest-coupons-v1-controller.php | 62 ++-- ...-rest-customer-downloads-v1-controller.php | 28 +- .../class-wc-rest-customers-v1-controller.php | 130 +++---- ...lass-wc-rest-order-notes-v1-controller.php | 46 +-- ...ss-wc-rest-order-refunds-v1-controller.php | 72 ++-- .../class-wc-rest-orders-v1-controller.php | 246 +++++++------- ...-product-attribute-terms-v1-controller.php | 24 +- ...-rest-product-attributes-v1-controller.php | 48 +-- ...-rest-product-categories-v1-controller.php | 30 +- ...-wc-rest-product-reviews-v1-controller.php | 64 ++-- ...product-shipping-classes-v1-controller.php | 10 +- ...ass-wc-rest-product-tags-v1-controller.php | 10 +- .../class-wc-rest-products-v1-controller.php | 320 +++++++++--------- ...ass-wc-rest-report-sales-v1-controller.php | 30 +- ...-rest-report-top-sellers-v1-controller.php | 6 +- .../class-wc-rest-reports-v1-controller.php | 10 +- ...lass-wc-rest-tax-classes-v1-controller.php | 22 +- .../class-wc-rest-taxes-v1-controller.php | 64 ++-- ...-rest-webhook-deliveries-v1-controller.php | 38 +-- .../class-wc-rest-webhooks-v1-controller.php | 84 ++--- .../class-wc-rest-coupons-v2-controller.php | 72 ++-- ...-rest-customer-downloads-v2-controller.php | 26 +- .../class-wc-rest-customers-v2-controller.php | 82 ++--- ...s-wc-rest-network-orders-v2-controller.php | 12 +- ...lass-wc-rest-order-notes-v2-controller.php | 14 +- ...ss-wc-rest-order-refunds-v2-controller.php | 84 ++--- .../class-wc-rest-orders-v2-controller.php | 292 ++++++++-------- ...wc-rest-payment-gateways-v2-controller.php | 46 +-- ...-rest-product-categories-v2-controller.php | 34 +- ...-wc-rest-product-reviews-v2-controller.php | 20 +- ...-rest-product-variations-v2-controller.php | 140 ++++---- .../class-wc-rest-products-v2-controller.php | 250 +++++++------- ...-wc-rest-setting-options-v2-controller.php | 40 +-- .../class-wc-rest-settings-v2-controller.php | 14 +- ...wc-rest-shipping-methods-v2-controller.php | 14 +- ...-shipping-zone-locations-v2-controller.php | 8 +- ...st-shipping-zone-methods-v2-controller.php | 56 +-- ...s-wc-rest-shipping-zones-v2-controller.php | 18 +- ...rest-system-status-tools-v2-controller.php | 134 ++++---- ...ss-wc-rest-system-status-v2-controller.php | 158 ++++----- ...-rest-webhook-deliveries-v2-controller.php | 24 +- .../class-wc-rest-webhooks-v2-controller.php | 28 +- .../Version3/class-wc-rest-controller.php | 16 +- .../class-wc-rest-crud-controller.php | 52 +-- .../class-wc-rest-customers-controller.php | 78 ++--- ...ass-wc-rest-data-continents-controller.php | 34 +- .../class-wc-rest-data-controller.php | 14 +- ...lass-wc-rest-data-countries-controller.php | 14 +- ...ass-wc-rest-data-currencies-controller.php | 10 +- .../class-wc-rest-order-notes-controller.php | 22 +- ...class-wc-rest-order-refunds-controller.php | 6 +- .../class-wc-rest-orders-controller.php | 6 +- ...ss-wc-rest-payment-gateways-controller.php | 34 +- .../class-wc-rest-posts-controller.php | 52 +-- ...-wc-rest-product-categories-controller.php | 34 +- ...ass-wc-rest-product-reviews-controller.php | 104 +++--- ...-wc-rest-product-variations-controller.php | 120 +++---- .../class-wc-rest-products-controller.php | 200 +++++------ ...-rest-report-coupons-totals-controller.php | 6 +- ...est-report-customers-totals-controller.php | 10 +- ...c-rest-report-orders-totals-controller.php | 6 +- ...rest-report-products-totals-controller.php | 6 +- ...-rest-report-reviews-totals-controller.php | 8 +- .../class-wc-rest-reports-controller.php | 16 +- ...ass-wc-rest-setting-options-controller.php | 24 +- .../class-wc-rest-settings-controller.php | 12 +- ...wc-rest-shipping-zones-controller-base.php | 18 +- .../class-wc-rest-terms-controller.php | 50 +-- .../Version4/AbstractController.php | 16 +- .../Version4/AbstractObjectsController.php | 50 +-- .../AbstractShippingZonesController.php | 10 +- .../Version4/AbstractTermsContoller.php | 34 +- src/Controllers/Version4/Coupons.php | 68 ++-- .../Version4/CustomerDownloads.php | 30 +- src/Controllers/Version4/Customers.php | 120 +++---- src/Controllers/Version4/Data.php | 12 +- src/Controllers/Version4/Data/Continents.php | 34 +- src/Controllers/Version4/Data/Countries.php | 14 +- src/Controllers/Version4/Data/Currencies.php | 10 +- src/Controllers/Version4/Data/DownloadIPs.php | 6 +- src/Controllers/Version4/NetworkOrders.php | 12 +- src/Controllers/Version4/OrderNotes.php | 52 +-- src/Controllers/Version4/OrderRefunds.php | 94 ++--- src/Controllers/Version4/Orders.php | 280 +++++++-------- src/Controllers/Version4/PaymentGateways.php | 42 +-- .../Version4/ProductAttributeTerms.php | 24 +- .../Version4/ProductAttributes.php | 30 +- .../Version4/ProductCategories.php | 34 +- src/Controllers/Version4/ProductReviews.php | 92 ++--- .../Version4/ProductShippingClasses.php | 10 +- src/Controllers/Version4/ProductTags.php | 10 +- .../Version4/ProductVariations.php | 148 ++++---- src/Controllers/Version4/Products.php | 240 ++++++------- .../Version4/Requests/CustomerRequest.php | 6 +- .../Version4/Requests/OrderRequest.php | 12 +- .../Version4/Requests/ProductRequest.php | 4 +- .../Requests/ProductVariationRequest.php | 2 +- src/Controllers/Version4/Settings.php | 12 +- src/Controllers/Version4/SettingsOptions.php | 38 +-- src/Controllers/Version4/ShippingMethods.php | 10 +- .../Version4/ShippingZoneLocations.php | 8 +- .../Version4/ShippingZoneMethods.php | 56 +-- src/Controllers/Version4/ShippingZones.php | 18 +- src/Controllers/Version4/SystemStatus.php | 140 ++++---- .../Version4/SystemStatusTools.php | 130 +++---- src/Controllers/Version4/TaxClasses.php | 16 +- src/Controllers/Version4/Taxes.php | 56 +-- .../Version4/Utilities/BatchTrait.php | 8 +- .../Utilities/DatabaseInformation.php | 4 +- .../Version4/Utilities/ServerEnvironment.php | 2 +- .../Version4/Utilities/SettingsTrait.php | 8 +- .../Version4/Utilities/ThemeInformation.php | 2 +- .../Version4/Utilities/WPEnvironment.php | 10 +- src/Controllers/Version4/Webhooks.php | 74 ++-- src/Utilities/ImageAttachment.php | 2 +- woocommerce-rest-api.php | 4 +- 117 files changed, 2979 insertions(+), 2980 deletions(-) diff --git a/composer.json b/composer.json index a1391a1f352..be084222a5c 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,7 @@ }, "require-dev": { "phpunit/phpunit": "6.5.14", - "woocommerce/woocommerce-sniffs": "0.0.6", - "slowprog/composer-copy-file": "~0.3" + "woocommerce/woocommerce-sniffs": "0.0.6" }, "scripts": { "post-install-cmd": [ diff --git a/src/Controllers/Version1/class-wc-rest-coupons-v1-controller.php b/src/Controllers/Version1/class-wc-rest-coupons-v1-controller.php index 4fb300a9d4e..5290c9f153c 100644 --- a/src/Controllers/Version1/class-wc-rest-coupons-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-coupons-v1-controller.php @@ -67,7 +67,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'permission_callback' => array( $this, 'create_item_permissions_check' ), 'args' => array_merge( $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array( 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'required' => true, 'type' => 'string', ), @@ -79,7 +79,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -105,7 +105,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -250,7 +250,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { // Validate required POST fields. if ( 'POST' === $request->get_method() && 0 === $coupon->get_id() ) { if ( empty( $request['code'] ) ) { - return new WP_Error( 'woocommerce_rest_empty_coupon_code', sprintf( __( 'The coupon code cannot be empty.', 'woocommerce' ), 'code' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_empty_coupon_code', sprintf( __( 'The coupon code cannot be empty.', 'woocommerce-rest-api' ), 'code' ), array( 'status' => 400 ) ); } } @@ -266,7 +266,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { $id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id ); if ( $id_from_code ) { - return new WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $coupon->set_code( $coupon_code ); @@ -307,7 +307,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $coupon_id = $this->save_coupon( $request ); @@ -348,7 +348,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { $post_id = (int) $request['id']; if ( empty( $post_id ) || get_post_type( $post_id ) !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $coupon_id = $this->save_coupon( $request ); @@ -412,64 +412,64 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the object.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the object.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the coupon was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the coupon was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Coupon description.', 'woocommerce' ), + 'description' => __( 'Coupon description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'discount_type' => array( - 'description' => __( 'Determines the type of discount that will be applied.', 'woocommerce' ), + 'description' => __( 'Determines the type of discount that will be applied.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'fixed_cart', 'enum' => array_keys( wc_get_coupon_types() ), 'context' => array( 'view', 'edit' ), ), 'amount' => array( - 'description' => __( 'The amount of discount. Should always be numeric, even if setting a percentage.', 'woocommerce' ), + 'description' => __( 'The amount of discount. Should always be numeric, even if setting a percentage.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'expiry_date' => array( - 'description' => __( 'UTC DateTime when the coupon expires.', 'woocommerce' ), + 'description' => __( 'UTC DateTime when the coupon expires.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'usage_count' => array( - 'description' => __( 'Number of times the coupon has been used already.', 'woocommerce' ), + 'description' => __( 'Number of times the coupon has been used already.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'individual_use' => array( - 'description' => __( 'If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.', 'woocommerce' ), + 'description' => __( 'If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'product_ids' => array( - 'description' => __( "List of product IDs the coupon can be used on.", 'woocommerce' ), + 'description' => __( "List of product IDs the coupon can be used on.", 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -477,7 +477,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'exclude_product_ids' => array( - 'description' => __( "List of product IDs the coupon cannot be used on.", 'woocommerce' ), + 'description' => __( "List of product IDs the coupon cannot be used on.", 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -485,28 +485,28 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'usage_limit' => array( - 'description' => __( 'How many times the coupon can be used in total.', 'woocommerce' ), + 'description' => __( 'How many times the coupon can be used in total.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'usage_limit_per_user' => array( - 'description' => __( 'How many times the coupon can be used per customer.', 'woocommerce' ), + 'description' => __( 'How many times the coupon can be used per customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'limit_usage_to_x_items' => array( - 'description' => __( 'Max number of items in the cart the coupon can be applied to.', 'woocommerce' ), + 'description' => __( 'Max number of items in the cart the coupon can be applied to.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'free_shipping' => array( - 'description' => __( 'If true and if the free shipping method requires a coupon, this coupon will enable free shipping.', 'woocommerce' ), + 'description' => __( 'If true and if the free shipping method requires a coupon, this coupon will enable free shipping.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'product_categories' => array( - 'description' => __( "List of category IDs the coupon applies to.", 'woocommerce' ), + 'description' => __( "List of category IDs the coupon applies to.", 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -514,7 +514,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'excluded_product_categories' => array( - 'description' => __( "List of category IDs the coupon does not apply to.", 'woocommerce' ), + 'description' => __( "List of category IDs the coupon does not apply to.", 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -522,23 +522,23 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'exclude_sale_items' => array( - 'description' => __( 'If true, this coupon will not be applied to items that have sale prices.', 'woocommerce' ), + 'description' => __( 'If true, this coupon will not be applied to items that have sale prices.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'minimum_amount' => array( - 'description' => __( 'Minimum order amount that needs to be in the cart before coupon applies.', 'woocommerce' ), + 'description' => __( 'Minimum order amount that needs to be in the cart before coupon applies.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'maximum_amount' => array( - 'description' => __( 'Maximum order amount allowed when using the coupon.', 'woocommerce' ), + 'description' => __( 'Maximum order amount allowed when using the coupon.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email_restrictions' => array( - 'description' => __( 'List of email addresses that can use this coupon.', 'woocommerce' ), + 'description' => __( 'List of email addresses that can use this coupon.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -546,7 +546,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'used_by' => array( - 'description' => __( 'List of user IDs (or guest email addresses) that have used the coupon.', 'woocommerce' ), + 'description' => __( 'List of user IDs (or guest email addresses) that have used the coupon.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -569,7 +569,7 @@ class WC_REST_Coupons_V1_Controller extends WC_REST_Posts_Controller { $params = parent::get_collection_params(); $params['code'] = array( - 'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php b/src/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php index 0161f47a0df..0d65f93dff9 100644 --- a/src/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php @@ -43,7 +43,7 @@ class WC_REST_Customer_Downloads_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'customer_id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -67,11 +67,11 @@ class WC_REST_Customer_Downloads_V1_Controller extends WC_REST_Controller { $customer = get_user_by( 'id', (int) $request['customer_id'] ); if ( ! $customer ) { - return new WP_Error( 'woocommerce_rest_customer_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_customer_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_user_permissions( 'read', $customer->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -166,67 +166,67 @@ class WC_REST_Customer_Downloads_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'download_url' => array( - 'description' => __( 'Download file URL.', 'woocommerce' ), + 'description' => __( 'Download file URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'download_id' => array( - 'description' => __( 'Download ID (MD5).', 'woocommerce' ), + 'description' => __( 'Download ID (MD5).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Downloadable product ID.', 'woocommerce' ), + 'description' => __( 'Downloadable product ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'download_name' => array( - 'description' => __( 'Downloadable file name.', 'woocommerce' ), + 'description' => __( 'Downloadable file name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'order_id' => array( - 'description' => __( 'Order ID.', 'woocommerce' ), + 'description' => __( 'Order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'order_key' => array( - 'description' => __( 'Order key.', 'woocommerce' ), + 'description' => __( 'Order key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'downloads_remaining' => array( - 'description' => __( 'Number of downloads remaining.', 'woocommerce' ), + 'description' => __( 'Number of downloads remaining.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'access_expires' => array( - 'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'file' => array( - 'description' => __( 'File details.', 'woocommerce' ), + 'description' => __( 'File details.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-customers-v1-controller.php b/src/Controllers/Version1/class-wc-rest-customers-v1-controller.php index 18b8d9786f6..8fc2687ca16 100644 --- a/src/Controllers/Version1/class-wc-rest-customers-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-customers-v1-controller.php @@ -55,16 +55,16 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'email' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'New user email address.', 'woocommerce' ), + 'description' => __( 'New user email address.', 'woocommerce-rest-api' ), ), 'username' => array( 'required' => 'no' === get_option( 'woocommerce_registration_generate_username', 'yes' ), - 'description' => __( 'New user username.', 'woocommerce' ), + 'description' => __( 'New user username.', 'woocommerce-rest-api' ), 'type' => 'string', ), 'password' => array( 'required' => 'no' === get_option( 'woocommerce_registration_generate_password', 'no' ), - 'description' => __( 'New user password.', 'woocommerce' ), + 'description' => __( 'New user password.', 'woocommerce-rest-api' ), 'type' => 'string', ), ) ), @@ -75,7 +75,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -101,12 +101,12 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), 'reassign' => array( 'default' => 0, 'type' => 'integer', - 'description' => __( 'ID to reassign posts to.', 'woocommerce' ), + 'description' => __( 'ID to reassign posts to.', 'woocommerce-rest-api' ), ), ), ), @@ -132,7 +132,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_user_permissions( 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -147,7 +147,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_user_permissions( 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -163,7 +163,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $id = (int) $request['id']; if ( ! wc_rest_check_user_permissions( 'read', $id ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -180,7 +180,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $id = (int) $request['id']; if ( ! wc_rest_check_user_permissions( 'edit', $id ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -197,7 +197,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $id = (int) $request['id']; if ( ! wc_rest_check_user_permissions( 'delete', $id ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -212,7 +212,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_user_permissions( 'batch' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -324,7 +324,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { public function create_item( $request ) { try { if ( ! empty( $request['id'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_customer_exists', __( 'Cannot create existing resource.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_customer_exists', __( 'Cannot create existing resource.', 'woocommerce-rest-api' ), 400 ); } // Sets the username. @@ -342,7 +342,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $customer->save(); if ( ! $customer->get_id() ) { - throw new WC_REST_Exception( 'woocommerce_rest_cannot_create', __( 'This resource cannot be created.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_cannot_create', __( 'This resource cannot be created.', 'woocommerce-rest-api' ), 400 ); } $user_data = get_userdata( $customer->get_id() ); @@ -380,7 +380,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $user_data = get_userdata( $id ); if ( empty( $id ) || empty( $user_data->ID ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $customer = $this->prepare_item_for_response( $user_data, $request ); @@ -401,15 +401,15 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $customer = new WC_Customer( $id ); if ( ! $customer->get_id() ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), 400 ); } if ( ! empty( $request['email'] ) && email_exists( $request['email'] ) && $request['email'] !== $customer->get_email() ) { - throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce-rest-api' ), 400 ); } if ( ! empty( $request['username'] ) && $request['username'] !== $customer->get_username() ) { - throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce-rest-api' ), 400 ); } // Customer email. @@ -463,17 +463,17 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Customers do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Customers do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $user_data = get_userdata( $id ); if ( ! $user_data ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } if ( ! empty( $reassign ) ) { if ( $reassign === $id || ! get_userdata( $reassign ) ) { - return new WP_Error( 'woocommerce_rest_customer_invalid_reassign', __( 'Invalid resource id for reassignment.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_customer_invalid_reassign', __( 'Invalid resource id for reassignment.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -492,7 +492,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { } if ( ! $result ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -629,31 +629,31 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( 'The date the customer was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'email' => array( - 'description' => __( 'The email address for the customer.', 'woocommerce' ), + 'description' => __( 'The email address for the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'first_name' => array( - 'description' => __( 'Customer first name.', 'woocommerce' ), + 'description' => __( 'Customer first name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -661,7 +661,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { ), ), 'last_name' => array( - 'description' => __( 'Customer last name.', 'woocommerce' ), + 'description' => __( 'Customer last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -669,7 +669,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { ), ), 'username' => array( - 'description' => __( 'Customer login name.', 'woocommerce' ), + 'description' => __( 'Customer login name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -677,24 +677,24 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { ), ), 'password' => array( - 'description' => __( 'Customer password.', 'woocommerce' ), + 'description' => __( 'Customer password.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'last_order' => array( - 'description' => __( 'Last order data.', 'woocommerce' ), + 'description' => __( 'Last order data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, 'properties' => array( 'id' => array( - 'description' => __( 'Last order ID.', 'woocommerce' ), + 'description' => __( 'Last order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date' => array( - 'description' => __( 'The date of the customer last order, as GMT.', 'woocommerce' ), + 'description' => __( 'The date of the customer last order, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -702,133 +702,133 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { ), ), 'orders_count' => array( - 'description' => __( 'Quantity of orders made by the customer.', 'woocommerce' ), + 'description' => __( 'Quantity of orders made by the customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_spent' => array( - 'description' => __( 'Total amount spent.', 'woocommerce' ), + 'description' => __( 'Total amount spent.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'avatar_url' => array( - 'description' => __( 'Avatar URL.', 'woocommerce' ), + 'description' => __( 'Avatar URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'billing' => array( - 'description' => __( 'List of billing address data.', 'woocommerce' ), + 'description' => __( 'List of billing address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1.', 'woocommerce' ), + 'description' => __( 'Address line 1.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2.', 'woocommerce' ), + 'description' => __( 'Address line 2.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'List of shipping address data.', 'woocommerce' ), + 'description' => __( 'List of shipping address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1.', 'woocommerce' ), + 'description' => __( 'Address line 1.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2.', 'woocommerce' ), + 'description' => __( 'Address line 2.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -862,7 +862,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { $params['context']['default'] = 'view'; $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -871,7 +871,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -880,14 +880,14 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( 'default' => 'asc', - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'enum' => array( 'asc', 'desc' ), 'sanitize_callback' => 'sanitize_key', 'type' => 'string', @@ -895,7 +895,7 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { ); $params['orderby'] = array( 'default' => 'name', - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'enum' => array( 'id', 'include', @@ -907,13 +907,13 @@ class WC_REST_Customers_V1_Controller extends WC_REST_Controller { 'validate_callback' => 'rest_validate_request_arg', ); $params['email'] = array( - 'description' => __( 'Limit result set to resources with a specific email.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific email.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'validate_callback' => 'rest_validate_request_arg', ); $params['role'] = array( - 'description' => __( 'Limit result set to resources with a specific role.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific role.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'customer', 'enum' => array_merge( array( 'all' ), $this->get_role_names() ), diff --git a/src/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php b/src/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php index 731e5c9c4e6..785ff4627b4 100644 --- a/src/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php @@ -50,7 +50,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -67,7 +67,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { 'args' => array_merge( $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array( 'note' => array( 'type' => 'string', - 'description' => __( 'Order note content.', 'woocommerce' ), + 'description' => __( 'Order note content.', 'woocommerce-rest-api' ), 'required' => true, ), ) ), @@ -78,11 +78,11 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -102,7 +102,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -118,7 +118,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( $this->post_type, 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -133,7 +133,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( $this->post_type, 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -149,7 +149,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( $order && ! wc_rest_check_post_permissions( $this->post_type, 'read', $order->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -166,7 +166,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( $order && ! wc_rest_check_post_permissions( $this->post_type, 'delete', $order->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -183,7 +183,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $args = array( @@ -217,20 +217,20 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Create the note. $note_id = $order->add_order_note( $request['note'], $request['customer_note'] ); if ( ! $note_id ) { - return new WP_Error( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $note = get_comment( $note_id ); @@ -265,13 +265,13 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $note = get_comment( $id ); if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $order_note = $this->prepare_item_for_response( $note, $request ); @@ -292,19 +292,19 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $note = get_comment( $id ); if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $request->set_param( 'context', 'edit' ); @@ -313,7 +313,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { $result = wc_delete_order_note( $note->comment_ID ); if ( ! $result ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), 'order_note' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), 'order_note' ), array( 'status' => 500 ) ); } /** @@ -398,24 +398,24 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'note' => array( - 'description' => __( 'Order note.', 'woocommerce' ), + 'description' => __( 'Order note.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'customer_note' => array( - 'description' => __( 'Shows/define if the note is only for reference or for the customer (the user will be notified).', 'woocommerce' ), + 'description' => __( 'Shows/define if the note is only for reference or for the customer (the user will be notified).', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), diff --git a/src/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php b/src/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php index d5a02e06ac0..659ffa844ae 100644 --- a/src/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php @@ -58,7 +58,7 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -80,11 +80,11 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -104,7 +104,7 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { 'force' => array( 'default' => true, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -124,13 +124,13 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order ) { - return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 ); + return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), 404 ); } $refund = wc_get_order( $post ); if ( ! $refund || $refund->get_parent_id() !== $order->get_id() ) { - return new WP_Error( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 404 ); + return new WP_Error( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce-rest-api' ), 404 ); } $dp = is_null( $request['dp'] ) ? wc_get_price_decimals() : absint( $request['dp'] ); @@ -278,17 +278,17 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $order_data = get_post( (int) $request['order_id'] ); if ( empty( $order_data ) ) { - return new WP_Error( 'woocommerce_rest_invalid_order', __( 'Order is invalid', 'woocommerce' ), 400 ); + return new WP_Error( 'woocommerce_rest_invalid_order', __( 'Order is invalid', 'woocommerce-rest-api' ), 400 ); } if ( 0 > $request['amount'] ) { - return new WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 ); + return new WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce-rest-api' ), 400 ); } // Create the refund. @@ -305,7 +305,7 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { } if ( ! $refund ) { - return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 ); + return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce-rest-api' ), 500 ); } $post = get_post( $refund->get_id() ); @@ -341,29 +341,29 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order refund was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order refund was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'amount' => array( - 'description' => __( 'Refund amount.', 'woocommerce' ), + 'description' => __( 'Refund amount.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'reason' => array( - 'description' => __( 'Reason for refund.', 'woocommerce' ), + 'description' => __( 'Reason for refund.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'line_items' => array( - 'description' => __( 'Line items data.', 'woocommerce' ), + 'description' => __( 'Line items data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -371,79 +371,79 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sku' => array( - 'description' => __( 'Product SKU.', 'woocommerce' ), + 'description' => __( 'Product SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'variation_id' => array( - 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), + 'description' => __( 'Variation ID, if applicable.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'quantity' => array( - 'description' => __( 'Quantity ordered.', 'woocommerce' ), + 'description' => __( 'Quantity ordered.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tax_class' => array( - 'description' => __( 'Tax class of product.', 'woocommerce' ), + 'description' => __( 'Tax class of product.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'price' => array( - 'description' => __( 'Product price.', 'woocommerce' ), + 'description' => __( 'Product price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal_tax' => array( - 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -451,19 +451,19 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -472,7 +472,7 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { ), ), 'meta' => array( - 'description' => __( 'Line item meta data.', 'woocommerce' ), + 'description' => __( 'Line item meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -480,19 +480,19 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { 'type' => 'object', 'properties' => array( 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'Meta label.', 'woocommerce' ), + 'description' => __( 'Meta label.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -519,7 +519,7 @@ class WC_REST_Order_Refunds_V1_Controller extends WC_REST_Orders_V1_Controller { $params['dp'] = array( 'default' => wc_get_price_decimals(), - 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce' ), + 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version1/class-wc-rest-orders-v1-controller.php b/src/Controllers/Version1/class-wc-rest-orders-v1-controller.php index 28bdf2c5eca..34570cda3d7 100644 --- a/src/Controllers/Version1/class-wc-rest-orders-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-orders-v1-controller.php @@ -73,7 +73,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -99,7 +99,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -531,7 +531,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { try { // Make sure customer exists. if ( ! is_null( $request['customer_id'] ) && 0 !== $request['customer_id'] && false === get_user_by( 'id', $request['customer_id'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id',__( 'Customer ID is invalid.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id',__( 'Customer ID is invalid.', 'woocommerce-rest-api' ), 400 ); } // Make sure customer is part of blog. @@ -618,7 +618,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { } elseif ( ! empty( $posted['variation_id'] ) ) { $product_id = (int) $posted['variation_id']; } else { - throw new WC_REST_Exception( 'woocommerce_rest_required_product_reference', __( 'Product ID or SKU is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_required_product_reference', __( 'Product ID or SKU is required.', 'woocommerce-rest-api' ), 400 ); } return $product_id; } @@ -690,7 +690,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { if ( 'create' === $action ) { if ( empty( $posted['method_id'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -713,7 +713,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { if ( 'create' === $action ) { if ( empty( $posted['name'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_fee_item', __( 'Fee name is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_fee_item', __( 'Fee name is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -736,7 +736,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { if ( 'create' === $action ) { if ( empty( $posted['code'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -774,7 +774,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { absint( $order->get_id() ) ) ); if ( is_null( $result ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce-rest-api' ), 400 ); } } @@ -823,7 +823,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $order_id = $this->create_order( $request ); @@ -862,7 +862,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { $post_id = (int) $request['id']; if ( empty( $post_id ) || get_post_type( $post_id ) !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $order_id = $this->update_order( $request ); @@ -916,236 +916,236 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'parent_id' => array( - 'description' => __( 'Parent order ID.', 'woocommerce' ), + 'description' => __( 'Parent order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Order status.', 'woocommerce' ), + 'description' => __( 'Order status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'pending', 'enum' => $this->get_order_statuses(), 'context' => array( 'view', 'edit' ), ), 'order_key' => array( - 'description' => __( 'Order key.', 'woocommerce' ), + 'description' => __( 'Order key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'number' => array( - 'description' => __( 'Order number.', 'woocommerce' ), + 'description' => __( 'Order number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'currency' => array( - 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce' ), + 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => get_woocommerce_currency(), 'enum' => array_keys( get_woocommerce_currencies() ), 'context' => array( 'view', 'edit' ), ), 'version' => array( - 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce' ), + 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'prices_include_tax' => array( - 'description' => __( 'True the prices included tax during checkout.', 'woocommerce' ), + 'description' => __( 'True the prices included tax during checkout.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order was created, as GMT.", 'woocommerce' ), + 'description' => __( "The date the order was created, as GMT.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the order was last modified, as GMT.", 'woocommerce' ), + 'description' => __( "The date the order was last modified, as GMT.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_id' => array( - 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce' ), + 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 0, 'context' => array( 'view', 'edit' ), ), 'discount_total' => array( - 'description' => __( 'Total discount amount for the order.', 'woocommerce' ), + 'description' => __( 'Total discount amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_tax' => array( - 'description' => __( 'Total discount tax amount for the order.', 'woocommerce' ), + 'description' => __( 'Total discount tax amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_total' => array( - 'description' => __( 'Total shipping amount for the order.', 'woocommerce' ), + 'description' => __( 'Total shipping amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_tax' => array( - 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce' ), + 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cart_tax' => array( - 'description' => __( 'Sum of line item taxes only.', 'woocommerce' ), + 'description' => __( 'Sum of line item taxes only.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Grand total.', 'woocommerce' ), + 'description' => __( 'Grand total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Sum of all taxes.', 'woocommerce' ), + 'description' => __( 'Sum of all taxes.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'billing' => array( - 'description' => __( 'Billing address.', 'woocommerce' ), + 'description' => __( 'Billing address.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1.', 'woocommerce' ), + 'description' => __( 'Address line 1.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2.', 'woocommerce' ), + 'description' => __( 'Address line 2.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), + 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'Shipping address.', 'woocommerce' ), + 'description' => __( 'Shipping address.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1.', 'woocommerce' ), + 'description' => __( 'Address line 1.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2.', 'woocommerce' ), + 'description' => __( 'Address line 2.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), + 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'payment_method' => array( - 'description' => __( 'Payment method ID.', 'woocommerce' ), + 'description' => __( 'Payment method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'payment_method_title' => array( - 'description' => __( 'Payment method title.', 'woocommerce' ), + 'description' => __( 'Payment method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -1153,131 +1153,131 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'set_paid' => array( - 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ), + 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'edit' ), ), 'transaction_id' => array( - 'description' => __( 'Unique transaction ID.', 'woocommerce' ), + 'description' => __( 'Unique transaction ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'customer_ip_address' => array( - 'description' => __( "Customer's IP address.", 'woocommerce' ), + 'description' => __( "Customer's IP address.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_user_agent' => array( - 'description' => __( 'User agent of the customer.', 'woocommerce' ), + 'description' => __( 'User agent of the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'created_via' => array( - 'description' => __( 'Shows where the order was created.', 'woocommerce' ), + 'description' => __( 'Shows where the order was created.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_note' => array( - 'description' => __( 'Note left by customer during checkout.', 'woocommerce' ), + 'description' => __( 'Note left by customer during checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_completed' => array( - 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_paid' => array( - 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cart_hash' => array( - 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce' ), + 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'line_items' => array( - 'description' => __( 'Line items data.', 'woocommerce' ), + 'description' => __( 'Line items data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sku' => array( - 'description' => __( 'Product SKU.', 'woocommerce' ), + 'description' => __( 'Product SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'variation_id' => array( - 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), + 'description' => __( 'Variation ID, if applicable.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'quantity' => array( - 'description' => __( 'Quantity ordered.', 'woocommerce' ), + 'description' => __( 'Quantity ordered.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class of product.', 'woocommerce' ), + 'description' => __( 'Tax class of product.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'price' => array( - 'description' => __( 'Product price.', 'woocommerce' ), + 'description' => __( 'Product price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal_tax' => array( - 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1285,19 +1285,19 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1306,7 +1306,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'meta' => array( - 'description' => __( 'Line item meta data.', 'woocommerce' ), + 'description' => __( 'Line item meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1314,19 +1314,19 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'Meta label.', 'woocommerce' ), + 'description' => __( 'Meta label.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1338,7 +1338,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'tax_lines' => array( - 'description' => __( 'Tax lines data.', 'woocommerce' ), + 'description' => __( 'Tax lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1346,43 +1346,43 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rate_code' => array( - 'description' => __( 'Tax rate code.', 'woocommerce' ), + 'description' => __( 'Tax rate code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rate_id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'Tax rate label.', 'woocommerce' ), + 'description' => __( 'Tax rate label.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'compound' => array( - 'description' => __( 'Show if is a compound tax rate.', 'woocommerce' ), + 'description' => __( 'Show if is a compound tax rate.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tax_total' => array( - 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce' ), + 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_tax_total' => array( - 'description' => __( 'Shipping tax total.', 'woocommerce' ), + 'description' => __( 'Shipping tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1391,41 +1391,41 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'shipping_lines' => array( - 'description' => __( 'Shipping lines data.', 'woocommerce' ), + 'description' => __( 'Shipping lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_title' => array( - 'description' => __( 'Shipping method name.', 'woocommerce' ), + 'description' => __( 'Shipping method name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'method_id' => array( - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1433,13 +1433,13 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1451,46 +1451,46 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'fee_lines' => array( - 'description' => __( 'Fee lines data.', 'woocommerce' ), + 'description' => __( 'Fee lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Fee name.', 'woocommerce' ), + 'description' => __( 'Fee name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class of fee.', 'woocommerce' ), + 'description' => __( 'Tax class of fee.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status of fee.', 'woocommerce' ), + 'description' => __( 'Tax status of fee.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'taxable', 'none' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1498,19 +1498,19 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1522,30 +1522,30 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'coupon_lines' => array( - 'description' => __( 'Coupons line data.', 'woocommerce' ), + 'description' => __( 'Coupons line data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'discount' => array( - 'description' => __( 'Discount total.', 'woocommerce' ), + 'description' => __( 'Discount total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'discount_tax' => array( - 'description' => __( 'Discount total tax.', 'woocommerce' ), + 'description' => __( 'Discount total tax.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1554,7 +1554,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { ), ), 'refunds' => array( - 'description' => __( 'List of refunds.', 'woocommerce' ), + 'description' => __( 'List of refunds.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1562,19 +1562,19 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Refund ID.', 'woocommerce' ), + 'description' => __( 'Refund ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reason' => array( - 'description' => __( 'Refund reason.', 'woocommerce' ), + 'description' => __( 'Refund reason.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Refund total.', 'woocommerce' ), + 'description' => __( 'Refund total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1598,27 +1598,27 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to orders assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'any' ), $this->get_order_statuses() ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['customer'] = array( - 'description' => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['product'] = array( - 'description' => __( 'Limit result set to orders assigned a specific product.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific product.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['dp'] = array( 'default' => wc_get_price_decimals(), - 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce' ), + 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php b/src/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php index 4d115f5ae2a..361febd1dcf 100644 --- a/src/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php @@ -44,7 +44,7 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro array( 'args' => array( 'attribute_id' => array( - 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -61,7 +61,7 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro 'args' => array_merge( $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array( 'name' => array( 'type' => 'string', - 'description' => __( 'Name for the resource.', 'woocommerce' ), + 'description' => __( 'Name for the resource.', 'woocommerce-rest-api' ), 'required' => true, ), ) ), @@ -72,11 +72,11 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'attribute_id' => array( - 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -102,7 +102,7 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -112,7 +112,7 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro register_rest_route( $this->namespace, '/' . $this->rest_base . '/batch', array( 'args' => array( 'attribute_id' => array( - 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -193,13 +193,13 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Term name.', 'woocommerce' ), + 'description' => __( 'Term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -207,7 +207,7 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -215,7 +215,7 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -223,12 +223,12 @@ class WC_REST_Product_Attribute_Terms_V1_Controller extends WC_REST_Terms_Contro ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php b/src/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php index 93b535937d6..3c9fa646a84 100644 --- a/src/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php @@ -60,7 +60,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { 'permission_callback' => array( $this, 'create_item_permissions_check' ), 'args' => array_merge( $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array( 'name' => array( - 'description' => __( 'Name for the resource.', 'woocommerce' ), + 'description' => __( 'Name for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'required' => true, ), @@ -72,7 +72,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -98,7 +98,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => true, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -124,7 +124,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'attributes', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -138,7 +138,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'attributes', 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you cannot create new resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you cannot create new resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -152,11 +152,11 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! $this->get_taxonomy( $request ) ) { - return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'attributes', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -170,11 +170,11 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ public function update_item_permissions_check( $request ) { if ( ! $this->get_taxonomy( $request ) ) { - return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'attributes', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot update resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot update resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -188,11 +188,11 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ public function delete_item_permissions_check( $request ) { if ( ! $this->get_taxonomy( $request ) ) { - return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'attributes', 'delete' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -207,7 +207,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'attributes', 'batch' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -354,7 +354,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $attribute = $this->get_attribute( (int) $request['id'] ); @@ -369,7 +369,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { $deleted = wc_delete_attribute( $attribute->attribute_id ); if ( false === $deleted ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -453,13 +453,13 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -467,7 +467,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -475,21 +475,21 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { ), ), 'type' => array( - 'description' => __( 'Type of attribute.', 'woocommerce' ), + 'description' => __( 'Type of attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'select', 'enum' => array_keys( wc_get_attribute_types() ), 'context' => array( 'view', 'edit' ), ), 'order_by' => array( - 'description' => __( 'Default sort order.', 'woocommerce' ), + 'description' => __( 'Default sort order.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'menu_order', 'enum' => array( 'menu_order', 'name', 'name_num', 'id' ), 'context' => array( 'view', 'edit' ), ), 'has_archives' => array( - 'description' => __( 'Enable/Disable attribute archives.', 'woocommerce' ), + 'description' => __( 'Enable/Disable attribute archives.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), @@ -548,7 +548,7 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { ", $id ) ); if ( is_wp_error( $attribute ) || is_null( $attribute ) ) { - return new WP_Error( 'woocommerce_rest_attribute_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_attribute_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $attribute; @@ -564,11 +564,11 @@ class WC_REST_Product_Attributes_V1_Controller extends WC_REST_Controller { */ protected function validate_attribute_slug( $slug, $new_data = true ) { if ( strlen( $slug ) >= 28 ) { - return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max). Shorten it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max). Shorten it, please.', 'woocommerce-rest-api' ), $slug ), array( 'status' => 400 ) ); } elseif ( wc_check_if_attribute_name_is_reserved( $slug ) ) { - return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce-rest-api' ), $slug ), array( 'status' => 400 ) ); } elseif ( $new_data && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) { - return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce-rest-api' ), $slug ), array( 'status' => 400 ) ); } return true; diff --git a/src/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php b/src/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php index 22d16a0d0bc..956d5cd43b3 100644 --- a/src/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php @@ -171,13 +171,13 @@ class WC_REST_Product_Categories_V1_Controller extends WC_REST_Terms_Controller 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -185,7 +185,7 @@ class WC_REST_Product_Categories_V1_Controller extends WC_REST_Terms_Controller ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -193,12 +193,12 @@ class WC_REST_Product_Categories_V1_Controller extends WC_REST_Terms_Controller ), ), 'parent' => array( - 'description' => __( 'The ID for the parent of the resource.', 'woocommerce' ), + 'description' => __( 'The ID for the parent of the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -206,59 +206,59 @@ class WC_REST_Product_Categories_V1_Controller extends WC_REST_Terms_Controller ), ), 'display' => array( - 'description' => __( 'Category archive display type.', 'woocommerce' ), + 'description' => __( 'Category archive display type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'default', 'enum' => array( 'default', 'products', 'subcategories', 'both' ), 'context' => array( 'view', 'edit' ), ), 'image' => array( - 'description' => __( 'Image data.', 'woocommerce' ), + 'description' => __( 'Image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'title' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php b/src/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php index f52b7e098ab..e4d9b93075b 100644 --- a/src/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php @@ -43,11 +43,11 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the variation.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variation.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -65,17 +65,17 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { 'review' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Review content.', 'woocommerce' ), + 'description' => __( 'Review content.', 'woocommerce-rest-api' ), ), 'name' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Name of the reviewer.', 'woocommerce' ), + 'description' => __( 'Name of the reviewer.', 'woocommerce-rest-api' ), ), 'email' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Email of the reviewer.', 'woocommerce' ), + 'description' => __( 'Email of the reviewer.', 'woocommerce-rest-api' ), ), ) ), ), @@ -85,11 +85,11 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -115,7 +115,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -131,7 +131,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( 'product', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -147,7 +147,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $post = get_post( (int) $request['product_id'] ); if ( $post && ! wc_rest_check_post_permissions( 'product', 'read', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -162,7 +162,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { public function create_item_permissions_check( $request ) { $post = get_post( (int) $request['product_id'] ); if ( $post && ! wc_rest_check_post_permissions( 'product', 'create', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -176,7 +176,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { public function update_item_permissions_check( $request ) { $post = get_post( (int) $request['product_id'] ); if ( $post && ! wc_rest_check_post_permissions( 'product', 'edit', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -190,7 +190,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { public function delete_item_permissions_check( $request ) { $post = get_post( (int) $request['product_id'] ); if ( $post && ! wc_rest_check_post_permissions( 'product', 'delete', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -206,7 +206,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $product_id = (int) $request['product_id']; if ( 'product' !== get_post_type( $product_id ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $reviews = get_approved_comments( $product_id ); @@ -231,13 +231,13 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $product_id = (int) $request['product_id']; if ( 'product' !== get_post_type( $product_id ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $review = get_comment( $id ); if ( empty( $id ) || empty( $review ) || intval( $review->comment_post_ID ) !== $product_id ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $delivery = $this->prepare_item_for_response( $review, $request ); @@ -257,7 +257,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $product_id = (int) $request['product_id']; if ( 'product' !== get_post_type( $product_id ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $prepared_review = $this->prepare_item_for_database( $request ); @@ -274,7 +274,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $product_review_id = wp_insert_comment( $prepared_review ); if ( ! $product_review_id ) { - return new WP_Error( 'rest_product_review_failed_create', __( 'Creating product review failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_product_review_failed_create', __( 'Creating product review failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } update_comment_meta( $product_review_id, 'rating', ( ! empty( $request['rating'] ) ? $request['rating'] : '0' ) ); @@ -312,20 +312,20 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $product_id = (int) $request['product_id']; if ( 'product' !== get_post_type( $product_id ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $review = get_comment( $product_review_id ); if ( empty( $product_review_id ) || empty( $review ) || intval( $review->comment_post_ID ) !== $product_id ) { - return new WP_Error( 'woocommerce_rest_product_review_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_review_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $prepared_review = $this->prepare_item_for_database( $request ); $updated = wp_update_comment( $prepared_review ); if ( 0 === $updated ) { - return new WP_Error( 'rest_product_review_failed_edit', __( 'Updating product review failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_product_review_failed_edit', __( 'Updating product review failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } if ( ! empty( $request['rating'] ) ) { @@ -363,7 +363,7 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $product_review = get_comment( $product_review_id ); if ( empty( $product_review_id ) || empty( $product_review->comment_ID ) || empty( $product_review->comment_post_ID ) ) { - return new WP_Error( 'woocommerce_rest_product_review_invalid_id', __( 'Invalid product review ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_review_invalid_id', __( 'Invalid product review ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } /** @@ -383,18 +383,18 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { $result = wp_delete_comment( $product_review_id, true ); } else { if ( ! $supports_trash ) { - return new WP_Error( 'rest_trash_not_supported', __( 'The product review does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'rest_trash_not_supported', __( 'The product review does not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } if ( 'trash' === $product_review->comment_approved ) { - return new WP_Error( 'rest_already_trashed', __( 'The comment has already been trashed.', 'woocommerce' ), array( 'status' => 410 ) ); + return new WP_Error( 'rest_already_trashed', __( 'The comment has already been trashed.', 'woocommerce-rest-api' ), array( 'status' => 410 ) ); } $result = wp_trash_comment( $product_review->comment_ID ); } if ( ! $result ) { - return new WP_Error( 'rest_cannot_delete', __( 'The product review cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_cannot_delete', __( 'The product review cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -523,38 +523,38 @@ class WC_REST_Product_Reviews_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'review' => array( - 'description' => __( 'The content of the review.', 'woocommerce' ), + 'description' => __( 'The content of the review.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'rating' => array( - 'description' => __( 'Review rating (0 to 5).', 'woocommerce' ), + 'description' => __( 'Review rating (0 to 5).', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Reviewer name.', 'woocommerce' ), + 'description' => __( 'Reviewer name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Reviewer email.', 'woocommerce' ), + 'description' => __( 'Reviewer email.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'verified' => array( - 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ), + 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php b/src/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php index fb2326df2dd..92ab292f1a0 100644 --- a/src/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php @@ -91,13 +91,13 @@ class WC_REST_Product_Shipping_Classes_V1_Controller extends WC_REST_Terms_Contr 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Shipping class name.', 'woocommerce' ), + 'description' => __( 'Shipping class name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -105,7 +105,7 @@ class WC_REST_Product_Shipping_Classes_V1_Controller extends WC_REST_Terms_Contr ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -113,7 +113,7 @@ class WC_REST_Product_Shipping_Classes_V1_Controller extends WC_REST_Terms_Contr ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -121,7 +121,7 @@ class WC_REST_Product_Shipping_Classes_V1_Controller extends WC_REST_Terms_Contr ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php b/src/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php index a43ef8b43f6..c4e587b44da 100644 --- a/src/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php @@ -91,13 +91,13 @@ class WC_REST_Product_Tags_V1_Controller extends WC_REST_Terms_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Tag name.', 'woocommerce' ), + 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -105,7 +105,7 @@ class WC_REST_Product_Tags_V1_Controller extends WC_REST_Terms_Controller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -113,7 +113,7 @@ class WC_REST_Product_Tags_V1_Controller extends WC_REST_Terms_Controller { ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -121,7 +121,7 @@ class WC_REST_Product_Tags_V1_Controller extends WC_REST_Terms_Controller { ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-products-v1-controller.php b/src/Controllers/Version1/class-wc-rest-products-v1-controller.php index cbe7a37f5eb..73cd14ea769 100644 --- a/src/Controllers/Version1/class-wc-rest-products-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-products-v1-controller.php @@ -74,7 +74,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -99,7 +99,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'args' => array( 'force' => array( 'default' => false, - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), 'type' => 'boolean', ), ), @@ -310,8 +310,8 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'date_created' => wc_rest_prepare_date_response( current_time( 'mysql' ) ), // Default to now. 'date_modified' => wc_rest_prepare_date_response( current_time( 'mysql' ) ), 'src' => wc_placeholder_img_src(), - 'name' => __( 'Placeholder', 'woocommerce' ), - 'alt' => __( 'Placeholder', 'woocommerce' ), + 'name' => __( 'Placeholder', 'woocommerce-rest-api' ), + 'alt' => __( 'Placeholder', 'woocommerce-rest-api' ), 'position' => 0, ); } @@ -736,7 +736,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { */ public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $product_id = 0; @@ -781,7 +781,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { $post_id = (int) $request['id']; if ( empty( $post_id ) || get_post_type( $post_id ) !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } try { @@ -864,7 +864,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { } if ( ! wp_attachment_is_image( $attachment_id ) ) { - throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce' ), $attachment_id ), 400 ); + throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce-rest-api' ), $attachment_id ), 400 ); } if ( isset( $image['position'] ) && 0 === absint( $image['position'] ) ) { @@ -1369,7 +1369,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { // Create initial name and status. if ( ! $variation->get_slug() ) { /* translators: 1: variation id 2: product name */ - $variation->set_name( sprintf( __( 'Variation #%1$s of %2$s', 'woocommerce' ), $variation->get_id(), $product->get_name() ) ); + $variation->set_name( sprintf( __( 'Variation #%1$s of %2$s', 'woocommerce-rest-api' ), $variation->get_id(), $product->get_name() ) ); $variation->set_status( isset( $data['visible'] ) && false === $data['visible'] ? 'private' : 'publish' ); } @@ -1634,9 +1634,9 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { $product = wc_get_product( $id ); if ( ! empty( $post->post_type ) && 'product_variation' === $post->post_type && 'product' === $this->post_type ) { - return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } elseif ( empty( $id ) || empty( $post->ID ) || $post->post_type !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid post ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid post ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $supports_trash = EMPTY_TRASH_DAYS > 0; @@ -1653,7 +1653,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $post->ID ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); } $request->set_param( 'context', 'edit' ); @@ -1685,13 +1685,13 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { // If we don't support trashing for this type, error out. if ( ! $supports_trash ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501 ) ); } // Otherwise, only trash if we haven't already. if ( 'trash' === $post->post_status ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 410 ) ); + return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410 ) ); } // (Note that internally this falls through to `wp_delete_post` if @@ -1702,7 +1702,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { if ( ! $result ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500 ) ); } // Delete parent product transients. @@ -1736,163 +1736,163 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'slug' => array( - 'description' => __( 'Product slug.', 'woocommerce' ), + 'description' => __( 'Product slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'permalink' => array( - 'description' => __( 'Product URL.', 'woocommerce' ), + 'description' => __( 'Product URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Product type.', 'woocommerce' ), + 'description' => __( 'Product type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'simple', 'enum' => array_keys( wc_get_product_types() ), 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Product status (post status).', 'woocommerce' ), + 'description' => __( 'Product status (post status).', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'publish', 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), 'context' => array( 'view', 'edit' ), ), 'featured' => array( - 'description' => __( 'Featured product.', 'woocommerce' ), + 'description' => __( 'Featured product.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'catalog_visibility' => array( - 'description' => __( 'Catalog visibility.', 'woocommerce' ), + 'description' => __( 'Catalog visibility.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'visible', 'enum' => array( 'visible', 'catalog', 'search', 'hidden' ), 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Product description.', 'woocommerce' ), + 'description' => __( 'Product description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'short_description' => array( - 'description' => __( 'Product short description.', 'woocommerce' ), + 'description' => __( 'Product short description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price' => array( - 'description' => __( 'Current product price.', 'woocommerce' ), + 'description' => __( 'Current product price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Product regular price.', 'woocommerce' ), + 'description' => __( 'Product regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Product sale price.', 'woocommerce' ), + 'description' => __( 'Product sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( 'Start date of sale price.', 'woocommerce' ), + 'description' => __( 'Start date of sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( 'End date of sale price.', 'woocommerce' ), + 'description' => __( 'End date of sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price_html' => array( - 'description' => __( 'Price formatted in HTML.', 'woocommerce' ), + 'description' => __( 'Price formatted in HTML.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'on_sale' => array( - 'description' => __( 'Shows if the product is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'purchasable' => array( - 'description' => __( 'Shows if the product can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the product can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_sales' => array( - 'description' => __( 'Amount of sales.', 'woocommerce' ), + 'description' => __( 'Amount of sales.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the product is virtual.', 'woocommerce' ), + 'description' => __( 'If the product is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the product is downloadable.', 'woocommerce' ), + 'description' => __( 'If the product is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -1900,163 +1900,163 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_type' => array( - 'description' => __( 'Download type, this controls the schema on the front-end.', 'woocommerce' ), + 'description' => __( 'Download type, this controls the schema on the front-end.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'standard', 'enum' => array( 'standard' ), 'context' => array( 'view', 'edit' ), ), 'external_url' => array( - 'description' => __( 'Product external URL. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external URL. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'button_text' => array( - 'description' => __( 'Product external button text. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external button text. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at product level.', 'woocommerce' ), + 'description' => __( 'Stock management at product level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'in_stock' => array( - 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ), + 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the product is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sold_individually' => array( - 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce' ), + 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Product dimensions.', 'woocommerce' ), + 'description' => __( 'Product dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_required' => array( - 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce' ), + 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_taxable' => array( - 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce' ), + 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reviews_allowed' => array( - 'description' => __( 'Allow reviews.', 'woocommerce' ), + 'description' => __( 'Allow reviews.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'average_rating' => array( - 'description' => __( 'Reviews average rating.', 'woocommerce' ), + 'description' => __( 'Reviews average rating.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rating_count' => array( - 'description' => __( 'Amount of reviews that the product have.', 'woocommerce' ), + 'description' => __( 'Amount of reviews that the product have.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'related_ids' => array( - 'description' => __( 'List of related products IDs.', 'woocommerce' ), + 'description' => __( 'List of related products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -2065,7 +2065,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'readonly' => true, ), 'upsell_ids' => array( - 'description' => __( 'List of upsell products IDs.', 'woocommerce' ), + 'description' => __( 'List of upsell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -2073,7 +2073,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'cross_sell_ids' => array( - 'description' => __( 'List of cross-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of cross-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -2081,35 +2081,35 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'Product parent ID.', 'woocommerce' ), + 'description' => __( 'Product parent ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'purchase_note' => array( - 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce' ), + 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'categories' => array( - 'description' => __( 'List of categories.', 'woocommerce' ), + 'description' => __( 'List of categories.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Category ID.', 'woocommerce' ), + 'description' => __( 'Category ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Category slug.', 'woocommerce' ), + 'description' => __( 'Category slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -2118,25 +2118,25 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'tags' => array( - 'description' => __( 'List of tags.', 'woocommerce' ), + 'description' => __( 'List of tags.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tag ID.', 'woocommerce' ), + 'description' => __( 'Tag ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Tag name.', 'woocommerce' ), + 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Tag slug.', 'woocommerce' ), + 'description' => __( 'Tag slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -2145,47 +2145,47 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'images' => array( - 'description' => __( 'List of images.', 'woocommerce' ), + 'description' => __( 'List of images.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce' ), + 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), @@ -2193,41 +2193,41 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Attribute position.', 'woocommerce' ), + 'description' => __( 'Attribute position.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'visible' => array( - 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce' ), + 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'variation' => array( - 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce' ), + 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'options' => array( - 'description' => __( 'List of available term names of the attribute.', 'woocommerce' ), + 'description' => __( 'List of available term names of the attribute.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), ), @@ -2235,24 +2235,24 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'default_attributes' => array( - 'description' => __( 'Defaults variation attributes.', 'woocommerce' ), + 'description' => __( 'Defaults variation attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -2260,116 +2260,116 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'variations' => array( - 'description' => __( 'List of variations.', 'woocommerce' ), + 'description' => __( 'List of variations.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Variation ID.', 'woocommerce' ), + 'description' => __( 'Variation ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'permalink' => array( - 'description' => __( 'Variation URL.', 'woocommerce' ), + 'description' => __( 'Variation URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price' => array( - 'description' => __( 'Current variation price.', 'woocommerce' ), + 'description' => __( 'Current variation price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Variation regular price.', 'woocommerce' ), + 'description' => __( 'Variation regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Variation sale price.', 'woocommerce' ), + 'description' => __( 'Variation sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( 'Start date of sale price.', 'woocommerce' ), + 'description' => __( 'Start date of sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( 'End date of sale price.', 'woocommerce' ), + 'description' => __( 'End date of sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'on_sale' => array( - 'description' => __( 'Shows if the variation is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'purchasable' => array( - 'description' => __( 'Shows if the variation can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the variation can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'visible' => array( - 'description' => __( 'If the variation is visible.', 'woocommerce' ), + 'description' => __( 'If the variation is visible.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ), 'virtual' => array( - 'description' => __( 'If the variation is virtual.', 'woocommerce' ), + 'description' => __( 'If the variation is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the variation is downloadable.', 'woocommerce' ), + 'description' => __( 'If the variation is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -2377,171 +2377,171 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => null, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => null, 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at variation level.', 'woocommerce' ), + 'description' => __( 'Stock management at variation level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'in_stock' => array( - 'description' => __( 'Controls whether or not the variation is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ), + 'description' => __( 'Controls whether or not the variation is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Variation dimensions.', 'woocommerce' ), + 'description' => __( 'Variation dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'image' => array( - 'description' => __( 'Variation image data.', 'woocommerce' ), + 'description' => __( 'Variation image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce' ), + 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -2552,7 +2552,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { ), ), 'grouped_products' => array( - 'description' => __( 'List of grouped products ID.', 'woocommerce' ), + 'description' => __( 'List of grouped products ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -2561,7 +2561,7 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { 'readonly' => true, ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), @@ -2580,57 +2580,57 @@ class WC_REST_Products_V1_Controller extends WC_REST_Posts_Controller { $params = parent::get_collection_params(); $params['slug'] = array( - 'description' => __( 'Limit result set to products with a specific slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'any', 'future' ), array_keys( get_post_statuses() ) ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['type'] = array( - 'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_types() ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['category'] = array( - 'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['tag'] = array( - 'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['shipping_class'] = array( - 'description' => __( 'Limit result set to products assigned a specific shipping class ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['attribute'] = array( - 'description' => __( 'Limit result set to products with a specific attribute.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['attribute_term'] = array( - 'description' => __( 'Limit result set to products with a specific attribute term ID (required an assigned attribute).', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific attribute term ID (required an assigned attribute).', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['sku'] = array( - 'description' => __( 'Limit result set to products with a specific SKU.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php b/src/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php index d880c86e7e5..57bd5da4490 100644 --- a/src/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php @@ -66,7 +66,7 @@ class WC_REST_Report_Sales_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'reports', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -287,67 +287,67 @@ class WC_REST_Report_Sales_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'total_sales' => array( - 'description' => __( 'Gross sales in the period.', 'woocommerce' ), + 'description' => __( 'Gross sales in the period.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'net_sales' => array( - 'description' => __( 'Net sales in the period.', 'woocommerce' ), + 'description' => __( 'Net sales in the period.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'average_sales' => array( - 'description' => __( 'Average net daily sales.', 'woocommerce' ), + 'description' => __( 'Average net daily sales.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total_orders' => array( - 'description' => __( 'Total of orders placed.', 'woocommerce' ), + 'description' => __( 'Total of orders placed.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'total_items' => array( - 'description' => __( 'Total of items purchased.', 'woocommerce' ), + 'description' => __( 'Total of items purchased.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Total charged for taxes.', 'woocommerce' ), + 'description' => __( 'Total charged for taxes.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total_shipping' => array( - 'description' => __( 'Total charged for shipping.', 'woocommerce' ), + 'description' => __( 'Total charged for shipping.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total_refunds' => array( - 'description' => __( 'Total of refunded orders.', 'woocommerce' ), + 'description' => __( 'Total of refunded orders.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'total_discount' => array( - 'description' => __( 'Total of coupons used.', 'woocommerce' ), + 'description' => __( 'Total of coupons used.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'totals_grouped_by' => array( - 'description' => __( 'Group type.', 'woocommerce' ), + 'description' => __( 'Group type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'totals' => array( - 'description' => __( 'Totals.', 'woocommerce' ), + 'description' => __( 'Totals.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'array', @@ -370,7 +370,7 @@ class WC_REST_Report_Sales_V1_Controller extends WC_REST_Controller { return array( 'context' => $this->get_context_param( array( 'default' => 'view' ) ), 'period' => array( - 'description' => __( 'Report period.', 'woocommerce' ), + 'description' => __( 'Report period.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array( 'week', 'month', 'last_month', 'year' ), 'validate_callback' => 'rest_validate_request_arg', @@ -378,7 +378,7 @@ class WC_REST_Report_Sales_V1_Controller extends WC_REST_Controller { ), 'date_min' => array( /* translators: %s: date format */ - 'description' => sprintf( __( 'Return sales for a specific start date, the date need to be in the %s format.', 'woocommerce' ), 'YYYY-MM-DD' ), + 'description' => sprintf( __( 'Return sales for a specific start date, the date need to be in the %s format.', 'woocommerce-rest-api' ), 'YYYY-MM-DD' ), 'type' => 'string', 'format' => 'date', 'validate_callback' => 'wc_rest_validate_reports_request_arg', @@ -386,7 +386,7 @@ class WC_REST_Report_Sales_V1_Controller extends WC_REST_Controller { ), 'date_max' => array( /* translators: %s: date format */ - 'description' => sprintf( __( 'Return sales for a specific end date, the date need to be in the %s format.', 'woocommerce' ), 'YYYY-MM-DD' ), + 'description' => sprintf( __( 'Return sales for a specific end date, the date need to be in the %s format.', 'woocommerce-rest-api' ), 'YYYY-MM-DD' ), 'type' => 'string', 'format' => 'date', 'validate_callback' => 'wc_rest_validate_reports_request_arg', diff --git a/src/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php b/src/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php index 22e928e05b8..76d0aa9d2ae 100644 --- a/src/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-report-top-sellers-v1-controller.php @@ -149,19 +149,19 @@ class WC_REST_Report_Top_Sellers_V1_Controller extends WC_REST_Report_Sales_V1_C 'type' => 'object', 'properties' => array( 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'quantity' => array( - 'description' => __( 'Total number of purchases.', 'woocommerce' ), + 'description' => __( 'Total number of purchases.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-reports-v1-controller.php b/src/Controllers/Version1/class-wc-rest-reports-v1-controller.php index c35b9e6329b..1f1463ae2b5 100644 --- a/src/Controllers/Version1/class-wc-rest-reports-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-reports-v1-controller.php @@ -59,7 +59,7 @@ class WC_REST_Reports_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'reports', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -75,11 +75,11 @@ class WC_REST_Reports_V1_Controller extends WC_REST_Controller { return array( array( 'slug' => 'sales', - 'description' => __( 'List of sales reports.', 'woocommerce' ), + 'description' => __( 'List of sales reports.', 'woocommerce-rest-api' ), ), array( 'slug' => 'top_sellers', - 'description' => __( 'List of top sellers products.', 'woocommerce' ), + 'description' => __( 'List of top sellers products.', 'woocommerce-rest-api' ), ), ); } @@ -154,13 +154,13 @@ class WC_REST_Reports_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human-readable description of the resource.', 'woocommerce' ), + 'description' => __( 'A human-readable description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php b/src/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php index 6d0a4d406e7..365d0c440f8 100644 --- a/src/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php @@ -59,7 +59,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P\w[\w\s\-]*)', array( 'args' => array( 'slug' => array( - 'description' => __( 'Unique slug for the resource.', 'woocommerce' ), + 'description' => __( 'Unique slug for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -71,7 +71,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -87,7 +87,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -102,7 +102,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -117,7 +117,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { */ public function delete_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'delete' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -135,7 +135,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { // Add standard class. $tax_classes[] = array( 'slug' => 'standard', - 'name' => __( 'Standard rate', 'woocommerce' ), + 'name' => __( 'Standard rate', 'woocommerce-rest-api' ), ); $classes = WC_Tax::get_tax_classes(); @@ -181,7 +181,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { // Return error if tax class already exists. if ( $exists ) { - return new WP_Error( 'woocommerce_rest_tax_class_exists', __( 'Cannot create existing resource.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_tax_class_exists', __( 'Cannot create existing resource.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Add the new class. @@ -222,7 +222,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $tax_class = array( @@ -242,7 +242,7 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { } if ( ! $deleted ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } update_option( 'woocommerce_tax_classes', implode( "\n", $classes ) ); @@ -331,13 +331,13 @@ class WC_REST_Tax_Classes_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Tax class name.', 'woocommerce' ), + 'description' => __( 'Tax class name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'required' => true, diff --git a/src/Controllers/Version1/class-wc-rest-taxes-v1-controller.php b/src/Controllers/Version1/class-wc-rest-taxes-v1-controller.php index bbbc1869314..ae81985a3d2 100644 --- a/src/Controllers/Version1/class-wc-rest-taxes-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-taxes-v1-controller.php @@ -59,7 +59,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -85,7 +85,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -111,7 +111,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -126,7 +126,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -140,7 +140,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -155,7 +155,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function update_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -170,7 +170,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function delete_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'delete' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -185,7 +185,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'batch' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -361,7 +361,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { */ public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { - return new WP_Error( 'woocommerce_rest_tax_exists', __( 'Cannot create existing resource.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_tax_exists', __( 'Cannot create existing resource.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $tax = $this->create_or_update_tax( $request ); @@ -397,7 +397,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { $tax_obj = WC_Tax::_get_tax_rate( $id, OBJECT ); if ( empty( $id ) || empty( $tax_obj ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tax = $this->prepare_item_for_response( $tax_obj, $request ); @@ -417,7 +417,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { $tax_obj = WC_Tax::_get_tax_rate( $id, OBJECT ); if ( empty( $id ) || empty( $tax_obj ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tax = $this->create_or_update_tax( $request, $tax_obj ); @@ -454,13 +454,13 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $tax = WC_Tax::_get_tax_rate( $id, OBJECT ); if ( empty( $id ) || empty( $tax ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $request->set_param( 'context', 'edit' ); @@ -469,7 +469,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { WC_Tax::_delete_tax_rate( $id ); if ( 0 === $wpdb->rows_affected ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -573,66 +573,66 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'country' => array( - 'description' => __( 'Country ISO 3166 code.', 'woocommerce' ), + 'description' => __( 'Country ISO 3166 code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'State code.', 'woocommerce' ), + 'description' => __( 'State code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postcode / ZIP.', 'woocommerce' ), + 'description' => __( 'Postcode / ZIP.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'rate' => array( - 'description' => __( 'Tax rate.', 'woocommerce' ), + 'description' => __( 'Tax rate.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Tax rate name.', 'woocommerce' ), + 'description' => __( 'Tax rate name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'priority' => array( - 'description' => __( 'Tax priority.', 'woocommerce' ), + 'description' => __( 'Tax priority.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 1, 'context' => array( 'view', 'edit' ), ), 'compound' => array( - 'description' => __( 'Whether or not this is a compound rate.', 'woocommerce' ), + 'description' => __( 'Whether or not this is a compound rate.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'shipping' => array( - 'description' => __( 'Whether or not this tax rate also gets applied to shipping.', 'woocommerce' ), + 'description' => __( 'Whether or not this tax rate also gets applied to shipping.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'order' => array( - 'description' => __( 'Indicates the order that will appear in queries.', 'woocommerce' ), + 'description' => __( 'Indicates the order that will appear in queries.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'standard', 'enum' => array_merge( array( 'standard' ), WC_Tax::get_tax_class_slugs() ), @@ -655,7 +655,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { $params['context']['default'] = 'view'; $params['page'] = array( - 'description' => __( 'Current page of the collection.', 'woocommerce' ), + 'description' => __( 'Current page of the collection.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint', @@ -663,7 +663,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { 'minimum' => 1, ); $params['per_page'] = array( - 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ), + 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 10, 'minimum' => 1, @@ -672,14 +672,14 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { 'validate_callback' => 'rest_validate_request_arg', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( 'default' => 'asc', - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'enum' => array( 'asc', 'desc' ), 'sanitize_callback' => 'sanitize_key', 'type' => 'string', @@ -687,7 +687,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { ); $params['orderby'] = array( 'default' => 'order', - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'enum' => array( 'id', 'order', @@ -697,7 +697,7 @@ class WC_REST_Taxes_V1_Controller extends WC_REST_Controller { 'validate_callback' => 'rest_validate_request_arg', ); $params['class'] = array( - 'description' => __( 'Sort by tax class.', 'woocommerce' ), + 'description' => __( 'Sort by tax class.', 'woocommerce-rest-api' ), 'enum' => array_merge( array( 'standard' ), WC_Tax::get_tax_class_slugs() ), 'sanitize_callback' => 'sanitize_title', 'type' => 'string', diff --git a/src/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php b/src/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php index 033a2c797c8..adbd3f62b2f 100644 --- a/src/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php @@ -44,7 +44,7 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'webhook_id' => array( - 'description' => __( 'Unique identifier for the webhook.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the webhook.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -60,11 +60,11 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'webhook_id' => array( - 'description' => __( 'Unique identifier for the webhook.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the webhook.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -88,7 +88,7 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -102,7 +102,7 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -119,7 +119,7 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { $webhook = wc_get_webhook( (int) $request['webhook_id'] ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $logs = array(); @@ -144,13 +144,13 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { $webhook = wc_get_webhook( (int) $request['webhook_id'] ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_webhook_invalid_id', __( 'Invalid webhook ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $log = array(); if ( empty( $id ) || empty( $log ) ) { - return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $delivery = $this->prepare_item_for_response( (object) $log, $request ); @@ -223,32 +223,32 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'duration' => array( - 'description' => __( 'The delivery duration, in seconds.', 'woocommerce' ), + 'description' => __( 'The delivery duration, in seconds.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'summary' => array( - 'description' => __( 'A friendly summary of the response including the HTTP response code, message, and body.', 'woocommerce' ), + 'description' => __( 'A friendly summary of the response including the HTTP response code, message, and body.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'request_url' => array( - 'description' => __( 'The URL where the webhook was delivered.', 'woocommerce' ), + 'description' => __( 'The URL where the webhook was delivered.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'request_headers' => array( - 'description' => __( 'Request headers.', 'woocommerce' ), + 'description' => __( 'Request headers.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -257,25 +257,25 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { ), ), 'request_body' => array( - 'description' => __( 'Request body.', 'woocommerce' ), + 'description' => __( 'Request body.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'response_code' => array( - 'description' => __( 'The HTTP response code from the receiving server.', 'woocommerce' ), + 'description' => __( 'The HTTP response code from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'response_message' => array( - 'description' => __( 'The HTTP response message from the receiving server.', 'woocommerce' ), + 'description' => __( 'The HTTP response message from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'response_headers' => array( - 'description' => __( 'Array of the response headers from the receiving server.', 'woocommerce' ), + 'description' => __( 'Array of the response headers from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -284,13 +284,13 @@ class WC_REST_Webhook_Deliveries_V1_Controller extends WC_REST_Controller { ), ), 'response_body' => array( - 'description' => __( 'The response body from the receiving server.', 'woocommerce' ), + 'description' => __( 'The response body from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the webhook delivery was logged, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook delivery was logged, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php b/src/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php index 9ad7e982b25..d9f6c611c8a 100644 --- a/src/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php +++ b/src/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php @@ -60,12 +60,12 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { 'topic' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Webhook topic.', 'woocommerce' ), + 'description' => __( 'Webhook topic.', 'woocommerce-rest-api' ), ), 'delivery_url' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Webhook delivery URL.', 'woocommerce' ), + 'description' => __( 'Webhook delivery URL.', 'woocommerce-rest-api' ), ), ) ), ), @@ -75,7 +75,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -101,7 +101,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -127,7 +127,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -142,7 +142,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -156,7 +156,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -171,7 +171,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { */ public function update_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -186,7 +186,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { */ public function delete_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'delete' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -201,7 +201,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'webhooks', 'batch' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -297,7 +297,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { $id = (int) $request['id']; if ( empty( $id ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $id, $request ); @@ -315,17 +315,17 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } // Validate topic. if ( empty( $request['topic'] ) || ! wc_is_webhook_valid_topic( strtolower( $request['topic'] ) ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic is required and must be valid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic is required and must be valid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Validate delivery URL. if ( empty( $request['delivery_url'] ) || ! wc_is_valid_url( $request['delivery_url'] ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $post = $this->prepare_item_for_database( $request ); @@ -377,7 +377,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { $webhook = wc_get_webhook( $id ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Update topic. @@ -385,7 +385,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { if ( wc_is_webhook_valid_topic( strtolower( $request['topic'] ) ) ) { $webhook->set_topic( $request['topic'] ); } else { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic must be valid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic must be valid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -394,7 +394,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { if ( wc_is_valid_url( $request['delivery_url'] ) ) { $webhook->set_delivery_url( $request['delivery_url'] ); } else { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -408,7 +408,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { if ( wc_is_webhook_valid_status( strtolower( $request['status'] ) ) ) { $webhook->set_status( $request['status'] ); } else { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_status", __( 'Webhook status must be valid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_status", __( 'Webhook status must be valid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -452,13 +452,13 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $webhook = wc_get_webhook( $id ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $request->set_param( 'context', 'edit' ); @@ -467,7 +467,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { if ( ! $result ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500 ) ); } /** @@ -498,7 +498,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { // Validate required POST fields. if ( 'POST' === $request->get_method() && empty( $data->ID ) ) { - $data->post_title = ! empty( $request['name'] ) ? $request['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ); // @codingStandardsIgnoreLine + $data->post_title = ! empty( $request['name'] ) ? $request['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce-rest-api' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce-rest-api' ) ) ); // @codingStandardsIgnoreLine // Post author. $data->post_author = get_current_user_id(); @@ -546,7 +546,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { $webhook = wc_get_webhook( $id ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $data = array( @@ -612,42 +612,42 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'A friendly name for the webhook.', 'woocommerce' ), + 'description' => __( 'A friendly name for the webhook.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Webhook status.', 'woocommerce' ), + 'description' => __( 'Webhook status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'active', 'enum' => array_keys( wc_get_webhook_statuses() ), 'context' => array( 'view', 'edit' ), ), 'topic' => array( - 'description' => __( 'Webhook topic.', 'woocommerce' ), + 'description' => __( 'Webhook topic.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'resource' => array( - 'description' => __( 'Webhook resource.', 'woocommerce' ), + 'description' => __( 'Webhook resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'event' => array( - 'description' => __( 'Webhook event.', 'woocommerce' ), + 'description' => __( 'Webhook event.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'hooks' => array( - 'description' => __( 'WooCommerce action names associated with the webhook.', 'woocommerce' ), + 'description' => __( 'WooCommerce action names associated with the webhook.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -656,25 +656,25 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { ), ), 'delivery_url' => array( - 'description' => __( 'The URL where the webhook payload is delivered.', 'woocommerce' ), + 'description' => __( 'The URL where the webhook payload is delivered.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'secret' => array( - 'description' => __( "Secret key used to generate a hash of the delivered webhook and provided in the request headers. This will default to a MD5 hash from the current user's ID|username if not provided.", 'woocommerce' ), + 'description' => __( "Secret key used to generate a hash of the delivered webhook and provided in the request headers. This will default to a MD5 hash from the current user's ID|username if not provided.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the webhook was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the webhook was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -696,19 +696,19 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { $params['context']['default'] = 'view'; $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -717,7 +717,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -726,20 +726,20 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( 'asc', 'desc' ), 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date', 'enum' => array( @@ -751,7 +751,7 @@ class WC_REST_Webhooks_V1_Controller extends WC_REST_Controller { ); $params['status'] = array( 'default' => 'all', - 'description' => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array( 'all', 'active', 'paused', 'disabled' ), 'sanitize_callback' => 'sanitize_key', diff --git a/src/Controllers/Version2/class-wc-rest-coupons-v2-controller.php b/src/Controllers/Version2/class-wc-rest-coupons-v2-controller.php index 687b4ed466a..5f3ac9fcbab 100644 --- a/src/Controllers/Version2/class-wc-rest-coupons-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-coupons-v2-controller.php @@ -58,7 +58,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'args' => array_merge( $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array( 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'required' => true, 'type' => 'string', ), @@ -73,7 +73,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -99,7 +99,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -268,7 +268,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { // Validate required POST fields. if ( $creating && empty( $request['code'] ) ) { - return new WP_Error( 'woocommerce_rest_empty_coupon_code', sprintf( __( 'The coupon code cannot be empty.', 'woocommerce' ), 'code' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_empty_coupon_code', sprintf( __( 'The coupon code cannot be empty.', 'woocommerce-rest-api' ), 'code' ), array( 'status' => 400 ) ); } // Handle all writable props. @@ -283,7 +283,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { $id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id ); if ( $id_from_code ) { - return new WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $coupon->set_code( $coupon_code ); @@ -332,81 +332,81 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the object.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the object.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'amount' => array( - 'description' => __( 'The amount of discount. Should always be numeric, even if setting a percentage.', 'woocommerce' ), + 'description' => __( 'The amount of discount. Should always be numeric, even if setting a percentage.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the coupon was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the coupon was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the coupon was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the coupon was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the coupon was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the coupon was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_type' => array( - 'description' => __( 'Determines the type of discount that will be applied.', 'woocommerce' ), + 'description' => __( 'Determines the type of discount that will be applied.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'fixed_cart', 'enum' => array_keys( wc_get_coupon_types() ), 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Coupon description.', 'woocommerce' ), + 'description' => __( 'Coupon description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_expires' => array( - 'description' => __( "The date the coupon expires, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon expires, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_expires_gmt' => array( - 'description' => __( 'The date the coupon expires, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the coupon expires, as GMT.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'usage_count' => array( - 'description' => __( 'Number of times the coupon has been used already.', 'woocommerce' ), + 'description' => __( 'Number of times the coupon has been used already.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'individual_use' => array( - 'description' => __( 'If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.', 'woocommerce' ), + 'description' => __( 'If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'product_ids' => array( - 'description' => __( 'List of product IDs the coupon can be used on.', 'woocommerce' ), + 'description' => __( 'List of product IDs the coupon can be used on.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -414,7 +414,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'excluded_product_ids' => array( - 'description' => __( 'List of product IDs the coupon cannot be used on.', 'woocommerce' ), + 'description' => __( 'List of product IDs the coupon cannot be used on.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -422,28 +422,28 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'usage_limit' => array( - 'description' => __( 'How many times the coupon can be used in total.', 'woocommerce' ), + 'description' => __( 'How many times the coupon can be used in total.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'usage_limit_per_user' => array( - 'description' => __( 'How many times the coupon can be used per customer.', 'woocommerce' ), + 'description' => __( 'How many times the coupon can be used per customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'limit_usage_to_x_items' => array( - 'description' => __( 'Max number of items in the cart the coupon can be applied to.', 'woocommerce' ), + 'description' => __( 'Max number of items in the cart the coupon can be applied to.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'free_shipping' => array( - 'description' => __( 'If true and if the free shipping method requires a coupon, this coupon will enable free shipping.', 'woocommerce' ), + 'description' => __( 'If true and if the free shipping method requires a coupon, this coupon will enable free shipping.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'product_categories' => array( - 'description' => __( 'List of category IDs the coupon applies to.', 'woocommerce' ), + 'description' => __( 'List of category IDs the coupon applies to.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -451,7 +451,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'excluded_product_categories' => array( - 'description' => __( 'List of category IDs the coupon does not apply to.', 'woocommerce' ), + 'description' => __( 'List of category IDs the coupon does not apply to.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -459,23 +459,23 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'exclude_sale_items' => array( - 'description' => __( 'If true, this coupon will not be applied to items that have sale prices.', 'woocommerce' ), + 'description' => __( 'If true, this coupon will not be applied to items that have sale prices.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'minimum_amount' => array( - 'description' => __( 'Minimum order amount that needs to be in the cart before coupon applies.', 'woocommerce' ), + 'description' => __( 'Minimum order amount that needs to be in the cart before coupon applies.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'maximum_amount' => array( - 'description' => __( 'Maximum order amount allowed when using the coupon.', 'woocommerce' ), + 'description' => __( 'Maximum order amount allowed when using the coupon.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email_restrictions' => array( - 'description' => __( 'List of email addresses that can use this coupon.', 'woocommerce' ), + 'description' => __( 'List of email addresses that can use this coupon.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -483,7 +483,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'used_by' => array( - 'description' => __( 'List of user IDs (or guest email addresses) that have used the coupon.', 'woocommerce' ), + 'description' => __( 'List of user IDs (or guest email addresses) that have used the coupon.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -492,25 +492,25 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -531,7 +531,7 @@ class WC_REST_Coupons_V2_Controller extends WC_REST_CRUD_Controller { $params = parent::get_collection_params(); $params['code'] = array( - 'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php b/src/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php index e403442f484..1b7c0de9fd6 100644 --- a/src/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php @@ -78,79 +78,79 @@ class WC_REST_Customer_Downloads_V2_Controller extends WC_REST_Customer_Download 'type' => 'object', 'properties' => array( 'download_id' => array( - 'description' => __( 'Download ID.', 'woocommerce' ), + 'description' => __( 'Download ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'download_url' => array( - 'description' => __( 'Download file URL.', 'woocommerce' ), + 'description' => __( 'Download file URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Downloadable product ID.', 'woocommerce' ), + 'description' => __( 'Downloadable product ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'product_name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'download_name' => array( - 'description' => __( 'Downloadable file name.', 'woocommerce' ), + 'description' => __( 'Downloadable file name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'order_id' => array( - 'description' => __( 'Order ID.', 'woocommerce' ), + 'description' => __( 'Order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'order_key' => array( - 'description' => __( 'Order key.', 'woocommerce' ), + 'description' => __( 'Order key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'downloads_remaining' => array( - 'description' => __( 'Number of downloads remaining.', 'woocommerce' ), + 'description' => __( 'Number of downloads remaining.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'access_expires' => array( - 'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'access_expires_gmt' => array( - 'description' => __( 'The date when download access expires, as GMT.', 'woocommerce' ), + 'description' => __( 'The date when download access expires, as GMT.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'file' => array( - 'description' => __( 'File details.', 'woocommerce' ), + 'description' => __( 'File details.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-customers-v2-controller.php b/src/Controllers/Version2/class-wc-rest-customers-v2-controller.php index de079d1ac2f..bc72be9664e 100644 --- a/src/Controllers/Version2/class-wc-rest-customers-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-customers-v2-controller.php @@ -121,43 +121,43 @@ class WC_REST_Customers_V2_Controller extends WC_REST_Customers_V1_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'email' => array( - 'description' => __( 'The email address for the customer.', 'woocommerce' ), + 'description' => __( 'The email address for the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'first_name' => array( - 'description' => __( 'Customer first name.', 'woocommerce' ), + 'description' => __( 'Customer first name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -165,7 +165,7 @@ class WC_REST_Customers_V2_Controller extends WC_REST_Customers_V1_Controller { ), ), 'last_name' => array( - 'description' => __( 'Customer last name.', 'woocommerce' ), + 'description' => __( 'Customer last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -173,13 +173,13 @@ class WC_REST_Customers_V2_Controller extends WC_REST_Customers_V1_Controller { ), ), 'role' => array( - 'description' => __( 'Customer role.', 'woocommerce' ), + 'description' => __( 'Customer role.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'username' => array( - 'description' => __( 'Customer login name.', 'woocommerce' ), + 'description' => __( 'Customer login name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -187,169 +187,169 @@ class WC_REST_Customers_V2_Controller extends WC_REST_Customers_V1_Controller { ), ), 'password' => array( - 'description' => __( 'Customer password.', 'woocommerce' ), + 'description' => __( 'Customer password.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'billing' => array( - 'description' => __( 'List of billing address data.', 'woocommerce' ), + 'description' => __( 'List of billing address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'List of shipping address data.', 'woocommerce' ), + 'description' => __( 'List of shipping address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'is_paying_customer' => array( - 'description' => __( 'Is the customer a paying customer?', 'woocommerce' ), + 'description' => __( 'Is the customer a paying customer?', 'woocommerce-rest-api' ), 'type' => 'bool', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'orders_count' => array( - 'description' => __( 'Quantity of orders made by the customer.', 'woocommerce' ), + 'description' => __( 'Quantity of orders made by the customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_spent' => array( - 'description' => __( 'Total amount spent.', 'woocommerce' ), + 'description' => __( 'Total amount spent.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'avatar_url' => array( - 'description' => __( 'Avatar URL.', 'woocommerce' ), + 'description' => __( 'Avatar URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php b/src/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php index 45d0f8b483d..357082d1b65 100644 --- a/src/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php @@ -55,31 +55,31 @@ class WC_REST_Network_Orders_V2_Controller extends WC_REST_Orders_V2_Controller $schema = parent::get_public_item_schema(); $schema['properties']['blog'] = array( - 'description' => __( 'Blog id of the record on the multisite.', 'woocommerce' ), + 'description' => __( 'Blog id of the record on the multisite.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['edit_url'] = array( - 'description' => __( 'URL to edit the order', 'woocommerce' ), + 'description' => __( 'URL to edit the order', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['customer'][] = array( - 'description' => __( 'Name of the customer for the order', 'woocommerce' ), + 'description' => __( 'Name of the customer for the order', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['status_name'][] = array( - 'description' => __( 'Order Status', 'woocommerce' ), + 'description' => __( 'Order Status', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['formatted_total'][] = array( - 'description' => __( 'Order total formatted for locale', 'woocommerce' ), + 'description' => __( 'Order total formatted for locale', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, @@ -146,7 +146,7 @@ class WC_REST_Network_Orders_V2_Controller extends WC_REST_Orders_V2_Controller $current_order['blog'] = get_blog_details( get_current_blog_id() ); $current_order['edit_url'] = get_admin_url( $blog_id, 'post.php?post=' . absint( $order->get_id() ) . '&action=edit' ); /* translators: 1: first name 2: last name */ - $current_order['customer'] = trim( sprintf( _x( '%1$s %2$s', 'full name', 'woocommerce' ), $order->get_billing_first_name(), $order->get_billing_last_name() ) ); + $current_order['customer'] = trim( sprintf( _x( '%1$s %2$s', 'full name', 'woocommerce-rest-api' ), $order->get_billing_first_name(), $order->get_billing_last_name() ) ); $current_order['status_name'] = wc_get_order_status_name( $order->get_status() ); $current_order['formatted_total'] = $order->get_formatted_order_total(); } diff --git a/src/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php b/src/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php index f3d269c963f..6ecd15e3165 100644 --- a/src/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php @@ -36,7 +36,7 @@ class WC_REST_Order_Notes_V2_Controller extends WC_REST_Order_Notes_V1_Controlle $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $args = array( @@ -126,30 +126,30 @@ class WC_REST_Order_Notes_V2_Controller extends WC_REST_Order_Notes_V1_Controlle 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order note was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order note was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'note' => array( - 'description' => __( 'Order note content.', 'woocommerce' ), + 'description' => __( 'Order note content.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'customer_note' => array( - 'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce' ), + 'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), @@ -170,7 +170,7 @@ class WC_REST_Order_Notes_V2_Controller extends WC_REST_Order_Notes_V1_Controlle $params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['type'] = array( 'default' => 'any', - 'description' => __( 'Limit result to customers or internal notes.', 'woocommerce' ), + 'description' => __( 'Limit result to customers or internal notes.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array( 'any', 'customer', 'internal' ), 'sanitize_callback' => 'sanitize_key', diff --git a/src/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php b/src/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php index 508db09352b..dff06e2d063 100644 --- a/src/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php @@ -61,7 +61,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -85,11 +85,11 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -109,7 +109,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { 'force' => array( 'default' => true, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -188,11 +188,11 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order ) { - return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 ); + return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), 404 ); } if ( ! $object || $object->get_parent_id() !== $order->get_id() ) { - return new WP_Error( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 404 ); + return new WP_Error( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce-rest-api' ), 404 ); } $data = $this->get_formatted_item_data( $object ); @@ -270,11 +270,11 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order ) { - return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 ); + return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), 404 ); } if ( 0 > $request['amount'] ) { - return new WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 ); + return new WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce-rest-api' ), 400 ); } // Create the refund. @@ -293,7 +293,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { } if ( ! $refund ) { - return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 ); + return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce-rest-api' ), 500 ); } if ( ! empty( $request['meta_data'] ) && is_array( $request['meta_data'] ) ) { @@ -352,64 +352,64 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order refund was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order refund was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order refund was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order refund was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'amount' => array( - 'description' => __( 'Refund amount.', 'woocommerce' ), + 'description' => __( 'Refund amount.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'reason' => array( - 'description' => __( 'Reason for refund.', 'woocommerce' ), + 'description' => __( 'Reason for refund.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'refunded_by' => array( - 'description' => __( 'User ID of user who created the refund.', 'woocommerce' ), + 'description' => __( 'User ID of user who created the refund.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'refunded_payment' => array( - 'description' => __( 'If the payment was refunded via the API.', 'woocommerce' ), + 'description' => __( 'If the payment was refunded via the API.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -417,7 +417,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { ), ), 'line_items' => array( - 'description' => __( 'Line items data.', 'woocommerce' ), + 'description' => __( 'Line items data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -425,67 +425,67 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'variation_id' => array( - 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), + 'description' => __( 'Variation ID, if applicable.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'quantity' => array( - 'description' => __( 'Quantity ordered.', 'woocommerce' ), + 'description' => __( 'Quantity ordered.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tax_class' => array( - 'description' => __( 'Tax class of product.', 'woocommerce' ), + 'description' => __( 'Tax class of product.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal_tax' => array( - 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -493,19 +493,19 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -514,7 +514,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -522,19 +522,19 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -543,13 +543,13 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { ), ), 'sku' => array( - 'description' => __( 'Product SKU.', 'woocommerce' ), + 'description' => __( 'Product SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'price' => array( - 'description' => __( 'Product price.', 'woocommerce' ), + 'description' => __( 'Product price.', 'woocommerce-rest-api' ), 'type' => 'number', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -558,7 +558,7 @@ class WC_REST_Order_Refunds_V2_Controller extends WC_REST_Orders_V2_Controller { ), ), 'api_refund' => array( - 'description' => __( 'When true, the payment gateway API is used to generate the refund.', 'woocommerce' ), + 'description' => __( 'When true, the payment gateway API is used to generate the refund.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'edit' ), 'default' => true, diff --git a/src/Controllers/Version2/class-wc-rest-orders-v2-controller.php b/src/Controllers/Version2/class-wc-rest-orders-v2-controller.php index 197d5a0e1dc..b073f04c5a1 100644 --- a/src/Controllers/Version2/class-wc-rest-orders-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-orders-v2-controller.php @@ -83,7 +83,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -109,7 +109,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -529,7 +529,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { if ( ! is_null( $request['customer_id'] ) && 0 !== $request['customer_id'] ) { // Make sure customer exists. if ( false === get_user_by( 'id', $request['customer_id'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce-rest-api' ), 400 ); } // Make sure customer is part of blog. @@ -601,7 +601,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { } elseif ( ! empty( $posted['variation_id'] ) ) { $product_id = (int) $posted['variation_id']; } else { - throw new WC_REST_Exception( 'woocommerce_rest_required_product_reference', __( 'Product ID or SKU is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_required_product_reference', __( 'Product ID or SKU is required.', 'woocommerce-rest-api' ), 400 ); } return $product_id; } @@ -693,7 +693,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { if ( 'create' === $action ) { if ( empty( $posted['method_id'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -717,7 +717,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { if ( 'create' === $action ) { if ( empty( $posted['name'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_fee_item', __( 'Fee name is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_fee_item', __( 'Fee name is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -741,7 +741,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { if ( 'create' === $action ) { if ( empty( $posted['code'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -778,7 +778,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { $item = $order->get_item( absint( $posted['id'] ), false ); if ( ! $item ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce-rest-api' ), 400 ); } } @@ -841,271 +841,271 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'parent_id' => array( - 'description' => __( 'Parent order ID.', 'woocommerce' ), + 'description' => __( 'Parent order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'number' => array( - 'description' => __( 'Order number.', 'woocommerce' ), + 'description' => __( 'Order number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'order_key' => array( - 'description' => __( 'Order key.', 'woocommerce' ), + 'description' => __( 'Order key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'created_via' => array( - 'description' => __( 'Shows where the order was created.', 'woocommerce' ), + 'description' => __( 'Shows where the order was created.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'version' => array( - 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce' ), + 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( - 'description' => __( 'Order status.', 'woocommerce' ), + 'description' => __( 'Order status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'pending', 'enum' => $this->get_order_statuses(), 'context' => array( 'view', 'edit' ), ), 'currency' => array( - 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce' ), + 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => get_woocommerce_currency(), 'enum' => array_keys( get_woocommerce_currencies() ), 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the order was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the order was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_total' => array( - 'description' => __( 'Total discount amount for the order.', 'woocommerce' ), + 'description' => __( 'Total discount amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_tax' => array( - 'description' => __( 'Total discount tax amount for the order.', 'woocommerce' ), + 'description' => __( 'Total discount tax amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_total' => array( - 'description' => __( 'Total shipping amount for the order.', 'woocommerce' ), + 'description' => __( 'Total shipping amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_tax' => array( - 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce' ), + 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cart_tax' => array( - 'description' => __( 'Sum of line item taxes only.', 'woocommerce' ), + 'description' => __( 'Sum of line item taxes only.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Grand total.', 'woocommerce' ), + 'description' => __( 'Grand total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Sum of all taxes.', 'woocommerce' ), + 'description' => __( 'Sum of all taxes.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'prices_include_tax' => array( - 'description' => __( 'True the prices included tax during checkout.', 'woocommerce' ), + 'description' => __( 'True the prices included tax during checkout.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_id' => array( - 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce' ), + 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 0, 'context' => array( 'view', 'edit' ), ), 'customer_ip_address' => array( - 'description' => __( "Customer's IP address.", 'woocommerce' ), + 'description' => __( "Customer's IP address.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_user_agent' => array( - 'description' => __( 'User agent of the customer.', 'woocommerce' ), + 'description' => __( 'User agent of the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_note' => array( - 'description' => __( 'Note left by customer during checkout.', 'woocommerce' ), + 'description' => __( 'Note left by customer during checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'billing' => array( - 'description' => __( 'Billing address.', 'woocommerce' ), + 'description' => __( 'Billing address.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), + 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'Shipping address.', 'woocommerce' ), + 'description' => __( 'Shipping address.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), + 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'payment_method' => array( - 'description' => __( 'Payment method ID.', 'woocommerce' ), + 'description' => __( 'Payment method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'payment_method_title' => array( - 'description' => __( 'Payment method title.', 'woocommerce' ), + 'description' => __( 'Payment method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -1113,60 +1113,60 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'transaction_id' => array( - 'description' => __( 'Unique transaction ID.', 'woocommerce' ), + 'description' => __( 'Unique transaction ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_paid' => array( - 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_paid_gmt' => array( - 'description' => __( 'The date the order was paid, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was paid, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_completed' => array( - 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_completed_gmt' => array( - 'description' => __( 'The date the order was completed, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was completed, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cart_hash' => array( - 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce' ), + 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1174,67 +1174,67 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'line_items' => array( - 'description' => __( 'Line items data.', 'woocommerce' ), + 'description' => __( 'Line items data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'variation_id' => array( - 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), + 'description' => __( 'Variation ID, if applicable.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'quantity' => array( - 'description' => __( 'Quantity ordered.', 'woocommerce' ), + 'description' => __( 'Quantity ordered.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class of product.', 'woocommerce' ), + 'description' => __( 'Tax class of product.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal' => array( - 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal_tax' => array( - 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1242,17 +1242,17 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -1260,25 +1260,25 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1286,13 +1286,13 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'sku' => array( - 'description' => __( 'Product SKU.', 'woocommerce' ), + 'description' => __( 'Product SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'price' => array( - 'description' => __( 'Product price.', 'woocommerce' ), + 'description' => __( 'Product price.', 'woocommerce-rest-api' ), 'type' => 'number', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1301,7 +1301,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'tax_lines' => array( - 'description' => __( 'Tax lines data.', 'woocommerce' ), + 'description' => __( 'Tax lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1309,67 +1309,67 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rate_code' => array( - 'description' => __( 'Tax rate code.', 'woocommerce' ), + 'description' => __( 'Tax rate code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rate_id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'Tax rate label.', 'woocommerce' ), + 'description' => __( 'Tax rate label.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'compound' => array( - 'description' => __( 'Show if is a compound tax rate.', 'woocommerce' ), + 'description' => __( 'Show if is a compound tax rate.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tax_total' => array( - 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce' ), + 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_tax_total' => array( - 'description' => __( 'Shipping tax total.', 'woocommerce' ), + 'description' => __( 'Shipping tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1380,46 +1380,46 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'shipping_lines' => array( - 'description' => __( 'Shipping lines data.', 'woocommerce' ), + 'description' => __( 'Shipping lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_title' => array( - 'description' => __( 'Shipping method name.', 'woocommerce' ), + 'description' => __( 'Shipping method name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'method_id' => array( - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'instance_id' => array( - 'description' => __( 'Shipping instance ID.', 'woocommerce' ), + 'description' => __( 'Shipping instance ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1427,13 +1427,13 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1442,25 +1442,25 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1471,47 +1471,47 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'fee_lines' => array( - 'description' => __( 'Fee lines data.', 'woocommerce' ), + 'description' => __( 'Fee lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Fee name.', 'woocommerce' ), + 'description' => __( 'Fee name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class of fee.', 'woocommerce' ), + 'description' => __( 'Tax class of fee.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status of fee.', 'woocommerce' ), + 'description' => __( 'Tax status of fee.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'taxable', 'none' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1519,19 +1519,19 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1540,25 +1540,25 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1569,54 +1569,54 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'coupon_lines' => array( - 'description' => __( 'Coupons line data.', 'woocommerce' ), + 'description' => __( 'Coupons line data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'discount' => array( - 'description' => __( 'Discount total.', 'woocommerce' ), + 'description' => __( 'Discount total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'discount_tax' => array( - 'description' => __( 'Discount total tax.', 'woocommerce' ), + 'description' => __( 'Discount total tax.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1627,7 +1627,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'refunds' => array( - 'description' => __( 'List of refunds.', 'woocommerce' ), + 'description' => __( 'List of refunds.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1635,19 +1635,19 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Refund ID.', 'woocommerce' ), + 'description' => __( 'Refund ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reason' => array( - 'description' => __( 'Refund reason.', 'woocommerce' ), + 'description' => __( 'Refund reason.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Refund total.', 'woocommerce' ), + 'description' => __( 'Refund total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1656,7 +1656,7 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'set_paid' => array( - 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ), + 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'edit' ), @@ -1677,27 +1677,27 @@ class WC_REST_Orders_V2_Controller extends WC_REST_CRUD_Controller { $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to orders assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'any', 'trash' ), $this->get_order_statuses() ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['customer'] = array( - 'description' => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['product'] = array( - 'description' => __( 'Limit result set to orders assigned a specific product.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific product.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['dp'] = array( 'default' => wc_get_price_decimals(), - 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce' ), + 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php b/src/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php index 69bfc51f418..a652ea1fab3 100644 --- a/src/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php @@ -51,7 +51,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { $this->namespace, '/' . $this->rest_base . '/(?P[\w-]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -82,7 +82,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'payment_gateways', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -95,7 +95,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'payment_gateways', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -108,7 +108,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { */ public function update_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'payment_gateways', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -141,7 +141,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { $gateway = $this->get_gateway( $request ); if ( is_null( $gateway ) ) { - return new WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $gateway = $this->prepare_item_for_response( $gateway, $request ); @@ -158,7 +158,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { $gateway = $this->get_gateway( $request ); if ( is_null( $gateway ) ) { - return new WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Get settings. @@ -184,7 +184,7 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { } if ( $errors_found ) { - return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -351,23 +351,23 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Payment gateway ID.', 'woocommerce' ), + 'description' => __( 'Payment gateway ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Payment gateway title on checkout.', 'woocommerce' ), + 'description' => __( 'Payment gateway title on checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Payment gateway description on checkout.', 'woocommerce' ), + 'description' => __( 'Payment gateway description on checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'order' => array( - 'description' => __( 'Payment gateway sort order.', 'woocommerce' ), + 'description' => __( 'Payment gateway sort order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -375,71 +375,71 @@ class WC_REST_Payment_Gateways_V2_Controller extends WC_REST_Controller { ), ), 'enabled' => array( - 'description' => __( 'Payment gateway enabled status.', 'woocommerce' ), + 'description' => __( 'Payment gateway enabled status.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ), 'method_title' => array( - 'description' => __( 'Payment gateway method title.', 'woocommerce' ), + 'description' => __( 'Payment gateway method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_description' => array( - 'description' => __( 'Payment gateway method description.', 'woocommerce' ), + 'description' => __( 'Payment gateway method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'settings' => array( - 'description' => __( 'Payment gateway settings.', 'woocommerce' ), + 'description' => __( 'Payment gateway settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php b/src/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php index 08c5f8f1980..5c065477ffa 100644 --- a/src/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php @@ -100,13 +100,13 @@ class WC_REST_Product_Categories_V2_Controller extends WC_REST_Product_Categorie 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -114,7 +114,7 @@ class WC_REST_Product_Categories_V2_Controller extends WC_REST_Product_Categorie ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -122,12 +122,12 @@ class WC_REST_Product_Categories_V2_Controller extends WC_REST_Product_Categorie ), ), 'parent' => array( - 'description' => __( 'The ID for the parent of the resource.', 'woocommerce' ), + 'description' => __( 'The ID for the parent of the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -135,71 +135,71 @@ class WC_REST_Product_Categories_V2_Controller extends WC_REST_Product_Categorie ), ), 'display' => array( - 'description' => __( 'Category archive display type.', 'woocommerce' ), + 'description' => __( 'Category archive display type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'default', 'enum' => array( 'default', 'products', 'subcategories', 'both' ), 'context' => array( 'view', 'edit' ), ), 'image' => array( - 'description' => __( 'Image data.', 'woocommerce' ), + 'description' => __( 'Image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'title' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php b/src/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php index 12ab7d62655..a90d4ad232e 100644 --- a/src/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php @@ -42,7 +42,7 @@ class WC_REST_Product_Reviews_V2_Controller extends WC_REST_Product_Reviews_V1_C $this->namespace, '/' . $this->rest_base . '/batch', array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -65,7 +65,7 @@ class WC_REST_Product_Reviews_V2_Controller extends WC_REST_Product_Reviews_V1_C */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( 'product', 'batch' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -150,43 +150,43 @@ class WC_REST_Product_Reviews_V2_Controller extends WC_REST_Product_Reviews_V1_C 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'review' => array( - 'description' => __( 'The content of the review.', 'woocommerce' ), + 'description' => __( 'The content of the review.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_created_gmt' => array( - 'description' => __( 'The date the review was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the review was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'rating' => array( - 'description' => __( 'Review rating (0 to 5).', 'woocommerce' ), + 'description' => __( 'Review rating (0 to 5).', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Reviewer name.', 'woocommerce' ), + 'description' => __( 'Reviewer name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Reviewer email.', 'woocommerce' ), + 'description' => __( 'Reviewer email.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'verified' => array( - 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ), + 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php b/src/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php index 7e051263f93..81c8e7884c6 100644 --- a/src/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php @@ -47,7 +47,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -70,11 +70,11 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the variation.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variation.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -104,7 +104,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -115,7 +115,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr $this->namespace, '/' . $this->rest_base . '/batch', array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -151,12 +151,12 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr $object = $this->get_object( (int) $request['id'] ); if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'edit', $object->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } // Check if variation belongs to the correct parent product. if ( $object && 0 !== $object->get_parent_id() && absint( $request['product_id'] ) !== $object->get_parent_id() ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Parent product does not match current variation.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Parent product does not match current variation.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -488,7 +488,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr if ( ! $object || 0 === $object->get_id() ) { return new WP_Error( - "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( + "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404, ) ); @@ -509,7 +509,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) { return new WP_Error( /* translators: %s: post type */ - "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( + "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code(), ) ); @@ -527,7 +527,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr if ( ! $supports_trash ) { return new WP_Error( /* translators: %s: post type */ - 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( + 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501, ) ); @@ -538,7 +538,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr if ( 'trash' === $object->get_status() ) { return new WP_Error( /* translators: %s: post type */ - 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( + 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410, ) ); @@ -552,7 +552,7 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr if ( ! $result ) { return new WP_Error( /* translators: %s: post type */ - 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( + 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500, ) ); @@ -646,125 +646,125 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Variation description.', 'woocommerce' ), + 'description' => __( 'Variation description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'permalink' => array( - 'description' => __( 'Variation URL.', 'woocommerce' ), + 'description' => __( 'Variation URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price' => array( - 'description' => __( 'Current variation price.', 'woocommerce' ), + 'description' => __( 'Current variation price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Variation regular price.', 'woocommerce' ), + 'description' => __( 'Variation regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Variation sale price.', 'woocommerce' ), + 'description' => __( 'Variation sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from_gmt' => array( - 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to_gmt' => array( - 'description' => __( 'End date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'End date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'on_sale' => array( - 'description' => __( 'Shows if the variation is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'visible' => array( - 'description' => __( "Define if the variation is visible on the product's page.", 'woocommerce' ), + 'description' => __( "Define if the variation is visible on the product's page.", 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'purchasable' => array( - 'description' => __( 'Shows if the variation can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the variation can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the variation is virtual.', 'woocommerce' ), + 'description' => __( 'If the variation is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the variation is downloadable.', 'woocommerce' ), + 'description' => __( 'If the variation is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -772,183 +772,183 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at variation level.', 'woocommerce' ), + 'description' => __( 'Stock management at variation level.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'in_stock' => array( - 'description' => __( 'Controls whether or not the variation is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ), + 'description' => __( 'Controls whether or not the variation is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Variation dimensions.', 'woocommerce' ), + 'description' => __( 'Variation dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'image' => array( - 'description' => __( 'Variation image data.', 'woocommerce' ), + 'description' => __( 'Variation image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce' ), + 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -956,30 +956,30 @@ class WC_REST_Product_Variations_V2_Controller extends WC_REST_Products_V2_Contr ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version2/class-wc-rest-products-v2-controller.php b/src/Controllers/Version2/class-wc-rest-products-v2-controller.php index f092749d5fe..97c4ec0a716 100644 --- a/src/Controllers/Version2/class-wc-rest-products-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-products-v2-controller.php @@ -83,7 +83,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -112,7 +112,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'args' => array( 'force' => array( 'default' => false, - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), 'type' => 'boolean', ), ), @@ -423,8 +423,8 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'date_modified' => wc_rest_prepare_date_response( current_time( 'mysql' ), false ), 'date_modified_gmt' => wc_rest_prepare_date_response( current_time( 'timestamp', true ) ), 'src' => wc_placeholder_img_src(), - 'name' => __( 'Placeholder', 'woocommerce' ), - 'alt' => __( 'Placeholder', 'woocommerce' ), + 'name' => __( 'Placeholder', 'woocommerce-rest-api' ), + 'alt' => __( 'Placeholder', 'woocommerce-rest-api' ), 'position' => 0, ); } @@ -730,7 +730,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { if ( 'variation' === $product->get_type() ) { return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", - __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), + __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404, ) @@ -1120,7 +1120,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { if ( ! wp_attachment_is_image( $attachment_id ) ) { /* translators: %s: attachment id */ - throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce' ), $attachment_id ), 400 ); + throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce-rest-api' ), $attachment_id ), 400 ); } $gallery_positions[ $attachment_id ] = absint( isset( $image['position'] ) ? $image['position'] : $index ); @@ -1351,7 +1351,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { if ( ! $object || 0 === $object->get_id() ) { return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", - __( 'Invalid ID.', 'woocommerce' ), + __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404, ) @@ -1361,7 +1361,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { if ( 'variation' === $object->get_type() ) { return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", - __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), + __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404, ) @@ -1384,7 +1384,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", /* translators: %s: post type */ - sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code(), ) @@ -1422,7 +1422,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { return new WP_Error( 'woocommerce_rest_trash_not_supported', /* translators: %s: post type */ - sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501, ) @@ -1435,7 +1435,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { return new WP_Error( 'woocommerce_rest_already_trashed', /* translators: %s: post type */ - sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410, ) @@ -1451,7 +1451,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { return new WP_Error( 'woocommerce_rest_cannot_delete', /* translators: %s: post type */ - sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500, ) @@ -1489,185 +1489,185 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'slug' => array( - 'description' => __( 'Product slug.', 'woocommerce' ), + 'description' => __( 'Product slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'permalink' => array( - 'description' => __( 'Product URL.', 'woocommerce' ), + 'description' => __( 'Product URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the product was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the product was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Product type.', 'woocommerce' ), + 'description' => __( 'Product type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'simple', 'enum' => array_keys( wc_get_product_types() ), 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Product status (post status).', 'woocommerce' ), + 'description' => __( 'Product status (post status).', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'publish', 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), 'context' => array( 'view', 'edit' ), ), 'featured' => array( - 'description' => __( 'Featured product.', 'woocommerce' ), + 'description' => __( 'Featured product.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'catalog_visibility' => array( - 'description' => __( 'Catalog visibility.', 'woocommerce' ), + 'description' => __( 'Catalog visibility.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'visible', 'enum' => array( 'visible', 'catalog', 'search', 'hidden' ), 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Product description.', 'woocommerce' ), + 'description' => __( 'Product description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'short_description' => array( - 'description' => __( 'Product short description.', 'woocommerce' ), + 'description' => __( 'Product short description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price' => array( - 'description' => __( 'Current product price.', 'woocommerce' ), + 'description' => __( 'Current product price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Product regular price.', 'woocommerce' ), + 'description' => __( 'Product regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Product sale price.', 'woocommerce' ), + 'description' => __( 'Product sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from_gmt' => array( - 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to_gmt' => array( - 'description' => __( 'End date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'End date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'price_html' => array( - 'description' => __( 'Price formatted in HTML.', 'woocommerce' ), + 'description' => __( 'Price formatted in HTML.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'on_sale' => array( - 'description' => __( 'Shows if the product is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'purchasable' => array( - 'description' => __( 'Shows if the product can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the product can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_sales' => array( - 'description' => __( 'Amount of sales.', 'woocommerce' ), + 'description' => __( 'Amount of sales.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the product is virtual.', 'woocommerce' ), + 'description' => __( 'If the product is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the product is downloadable.', 'woocommerce' ), + 'description' => __( 'If the product is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -1675,156 +1675,156 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'external_url' => array( - 'description' => __( 'Product external URL. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external URL. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'button_text' => array( - 'description' => __( 'Product external button text. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external button text. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at product level.', 'woocommerce' ), + 'description' => __( 'Stock management at product level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'in_stock' => array( - 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce' ), + 'description' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the product is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sold_individually' => array( - 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce' ), + 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Product dimensions.', 'woocommerce' ), + 'description' => __( 'Product dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_required' => array( - 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce' ), + 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_taxable' => array( - 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce' ), + 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reviews_allowed' => array( - 'description' => __( 'Allow reviews.', 'woocommerce' ), + 'description' => __( 'Allow reviews.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'average_rating' => array( - 'description' => __( 'Reviews average rating.', 'woocommerce' ), + 'description' => __( 'Reviews average rating.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rating_count' => array( - 'description' => __( 'Amount of reviews that the product have.', 'woocommerce' ), + 'description' => __( 'Amount of reviews that the product have.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'related_ids' => array( - 'description' => __( 'List of related products IDs.', 'woocommerce' ), + 'description' => __( 'List of related products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1833,7 +1833,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'readonly' => true, ), 'upsell_ids' => array( - 'description' => __( 'List of up-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of up-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1841,7 +1841,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'cross_sell_ids' => array( - 'description' => __( 'List of cross-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of cross-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1849,35 +1849,35 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'Product parent ID.', 'woocommerce' ), + 'description' => __( 'Product parent ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'purchase_note' => array( - 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce' ), + 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'categories' => array( - 'description' => __( 'List of categories.', 'woocommerce' ), + 'description' => __( 'List of categories.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Category ID.', 'woocommerce' ), + 'description' => __( 'Category ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Category slug.', 'woocommerce' ), + 'description' => __( 'Category slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1886,25 +1886,25 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'tags' => array( - 'description' => __( 'List of tags.', 'woocommerce' ), + 'description' => __( 'List of tags.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tag ID.', 'woocommerce' ), + 'description' => __( 'Tag ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Tag name.', 'woocommerce' ), + 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Tag slug.', 'woocommerce' ), + 'description' => __( 'Tag slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1913,59 +1913,59 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'images' => array( - 'description' => __( 'List of images.', 'woocommerce' ), + 'description' => __( 'List of images.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce' ), + 'description' => __( 'Image position. 0 means that the image is featured.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), @@ -1973,41 +1973,41 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Attribute position.', 'woocommerce' ), + 'description' => __( 'Attribute position.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'visible' => array( - 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce' ), + 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'variation' => array( - 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce' ), + 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'options' => array( - 'description' => __( 'List of available term names of the attribute.', 'woocommerce' ), + 'description' => __( 'List of available term names of the attribute.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -2018,24 +2018,24 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'default_attributes' => array( - 'description' => __( 'Defaults variation attributes.', 'woocommerce' ), + 'description' => __( 'Defaults variation attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -2043,7 +2043,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { ), ), 'variations' => array( - 'description' => __( 'List of variations IDs.', 'woocommerce' ), + 'description' => __( 'List of variations IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -2052,7 +2052,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'readonly' => true, ), 'grouped_products' => array( - 'description' => __( 'List of grouped products ID.', 'woocommerce' ), + 'description' => __( 'List of grouped products ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -2060,30 +2060,30 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { 'context' => array( 'view', 'edit' ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -2105,63 +2105,63 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { $params = parent::get_collection_params(); $params['slug'] = array( - 'description' => __( 'Limit result set to products with a specific slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'any', 'future' ), array_keys( get_post_statuses() ) ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['type'] = array( - 'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_types() ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); $params['sku'] = array( - 'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['featured'] = array( - 'description' => __( 'Limit result set to featured products.', 'woocommerce' ), + 'description' => __( 'Limit result set to featured products.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'sanitize_callback' => 'wc_string_to_bool', 'validate_callback' => 'rest_validate_request_arg', ); $params['category'] = array( - 'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['tag'] = array( - 'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['shipping_class'] = array( - 'description' => __( 'Limit result set to products assigned a specific shipping class ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['attribute'] = array( - 'description' => __( 'Limit result set to products with a specific attribute. Use the taxonomy name/attribute slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific attribute. Use the taxonomy name/attribute slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['attribute_term'] = array( - 'description' => __( 'Limit result set to products with a specific attribute term ID (required an assigned attribute).', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific attribute term ID (required an assigned attribute).', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', @@ -2169,7 +2169,7 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { if ( wc_tax_enabled() ) { $params['tax_class'] = array( - 'description' => __( 'Limit result set to products with a specific tax class.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'standard' ), WC_Tax::get_tax_class_slugs() ), 'sanitize_callback' => 'sanitize_text_field', @@ -2178,25 +2178,25 @@ class WC_REST_Products_V2_Controller extends WC_REST_CRUD_Controller { } $params['in_stock'] = array( - 'description' => __( 'Limit result set to products in stock or out of stock.', 'woocommerce' ), + 'description' => __( 'Limit result set to products in stock or out of stock.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'sanitize_callback' => 'wc_string_to_bool', 'validate_callback' => 'rest_validate_request_arg', ); $params['on_sale'] = array( - 'description' => __( 'Limit result set to products on sale.', 'woocommerce' ), + 'description' => __( 'Limit result set to products on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'sanitize_callback' => 'wc_string_to_bool', 'validate_callback' => 'rest_validate_request_arg', ); $params['min_price'] = array( - 'description' => __( 'Limit result set to products based on a minimum price.', 'woocommerce' ), + 'description' => __( 'Limit result set to products based on a minimum price.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['max_price'] = array( - 'description' => __( 'Limit result set to products based on a maximum price.', 'woocommerce' ), + 'description' => __( 'Limit result set to products based on a maximum price.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php b/src/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php index 0b1d988f941..7c8a72a1220 100644 --- a/src/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php @@ -42,7 +42,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { $this->namespace, '/' . $this->rest_base, array( 'args' => array( 'group' => array( - 'description' => __( 'Settings group ID.', 'woocommerce' ), + 'description' => __( 'Settings group ID.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -59,7 +59,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { $this->namespace, '/' . $this->rest_base . '/batch', array( 'args' => array( 'group' => array( - 'description' => __( 'Settings group ID.', 'woocommerce' ), + 'description' => __( 'Settings group ID.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -77,11 +77,11 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { $this->namespace, '/' . $this->rest_base . '/(?P[\w-]+)', array( 'args' => array( 'group' => array( - 'description' => __( 'Settings group ID.', 'woocommerce' ), + 'description' => __( 'Settings group ID.', 'woocommerce-rest-api' ), 'type' => 'string', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -156,13 +156,13 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { */ public function get_group_settings( $group_id ) { if ( empty( $group_id ) ) { - return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $settings = apply_filters( 'woocommerce_settings-' . $group_id, array() ); if ( empty( $settings ) ) { - return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $filtered_settings = array(); @@ -231,7 +231,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { */ public function get_setting( $group_id, $setting_id ) { if ( empty( $setting_id ) ) { - return new WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $settings = $this->get_group_settings( $group_id ); @@ -243,13 +243,13 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { $array_key = array_keys( wp_list_pluck( $settings, 'id' ), $setting_id ); if ( empty( $array_key ) ) { - return new WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $setting = $settings[ $array_key[0] ]; if ( ! $this->is_setting_type_valid( $setting['type'] ) ) { - return new WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $setting; @@ -373,7 +373,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -388,7 +388,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { */ public function update_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -502,7 +502,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_title', @@ -511,7 +511,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -520,7 +520,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -529,18 +529,18 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -549,7 +549,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -558,7 +558,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -568,7 +568,7 @@ class WC_REST_Setting_Options_V2_Controller extends WC_REST_Controller { 'readonly' => true, ), 'options' => array( - 'description' => __( 'Array of options (key value pairs) for inputs such as select, multiselect, and radio buttons.', 'woocommerce' ), + 'description' => __( 'Array of options (key value pairs) for inputs such as select, multiselect, and radio buttons.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-settings-v2-controller.php b/src/Controllers/Version2/class-wc-rest-settings-v2-controller.php index f41c91e722d..1ca5f153b40 100644 --- a/src/Controllers/Version2/class-wc-rest-settings-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-settings-v2-controller.php @@ -60,7 +60,7 @@ class WC_REST_Settings_V2_Controller extends WC_REST_Controller { public function get_items( $request ) { $groups = apply_filters( 'woocommerce_settings_groups', array() ); if ( empty( $groups ) ) { - return new WP_Error( 'rest_setting_groups_empty', __( 'No setting groups have been registered.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'rest_setting_groups_empty', __( 'No setting groups have been registered.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $defaults = $this->group_defaults(); @@ -176,7 +176,7 @@ class WC_REST_Settings_V2_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -195,31 +195,31 @@ class WC_REST_Settings_V2_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce' ), + 'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'parent_id' => array( - 'description' => __( 'ID of parent grouping.', 'woocommerce' ), + 'description' => __( 'ID of parent grouping.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'sub_groups' => array( - 'description' => __( 'IDs for settings sub groups.', 'woocommerce' ), + 'description' => __( 'IDs for settings sub groups.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php b/src/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php index 795c92b3e18..0c4a0ff8fcd 100644 --- a/src/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php @@ -51,7 +51,7 @@ class WC_REST_Shipping_Methods_V2_Controller extends WC_REST_Controller { $this->namespace, '/' . $this->rest_base . '/(?P[\w-]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -76,7 +76,7 @@ class WC_REST_Shipping_Methods_V2_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'shipping_methods', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -89,7 +89,7 @@ class WC_REST_Shipping_Methods_V2_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'shipping_methods', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -121,7 +121,7 @@ class WC_REST_Shipping_Methods_V2_Controller extends WC_REST_Controller { $wc_shipping = WC_Shipping::instance(); $methods = $wc_shipping->get_shipping_methods(); if ( empty( $methods[ $request['id'] ] ) ) { - return new WP_Error( 'woocommerce_rest_shipping_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_shipping_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $method = $methods[ $request['id'] ]; @@ -195,19 +195,19 @@ class WC_REST_Shipping_Methods_V2_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Method ID.', 'woocommerce' ), + 'description' => __( 'Method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Shipping method title.', 'woocommerce' ), + 'description' => __( 'Shipping method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Shipping method description.', 'woocommerce' ), + 'description' => __( 'Shipping method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php b/src/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php index 9e171814f70..434906709c7 100644 --- a/src/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php @@ -26,7 +26,7 @@ class WC_REST_Shipping_Zone_Locations_V2_Controller extends WC_REST_Shipping_Zon $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)/locations', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique ID for the resource.', 'woocommerce' ), + 'description' => __( 'Unique ID for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -85,7 +85,7 @@ class WC_REST_Shipping_Zone_Locations_V2_Controller extends WC_REST_Shipping_Zon } if ( 0 === $zone->get_id() ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_locations_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce' ), array( 'status' => 403 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_locations_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce-rest-api' ), array( 'status' => 403 ) ); } $raw_locations = $request->get_json_params(); @@ -166,12 +166,12 @@ class WC_REST_Shipping_Zone_Locations_V2_Controller extends WC_REST_Shipping_Zon 'type' => 'object', 'properties' => array( 'code' => array( - 'description' => __( 'Shipping zone location code.', 'woocommerce' ), + 'description' => __( 'Shipping zone location code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'type' => array( - 'description' => __( 'Shipping zone location type.', 'woocommerce' ), + 'description' => __( 'Shipping zone location type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'country', 'enum' => array( diff --git a/src/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php b/src/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php index c753fd8e42f..67ad37bfd26 100644 --- a/src/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php @@ -26,7 +26,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)/methods', array( 'args' => array( 'zone_id' => array( - 'description' => __( 'Unique ID for the zone.', 'woocommerce' ), + 'description' => __( 'Unique ID for the zone.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -44,7 +44,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones 'method_id' => array( 'required' => true, 'readonly' => false, - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), ), ) ), @@ -57,11 +57,11 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)/methods/(?P[\d]+)', array( 'args' => array( 'zone_id' => array( - 'description' => __( 'Unique ID for the zone.', 'woocommerce' ), + 'description' => __( 'Unique ID for the zone.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'instance_id' => array( - 'description' => __( 'Unique ID for the instance.', 'woocommerce' ), + 'description' => __( 'Unique ID for the instance.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -84,7 +84,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -118,7 +118,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones } if ( false === $method ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $method, $request ); @@ -174,7 +174,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones } if ( false === $method ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( 'Resource cannot be created.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( 'Resource cannot be created.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $method = $this->update_fields( $instance_id, $method, $request ); @@ -212,7 +212,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones } if ( false === $method ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $method = $this->update_fields( $instance_id, $method, $request ); @@ -227,7 +227,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones if ( $force ) { $zone->delete_shipping_method( $instance_id ); } else { - return new WP_Error( 'rest_trash_not_supported', __( 'Shipping methods do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'rest_trash_not_supported', __( 'Shipping methods do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } /** @@ -266,7 +266,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones } if ( false === $method ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $method = $this->update_fields( $instance_id, $method, $request ); @@ -311,7 +311,7 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones } if ( $errors_found ) { - return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } update_option( $method->get_instance_option_key(), apply_filters( 'woocommerce_shipping_' . $method->id . '_instance_settings_values', $instance_settings, $method ) ); @@ -433,100 +433,100 @@ class WC_REST_Shipping_Zone_Methods_V2_Controller extends WC_REST_Shipping_Zones 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Shipping method instance ID.', 'woocommerce' ), + 'description' => __( 'Shipping method instance ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'instance_id' => array( - 'description' => __( 'Shipping method instance ID.', 'woocommerce' ), + 'description' => __( 'Shipping method instance ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Shipping method customer facing title.', 'woocommerce' ), + 'description' => __( 'Shipping method customer facing title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'order' => array( - 'description' => __( 'Shipping method sort order.', 'woocommerce' ), + 'description' => __( 'Shipping method sort order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'enabled' => array( - 'description' => __( 'Shipping method enabled status.', 'woocommerce' ), + 'description' => __( 'Shipping method enabled status.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ), 'method_id' => array( - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_title' => array( - 'description' => __( 'Shipping method title.', 'woocommerce' ), + 'description' => __( 'Shipping method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_description' => array( - 'description' => __( 'Shipping method description.', 'woocommerce' ), + 'description' => __( 'Shipping method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'settings' => array( - 'description' => __( 'Shipping method settings.', 'woocommerce' ), + 'description' => __( 'Shipping method settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php b/src/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php index db881b97fbe..d3abcf9ff46 100644 --- a/src/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php @@ -38,7 +38,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro 'name' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Shipping zone name.', 'woocommerce' ), + 'description' => __( 'Shipping zone name.', 'woocommerce-rest-api' ), ), ) ), @@ -51,7 +51,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro $this->namespace, '/' . $this->rest_base . '/(?P[\d-]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique ID for the resource.', 'woocommerce' ), + 'description' => __( 'Unique ID for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -74,7 +74,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -151,7 +151,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $zone->get_id() ) ) ); return $response; } else { - return new WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( "Resource cannot be created. Check to make sure 'order' and 'name' are present.", 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( "Resource cannot be created. Check to make sure 'order' and 'name' are present.", 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } } @@ -169,7 +169,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro } if ( 0 === $zone->get_id() ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce' ), array( 'status' => 403 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce-rest-api' ), array( 'status' => 403 ) ); } $zone_changed = false; @@ -211,7 +211,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro if ( $force ) { $zone->delete(); } else { - return new WP_Error( 'rest_trash_not_supported', __( 'Shipping zones do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'rest_trash_not_supported', __( 'Shipping zones do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } return $response; @@ -278,13 +278,13 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Shipping zone name.', 'woocommerce' ), + 'description' => __( 'Shipping zone name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -292,7 +292,7 @@ class WC_REST_Shipping_Zones_V2_Controller extends WC_REST_Shipping_Zones_Contro ), ), 'order' => array( - 'description' => __( 'Shipping zone order.', 'woocommerce' ), + 'description' => __( 'Shipping zone order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php b/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php index 4842a63c4fb..37394960d2a 100644 --- a/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php @@ -56,7 +56,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -84,7 +84,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -97,7 +97,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -110,7 +110,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { */ public function update_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'system_status', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot update resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot update resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -124,79 +124,79 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { public function get_tools() { $tools = array( 'clear_transients' => array( - 'name' => __( 'WooCommerce transients', 'woocommerce' ), - 'button' => __( 'Clear transients', 'woocommerce' ), - 'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ), + 'name' => __( 'WooCommerce transients', 'woocommerce-rest-api' ), + 'button' => __( 'Clear transients', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce-rest-api' ), ), 'clear_expired_transients' => array( - 'name' => __( 'Expired transients', 'woocommerce' ), - 'button' => __( 'Clear transients', 'woocommerce' ), - 'desc' => __( 'This tool will clear ALL expired transients from WordPress.', 'woocommerce' ), + 'name' => __( 'Expired transients', 'woocommerce-rest-api' ), + 'button' => __( 'Clear transients', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will clear ALL expired transients from WordPress.', 'woocommerce-rest-api' ), ), 'delete_orphaned_variations' => array( - 'name' => __( 'Orphaned variations', 'woocommerce' ), - 'button' => __( 'Delete orphaned variations', 'woocommerce' ), - 'desc' => __( 'This tool will delete all variations which have no parent.', 'woocommerce' ), + 'name' => __( 'Orphaned variations', 'woocommerce-rest-api' ), + 'button' => __( 'Delete orphaned variations', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will delete all variations which have no parent.', 'woocommerce-rest-api' ), ), 'clear_expired_download_permissions' => array( - 'name' => __( 'Used-up download permissions', 'woocommerce' ), - 'button' => __( 'Clean up download permissions', 'woocommerce' ), - 'desc' => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce' ), + 'name' => __( 'Used-up download permissions', 'woocommerce-rest-api' ), + 'button' => __( 'Clean up download permissions', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce-rest-api' ), ), 'regenerate_product_lookup_tables' => array( - 'name' => __( 'Product lookup tables', 'woocommerce' ), - 'button' => __( 'Regenerate', 'woocommerce' ), - 'desc' => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce' ), + 'name' => __( 'Product lookup tables', 'woocommerce-rest-api' ), + 'button' => __( 'Regenerate', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce-rest-api' ), ), 'recount_terms' => array( - 'name' => __( 'Term counts', 'woocommerce' ), - 'button' => __( 'Recount terms', 'woocommerce' ), - 'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce' ), + 'name' => __( 'Term counts', 'woocommerce-rest-api' ), + 'button' => __( 'Recount terms', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce-rest-api' ), ), 'reset_roles' => array( - 'name' => __( 'Capabilities', 'woocommerce' ), - 'button' => __( 'Reset capabilities', 'woocommerce' ), - 'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce' ), + 'name' => __( 'Capabilities', 'woocommerce-rest-api' ), + 'button' => __( 'Reset capabilities', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce-rest-api' ), ), 'clear_sessions' => array( - 'name' => __( 'Clear customer sessions', 'woocommerce' ), - 'button' => __( 'Clear', 'woocommerce' ), + 'name' => __( 'Clear customer sessions', 'woocommerce-rest-api' ), + 'button' => __( 'Clear', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce-rest-api' ) ), ), 'install_pages' => array( - 'name' => __( 'Create default WooCommerce pages', 'woocommerce' ), - 'button' => __( 'Create pages', 'woocommerce' ), + 'name' => __( 'Create default WooCommerce pages', 'woocommerce-rest-api' ), + 'button' => __( 'Create pages', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce-rest-api' ) ), ), 'delete_taxes' => array( - 'name' => __( 'Delete WooCommerce tax rates', 'woocommerce' ), - 'button' => __( 'Delete tax rates', 'woocommerce' ), + 'name' => __( 'Delete WooCommerce tax rates', 'woocommerce-rest-api' ), + 'button' => __( 'Delete tax rates', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This option will delete ALL of your tax rates, use with caution. This action cannot be reversed.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This option will delete ALL of your tax rates, use with caution. This action cannot be reversed.', 'woocommerce-rest-api' ) ), ), 'regenerate_thumbnails' => array( - 'name' => __( 'Regenerate shop thumbnails', 'woocommerce' ), - 'button' => __( 'Regenerate', 'woocommerce' ), - 'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce' ), + 'name' => __( 'Regenerate shop thumbnails', 'woocommerce-rest-api' ), + 'button' => __( 'Regenerate', 'woocommerce-rest-api' ), + 'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce-rest-api' ), ), 'db_update_routine' => array( - 'name' => __( 'Update database', 'woocommerce' ), - 'button' => __( 'Update database', 'woocommerce' ), + 'name' => __( 'Update database', 'woocommerce-rest-api' ), + 'button' => __( 'Update database', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce-rest-api' ) ), ), ); @@ -244,7 +244,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { public function get_item( $request ) { $tools = $this->get_tools(); if ( empty( $tools[ $request['id'] ] ) ) { - return new WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tool = $tools[ $request['id'] ]; return rest_ensure_response( @@ -269,7 +269,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { public function update_item( $request ) { $tools = $this->get_tools(); if ( empty( $tools[ $request['id'] ] ) ) { - return new WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tool = $tools[ $request['id'] ]; @@ -327,7 +327,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the tool.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the tool.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -335,7 +335,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ), ), 'name' => array( - 'description' => __( 'Tool name.', 'woocommerce' ), + 'description' => __( 'Tool name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -343,7 +343,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ), ), 'action' => array( - 'description' => __( 'What running the tool will do.', 'woocommerce' ), + 'description' => __( 'What running the tool will do.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -351,7 +351,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ), ), 'description' => array( - 'description' => __( 'Tool description.', 'woocommerce' ), + 'description' => __( 'Tool description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -359,12 +359,12 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ), ), 'success' => array( - 'description' => __( 'Did the tool run successfully?', 'woocommerce' ), + 'description' => __( 'Did the tool run successfully?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'edit' ), ), 'message' => array( - 'description' => __( 'Tool return message.', 'woocommerce' ), + 'description' => __( 'Tool return message.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( @@ -430,12 +430,12 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { } WC_Cache_Helper::get_transient_version( 'shipping', true ); - $message = __( 'Product transients cleared', 'woocommerce' ); + $message = __( 'Product transients cleared', 'woocommerce-rest-api' ); break; case 'clear_expired_transients': /* translators: %d: amount of expired transients */ - $message = sprintf( __( '%d transients rows cleared', 'woocommerce' ), wc_delete_expired_transients() ); + $message = sprintf( __( '%d transients rows cleared', 'woocommerce-rest-api' ), wc_delete_expired_transients() ); break; case 'delete_orphaned_variations': @@ -449,7 +449,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ) ); /* translators: %d: amount of orphaned variations */ - $message = sprintf( __( '%d orphaned variations deleted', 'woocommerce' ), $result ); + $message = sprintf( __( '%d orphaned variations deleted', 'woocommerce-rest-api' ), $result ); break; case 'clear_expired_download_permissions': @@ -464,20 +464,20 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ) ); /* translators: %d: amount of permissions */ - $message = sprintf( __( '%d permissions deleted', 'woocommerce' ), $result ); + $message = sprintf( __( '%d permissions deleted', 'woocommerce-rest-api' ), $result ); break; case 'regenerate_product_lookup_tables': if ( ! wc_update_product_lookup_tables_is_running() ) { wc_update_product_lookup_tables(); } - $message = __( 'Lookup tables are regenerating', 'woocommerce' ); + $message = __( 'Lookup tables are regenerating', 'woocommerce-rest-api' ); break; case 'reset_roles': // Remove then re-add caps and roles. WC_Install::remove_roles(); WC_Install::create_roles(); - $message = __( 'Roles successfully reset', 'woocommerce' ); + $message = __( 'Roles successfully reset', 'woocommerce-rest-api' ); break; case 'recount_terms': @@ -497,7 +497,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { ) ); _wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), true, false ); - $message = __( 'Terms successfully recounted', 'woocommerce' ); + $message = __( 'Terms successfully recounted', 'woocommerce-rest-api' ); break; case 'clear_sessions': @@ -505,24 +505,24 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { $result = absint( $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key='_woocommerce_persistent_cart_" . get_current_blog_id() . "';" ) ); // WPCS: unprepared SQL ok. wp_cache_flush(); /* translators: %d: amount of sessions */ - $message = sprintf( __( 'Deleted all active sessions, and %d saved carts.', 'woocommerce' ), absint( $result ) ); + $message = sprintf( __( 'Deleted all active sessions, and %d saved carts.', 'woocommerce-rest-api' ), absint( $result ) ); break; case 'install_pages': WC_Install::create_pages(); - $message = __( 'All missing WooCommerce pages successfully installed', 'woocommerce' ); + $message = __( 'All missing WooCommerce pages successfully installed', 'woocommerce-rest-api' ); break; case 'delete_taxes': $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rates;" ); $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rate_locations;" ); WC_Cache_Helper::incr_cache_prefix( 'taxes' ); - $message = __( 'Tax rates successfully deleted', 'woocommerce' ); + $message = __( 'Tax rates successfully deleted', 'woocommerce-rest-api' ); break; case 'regenerate_thumbnails': WC_Regenerate_Images::queue_image_regeneration(); - $message = __( 'Thumbnail regeneration has been scheduled to run in the background.', 'woocommerce' ); + $message = __( 'Thumbnail regeneration has been scheduled to run in the background.', 'woocommerce-rest-api' ); break; case 'db_update_routine': @@ -530,7 +530,7 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { // Used to fire an action added in WP_Background_Process::_construct() that calls WP_Background_Process::handle_cron_healthcheck(). // This method will make sure the database updates are executed even if cron is disabled. Nothing will happen if the updates are already running. do_action( 'wp_' . $blog_id . '_wc_updater_cron' ); - $message = __( 'Database upgrade routine has been scheduled to run in the background.', 'woocommerce' ); + $message = __( 'Database upgrade routine has been scheduled to run in the background.', 'woocommerce-rest-api' ); break; default: @@ -544,13 +544,13 @@ class WC_REST_System_Status_Tools_V2_Controller extends WC_REST_Controller { $callback_string = is_array( $callback ) ? get_class( $callback[0] ) . '::' . $callback[1] : $callback; $ran = false; /* translators: %s: callback string */ - $message = sprintf( __( 'There was an error calling %s', 'woocommerce' ), $callback_string ); + $message = sprintf( __( 'There was an error calling %s', 'woocommerce-rest-api' ), $callback_string ); } else { - $message = __( 'Tool ran.', 'woocommerce' ); + $message = __( 'Tool ran.', 'woocommerce-rest-api' ); } } else { $ran = false; - $message = __( 'There was an error calling this tool. There is no callback present.', 'woocommerce' ); + $message = __( 'There was an error calling this tool. There is no callback present.', 'woocommerce-rest-api' ); } break; } diff --git a/src/Controllers/Version2/class-wc-rest-system-status-v2-controller.php b/src/Controllers/Version2/class-wc-rest-system-status-v2-controller.php index 9b4fcec7b38..0f97047dcb0 100644 --- a/src/Controllers/Version2/class-wc-rest-system-status-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-system-status-v2-controller.php @@ -59,7 +59,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -102,195 +102,195 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'environment' => array( - 'description' => __( 'Environment.', 'woocommerce' ), + 'description' => __( 'Environment.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'home_url' => array( - 'description' => __( 'Home URL.', 'woocommerce' ), + 'description' => __( 'Home URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'site_url' => array( - 'description' => __( 'Site URL.', 'woocommerce' ), + 'description' => __( 'Site URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'wc_version' => array( - 'description' => __( 'WooCommerce version.', 'woocommerce' ), + 'description' => __( 'WooCommerce version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'log_directory' => array( - 'description' => __( 'Log directory.', 'woocommerce' ), + 'description' => __( 'Log directory.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'log_directory_writable' => array( - 'description' => __( 'Is log directory writable?', 'woocommerce' ), + 'description' => __( 'Is log directory writable?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_version' => array( - 'description' => __( 'WordPress version.', 'woocommerce' ), + 'description' => __( 'WordPress version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_multisite' => array( - 'description' => __( 'Is WordPress multisite?', 'woocommerce' ), + 'description' => __( 'Is WordPress multisite?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_memory_limit' => array( - 'description' => __( 'WordPress memory limit.', 'woocommerce' ), + 'description' => __( 'WordPress memory limit.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_debug_mode' => array( - 'description' => __( 'Is WordPress debug mode active?', 'woocommerce' ), + 'description' => __( 'Is WordPress debug mode active?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_cron' => array( - 'description' => __( 'Are WordPress cron jobs enabled?', 'woocommerce' ), + 'description' => __( 'Are WordPress cron jobs enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'language' => array( - 'description' => __( 'WordPress language.', 'woocommerce' ), + 'description' => __( 'WordPress language.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'server_info' => array( - 'description' => __( 'Server info.', 'woocommerce' ), + 'description' => __( 'Server info.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'php_version' => array( - 'description' => __( 'PHP version.', 'woocommerce' ), + 'description' => __( 'PHP version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'php_post_max_size' => array( - 'description' => __( 'PHP post max size.', 'woocommerce' ), + 'description' => __( 'PHP post max size.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'php_max_execution_time' => array( - 'description' => __( 'PHP max execution time.', 'woocommerce' ), + 'description' => __( 'PHP max execution time.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'php_max_input_vars' => array( - 'description' => __( 'PHP max input vars.', 'woocommerce' ), + 'description' => __( 'PHP max input vars.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'curl_version' => array( - 'description' => __( 'cURL version.', 'woocommerce' ), + 'description' => __( 'cURL version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'suhosin_installed' => array( - 'description' => __( 'Is SUHOSIN installed?', 'woocommerce' ), + 'description' => __( 'Is SUHOSIN installed?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'max_upload_size' => array( - 'description' => __( 'Max upload size.', 'woocommerce' ), + 'description' => __( 'Max upload size.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'mysql_version' => array( - 'description' => __( 'MySQL version.', 'woocommerce' ), + 'description' => __( 'MySQL version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'mysql_version_string' => array( - 'description' => __( 'MySQL version string.', 'woocommerce' ), + 'description' => __( 'MySQL version string.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'default_timezone' => array( - 'description' => __( 'Default timezone.', 'woocommerce' ), + 'description' => __( 'Default timezone.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'fsockopen_or_curl_enabled' => array( - 'description' => __( 'Is fsockopen/cURL enabled?', 'woocommerce' ), + 'description' => __( 'Is fsockopen/cURL enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'soapclient_enabled' => array( - 'description' => __( 'Is SoapClient class enabled?', 'woocommerce' ), + 'description' => __( 'Is SoapClient class enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'domdocument_enabled' => array( - 'description' => __( 'Is DomDocument class enabled?', 'woocommerce' ), + 'description' => __( 'Is DomDocument class enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'gzip_enabled' => array( - 'description' => __( 'Is GZip enabled?', 'woocommerce' ), + 'description' => __( 'Is GZip enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'mbstring_enabled' => array( - 'description' => __( 'Is mbstring enabled?', 'woocommerce' ), + 'description' => __( 'Is mbstring enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_post_successful' => array( - 'description' => __( 'Remote POST successful?', 'woocommerce' ), + 'description' => __( 'Remote POST successful?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_post_response' => array( - 'description' => __( 'Remote POST response.', 'woocommerce' ), + 'description' => __( 'Remote POST response.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_get_successful' => array( - 'description' => __( 'Remote GET successful?', 'woocommerce' ), + 'description' => __( 'Remote GET successful?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_get_response' => array( - 'description' => __( 'Remote GET response.', 'woocommerce' ), + 'description' => __( 'Remote GET response.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, @@ -298,31 +298,31 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'database' => array( - 'description' => __( 'Database.', 'woocommerce' ), + 'description' => __( 'Database.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'wc_database_version' => array( - 'description' => __( 'WC database version.', 'woocommerce' ), + 'description' => __( 'WC database version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'database_prefix' => array( - 'description' => __( 'Database prefix.', 'woocommerce' ), + 'description' => __( 'Database prefix.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'maxmind_geoip_database' => array( - 'description' => __( 'MaxMind GeoIP database.', 'woocommerce' ), + 'description' => __( 'MaxMind GeoIP database.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'database_tables' => array( - 'description' => __( 'Database tables.', 'woocommerce' ), + 'description' => __( 'Database tables.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -333,7 +333,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'active_plugins' => array( - 'description' => __( 'Active plugins.', 'woocommerce' ), + 'description' => __( 'Active plugins.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -342,7 +342,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'inactive_plugins' => array( - 'description' => __( 'Inactive plugins.', 'woocommerce' ), + 'description' => __( 'Inactive plugins.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -351,7 +351,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'dropins_mu_plugins' => array( - 'description' => __( 'Dropins & MU plugins.', 'woocommerce' ), + 'description' => __( 'Dropins & MU plugins.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -360,62 +360,62 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'theme' => array( - 'description' => __( 'Theme.', 'woocommerce' ), + 'description' => __( 'Theme.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'name' => array( - 'description' => __( 'Theme name.', 'woocommerce' ), + 'description' => __( 'Theme name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'version' => array( - 'description' => __( 'Theme version.', 'woocommerce' ), + 'description' => __( 'Theme version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'version_latest' => array( - 'description' => __( 'Latest version of theme.', 'woocommerce' ), + 'description' => __( 'Latest version of theme.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'author_url' => array( - 'description' => __( 'Theme author URL.', 'woocommerce' ), + 'description' => __( 'Theme author URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'is_child_theme' => array( - 'description' => __( 'Is this theme a child theme?', 'woocommerce' ), + 'description' => __( 'Is this theme a child theme?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'has_woocommerce_support' => array( - 'description' => __( 'Does the theme declare WooCommerce support?', 'woocommerce' ), + 'description' => __( 'Does the theme declare WooCommerce support?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'has_woocommerce_file' => array( - 'description' => __( 'Does the theme have a woocommerce.php file?', 'woocommerce' ), + 'description' => __( 'Does the theme have a woocommerce.php file?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'has_outdated_templates' => array( - 'description' => __( 'Does this theme have outdated templates?', 'woocommerce' ), + 'description' => __( 'Does this theme have outdated templates?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'overrides' => array( - 'description' => __( 'Template overrides.', 'woocommerce' ), + 'description' => __( 'Template overrides.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -424,19 +424,19 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'parent_name' => array( - 'description' => __( 'Parent theme name.', 'woocommerce' ), + 'description' => __( 'Parent theme name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'parent_version' => array( - 'description' => __( 'Parent theme version.', 'woocommerce' ), + 'description' => __( 'Parent theme version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'parent_author_url' => array( - 'description' => __( 'Parent theme author URL.', 'woocommerce' ), + 'description' => __( 'Parent theme author URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), @@ -445,67 +445,67 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'settings' => array( - 'description' => __( 'Settings.', 'woocommerce' ), + 'description' => __( 'Settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'api_enabled' => array( - 'description' => __( 'REST API enabled?', 'woocommerce' ), + 'description' => __( 'REST API enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'force_ssl' => array( - 'description' => __( 'SSL forced?', 'woocommerce' ), + 'description' => __( 'SSL forced?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'currency' => array( - 'description' => __( 'Currency.', 'woocommerce' ), + 'description' => __( 'Currency.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'currency_symbol' => array( - 'description' => __( 'Currency symbol.', 'woocommerce' ), + 'description' => __( 'Currency symbol.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'currency_position' => array( - 'description' => __( 'Currency position.', 'woocommerce' ), + 'description' => __( 'Currency position.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'thousand_separator' => array( - 'description' => __( 'Thousand separator.', 'woocommerce' ), + 'description' => __( 'Thousand separator.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'decimal_separator' => array( - 'description' => __( 'Decimal separator.', 'woocommerce' ), + 'description' => __( 'Decimal separator.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'number_of_decimals' => array( - 'description' => __( 'Number of decimals.', 'woocommerce' ), + 'description' => __( 'Number of decimals.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'geolocation_enabled' => array( - 'description' => __( 'Geolocation enabled?', 'woocommerce' ), + 'description' => __( 'Geolocation enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'taxonomies' => array( - 'description' => __( 'Taxonomy terms for product/order statuses.', 'woocommerce' ), + 'description' => __( 'Taxonomy terms for product/order statuses.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -514,7 +514,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'product_visibility_terms' => array( - 'description' => __( 'Terms in the product visibility taxonomy.', 'woocommerce' ), + 'description' => __( 'Terms in the product visibility taxonomy.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -525,19 +525,19 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'security' => array( - 'description' => __( 'Security.', 'woocommerce' ), + 'description' => __( 'Security.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'secure_connection' => array( - 'description' => __( 'Is the connection to your store secure?', 'woocommerce' ), + 'description' => __( 'Is the connection to your store secure?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'hide_errors' => array( - 'description' => __( 'Hide errors from visitors?', 'woocommerce' ), + 'description' => __( 'Hide errors from visitors?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, @@ -545,7 +545,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { ), ), 'pages' => array( - 'description' => __( 'WooCommerce pages.', 'woocommerce' ), + 'description' => __( 'WooCommerce pages.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -593,7 +593,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { $curl_version = curl_version(); $curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version']; } elseif ( extension_loaded( 'curl' ) ) { - $curl_version = __( 'cURL installed but unable to retrieve version.', 'woocommerce' ); + $curl_version = __( 'cURL installed but unable to retrieve version.', 'woocommerce-rest-api' ); } // WP memory limit. @@ -744,7 +744,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { * To ensure we include all WC tables, even if they do not exist, pre-populate the WC array with all the tables. */ $tables = array( - 'woocommerce' => array_fill_keys( $core_tables, false ), + 'woocommerce-rest-api' => array_fill_keys( $core_tables, false ), 'other' => array(), ); @@ -760,7 +760,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) && ! in_array( $table->name, $global_tables, true ) ) { continue; } - $table_type = in_array( $table->name, $core_tables ) ? 'woocommerce' : 'other'; + $table_type = in_array( $table->name, $core_tables ) ? 'woocommerce-rest-api' : 'other'; $tables[ $table_type ][ $table->name ] = array( 'data' => $table->data, @@ -1001,7 +1001,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { 'version_latest' => WC_Admin_Status::get_latest_theme_version( $active_theme ), 'author_url' => esc_url_raw( $active_theme->{'Author URI'} ), 'is_child_theme' => is_child_theme(), - 'has_woocommerce_support' => current_theme_supports( 'woocommerce' ), + 'has_woocommerce_support' => current_theme_supports( 'woocommerce-rest-api' ), 'has_woocommerce_file' => ( file_exists( get_stylesheet_directory() . '/woocommerce.php' ) || file_exists( get_template_directory() . '/woocommerce.php' ) ), 'has_outdated_templates' => $outdated_templates, 'overrides' => $override_files, @@ -1077,23 +1077,23 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller { public function get_pages() { // WC pages to check against. $check_pages = array( - _x( 'Shop base', 'Page setting', 'woocommerce' ) => array( + _x( 'Shop base', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_shop_page_id', 'shortcode' => '', ), - _x( 'Cart', 'Page setting', 'woocommerce' ) => array( + _x( 'Cart', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_cart_page_id', 'shortcode' => '[' . apply_filters( 'woocommerce_cart_shortcode_tag', 'woocommerce_cart' ) . ']', ), - _x( 'Checkout', 'Page setting', 'woocommerce' ) => array( + _x( 'Checkout', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_checkout_page_id', 'shortcode' => '[' . apply_filters( 'woocommerce_checkout_shortcode_tag', 'woocommerce_checkout' ) . ']', ), - _x( 'My account', 'Page setting', 'woocommerce' ) => array( + _x( 'My account', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_myaccount_page_id', 'shortcode' => '[' . apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) . ']', ), - _x( 'Terms and conditions', 'Page setting', 'woocommerce' ) => array( + _x( 'Terms and conditions', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_terms_page_id', 'shortcode' => '', ), diff --git a/src/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php b/src/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php index 778a805d1e2..30639073e92 100644 --- a/src/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php @@ -67,32 +67,32 @@ class WC_REST_Webhook_Deliveries_V2_Controller extends WC_REST_Webhook_Deliverie 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'duration' => array( - 'description' => __( 'The delivery duration, in seconds.', 'woocommerce' ), + 'description' => __( 'The delivery duration, in seconds.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'summary' => array( - 'description' => __( 'A friendly summary of the response including the HTTP response code, message, and body.', 'woocommerce' ), + 'description' => __( 'A friendly summary of the response including the HTTP response code, message, and body.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'request_url' => array( - 'description' => __( 'The URL where the webhook was delivered.', 'woocommerce' ), + 'description' => __( 'The URL where the webhook was delivered.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'request_headers' => array( - 'description' => __( 'Request headers.', 'woocommerce' ), + 'description' => __( 'Request headers.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -101,25 +101,25 @@ class WC_REST_Webhook_Deliveries_V2_Controller extends WC_REST_Webhook_Deliverie ), ), 'request_body' => array( - 'description' => __( 'Request body.', 'woocommerce' ), + 'description' => __( 'Request body.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'response_code' => array( - 'description' => __( 'The HTTP response code from the receiving server.', 'woocommerce' ), + 'description' => __( 'The HTTP response code from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'response_message' => array( - 'description' => __( 'The HTTP response message from the receiving server.', 'woocommerce' ), + 'description' => __( 'The HTTP response message from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'response_headers' => array( - 'description' => __( 'Array of the response headers from the receiving server.', 'woocommerce' ), + 'description' => __( 'Array of the response headers from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -128,19 +128,19 @@ class WC_REST_Webhook_Deliveries_V2_Controller extends WC_REST_Webhook_Deliverie ), ), 'response_body' => array( - 'description' => __( 'The response body from the receiving server.', 'woocommerce' ), + 'description' => __( 'The response body from the receiving server.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the webhook delivery was logged, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook delivery was logged, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the webhook delivery was logged, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the webhook delivery was logged, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php b/src/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php index ede2c1d121a..d30967f2392 100644 --- a/src/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php +++ b/src/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php @@ -36,7 +36,7 @@ class WC_REST_Webhooks_V2_Controller extends WC_REST_Webhooks_V1_Controller { $webhook = wc_get_webhook( $id ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $data = array( @@ -95,42 +95,42 @@ class WC_REST_Webhooks_V2_Controller extends WC_REST_Webhooks_V1_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'A friendly name for the webhook.', 'woocommerce' ), + 'description' => __( 'A friendly name for the webhook.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Webhook status.', 'woocommerce' ), + 'description' => __( 'Webhook status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'active', 'enum' => array_keys( wc_get_webhook_statuses() ), 'context' => array( 'view', 'edit' ), ), 'topic' => array( - 'description' => __( 'Webhook topic.', 'woocommerce' ), + 'description' => __( 'Webhook topic.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'resource' => array( - 'description' => __( 'Webhook resource.', 'woocommerce' ), + 'description' => __( 'Webhook resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'event' => array( - 'description' => __( 'Webhook event.', 'woocommerce' ), + 'description' => __( 'Webhook event.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'hooks' => array( - 'description' => __( 'WooCommerce action names associated with the webhook.', 'woocommerce' ), + 'description' => __( 'WooCommerce action names associated with the webhook.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -139,37 +139,37 @@ class WC_REST_Webhooks_V2_Controller extends WC_REST_Webhooks_V1_Controller { ), ), 'delivery_url' => array( - 'description' => __( 'The URL where the webhook payload is delivered.', 'woocommerce' ), + 'description' => __( 'The URL where the webhook payload is delivered.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'secret' => array( - 'description' => __( "Secret key used to generate a hash of the delivered webhook and provided in the request headers. This will default to a MD5 hash from the current user's ID|username if not provided.", 'woocommerce' ), + 'description' => __( "Secret key used to generate a hash of the delivered webhook and provided in the request headers. This will default to a MD5 hash from the current user's ID|username if not provided.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the webhook was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the webhook was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the webhook was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the webhook was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the webhook was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the webhook was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-controller.php b/src/Controllers/Version3/class-wc-rest-controller.php index 0c7278ab2cd..4fa75d21259 100644 --- a/src/Controllers/Version3/class-wc-rest-controller.php +++ b/src/Controllers/Version3/class-wc-rest-controller.php @@ -110,7 +110,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { if ( $total > $limit ) { /* translators: %s: items limit */ - return new WP_Error( 'woocommerce_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), array( 'status' => 413 ) ); + return new WP_Error( 'woocommerce_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce-rest-api' ), $limit ), array( 'status' => 413 ) ); } return true; @@ -254,7 +254,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { if ( array_key_exists( $value, $setting['options'] ) ) { return $value; } else { - return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -272,7 +272,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { } if ( ! is_array( $values ) ) { - return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $final_values = array(); @@ -295,7 +295,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { */ public function validate_setting_image_width_field( $values, $setting ) { if ( ! is_array( $values ) ) { - return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $current = $setting['value']; @@ -338,7 +338,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { $value = isset( $setting['default'] ) ? $setting['default'] : 'no'; return $value; } else { - return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -398,7 +398,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { 'type' => 'object', 'properties' => array( 'create' => array( - 'description' => __( 'List of created resources.', 'woocommerce' ), + 'description' => __( 'List of created resources.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -406,7 +406,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { ), ), 'update' => array( - 'description' => __( 'List of updated resources.', 'woocommerce' ), + 'description' => __( 'List of updated resources.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -414,7 +414,7 @@ abstract class WC_REST_Controller extends WP_REST_Controller { ), ), 'delete' => array( - 'description' => __( 'List of delete resources.', 'woocommerce' ), + 'description' => __( 'List of delete resources.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( diff --git a/src/Controllers/Version3/class-wc-rest-crud-controller.php b/src/Controllers/Version3/class-wc-rest-crud-controller.php index 5733ddbb37d..1c66e9bbd20 100644 --- a/src/Controllers/Version3/class-wc-rest-crud-controller.php +++ b/src/Controllers/Version3/class-wc-rest-crud-controller.php @@ -40,7 +40,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { */ protected function get_object( $id ) { // translators: %s: Class method name. - return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) ); + return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce-rest-api' ), __METHOD__ ), array( 'status' => 405 ) ); } /** @@ -53,7 +53,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $object = $this->get_object( (int) $request['id'] ); if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'read', $object->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -69,7 +69,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $object = $this->get_object( (int) $request['id'] ); if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'edit', $object->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -85,7 +85,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $object = $this->get_object( (int) $request['id'] ); if ( $object && 0 !== $object->get_id() && ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -111,7 +111,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { */ protected function prepare_object_for_response( $object, $request ) { // translators: %s: Class method name. - return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) ); + return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce-rest-api' ), __METHOD__ ), array( 'status' => 405 ) ); } /** @@ -124,7 +124,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { */ protected function prepare_object_for_database( $request, $creating = false ) { // translators: %s: Class method name. - return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) ); + return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce-rest-api' ), __METHOD__ ), array( 'status' => 405 ) ); } /** @@ -137,7 +137,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $object = $this->get_object( (int) $request['id'] ); if ( ! $object || 0 === $object->get_id() ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $data = $this->prepare_object_for_response( $object, $request ); @@ -185,7 +185,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $object = $this->save_object( $request, true ); @@ -232,7 +232,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $object = $this->get_object( (int) $request['id'] ); if ( ! $object || 0 === $object->get_id() ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $object = $this->save_object( $request, false ); @@ -415,7 +415,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $result = false; if ( ! $object || 0 === $object->get_id() ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $supports_trash = EMPTY_TRASH_DAYS > 0 && is_callable( array( $object, 'get_status' ) ); @@ -432,7 +432,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $object->get_id() ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); } $request->set_param( 'context', 'edit' ); @@ -446,14 +446,14 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { // If we don't support trashing for this type, error out. if ( ! $supports_trash ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501 ) ); } // Otherwise, only trash if we haven't already. if ( is_callable( array( $object, 'get_status' ) ) ) { if ( 'trash' === $object->get_status() ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 410 ) ); + return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410 ) ); } $object->delete(); @@ -463,7 +463,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { if ( ! $result ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500 ) ); } /** @@ -509,7 +509,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { $params['context']['default'] = 'view'; $params['page'] = array( - 'description' => __( 'Current page of the collection.', 'woocommerce' ), + 'description' => __( 'Current page of the collection.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint', @@ -517,7 +517,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { 'minimum' => 1, ); $params['per_page'] = array( - 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ), + 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 10, 'minimum' => 1, @@ -526,25 +526,25 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { 'validate_callback' => 'rest_validate_request_arg', ); $params['search'] = array( - 'description' => __( 'Limit results to those matching a string.', 'woocommerce' ), + 'description' => __( 'Limit results to those matching a string.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -553,7 +553,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -562,20 +562,20 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( 'asc', 'desc' ), 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date', 'enum' => array( @@ -590,7 +590,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { if ( $this->hierarchical ) { $params['parent'] = array( - 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -599,7 +599,7 @@ abstract class WC_REST_CRUD_Controller extends WC_REST_Posts_Controller { 'default' => array(), ); $params['parent_exclude'] = array( - 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', diff --git a/src/Controllers/Version3/class-wc-rest-customers-controller.php b/src/Controllers/Version3/class-wc-rest-customers-controller.php index b577fe89792..65ce592cd55 100644 --- a/src/Controllers/Version3/class-wc-rest-customers-controller.php +++ b/src/Controllers/Version3/class-wc-rest-customers-controller.php @@ -76,43 +76,43 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the customer was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'email' => array( - 'description' => __( 'The email address for the customer.', 'woocommerce' ), + 'description' => __( 'The email address for the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'first_name' => array( - 'description' => __( 'Customer first name.', 'woocommerce' ), + 'description' => __( 'Customer first name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -120,7 +120,7 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller { ), ), 'last_name' => array( - 'description' => __( 'Customer last name.', 'woocommerce' ), + 'description' => __( 'Customer last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -128,13 +128,13 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller { ), ), 'role' => array( - 'description' => __( 'Customer role.', 'woocommerce' ), + 'description' => __( 'Customer role.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'username' => array( - 'description' => __( 'Customer login name.', 'woocommerce' ), + 'description' => __( 'Customer login name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -142,157 +142,157 @@ class WC_REST_Customers_Controller extends WC_REST_Customers_V2_Controller { ), ), 'password' => array( - 'description' => __( 'Customer password.', 'woocommerce' ), + 'description' => __( 'Customer password.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'billing' => array( - 'description' => __( 'List of billing address data.', 'woocommerce' ), + 'description' => __( 'List of billing address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'List of shipping address data.', 'woocommerce' ), + 'description' => __( 'List of shipping address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'is_paying_customer' => array( - 'description' => __( 'Is the customer a paying customer?', 'woocommerce' ), + 'description' => __( 'Is the customer a paying customer?', 'woocommerce-rest-api' ), 'type' => 'bool', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'avatar_url' => array( - 'description' => __( 'Avatar URL.', 'woocommerce' ), + 'description' => __( 'Avatar URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version3/class-wc-rest-data-continents-controller.php b/src/Controllers/Version3/class-wc-rest-data-continents-controller.php index 37d3a55630d..7b79f969397 100644 --- a/src/Controllers/Version3/class-wc-rest-data-continents-controller.php +++ b/src/Controllers/Version3/class-wc-rest-data-continents-controller.php @@ -56,7 +56,7 @@ class WC_REST_Data_Continents_Controller extends WC_REST_Data_Controller { 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => array( 'continent' => array( - 'description' => __( '2 character continent code.', 'woocommerce' ), + 'description' => __( '2 character continent code.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -182,7 +182,7 @@ class WC_REST_Data_Continents_Controller extends WC_REST_Data_Controller { public function get_item( $request ) { $data = $this->get_continent( strtoupper( $request['location'] ), $request ); if ( empty( $data ) ) { - return new WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $data, $request ); } @@ -247,19 +247,19 @@ class WC_REST_Data_Continents_Controller extends WC_REST_Data_Controller { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( '2 character continent code.', 'woocommerce' ), + 'description' => __( '2 character continent code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of continent.', 'woocommerce' ), + 'description' => __( 'Full name of continent.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'countries' => array( 'type' => 'array', - 'description' => __( 'List of countries on this continent.', 'woocommerce' ), + 'description' => __( 'List of countries on this continent.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, 'items' => array( @@ -269,49 +269,49 @@ class WC_REST_Data_Continents_Controller extends WC_REST_Data_Controller { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), + 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'currency_code' => array( 'type' => 'string', - 'description' => __( 'Default ISO4127 alpha-3 currency code for the country.', 'woocommerce' ), + 'description' => __( 'Default ISO4127 alpha-3 currency code for the country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'currency_pos' => array( 'type' => 'string', - 'description' => __( 'Currency symbol position for this country.', 'woocommerce' ), + 'description' => __( 'Currency symbol position for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'decimal_sep' => array( 'type' => 'string', - 'description' => __( 'Decimal separator for displayed prices for this country.', 'woocommerce' ), + 'description' => __( 'Decimal separator for displayed prices for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'dimension_unit' => array( 'type' => 'string', - 'description' => __( 'The unit lengths are defined in for this country.', 'woocommerce' ), + 'description' => __( 'The unit lengths are defined in for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of country.', 'woocommerce' ), + 'description' => __( 'Full name of country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'num_decimals' => array( 'type' => 'integer', - 'description' => __( 'Number of decimal points shown in displayed prices for this country.', 'woocommerce' ), + 'description' => __( 'Number of decimal points shown in displayed prices for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'states' => array( 'type' => 'array', - 'description' => __( 'List of states in this country.', 'woocommerce' ), + 'description' => __( 'List of states in this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, 'items' => array( @@ -321,13 +321,13 @@ class WC_REST_Data_Continents_Controller extends WC_REST_Data_Controller { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'State code.', 'woocommerce' ), + 'description' => __( 'State code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of state.', 'woocommerce' ), + 'description' => __( 'Full name of state.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), @@ -336,13 +336,13 @@ class WC_REST_Data_Continents_Controller extends WC_REST_Data_Controller { ), 'thousand_sep' => array( 'type' => 'string', - 'description' => __( 'Thousands separator for displayed prices in this country.', 'woocommerce' ), + 'description' => __( 'Thousands separator for displayed prices in this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'weight_unit' => array( 'type' => 'string', - 'description' => __( 'The unit weights are defined in for this country.', 'woocommerce' ), + 'description' => __( 'The unit weights are defined in for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version3/class-wc-rest-data-controller.php b/src/Controllers/Version3/class-wc-rest-data-controller.php index 67a69f025a5..e6b794a2ba7 100644 --- a/src/Controllers/Version3/class-wc-rest-data-controller.php +++ b/src/Controllers/Version3/class-wc-rest-data-controller.php @@ -58,7 +58,7 @@ class WC_REST_Data_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -72,7 +72,7 @@ class WC_REST_Data_Controller extends WC_REST_Controller { */ public function get_item_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -90,15 +90,15 @@ class WC_REST_Data_Controller extends WC_REST_Controller { $resources = array( array( 'slug' => 'continents', - 'description' => __( 'List of supported continents, countries, and states.', 'woocommerce' ), + 'description' => __( 'List of supported continents, countries, and states.', 'woocommerce-rest-api' ), ), array( 'slug' => 'countries', - 'description' => __( 'List of supported states in a given country.', 'woocommerce' ), + 'description' => __( 'List of supported states in a given country.', 'woocommerce-rest-api' ), ), array( 'slug' => 'currencies', - 'description' => __( 'List of supported currencies.', 'woocommerce' ), + 'description' => __( 'List of supported currencies.', 'woocommerce-rest-api' ), ), ); @@ -165,13 +165,13 @@ class WC_REST_Data_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'Data resource ID.', 'woocommerce' ), + 'description' => __( 'Data resource ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Data resource description.', 'woocommerce' ), + 'description' => __( 'Data resource description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-data-countries-controller.php b/src/Controllers/Version3/class-wc-rest-data-countries-controller.php index d8219a77439..aaed5e2f30d 100644 --- a/src/Controllers/Version3/class-wc-rest-data-countries-controller.php +++ b/src/Controllers/Version3/class-wc-rest-data-countries-controller.php @@ -56,7 +56,7 @@ class WC_REST_Data_Countries_Controller extends WC_REST_Data_Controller { 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => array( 'location' => array( - 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), + 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -130,7 +130,7 @@ class WC_REST_Data_Countries_Controller extends WC_REST_Data_Controller { public function get_item( $request ) { $data = $this->get_country( strtoupper( $request['location'] ), $request ); if ( empty( $data ) ) { - return new WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $data, $request ); } @@ -197,19 +197,19 @@ class WC_REST_Data_Countries_Controller extends WC_REST_Data_Controller { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), + 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of country.', 'woocommerce' ), + 'description' => __( 'Full name of country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'states' => array( 'type' => 'array', - 'description' => __( 'List of states in this country.', 'woocommerce' ), + 'description' => __( 'List of states in this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, 'items' => array( @@ -219,13 +219,13 @@ class WC_REST_Data_Countries_Controller extends WC_REST_Data_Controller { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'State code.', 'woocommerce' ), + 'description' => __( 'State code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of state.', 'woocommerce' ), + 'description' => __( 'Full name of state.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version3/class-wc-rest-data-currencies-controller.php b/src/Controllers/Version3/class-wc-rest-data-currencies-controller.php index 574d9d4c571..eb62a89f048 100644 --- a/src/Controllers/Version3/class-wc-rest-data-currencies-controller.php +++ b/src/Controllers/Version3/class-wc-rest-data-currencies-controller.php @@ -63,7 +63,7 @@ class WC_REST_Data_Currencies_Controller extends WC_REST_Data_Controller { 'permission_callback' => array( $this, 'get_item_permissions_check' ), 'args' => array( 'location' => array( - 'description' => __( 'ISO4217 currency code.', 'woocommerce' ), + 'description' => __( 'ISO4217 currency code.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -123,7 +123,7 @@ class WC_REST_Data_Currencies_Controller extends WC_REST_Data_Controller { public function get_item( $request ) { $data = $this->get_currency( strtoupper( $request['currency'] ), $request ); if ( empty( $data ) ) { - return new WP_Error( 'woocommerce_rest_data_invalid_currency', __( 'There are no currencies matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_data_invalid_currency', __( 'There are no currencies matching these parameters.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $data, $request ); } @@ -197,19 +197,19 @@ class WC_REST_Data_Currencies_Controller extends WC_REST_Data_Controller { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'ISO4217 currency code.', 'woocommerce' ), + 'description' => __( 'ISO4217 currency code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of currency.', 'woocommerce' ), + 'description' => __( 'Full name of currency.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'symbol' => array( 'type' => 'string', - 'description' => __( 'Currency symbol.', 'woocommerce' ), + 'description' => __( 'Currency symbol.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version3/class-wc-rest-order-notes-controller.php b/src/Controllers/Version3/class-wc-rest-order-notes-controller.php index 738961591e4..6015634664b 100644 --- a/src/Controllers/Version3/class-wc-rest-order-notes-controller.php +++ b/src/Controllers/Version3/class-wc-rest-order-notes-controller.php @@ -35,7 +35,7 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Order_Notes_V2_Controller { public function prepare_item_for_response( $note, $request ) { $data = array( 'id' => (int) $note->comment_ID, - 'author' => __( 'WooCommerce', 'woocommerce' ) === $note->comment_author ? 'system' : $note->comment_author, + 'author' => __( 'woocommerce-rest-api', 'woocommerce-rest-api' ) === $note->comment_author ? 'system' : $note->comment_author, 'date_created' => wc_rest_prepare_date_response( $note->comment_date ), 'date_created_gmt' => wc_rest_prepare_date_response( $note->comment_date_gmt ), 'note' => $note->comment_content, @@ -70,20 +70,20 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Order_Notes_V2_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Create the note. $note_id = $order->add_order_note( $request['note'], $request['customer_note'], $request['added_by_user'] ); if ( ! $note_id ) { - return new WP_Error( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $note = get_comment( $note_id ); @@ -119,42 +119,42 @@ class WC_REST_Order_Notes_Controller extends WC_REST_Order_Notes_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'author' => array( - 'description' => __( 'Order note author.', 'woocommerce' ), + 'description' => __( 'Order note author.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order note was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order note was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'note' => array( - 'description' => __( 'Order note content.', 'woocommerce' ), + 'description' => __( 'Order note content.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'customer_note' => array( - 'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce' ), + 'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'added_by_user' => array( - 'description' => __( 'If true, this note will be attributed to the current user. If false, the note will be attributed to the system.', 'woocommerce' ), + 'description' => __( 'If true, this note will be attributed to the current user. If false, the note will be attributed to the system.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'edit' ), diff --git a/src/Controllers/Version3/class-wc-rest-order-refunds-controller.php b/src/Controllers/Version3/class-wc-rest-order-refunds-controller.php index 98731f5756c..865634affe0 100644 --- a/src/Controllers/Version3/class-wc-rest-order-refunds-controller.php +++ b/src/Controllers/Version3/class-wc-rest-order-refunds-controller.php @@ -37,11 +37,11 @@ class WC_REST_Order_Refunds_Controller extends WC_REST_Order_Refunds_V2_Controll $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order ) { - return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 ); + return new WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), 404 ); } if ( 0 > $request['amount'] ) { - return new WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 ); + return new WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce-rest-api' ), 400 ); } // Create the refund. @@ -61,7 +61,7 @@ class WC_REST_Order_Refunds_Controller extends WC_REST_Order_Refunds_V2_Controll } if ( ! $refund ) { - return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 ); + return new WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce-rest-api' ), 500 ); } if ( ! empty( $request['meta_data'] ) && is_array( $request['meta_data'] ) ) { diff --git a/src/Controllers/Version3/class-wc-rest-orders-controller.php b/src/Controllers/Version3/class-wc-rest-orders-controller.php index 5e4ea622fc8..1d2ad09d5d7 100644 --- a/src/Controllers/Version3/class-wc-rest-orders-controller.php +++ b/src/Controllers/Version3/class-wc-rest-orders-controller.php @@ -47,7 +47,7 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller { if ( is_array( $item ) ) { if ( empty( $item['id'] ) ) { if ( empty( $item['code'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon', __( 'Coupon code is required.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon', __( 'Coupon code is required.', 'woocommerce-rest-api' ), 400 ); } $results = $order->apply_coupon( wc_clean( $item['code'] ) ); @@ -157,7 +157,7 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller { if ( ! is_null( $request['customer_id'] ) && 0 !== $request['customer_id'] ) { // Make sure customer exists. if ( false === get_user_by( 'id', $request['customer_id'] ) ) { - throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 ); + throw new WC_REST_Exception( 'woocommerce_rest_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce-rest-api' ), 400 ); } // Make sure customer is part of blog. @@ -257,7 +257,7 @@ class WC_REST_Orders_Controller extends WC_REST_Orders_V2_Controller { $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to orders which have specific statuses.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders which have specific statuses.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', diff --git a/src/Controllers/Version3/class-wc-rest-payment-gateways-controller.php b/src/Controllers/Version3/class-wc-rest-payment-gateways-controller.php index 5c0eb9c8ac9..f48b155f3dd 100644 --- a/src/Controllers/Version3/class-wc-rest-payment-gateways-controller.php +++ b/src/Controllers/Version3/class-wc-rest-payment-gateways-controller.php @@ -114,23 +114,23 @@ class WC_REST_Payment_Gateways_Controller extends WC_REST_Payment_Gateways_V2_Co 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Payment gateway ID.', 'woocommerce' ), + 'description' => __( 'Payment gateway ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Payment gateway title on checkout.', 'woocommerce' ), + 'description' => __( 'Payment gateway title on checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Payment gateway description on checkout.', 'woocommerce' ), + 'description' => __( 'Payment gateway description on checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'order' => array( - 'description' => __( 'Payment gateway sort order.', 'woocommerce' ), + 'description' => __( 'Payment gateway sort order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -138,24 +138,24 @@ class WC_REST_Payment_Gateways_Controller extends WC_REST_Payment_Gateways_V2_Co ), ), 'enabled' => array( - 'description' => __( 'Payment gateway enabled status.', 'woocommerce' ), + 'description' => __( 'Payment gateway enabled status.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ), 'method_title' => array( - 'description' => __( 'Payment gateway method title.', 'woocommerce' ), + 'description' => __( 'Payment gateway method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_description' => array( - 'description' => __( 'Payment gateway method description.', 'woocommerce' ), + 'description' => __( 'Payment gateway method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_supports' => array( - 'description' => __( 'Supported features for this payment gateway.', 'woocommerce' ), + 'description' => __( 'Supported features for this payment gateway.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -164,54 +164,54 @@ class WC_REST_Payment_Gateways_Controller extends WC_REST_Payment_Gateways_V2_Co ), ), 'settings' => array( - 'description' => __( 'Payment gateway settings.', 'woocommerce' ), + 'description' => __( 'Payment gateway settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-posts-controller.php b/src/Controllers/Version3/class-wc-rest-posts-controller.php index 078f5cee4dd..7c04b058923 100644 --- a/src/Controllers/Version3/class-wc-rest-posts-controller.php +++ b/src/Controllers/Version3/class-wc-rest-posts-controller.php @@ -54,7 +54,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( $this->post_type, 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -68,7 +68,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( $this->post_type, 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -84,7 +84,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $post = get_post( (int) $request['id'] ); if ( $post && ! wc_rest_check_post_permissions( $this->post_type, 'read', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -100,7 +100,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $post = get_post( (int) $request['id'] ); if ( $post && ! wc_rest_check_post_permissions( $this->post_type, 'edit', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -116,7 +116,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $post = get_post( (int) $request['id'] ); if ( $post && ! wc_rest_check_post_permissions( $this->post_type, 'delete', $post->ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -131,7 +131,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_post_permissions( $this->post_type, 'batch' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -148,9 +148,9 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $post = get_post( $id ); if ( ! empty( $post->post_type ) && 'product_variation' === $post->post_type && 'product' === $this->post_type ) { - return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } elseif ( empty( $id ) || empty( $post->ID ) || $post->post_type !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $post, $request ); @@ -172,7 +172,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $post = $this->prepare_item_for_database( $request ); @@ -255,9 +255,9 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $post = get_post( $id ); if ( ! empty( $post->post_type ) && 'product_variation' === $post->post_type && 'product' === $this->post_type ) { - return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } elseif ( empty( $id ) || empty( $post->ID ) || $post->post_type !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $post = $this->prepare_item_for_database( $request ); @@ -418,7 +418,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $post = get_post( $id ); if ( empty( $id ) || empty( $post->ID ) || $post->post_type !== $this->post_type ) { - return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $supports_trash = EMPTY_TRASH_DAYS > 0; @@ -435,7 +435,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { if ( ! wc_rest_check_post_permissions( $this->post_type, 'delete', $post->ID ) ) { /* translators: %s: post type */ - return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); } $request->set_param( 'context', 'edit' ); @@ -448,13 +448,13 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { // If we don't support trashing for this type, error out. if ( ! $supports_trash ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501 ) ); } // Otherwise, only trash if we haven't already. if ( 'trash' === $post->post_status ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 410 ) ); + return new WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410 ) ); } // (Note that internally this falls through to `wp_delete_post` if @@ -464,7 +464,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { if ( ! $result ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500 ) ); } /** @@ -621,19 +621,19 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { $params['context']['default'] = 'view'; $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -642,7 +642,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -651,20 +651,20 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( 'asc', 'desc' ), 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date', 'enum' => array( @@ -681,7 +681,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { if ( isset( $post_type_obj->hierarchical ) && $post_type_obj->hierarchical ) { $params['parent'] = array( - 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -690,7 +690,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { 'default' => array(), ); $params['parent_exclude'] = array( - 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -703,7 +703,7 @@ abstract class WC_REST_Posts_Controller extends WC_REST_Controller { if ( 'wc/v1' === $this->namespace ) { $params['filter'] = array( 'type' => 'object', - 'description' => __( 'Use WP Query arguments to modify the response; private query vars require appropriate authorization.', 'woocommerce' ), + 'description' => __( 'Use WP Query arguments to modify the response; private query vars require appropriate authorization.', 'woocommerce-rest-api' ), ); } diff --git a/src/Controllers/Version3/class-wc-rest-product-categories-controller.php b/src/Controllers/Version3/class-wc-rest-product-categories-controller.php index c69f5640a99..63ced695fec 100644 --- a/src/Controllers/Version3/class-wc-rest-product-categories-controller.php +++ b/src/Controllers/Version3/class-wc-rest-product-categories-controller.php @@ -100,13 +100,13 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Product_Categories_V 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -114,7 +114,7 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Product_Categories_V ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -122,12 +122,12 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Product_Categories_V ), ), 'parent' => array( - 'description' => __( 'The ID for the parent of the resource.', 'woocommerce' ), + 'description' => __( 'The ID for the parent of the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -135,71 +135,71 @@ class WC_REST_Product_Categories_Controller extends WC_REST_Product_Categories_V ), ), 'display' => array( - 'description' => __( 'Category archive display type.', 'woocommerce' ), + 'description' => __( 'Category archive display type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'default', 'enum' => array( 'default', 'products', 'subcategories', 'both' ), 'context' => array( 'view', 'edit' ), ), 'image' => array( - 'description' => __( 'Image data.', 'woocommerce' ), + 'description' => __( 'Image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-product-reviews-controller.php b/src/Controllers/Version3/class-wc-rest-product-reviews-controller.php index 7b4a12d2c6e..aee1016454f 100644 --- a/src/Controllers/Version3/class-wc-rest-product-reviews-controller.php +++ b/src/Controllers/Version3/class-wc-rest-product-reviews-controller.php @@ -52,23 +52,23 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $this->get_endpoint_args_for_item_schema( WP_REST_Server::CREATABLE ), array( 'product_id' => array( 'required' => true, - 'description' => __( 'Unique identifier for the product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'review' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Review content.', 'woocommerce' ), + 'description' => __( 'Review content.', 'woocommerce-rest-api' ), ), 'reviewer' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Name of the reviewer.', 'woocommerce' ), + 'description' => __( 'Name of the reviewer.', 'woocommerce-rest-api' ), ), 'reviewer_email' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Email of the reviewer.', 'woocommerce' ), + 'description' => __( 'Email of the reviewer.', 'woocommerce-rest-api' ), ), ) ), @@ -81,7 +81,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $this->namespace, '/' . $this->rest_base . '/(?P[\d]+)', array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -107,7 +107,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -136,7 +136,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { */ public function get_items_permissions_check( $request ) { if ( ! wc_rest_check_product_reviews_permissions( 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -153,7 +153,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $review = get_comment( $id ); if ( $review && ! wc_rest_check_product_reviews_permissions( 'read', $review->comment_ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -167,7 +167,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { */ public function create_item_permissions_check( $request ) { if ( ! wc_rest_check_product_reviews_permissions( 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -184,7 +184,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $review = get_comment( $id ); if ( $review && ! wc_rest_check_product_reviews_permissions( 'edit', $review->comment_ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -201,7 +201,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $review = get_comment( $id ); if ( $review && ! wc_rest_check_product_reviews_permissions( 'delete', $review->comment_ID ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -215,7 +215,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { */ public function batch_items_permissions_check( $request ) { if ( ! wc_rest_check_product_reviews_permissions( 'create' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -371,13 +371,13 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { */ public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { - return new WP_Error( 'woocommerce_rest_review_exists', __( 'Cannot create existing product review.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_review_exists', __( 'Cannot create existing product review.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $product_id = (int) $request['product_id']; if ( 'product' !== get_post_type( $product_id ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $prepared_review = $this->prepare_item_for_database( $request ); @@ -391,7 +391,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { * Do not allow a comment to be created with missing or empty comment_content. See wp_handle_comment_submission(). */ if ( empty( $prepared_review['comment_content'] ) ) { - return new WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Setting remaining values before wp_insert_comment so we can use wp_allow_comment(). @@ -416,7 +416,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $check_comment_lengths = wp_check_comment_data_max_lengths( $prepared_review ); if ( is_wp_error( $check_comment_lengths ) ) { $error_code = str_replace( array( 'comment_author', 'comment_content' ), array( 'reviewer', 'review_content' ), $check_comment_lengths->get_error_code() ); - return new WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $prepared_review['comment_parent'] = 0; @@ -457,7 +457,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $review_id = wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_review ) ) ); if ( ! $review_id ) { - return new WP_Error( 'woocommerce_rest_review_failed_create', __( 'Creating product review failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_review_failed_create', __( 'Creating product review failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } if ( isset( $request['status'] ) ) { @@ -527,7 +527,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $id = (int) $review->comment_ID; if ( isset( $request['type'] ) && 'review' !== get_comment_type( $id ) ) { - return new WP_Error( 'woocommerce_rest_review_invalid_type', __( 'Sorry, you are not allowed to change the comment type.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_review_invalid_type', __( 'Sorry, you are not allowed to change the comment type.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $prepared_args = $this->prepare_item_for_database( $request ); @@ -537,7 +537,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { if ( ! empty( $prepared_args['comment_post_ID'] ) ) { if ( 'product' !== get_post_type( (int) $prepared_args['comment_post_ID'] ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } } @@ -546,7 +546,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $change = $this->handle_status_param( $request['status'], $id ); if ( ! $change ) { - return new WP_Error( 'woocommerce_rest_review_failed_edit', __( 'Updating review status failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_review_failed_edit', __( 'Updating review status failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } } elseif ( ! empty( $prepared_args ) ) { if ( is_wp_error( $prepared_args ) ) { @@ -554,7 +554,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { } if ( isset( $prepared_args['comment_content'] ) && empty( $prepared_args['comment_content'] ) ) { - return new WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $prepared_args['comment_ID'] = $id; @@ -562,13 +562,13 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $check_comment_lengths = wp_check_comment_data_max_lengths( $prepared_args ); if ( is_wp_error( $check_comment_lengths ) ) { $error_code = str_replace( array( 'comment_author', 'comment_content' ), array( 'reviewer', 'review_content' ), $check_comment_lengths->get_error_code() ); - return new WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $updated = wp_update_comment( wp_slash( (array) $prepared_args ) ); if ( false === $updated ) { - return new WP_Error( 'woocommerce_rest_comment_failed_edit', __( 'Updating review failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_comment_failed_edit', __( 'Updating review failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } if ( isset( $request['status'] ) ) { @@ -639,11 +639,11 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { // If this type doesn't support trashing, error out. if ( ! $supports_trash ) { /* translators: %s: force=true */ - return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( "The object does not support trashing. Set '%s' to delete.", 'woocommerce' ), 'force=true' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( "The object does not support trashing. Set '%s' to delete.", 'woocommerce-rest-api' ), 'force=true' ), array( 'status' => 501 ) ); } if ( 'trash' === $review->comment_approved ) { - return new WP_Error( 'woocommerce_rest_already_trashed', __( 'The object has already been trashed.', 'woocommerce' ), array( 'status' => 410 ) ); + return new WP_Error( 'woocommerce_rest_already_trashed', __( 'The object has already been trashed.', 'woocommerce-rest-api' ), array( 'status' => 410 ) ); } $result = wp_trash_comment( $review->comment_ID ); @@ -652,7 +652,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { } if ( ! $result ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The object cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The object cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -828,48 +828,48 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the review was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the review was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Unique identifier for the product that the review belongs to.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the product that the review belongs to.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Status of the review.', 'woocommerce' ), + 'description' => __( 'Status of the review.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'approved', 'enum' => array( 'approved', 'hold', 'spam', 'unspam', 'trash', 'untrash' ), 'context' => array( 'view', 'edit' ), ), 'reviewer' => array( - 'description' => __( 'Reviewer name.', 'woocommerce' ), + 'description' => __( 'Reviewer name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'reviewer_email' => array( - 'description' => __( 'Reviewer email.', 'woocommerce' ), + 'description' => __( 'Reviewer email.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'review' => array( - 'description' => __( 'The content of the review.', 'woocommerce' ), + 'description' => __( 'The content of the review.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -877,12 +877,12 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { ), ), 'rating' => array( - 'description' => __( 'Review rating (0 to 5).', 'woocommerce' ), + 'description' => __( 'Review rating (0 to 5).', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'verified' => array( - 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ), + 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -897,14 +897,14 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { foreach ( $avatar_sizes as $size ) { $avatar_properties[ $size ] = array( /* translators: %d: avatar image size in pixels */ - 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce' ), $size ), + 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce-rest-api' ), $size ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), ); } $schema['properties']['reviewer_avatar_urls'] = array( - 'description' => __( 'Avatar URLs for the object reviewer.', 'woocommerce' ), + 'description' => __( 'Avatar URLs for the object reviewer.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -926,17 +926,17 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $params['context']['default'] = 'view'; $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', ); $params['before'] = array( - 'description' => __( 'Limit response to reviews published before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to reviews published before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -944,7 +944,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { 'default' => array(), ); $params['include'] = array( - 'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -952,11 +952,11 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { 'default' => array(), ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( @@ -965,7 +965,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { ), ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date_gmt', 'enum' => array( @@ -977,14 +977,14 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { ), ); $params['reviewer'] = array( - 'description' => __( 'Limit result set to reviews assigned to specific user IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to reviews assigned to specific user IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), ); $params['reviewer_exclude'] = array( - 'description' => __( 'Ensure result set excludes reviews assigned to specific user IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes reviews assigned to specific user IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -992,13 +992,13 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { ); $params['reviewer_email'] = array( 'default' => null, - 'description' => __( 'Limit result set to that from a specific author email.', 'woocommerce' ), + 'description' => __( 'Limit result set to that from a specific author email.', 'woocommerce-rest-api' ), 'format' => 'email', 'type' => 'string', ); $params['product'] = array( 'default' => array(), - 'description' => __( 'Limit result set to reviews assigned to specific product IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to reviews assigned to specific product IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1006,7 +1006,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { ); $params['status'] = array( 'default' => 'approved', - 'description' => __( 'Limit result set to reviews assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to reviews assigned a specific status.', 'woocommerce-rest-api' ), 'sanitize_callback' => 'sanitize_key', 'type' => 'string', 'enum' => array( @@ -1040,7 +1040,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { */ protected function get_review( $id ) { $id = (int) $id; - $error = new WP_Error( 'woocommerce_rest_review_invalid_id', __( 'Invalid review ID.', 'woocommerce' ), array( 'status' => 404 ) ); + $error = new WP_Error( 'woocommerce_rest_review_invalid_id', __( 'Invalid review ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); if ( 0 >= $id ) { return $error; @@ -1055,7 +1055,7 @@ class WC_REST_Product_Reviews_Controller extends WC_REST_Controller { $post = get_post( (int) $review->comment_post_ID ); if ( 'product' !== get_post_type( (int) $review->comment_post_ID ) ) { - return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } } diff --git a/src/Controllers/Version3/class-wc-rest-product-variations-controller.php b/src/Controllers/Version3/class-wc-rest-product-variations-controller.php index 65cc4f11520..0477e818df9 100644 --- a/src/Controllers/Version3/class-wc-rest-product-variations-controller.php +++ b/src/Controllers/Version3/class-wc-rest-product-variations-controller.php @@ -234,7 +234,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V if ( ! $parent ) { return new WP_Error( // Translators: %d parent ID. - "woocommerce_rest_{$this->post_type}_invalid_parent", sprintf( __( 'Cannot set attributes due to invalid parent product.', 'woocommerce' ), $variation->get_parent_id() ), array( + "woocommerce_rest_{$this->post_type}_invalid_parent", sprintf( __( 'Cannot set attributes due to invalid parent product.', 'woocommerce-rest-api' ), $variation->get_parent_id() ), array( 'status' => 404, ) ); @@ -368,7 +368,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V if ( ! wp_attachment_is_image( $attachment_id ) ) { /* translators: %s: attachment ID */ - throw new WC_REST_Exception( 'woocommerce_variation_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce' ), $attachment_id ), 400 ); + throw new WC_REST_Exception( 'woocommerce_variation_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce-rest-api' ), $attachment_id ), 400 ); } $variation->set_image_id( $attachment_id ); @@ -405,126 +405,126 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Variation description.', 'woocommerce' ), + 'description' => __( 'Variation description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'permalink' => array( - 'description' => __( 'Variation URL.', 'woocommerce' ), + 'description' => __( 'Variation URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price' => array( - 'description' => __( 'Current variation price.', 'woocommerce' ), + 'description' => __( 'Current variation price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Variation regular price.', 'woocommerce' ), + 'description' => __( 'Variation regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Variation sale price.', 'woocommerce' ), + 'description' => __( 'Variation sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from_gmt' => array( - 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to_gmt' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'on_sale' => array( - 'description' => __( 'Shows if the variation is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( - 'description' => __( 'Variation status.', 'woocommerce' ), + 'description' => __( 'Variation status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'publish', 'enum' => array_keys( get_post_statuses() ), 'context' => array( 'view', 'edit' ), ), 'purchasable' => array( - 'description' => __( 'Shows if the variation can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the variation can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the variation is virtual.', 'woocommerce' ), + 'description' => __( 'If the variation is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the variation is downloadable.', 'woocommerce' ), + 'description' => __( 'If the variation is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -532,179 +532,179 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at variation level.', 'woocommerce' ), + 'description' => __( 'Stock management at variation level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'stock_status' => array( - 'description' => __( 'Controls the stock status of the product.', 'woocommerce' ), + 'description' => __( 'Controls the stock status of the product.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'instock', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Variation dimensions.', 'woocommerce' ), + 'description' => __( 'Variation dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'image' => array( - 'description' => __( 'Variation image data.', 'woocommerce' ), + 'description' => __( 'Variation image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -712,30 +712,30 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -848,7 +848,7 @@ class WC_REST_Product_Variations_Controller extends WC_REST_Product_Variations_V ); $params['stock_status'] = array( - 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'sanitize_callback' => 'sanitize_text_field', diff --git a/src/Controllers/Version3/class-wc-rest-products-controller.php b/src/Controllers/Version3/class-wc-rest-products-controller.php index de21777ca9b..5dcc4cb5e9a 100644 --- a/src/Controllers/Version3/class-wc-rest-products-controller.php +++ b/src/Controllers/Version3/class-wc-rest-products-controller.php @@ -250,7 +250,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { if ( ! wp_attachment_is_image( $attachment_id ) ) { /* translators: %s: image ID */ - throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce' ), $attachment_id ), 400 ); + throw new WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce-rest-api' ), $attachment_id ), 400 ); } $featured_image = $product->get_image_id(); @@ -313,7 +313,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { if ( 'variation' === $product->get_type() ) { return new WP_Error( - "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), array( + "woocommerce_rest_invalid_{$this->post_type}_id", __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404, ) ); @@ -698,183 +698,183 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'slug' => array( - 'description' => __( 'Product slug.', 'woocommerce' ), + 'description' => __( 'Product slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'permalink' => array( - 'description' => __( 'Product URL.', 'woocommerce' ), + 'description' => __( 'Product URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_created_gmt' => array( - 'description' => __( 'The date the product was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the product was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_modified' => array( - 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Product type.', 'woocommerce' ), + 'description' => __( 'Product type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'simple', 'enum' => array_keys( wc_get_product_types() ), 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Product status (post status).', 'woocommerce' ), + 'description' => __( 'Product status (post status).', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'publish', 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), 'context' => array( 'view', 'edit' ), ), 'featured' => array( - 'description' => __( 'Featured product.', 'woocommerce' ), + 'description' => __( 'Featured product.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'catalog_visibility' => array( - 'description' => __( 'Catalog visibility.', 'woocommerce' ), + 'description' => __( 'Catalog visibility.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'visible', 'enum' => array( 'visible', 'catalog', 'search', 'hidden' ), 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Product description.', 'woocommerce' ), + 'description' => __( 'Product description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'short_description' => array( - 'description' => __( 'Product short description.', 'woocommerce' ), + 'description' => __( 'Product short description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'price' => array( - 'description' => __( 'Current product price.', 'woocommerce' ), + 'description' => __( 'Current product price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Product regular price.', 'woocommerce' ), + 'description' => __( 'Product regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Product sale price.', 'woocommerce' ), + 'description' => __( 'Product sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from_gmt' => array( - 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to_gmt' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'price_html' => array( - 'description' => __( 'Price formatted in HTML.', 'woocommerce' ), + 'description' => __( 'Price formatted in HTML.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'on_sale' => array( - 'description' => __( 'Shows if the product is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'purchasable' => array( - 'description' => __( 'Shows if the product can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the product can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_sales' => array( - 'description' => __( 'Amount of sales.', 'woocommerce' ), + 'description' => __( 'Amount of sales.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the product is virtual.', 'woocommerce' ), + 'description' => __( 'If the product is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the product is downloadable.', 'woocommerce' ), + 'description' => __( 'If the product is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -882,157 +882,157 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'external_url' => array( - 'description' => __( 'Product external URL. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external URL. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'button_text' => array( - 'description' => __( 'Product external button text. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external button text. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at product level.', 'woocommerce' ), + 'description' => __( 'Stock management at product level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'stock_status' => array( - 'description' => __( 'Controls the stock status of the product.', 'woocommerce' ), + 'description' => __( 'Controls the stock status of the product.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'instock', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the product is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sold_individually' => array( - 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce' ), + 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Product dimensions.', 'woocommerce' ), + 'description' => __( 'Product dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_required' => array( - 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce' ), + 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_taxable' => array( - 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce' ), + 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reviews_allowed' => array( - 'description' => __( 'Allow reviews.', 'woocommerce' ), + 'description' => __( 'Allow reviews.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'average_rating' => array( - 'description' => __( 'Reviews average rating.', 'woocommerce' ), + 'description' => __( 'Reviews average rating.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rating_count' => array( - 'description' => __( 'Amount of reviews that the product have.', 'woocommerce' ), + 'description' => __( 'Amount of reviews that the product have.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'related_ids' => array( - 'description' => __( 'List of related products IDs.', 'woocommerce' ), + 'description' => __( 'List of related products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1041,7 +1041,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'readonly' => true, ), 'upsell_ids' => array( - 'description' => __( 'List of up-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of up-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1049,7 +1049,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'context' => array( 'view', 'edit' ), ), 'cross_sell_ids' => array( - 'description' => __( 'List of cross-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of cross-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1057,35 +1057,35 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'Product parent ID.', 'woocommerce' ), + 'description' => __( 'Product parent ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'purchase_note' => array( - 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce' ), + 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'categories' => array( - 'description' => __( 'List of categories.', 'woocommerce' ), + 'description' => __( 'List of categories.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Category ID.', 'woocommerce' ), + 'description' => __( 'Category ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Category slug.', 'woocommerce' ), + 'description' => __( 'Category slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1094,25 +1094,25 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { ), ), 'tags' => array( - 'description' => __( 'List of tags.', 'woocommerce' ), + 'description' => __( 'List of tags.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tag ID.', 'woocommerce' ), + 'description' => __( 'Tag ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Tag name.', 'woocommerce' ), + 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Tag slug.', 'woocommerce' ), + 'description' => __( 'Tag slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1121,54 +1121,54 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { ), ), 'images' => array( - 'description' => __( 'List of images.', 'woocommerce' ), + 'description' => __( 'List of images.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -1176,41 +1176,41 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Attribute position.', 'woocommerce' ), + 'description' => __( 'Attribute position.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'visible' => array( - 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce' ), + 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'variation' => array( - 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce' ), + 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'options' => array( - 'description' => __( 'List of available term names of the attribute.', 'woocommerce' ), + 'description' => __( 'List of available term names of the attribute.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -1221,24 +1221,24 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { ), ), 'default_attributes' => array( - 'description' => __( 'Defaults variation attributes.', 'woocommerce' ), + 'description' => __( 'Defaults variation attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -1246,7 +1246,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { ), ), 'variations' => array( - 'description' => __( 'List of variations IDs.', 'woocommerce' ), + 'description' => __( 'List of variations IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -1255,7 +1255,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'readonly' => true, ), 'grouped_products' => array( - 'description' => __( 'List of grouped products ID.', 'woocommerce' ), + 'description' => __( 'List of grouped products ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -1264,30 +1264,30 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { 'readonly' => true, ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1310,7 +1310,7 @@ class WC_REST_Products_Controller extends WC_REST_Products_V2_Controller { unset( $params['in_stock'] ); $params['stock_status'] = array( - 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'sanitize_callback' => 'sanitize_text_field', diff --git a/src/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php b/src/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php index b6bfe4304b3..85d4ae34795 100644 --- a/src/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php +++ b/src/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php @@ -118,19 +118,19 @@ class WC_REST_Report_Coupons_Totals_Controller extends WC_REST_Reports_Controlle 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Coupon type name.', 'woocommerce' ), + 'description' => __( 'Coupon type name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Amount of coupons.', 'woocommerce' ), + 'description' => __( 'Amount of coupons.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php b/src/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php index 929a2f3c73a..38867bd7135 100644 --- a/src/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php +++ b/src/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php @@ -71,12 +71,12 @@ class WC_REST_Report_Customers_Totals_Controller extends WC_REST_Reports_Control $data = array( array( 'slug' => 'paying', - 'name' => __( 'Paying customer', 'woocommerce' ), + 'name' => __( 'Paying customer', 'woocommerce-rest-api' ), 'total' => $total_paying, ), array( 'slug' => 'non_paying', - 'name' => __( 'Non-paying customer', 'woocommerce' ), + 'name' => __( 'Non-paying customer', 'woocommerce-rest-api' ), 'total' => $total_customers - $total_paying, ), ); @@ -129,19 +129,19 @@ class WC_REST_Report_Customers_Totals_Controller extends WC_REST_Reports_Control 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Customer type name.', 'woocommerce' ), + 'description' => __( 'Customer type name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Amount of customers.', 'woocommerce' ), + 'description' => __( 'Amount of customers.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php b/src/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php index f70ebe6a5a4..4c7c9289806 100644 --- a/src/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php +++ b/src/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php @@ -102,19 +102,19 @@ class WC_REST_Report_Orders_Totals_Controller extends WC_REST_Reports_Controller 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Order status name.', 'woocommerce' ), + 'description' => __( 'Order status name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Amount of orders.', 'woocommerce' ), + 'description' => __( 'Amount of orders.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-report-products-totals-controller.php b/src/Controllers/Version3/class-wc-rest-report-products-totals-controller.php index c45671c50d9..d855b6298b9 100644 --- a/src/Controllers/Version3/class-wc-rest-report-products-totals-controller.php +++ b/src/Controllers/Version3/class-wc-rest-report-products-totals-controller.php @@ -108,19 +108,19 @@ class WC_REST_Report_Products_Totals_Controller extends WC_REST_Reports_Controll 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product type name.', 'woocommerce' ), + 'description' => __( 'Product type name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Amount of products.', 'woocommerce' ), + 'description' => __( 'Amount of products.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php b/src/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php index c7b5cf2249a..d585d586d27 100644 --- a/src/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php +++ b/src/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php @@ -54,7 +54,7 @@ class WC_REST_Report_Reviews_Totals_Controller extends WC_REST_Reports_Controlle $data[] = array( 'slug' => 'rated_' . $i . '_out_of_5', /* translators: %s: average rating */ - 'name' => sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $i ), + 'name' => sprintf( __( 'Rated %s out of 5', 'woocommerce-rest-api' ), $i ), 'total' => (int) get_comments( $query_data ), ); } @@ -107,19 +107,19 @@ class WC_REST_Report_Reviews_Totals_Controller extends WC_REST_Reports_Controlle 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Review type name.', 'woocommerce' ), + 'description' => __( 'Review type name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Amount of reviews.', 'woocommerce' ), + 'description' => __( 'Amount of reviews.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-reports-controller.php b/src/Controllers/Version3/class-wc-rest-reports-controller.php index 67a37e697da..2ae97fbb4c0 100644 --- a/src/Controllers/Version3/class-wc-rest-reports-controller.php +++ b/src/Controllers/Version3/class-wc-rest-reports-controller.php @@ -36,35 +36,35 @@ class WC_REST_Reports_Controller extends WC_REST_Reports_V2_Controller { $reports[] = array( 'slug' => 'orders/totals', - 'description' => __( 'Orders totals.', 'woocommerce' ), + 'description' => __( 'Orders totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'products/totals', - 'description' => __( 'Products totals.', 'woocommerce' ), + 'description' => __( 'Products totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'customers/totals', - 'description' => __( 'Customers totals.', 'woocommerce' ), + 'description' => __( 'Customers totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'coupons/totals', - 'description' => __( 'Coupons totals.', 'woocommerce' ), + 'description' => __( 'Coupons totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'reviews/totals', - 'description' => __( 'Reviews totals.', 'woocommerce' ), + 'description' => __( 'Reviews totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'categories/totals', - 'description' => __( 'Categories totals.', 'woocommerce' ), + 'description' => __( 'Categories totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'tags/totals', - 'description' => __( 'Tags totals.', 'woocommerce' ), + 'description' => __( 'Tags totals.', 'woocommerce-rest-api' ), ); $reports[] = array( 'slug' => 'attributes/totals', - 'description' => __( 'Attributes totals.', 'woocommerce' ), + 'description' => __( 'Attributes totals.', 'woocommerce-rest-api' ), ); return $reports; diff --git a/src/Controllers/Version3/class-wc-rest-setting-options-controller.php b/src/Controllers/Version3/class-wc-rest-setting-options-controller.php index a09e1fb5d72..b7255694912 100644 --- a/src/Controllers/Version3/class-wc-rest-setting-options-controller.php +++ b/src/Controllers/Version3/class-wc-rest-setting-options-controller.php @@ -73,13 +73,13 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont */ public function get_group_settings( $group_id ) { if ( empty( $group_id ) ) { - return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $settings = apply_filters( 'woocommerce_settings-' . $group_id, array() ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores if ( empty( $settings ) ) { - return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $filtered_settings = array(); @@ -162,7 +162,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_title', @@ -171,7 +171,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'group_id' => array( - 'description' => __( 'An identifier for the group this setting belongs to.', 'woocommerce' ), + 'description' => __( 'An identifier for the group this setting belongs to.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_title', @@ -180,7 +180,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -189,7 +189,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -198,18 +198,18 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -218,7 +218,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -227,7 +227,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -237,7 +237,7 @@ class WC_REST_Setting_Options_Controller extends WC_REST_Setting_Options_V2_Cont 'readonly' => true, ), 'options' => array( - 'description' => __( 'Array of options (key value pairs) for inputs such as select, multiselect, and radio buttons.', 'woocommerce' ), + 'description' => __( 'Array of options (key value pairs) for inputs such as select, multiselect, and radio buttons.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version3/class-wc-rest-settings-controller.php b/src/Controllers/Version3/class-wc-rest-settings-controller.php index 77aebd681d4..0762c090fd4 100644 --- a/src/Controllers/Version3/class-wc-rest-settings-controller.php +++ b/src/Controllers/Version3/class-wc-rest-settings-controller.php @@ -48,7 +48,7 @@ class WC_REST_Settings_Controller extends WC_REST_Settings_V2_Controller { */ public function update_items_permissions_check( $request ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -80,27 +80,27 @@ class WC_REST_Settings_Controller extends WC_REST_Settings_V2_Controller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce' ), + 'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'ID of parent grouping.', 'woocommerce' ), + 'description' => __( 'ID of parent grouping.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sub_groups' => array( - 'description' => __( 'IDs for settings sub groups.', 'woocommerce' ), + 'description' => __( 'IDs for settings sub groups.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php b/src/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php index 871c5199e31..250269663d0 100644 --- a/src/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php +++ b/src/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php @@ -44,7 +44,7 @@ abstract class WC_REST_Shipping_Zones_Controller_Base extends WC_REST_Controller $zone = WC_Shipping_Zones::get_zone_by( 'zone_id', $zone_id ); if ( false === $zone ) { - return new WP_Error( 'woocommerce_rest_shipping_zone_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_shipping_zone_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $zone; @@ -58,11 +58,11 @@ abstract class WC_REST_Shipping_Zones_Controller_Base extends WC_REST_Controller */ public function get_items_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -76,11 +76,11 @@ abstract class WC_REST_Shipping_Zones_Controller_Base extends WC_REST_Controller */ public function create_item_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -94,11 +94,11 @@ abstract class WC_REST_Shipping_Zones_Controller_Base extends WC_REST_Controller */ public function update_items_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -112,11 +112,11 @@ abstract class WC_REST_Shipping_Zones_Controller_Base extends WC_REST_Controller */ public function delete_items_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! wc_rest_check_manager_permissions( 'settings', 'delete' ) ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; diff --git a/src/Controllers/Version3/class-wc-rest-terms-controller.php b/src/Controllers/Version3/class-wc-rest-terms-controller.php index 2422f99b286..5722aeb8b5d 100644 --- a/src/Controllers/Version3/class-wc-rest-terms-controller.php +++ b/src/Controllers/Version3/class-wc-rest-terms-controller.php @@ -52,7 +52,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { array( 'name' => array( 'type' => 'string', - 'description' => __( 'Name for the resource.', 'woocommerce' ), + 'description' => __( 'Name for the resource.', 'woocommerce-rest-api' ), 'required' => true, ), ) @@ -68,7 +68,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -94,7 +94,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -130,7 +130,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( ! $permissions ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -149,7 +149,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( ! $permissions ) { - return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -168,7 +168,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( ! $permissions ) { - return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -187,7 +187,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( ! $permissions ) { - return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -206,7 +206,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( ! $permissions ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -225,7 +225,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( ! $permissions ) { - return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -242,7 +242,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { // Get taxonomy. $taxonomy = $this->get_taxonomy( $request ); if ( ! $taxonomy || ! taxonomy_exists( $taxonomy ) ) { - return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Taxonomy does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_taxonomy_invalid', __( 'Taxonomy does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Check permissions for a single term. @@ -251,7 +251,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { $term = get_term( $id, $taxonomy ); if ( is_wp_error( $term ) || ! $term || $term->taxonomy !== $taxonomy ) { - return new WP_Error( 'woocommerce_rest_term_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new WP_Error( 'woocommerce_rest_term_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return wc_rest_check_product_term_permissions( $taxonomy, $context, $term->term_id ); @@ -390,7 +390,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( isset( $request['parent'] ) ) { if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { - return new WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $args['parent'] = $request['parent']; } @@ -487,7 +487,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { } if ( isset( $request['parent'] ) ) { if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { - return new WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) ); + return new WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $prepared_args['parent'] = $request['parent']; } @@ -536,7 +536,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $term = get_term( (int) $request['id'], $taxonomy ); @@ -545,7 +545,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { // Prevent deleting the default product category. if ( $default_category_id === (int) $request['id'] ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $request->set_param( 'context', 'edit' ); @@ -553,7 +553,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { $retval = wp_delete_term( $term->term_id, $term->taxonomy ); if ( ! $retval ) { - return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -701,7 +701,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { $params['context']['default'] = 'view'; $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -710,7 +710,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -720,14 +720,14 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { ); if ( ! $taxonomy->hierarchical ) { $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); } $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_key', 'default' => 'asc', @@ -738,7 +738,7 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( - 'description' => __( 'Sort collection by resource attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by resource attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_key', 'default' => 'name', @@ -754,27 +754,27 @@ abstract class WC_REST_Terms_Controller extends WC_REST_Controller { 'validate_callback' => 'rest_validate_request_arg', ); $params['hide_empty'] = array( - 'description' => __( 'Whether to hide resources not assigned to any products.', 'woocommerce' ), + 'description' => __( 'Whether to hide resources not assigned to any products.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'validate_callback' => 'rest_validate_request_arg', ); if ( $taxonomy->hierarchical ) { $params['parent'] = array( - 'description' => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); } $params['product'] = array( - 'description' => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => null, 'validate_callback' => 'rest_validate_request_arg', ); $params['slug'] = array( - 'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); diff --git a/src/Controllers/Version4/AbstractController.php b/src/Controllers/Version4/AbstractController.php index e28d3d27729..9916af122ed 100644 --- a/src/Controllers/Version4/AbstractController.php +++ b/src/Controllers/Version4/AbstractController.php @@ -94,7 +94,7 @@ abstract class AbstractController extends WP_REST_Controller { $routes['schema'] = [ $this, 'get_public_item_schema' ]; $routes['args'] = [ 'id' => [ - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ], ]; @@ -131,7 +131,7 @@ abstract class AbstractController extends WP_REST_Controller { 'args' => array( 'force' => array( 'default' => false, - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), 'type' => 'boolean', ), ), @@ -171,7 +171,7 @@ abstract class AbstractController extends WP_REST_Controller { $permission = Permissions::user_can_list( $this->get_item_title() ); if ( false === $permission ) { - return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $permission; @@ -188,7 +188,7 @@ abstract class AbstractController extends WP_REST_Controller { $permission = Permissions::user_can_create( $this->get_item_title() ); if ( false === $permission ) { - return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $permission; @@ -205,7 +205,7 @@ abstract class AbstractController extends WP_REST_Controller { $permission = Permissions::user_can_read( $this->get_item_title(), $id ); if ( false === $permission ) { - return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $permission; @@ -223,7 +223,7 @@ abstract class AbstractController extends WP_REST_Controller { $permission = Permissions::user_can_edit( $this->get_item_title(), $id ); if ( false === $permission ) { - return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you are not allowed to edit this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $permission; @@ -241,7 +241,7 @@ abstract class AbstractController extends WP_REST_Controller { $permission = Permissions::user_can_delete( $this->get_item_title(), $id ); if ( false === $permission ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $permission; @@ -258,7 +258,7 @@ abstract class AbstractController extends WP_REST_Controller { $permission = Permissions::user_can_batch( $this->get_item_title() ); if ( false === $permission ) { - return new \WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_batch', __( 'Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return $permission; diff --git a/src/Controllers/Version4/AbstractObjectsController.php b/src/Controllers/Version4/AbstractObjectsController.php index ddc32658270..332ae8828b7 100644 --- a/src/Controllers/Version4/AbstractObjectsController.php +++ b/src/Controllers/Version4/AbstractObjectsController.php @@ -68,7 +68,7 @@ abstract class AbstractObjectsController extends AbstractController { $object = $this->get_object( (int) $request['id'] ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $object, $request ); @@ -112,7 +112,7 @@ abstract class AbstractObjectsController extends AbstractController { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $object = $this->save_object( $request, true ); @@ -159,7 +159,7 @@ abstract class AbstractObjectsController extends AbstractController { $object = $this->get_object( (int) $request['id'] ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $object = $this->save_object( $request, false ); @@ -318,14 +318,14 @@ abstract class AbstractObjectsController extends AbstractController { $result = false; if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $supports_trash = $this->supports_trash( $object ); if ( ! Permissions::user_can_delete( $this->post_type, $object->get_id() ) ) { /* translators: %s: post type */ - return new \WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code() ) ); } $request->set_param( 'context', 'edit' ); @@ -339,13 +339,13 @@ abstract class AbstractObjectsController extends AbstractController { // If we don't support trashing for this type, error out. if ( ! $supports_trash ) { /* translators: %s: post type */ - return new \WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501 ) ); } // Otherwise, only trash if we haven't already. if ( is_callable( array( $object, 'get_status' ) ) && 'trash' === $object->get_status() ) { /* translators: %s: post type */ - return new \WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 410 ) ); + return new \WP_Error( 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410 ) ); } else { $object->delete(); $result = is_callable( array( $object, 'get_status' ) ) ? 'trash' === $object->get_status() : true; @@ -354,7 +354,7 @@ abstract class AbstractObjectsController extends AbstractController { if ( ! $result ) { /* translators: %s: post type */ - return new \WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500 ) ); } $response = new \WP_REST_Response(); @@ -428,7 +428,7 @@ abstract class AbstractObjectsController extends AbstractController { $params['context']['default'] = 'view'; $params['page'] = array( - 'description' => __( 'Current page of the collection.', 'woocommerce' ), + 'description' => __( 'Current page of the collection.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint', @@ -437,7 +437,7 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['per_page'] = array( - 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ), + 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 10, 'minimum' => 1, @@ -447,28 +447,28 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['search'] = array( - 'description' => __( 'Limit results to those matching a string.', 'woocommerce' ), + 'description' => __( 'Limit results to those matching a string.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['after'] = array( - 'description' => __( 'Limit response to resources created after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources created after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['before'] = array( - 'description' => __( 'Limit response to resources created before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources created before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['date_column'] = array( - 'description' => __( 'When limiting response using after/before, which date column to compare against.', 'woocommerce' ), + 'description' => __( 'When limiting response using after/before, which date column to compare against.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date', 'enum' => array( @@ -481,14 +481,14 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['modified_before'] = array( - 'description' => __( 'Limit response to resources modified before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources modified before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -498,7 +498,7 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -508,14 +508,14 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( 'asc', 'desc' ), @@ -523,7 +523,7 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date', 'enum' => array( @@ -539,7 +539,7 @@ abstract class AbstractObjectsController extends AbstractController { if ( $this->hierarchical ) { $params['parent'] = array( - 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -549,7 +549,7 @@ abstract class AbstractObjectsController extends AbstractController { ); $params['parent_exclude'] = array( - 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -723,7 +723,7 @@ abstract class AbstractObjectsController extends AbstractController { $object = $this->get_object( $id ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::get_item_permissions_check( $request ); @@ -741,7 +741,7 @@ abstract class AbstractObjectsController extends AbstractController { $object = $this->get_object( $id ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::update_item_permissions_check( $request ); @@ -759,7 +759,7 @@ abstract class AbstractObjectsController extends AbstractController { $object = $this->get_object( $id ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::delete_item_permissions_check( $request ); diff --git a/src/Controllers/Version4/AbstractShippingZonesController.php b/src/Controllers/Version4/AbstractShippingZonesController.php index 0a3a6809ba3..88f7e9d7f7e 100644 --- a/src/Controllers/Version4/AbstractShippingZonesController.php +++ b/src/Controllers/Version4/AbstractShippingZonesController.php @@ -44,7 +44,7 @@ abstract class AbstractShippingZonesController extends AbstractController { $zone = \WC_Shipping_Zones::get_zone_by( 'zone_id', $zone_id ); if ( false === $zone ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $zone; @@ -58,7 +58,7 @@ abstract class AbstractShippingZonesController extends AbstractController { */ public function get_items_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::get_items_permissions_check( $request ); } @@ -71,7 +71,7 @@ abstract class AbstractShippingZonesController extends AbstractController { */ public function create_item_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::create_item_permissions_check( $request ); } @@ -84,7 +84,7 @@ abstract class AbstractShippingZonesController extends AbstractController { */ public function update_item_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::update_item_permissions_check( $request ); } @@ -97,7 +97,7 @@ abstract class AbstractShippingZonesController extends AbstractController { */ public function delete_item_permissions_check( $request ) { if ( ! wc_shipping_enabled() ) { - return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_no_route', __( 'Shipping is disabled.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return parent::delete_item_permissions_check( $request ); } diff --git a/src/Controllers/Version4/AbstractTermsContoller.php b/src/Controllers/Version4/AbstractTermsContoller.php index 2cb1366a42c..68a41e8418a 100644 --- a/src/Controllers/Version4/AbstractTermsContoller.php +++ b/src/Controllers/Version4/AbstractTermsContoller.php @@ -68,7 +68,7 @@ abstract class AbstractTermsContoller extends AbstractController { array( 'name' => array( 'type' => 'string', - 'description' => __( 'Name for the resource.', 'woocommerce' ), + 'description' => __( 'Name for the resource.', 'woocommerce-rest-api' ), 'required' => true, ), ) @@ -85,7 +85,7 @@ abstract class AbstractTermsContoller extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -111,7 +111,7 @@ abstract class AbstractTermsContoller extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -234,7 +234,7 @@ abstract class AbstractTermsContoller extends AbstractController { } if ( isset( $request['parent'] ) ) { if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { - return new \WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $args['parent'] = $request['parent']; } @@ -331,7 +331,7 @@ abstract class AbstractTermsContoller extends AbstractController { } if ( isset( $request['parent'] ) ) { if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { - return new \WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $prepared_args['parent'] = $request['parent']; } @@ -380,7 +380,7 @@ abstract class AbstractTermsContoller extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $term = get_term( (int) $request['id'], $taxonomy ); @@ -389,7 +389,7 @@ abstract class AbstractTermsContoller extends AbstractController { // Prevent deleting the default product category. if ( $default_category_id === (int) $request['id'] ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $request->set_param( 'context', 'edit' ); @@ -397,7 +397,7 @@ abstract class AbstractTermsContoller extends AbstractController { $retval = wp_delete_term( $term->term_id, $term->taxonomy ); if ( ! $retval ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -545,7 +545,7 @@ abstract class AbstractTermsContoller extends AbstractController { $params['context']['default'] = 'view'; $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -554,7 +554,7 @@ abstract class AbstractTermsContoller extends AbstractController { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -564,14 +564,14 @@ abstract class AbstractTermsContoller extends AbstractController { ); if ( ! $taxonomy->hierarchical ) { $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); } $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_key', 'default' => 'asc', @@ -582,7 +582,7 @@ abstract class AbstractTermsContoller extends AbstractController { 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( - 'description' => __( 'Sort collection by resource attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by resource attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_key', 'default' => 'name', @@ -598,27 +598,27 @@ abstract class AbstractTermsContoller extends AbstractController { 'validate_callback' => 'rest_validate_request_arg', ); $params['hide_empty'] = array( - 'description' => __( 'Whether to hide resources not assigned to any products.', 'woocommerce' ), + 'description' => __( 'Whether to hide resources not assigned to any products.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'validate_callback' => 'rest_validate_request_arg', ); if ( $taxonomy->hierarchical ) { $params['parent'] = array( - 'description' => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); } $params['product'] = array( - 'description' => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => null, 'validate_callback' => 'rest_validate_request_arg', ); $params['slug'] = array( - 'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); diff --git a/src/Controllers/Version4/Coupons.php b/src/Controllers/Version4/Coupons.php index bbca5237287..10dff13fc62 100644 --- a/src/Controllers/Version4/Coupons.php +++ b/src/Controllers/Version4/Coupons.php @@ -141,7 +141,7 @@ class Coupons extends AbstractObjectsController { // Validate required POST fields. if ( $creating && empty( $request['code'] ) ) { - return new \WP_Error( 'woocommerce_rest_empty_coupon_code', sprintf( __( 'The coupon code cannot be empty.', 'woocommerce' ), 'code' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_empty_coupon_code', sprintf( __( 'The coupon code cannot be empty.', 'woocommerce-rest-api' ), 'code' ), array( 'status' => 400 ) ); } // Handle all writable props. @@ -156,7 +156,7 @@ class Coupons extends AbstractObjectsController { $id_from_code = wc_get_coupon_id_by_code( $coupon_code, $id ); if ( $id_from_code ) { - return new \WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_coupon_code_already_exists', __( 'The coupon code already exists', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $coupon->set_code( $coupon_code ); @@ -205,82 +205,82 @@ class Coupons extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the object.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the object.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'required' => true, ), 'amount' => array( - 'description' => __( 'The amount of discount. Should always be numeric, even if setting a percentage.', 'woocommerce' ), + 'description' => __( 'The amount of discount. Should always be numeric, even if setting a percentage.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the coupon was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the coupon was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the coupon was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the coupon was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the coupon was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the coupon was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_type' => array( - 'description' => __( 'Determines the type of discount that will be applied.', 'woocommerce' ), + 'description' => __( 'Determines the type of discount that will be applied.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'fixed_cart', 'enum' => array_keys( wc_get_coupon_types() ), 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Coupon description.', 'woocommerce' ), + 'description' => __( 'Coupon description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_expires' => array( - 'description' => __( "The date the coupon expires, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the coupon expires, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_expires_gmt' => array( - 'description' => __( 'The date the coupon expires, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the coupon expires, as GMT.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'usage_count' => array( - 'description' => __( 'Number of times the coupon has been used already.', 'woocommerce' ), + 'description' => __( 'Number of times the coupon has been used already.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'individual_use' => array( - 'description' => __( 'If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.', 'woocommerce' ), + 'description' => __( 'If true, the coupon can only be used individually. Other applied coupons will be removed from the cart.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'product_ids' => array( - 'description' => __( 'List of product IDs the coupon can be used on.', 'woocommerce' ), + 'description' => __( 'List of product IDs the coupon can be used on.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -288,7 +288,7 @@ class Coupons extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'excluded_product_ids' => array( - 'description' => __( 'List of product IDs the coupon cannot be used on.', 'woocommerce' ), + 'description' => __( 'List of product IDs the coupon cannot be used on.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -296,28 +296,28 @@ class Coupons extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'usage_limit' => array( - 'description' => __( 'How many times the coupon can be used in total.', 'woocommerce' ), + 'description' => __( 'How many times the coupon can be used in total.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'usage_limit_per_user' => array( - 'description' => __( 'How many times the coupon can be used per customer.', 'woocommerce' ), + 'description' => __( 'How many times the coupon can be used per customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'limit_usage_to_x_items' => array( - 'description' => __( 'Max number of items in the cart the coupon can be applied to.', 'woocommerce' ), + 'description' => __( 'Max number of items in the cart the coupon can be applied to.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'free_shipping' => array( - 'description' => __( 'If true and if the free shipping method requires a coupon, this coupon will enable free shipping.', 'woocommerce' ), + 'description' => __( 'If true and if the free shipping method requires a coupon, this coupon will enable free shipping.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'product_categories' => array( - 'description' => __( 'List of category IDs the coupon applies to.', 'woocommerce' ), + 'description' => __( 'List of category IDs the coupon applies to.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -325,7 +325,7 @@ class Coupons extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'excluded_product_categories' => array( - 'description' => __( 'List of category IDs the coupon does not apply to.', 'woocommerce' ), + 'description' => __( 'List of category IDs the coupon does not apply to.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -333,23 +333,23 @@ class Coupons extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'exclude_sale_items' => array( - 'description' => __( 'If true, this coupon will not be applied to items that have sale prices.', 'woocommerce' ), + 'description' => __( 'If true, this coupon will not be applied to items that have sale prices.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'minimum_amount' => array( - 'description' => __( 'Minimum order amount that needs to be in the cart before coupon applies.', 'woocommerce' ), + 'description' => __( 'Minimum order amount that needs to be in the cart before coupon applies.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'maximum_amount' => array( - 'description' => __( 'Maximum order amount allowed when using the coupon.', 'woocommerce' ), + 'description' => __( 'Maximum order amount allowed when using the coupon.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email_restrictions' => array( - 'description' => __( 'List of email addresses that can use this coupon.', 'woocommerce' ), + 'description' => __( 'List of email addresses that can use this coupon.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -357,7 +357,7 @@ class Coupons extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'used_by' => array( - 'description' => __( 'List of user IDs (or guest email addresses) that have used the coupon.', 'woocommerce' ), + 'description' => __( 'List of user IDs (or guest email addresses) that have used the coupon.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -366,25 +366,25 @@ class Coupons extends AbstractObjectsController { 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -405,14 +405,14 @@ class Coupons extends AbstractObjectsController { $params = parent::get_collection_params(); $params['code'] = array( - 'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific code.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['search'] = array( - 'description' => __( 'Limit results to coupons with codes matching a given string.', 'woocommerce' ), + 'description' => __( 'Limit results to coupons with codes matching a given string.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); diff --git a/src/Controllers/Version4/CustomerDownloads.php b/src/Controllers/Version4/CustomerDownloads.php index 6504eb9967d..c63fe2b875b 100644 --- a/src/Controllers/Version4/CustomerDownloads.php +++ b/src/Controllers/Version4/CustomerDownloads.php @@ -49,11 +49,11 @@ class CustomerDownloads extends AbstractController { $customer = get_user_by( 'id', (int) $request['customer_id'] ); if ( ! $customer ) { - return new \WP_Error( 'woocommerce_rest_customer_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_customer_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( ! Permissions::user_can_read( $this->resource_type, $customer->ID ) ) { - return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -137,79 +137,79 @@ class CustomerDownloads extends AbstractController { 'type' => 'object', 'properties' => array( 'download_id' => array( - 'description' => __( 'Download ID.', 'woocommerce' ), + 'description' => __( 'Download ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'download_url' => array( - 'description' => __( 'Download file URL.', 'woocommerce' ), + 'description' => __( 'Download file URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Downloadable product ID.', 'woocommerce' ), + 'description' => __( 'Downloadable product ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'product_name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'download_name' => array( - 'description' => __( 'Downloadable file name.', 'woocommerce' ), + 'description' => __( 'Downloadable file name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'order_id' => array( - 'description' => __( 'Order ID.', 'woocommerce' ), + 'description' => __( 'Order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'order_key' => array( - 'description' => __( 'Order key.', 'woocommerce' ), + 'description' => __( 'Order key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'downloads_remaining' => array( - 'description' => __( 'Number of downloads remaining.', 'woocommerce' ), + 'description' => __( 'Number of downloads remaining.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'access_expires' => array( - 'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date when download access expires, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'access_expires_gmt' => array( - 'description' => __( 'The date when download access expires, as GMT.', 'woocommerce' ), + 'description' => __( 'The date when download access expires, as GMT.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'file' => array( - 'description' => __( 'File details.', 'woocommerce' ), + 'description' => __( 'File details.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version4/Customers.php b/src/Controllers/Version4/Customers.php index d931c1b05f5..38688b23f0e 100644 --- a/src/Controllers/Version4/Customers.php +++ b/src/Controllers/Version4/Customers.php @@ -59,16 +59,16 @@ class Customers extends AbstractController { 'email' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'New user email address.', 'woocommerce' ), + 'description' => __( 'New user email address.', 'woocommerce-rest-api' ), ), 'username' => array( 'required' => 'no' === get_option( 'woocommerce_registration_generate_username', 'yes' ), - 'description' => __( 'New user username.', 'woocommerce' ), + 'description' => __( 'New user username.', 'woocommerce-rest-api' ), 'type' => 'string', ), 'password' => array( 'required' => 'no' === get_option( 'woocommerce_registration_generate_password', 'no' ), - 'description' => __( 'New user password.', 'woocommerce' ), + 'description' => __( 'New user password.', 'woocommerce-rest-api' ), 'type' => 'string', ), ) @@ -85,7 +85,7 @@ class Customers extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -111,12 +111,12 @@ class Customers extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), 'reassign' => array( 'default' => 0, 'type' => 'integer', - 'description' => __( 'ID to reassign posts to.', 'woocommerce' ), + 'description' => __( 'ID to reassign posts to.', 'woocommerce-rest-api' ), ), ), ), @@ -223,7 +223,7 @@ class Customers extends AbstractController { public function create_item( $request ) { try { if ( ! empty( $request['id'] ) ) { - throw new \WC_REST_Exception( 'woocommerce_rest_customer_exists', __( 'Cannot create existing resource.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_customer_exists', __( 'Cannot create existing resource.', 'woocommerce-rest-api' ), 400 ); } $customer_request = new CustomerRequest( $request ); @@ -231,7 +231,7 @@ class Customers extends AbstractController { $customer->save(); if ( ! $customer->get_id() ) { - throw new \WC_REST_Exception( 'woocommerce_rest_cannot_create', __( 'This resource cannot be created.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_cannot_create', __( 'This resource cannot be created.', 'woocommerce-rest-api' ), 400 ); } $this->update_additional_fields_for_object( $customer, $request ); @@ -268,7 +268,7 @@ class Customers extends AbstractController { $customer = new \WC_Customer( $id ); if ( empty( $id ) || ! $customer->get_id() ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $response = $this->prepare_item_for_response( $customer, $request ); @@ -328,16 +328,16 @@ class Customers extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Customers do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Customers do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } if ( ! get_userdata( $id ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } if ( ! empty( $reassign ) ) { if ( $reassign === $id || ! get_userdata( $reassign ) ) { - return new \WP_Error( 'woocommerce_rest_customer_invalid_reassign', __( 'Invalid resource id for reassignment.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_customer_invalid_reassign', __( 'Invalid resource id for reassignment.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -356,7 +356,7 @@ class Customers extends AbstractController { } if ( ! $result ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -415,43 +415,43 @@ class Customers extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the customer was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the customer was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the customer was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the customer was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'email' => array( - 'description' => __( 'The email address for the customer.', 'woocommerce' ), + 'description' => __( 'The email address for the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'first_name' => array( - 'description' => __( 'Customer first name.', 'woocommerce' ), + 'description' => __( 'Customer first name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -459,7 +459,7 @@ class Customers extends AbstractController { ), ), 'last_name' => array( - 'description' => __( 'Customer last name.', 'woocommerce' ), + 'description' => __( 'Customer last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -467,13 +467,13 @@ class Customers extends AbstractController { ), ), 'role' => array( - 'description' => __( 'Customer role.', 'woocommerce' ), + 'description' => __( 'Customer role.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'username' => array( - 'description' => __( 'Customer login name.', 'woocommerce' ), + 'description' => __( 'Customer login name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -481,157 +481,157 @@ class Customers extends AbstractController { ), ), 'password' => array( - 'description' => __( 'Customer password.', 'woocommerce' ), + 'description' => __( 'Customer password.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'billing' => array( - 'description' => __( 'List of billing address data.', 'woocommerce' ), + 'description' => __( 'List of billing address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'List of shipping address data.', 'woocommerce' ), + 'description' => __( 'List of shipping address data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'ISO code of the country.', 'woocommerce' ), + 'description' => __( 'ISO code of the country.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'is_paying_customer' => array( - 'description' => __( 'Is the customer a paying customer?', 'woocommerce' ), + 'description' => __( 'Is the customer a paying customer?', 'woocommerce-rest-api' ), 'type' => 'bool', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'avatar_url' => array( - 'description' => __( 'Avatar URL.', 'woocommerce' ), + 'description' => __( 'Avatar URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -666,7 +666,7 @@ class Customers extends AbstractController { $params['context']['default'] = 'view'; $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -675,7 +675,7 @@ class Customers extends AbstractController { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -684,14 +684,14 @@ class Customers extends AbstractController { 'sanitize_callback' => 'wp_parse_id_list', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( 'default' => 'asc', - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'enum' => array( 'asc', 'desc' ), 'sanitize_callback' => 'sanitize_key', 'type' => 'string', @@ -699,7 +699,7 @@ class Customers extends AbstractController { ); $params['orderby'] = array( 'default' => 'name', - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'enum' => array( 'id', 'include', @@ -711,13 +711,13 @@ class Customers extends AbstractController { 'validate_callback' => 'rest_validate_request_arg', ); $params['email'] = array( - 'description' => __( 'Limit result set to resources with a specific email.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific email.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'validate_callback' => 'rest_validate_request_arg', ); $params['role'] = array( - 'description' => __( 'Limit result set to resources with a specific role.', 'woocommerce' ), + 'description' => __( 'Limit result set to resources with a specific role.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'customer', 'enum' => array_merge( array( 'all' ), $this->get_role_names() ), @@ -737,7 +737,7 @@ class Customers extends AbstractController { $user = get_userdata( $id ); if ( false === $user ) { - return new \WP_Error( 'woocommerce_rest_customer_invalid_id', __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_customer_invalid_id', __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return true; } diff --git a/src/Controllers/Version4/Data.php b/src/Controllers/Version4/Data.php index a2fb405b9ee..f8a322a47de 100644 --- a/src/Controllers/Version4/Data.php +++ b/src/Controllers/Version4/Data.php @@ -63,19 +63,19 @@ class Data extends AbstractController { $resources = array( array( 'slug' => 'continents', - 'description' => __( 'List of supported continents, countries, and states.', 'woocommerce' ), + 'description' => __( 'List of supported continents, countries, and states.', 'woocommerce-rest-api' ), ), array( 'slug' => 'countries', - 'description' => __( 'List of supported states in a given country.', 'woocommerce' ), + 'description' => __( 'List of supported states in a given country.', 'woocommerce-rest-api' ), ), array( 'slug' => 'currencies', - 'description' => __( 'List of supported currencies.', 'woocommerce' ), + 'description' => __( 'List of supported currencies.', 'woocommerce-rest-api' ), ), array( 'slug' => 'download-ips', - 'description' => __( 'An endpoint used for searching download logs for a specific IP address.', 'woocommerce' ), + 'description' => __( 'An endpoint used for searching download logs for a specific IP address.', 'woocommerce-rest-api' ), ), ); @@ -134,13 +134,13 @@ class Data extends AbstractController { 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'Data resource ID.', 'woocommerce' ), + 'description' => __( 'Data resource ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Data resource description.', 'woocommerce' ), + 'description' => __( 'Data resource description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version4/Data/Continents.php b/src/Controllers/Version4/Data/Continents.php index 07271be8432..c95b0b782bd 100644 --- a/src/Controllers/Version4/Data/Continents.php +++ b/src/Controllers/Version4/Data/Continents.php @@ -53,7 +53,7 @@ class Continents extends DataController { 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => array( 'continent' => array( - 'description' => __( '2 character continent code.', 'woocommerce' ), + 'description' => __( '2 character continent code.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -180,7 +180,7 @@ class Continents extends DataController { public function get_item( $request ) { $data = $this->get_continent( strtoupper( $request['location'] ), $request ); if ( empty( $data ) ) { - return new \WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $data, $request ); } @@ -230,19 +230,19 @@ class Continents extends DataController { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( '2 character continent code.', 'woocommerce' ), + 'description' => __( '2 character continent code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of continent.', 'woocommerce' ), + 'description' => __( 'Full name of continent.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'countries' => array( 'type' => 'array', - 'description' => __( 'List of countries on this continent.', 'woocommerce' ), + 'description' => __( 'List of countries on this continent.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, 'items' => array( @@ -252,49 +252,49 @@ class Continents extends DataController { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), + 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'currency_code' => array( 'type' => 'string', - 'description' => __( 'Default ISO4127 alpha-3 currency code for the country.', 'woocommerce' ), + 'description' => __( 'Default ISO4127 alpha-3 currency code for the country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'currency_pos' => array( 'type' => 'string', - 'description' => __( 'Currency symbol position for this country.', 'woocommerce' ), + 'description' => __( 'Currency symbol position for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'decimal_sep' => array( 'type' => 'string', - 'description' => __( 'Decimal separator for displayed prices for this country.', 'woocommerce' ), + 'description' => __( 'Decimal separator for displayed prices for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'dimension_unit' => array( 'type' => 'string', - 'description' => __( 'The unit lengths are defined in for this country.', 'woocommerce' ), + 'description' => __( 'The unit lengths are defined in for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of country.', 'woocommerce' ), + 'description' => __( 'Full name of country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'num_decimals' => array( 'type' => 'integer', - 'description' => __( 'Number of decimal points shown in displayed prices for this country.', 'woocommerce' ), + 'description' => __( 'Number of decimal points shown in displayed prices for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'states' => array( 'type' => 'array', - 'description' => __( 'List of states in this country.', 'woocommerce' ), + 'description' => __( 'List of states in this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, 'items' => array( @@ -304,13 +304,13 @@ class Continents extends DataController { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'State code.', 'woocommerce' ), + 'description' => __( 'State code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of state.', 'woocommerce' ), + 'description' => __( 'Full name of state.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), @@ -319,13 +319,13 @@ class Continents extends DataController { ), 'thousand_sep' => array( 'type' => 'string', - 'description' => __( 'Thousands separator for displayed prices in this country.', 'woocommerce' ), + 'description' => __( 'Thousands separator for displayed prices in this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'weight_unit' => array( 'type' => 'string', - 'description' => __( 'The unit weights are defined in for this country.', 'woocommerce' ), + 'description' => __( 'The unit weights are defined in for this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version4/Data/Countries.php b/src/Controllers/Version4/Data/Countries.php index bfa28bc79e3..cca85709109 100644 --- a/src/Controllers/Version4/Data/Countries.php +++ b/src/Controllers/Version4/Data/Countries.php @@ -53,7 +53,7 @@ class Countries extends DataController { 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => array( 'location' => array( - 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), + 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -127,7 +127,7 @@ class Countries extends DataController { public function get_item( $request ) { $data = $this->get_country( strtoupper( $request['location'] ), $request ); if ( empty( $data ) ) { - return new \WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $data, $request ); } @@ -179,19 +179,19 @@ class Countries extends DataController { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), + 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of country.', 'woocommerce' ), + 'description' => __( 'Full name of country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'states' => array( 'type' => 'array', - 'description' => __( 'List of states in this country.', 'woocommerce' ), + 'description' => __( 'List of states in this country.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, 'items' => array( @@ -201,13 +201,13 @@ class Countries extends DataController { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'State code.', 'woocommerce' ), + 'description' => __( 'State code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of state.', 'woocommerce' ), + 'description' => __( 'Full name of state.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version4/Data/Currencies.php b/src/Controllers/Version4/Data/Currencies.php index 98d6e39139c..cb87d6d242c 100644 --- a/src/Controllers/Version4/Data/Currencies.php +++ b/src/Controllers/Version4/Data/Currencies.php @@ -63,7 +63,7 @@ class Currencies extends DataController { 'permission_callback' => array( $this, 'get_item_permissions_check' ), 'args' => array( 'location' => array( - 'description' => __( 'ISO4217 currency code.', 'woocommerce' ), + 'description' => __( 'ISO4217 currency code.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -123,7 +123,7 @@ class Currencies extends DataController { public function get_item( $request ) { $data = $this->get_currency( strtoupper( $request['currency'] ), $request ); if ( empty( $data ) ) { - return new \WP_Error( 'woocommerce_rest_data_invalid_currency', __( 'There are no currencies matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_data_invalid_currency', __( 'There are no currencies matching these parameters.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $data, $request ); } @@ -185,19 +185,19 @@ class Currencies extends DataController { 'properties' => array( 'code' => array( 'type' => 'string', - 'description' => __( 'ISO4217 currency code.', 'woocommerce' ), + 'description' => __( 'ISO4217 currency code.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'name' => array( 'type' => 'string', - 'description' => __( 'Full name of currency.', 'woocommerce' ), + 'description' => __( 'Full name of currency.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), 'symbol' => array( 'type' => 'string', - 'description' => __( 'Currency symbol.', 'woocommerce' ), + 'description' => __( 'Currency symbol.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version4/Data/DownloadIPs.php b/src/Controllers/Version4/Data/DownloadIPs.php index 5d62d801926..14a47ff7f85 100644 --- a/src/Controllers/Version4/Data/DownloadIPs.php +++ b/src/Controllers/Version4/Data/DownloadIPs.php @@ -65,7 +65,7 @@ class DownloadIPs extends DataController { ) ); } else { - return new \WP_Error( 'woocommerce_rest_data_download_ips_invalid_request', __( 'Invalid request. Please pass the match parameter.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_data_download_ips_invalid_request', __( 'Invalid request. Please pass the match parameter.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $data = array(); @@ -116,7 +116,7 @@ class DownloadIPs extends DataController { $params = array(); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['match'] = array( - 'description' => __( 'A partial IP address can be passed and matching results will be returned.', 'woocommerce' ), + 'description' => __( 'A partial IP address can be passed and matching results will be returned.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); @@ -137,7 +137,7 @@ class DownloadIPs extends DataController { 'properties' => array( 'user_ip_address' => array( 'type' => 'string', - 'description' => __( 'IP address.', 'woocommerce' ), + 'description' => __( 'IP address.', 'woocommerce-rest-api' ), 'context' => array( 'view' ), 'readonly' => true, ), diff --git a/src/Controllers/Version4/NetworkOrders.php b/src/Controllers/Version4/NetworkOrders.php index 7fafab5b3bd..a721b5cd5a0 100644 --- a/src/Controllers/Version4/NetworkOrders.php +++ b/src/Controllers/Version4/NetworkOrders.php @@ -47,31 +47,31 @@ class NetworkOrders extends Orders { $schema = parent::get_public_item_schema(); $schema['properties']['blog'] = array( - 'description' => __( 'Blog id of the record on the multisite.', 'woocommerce' ), + 'description' => __( 'Blog id of the record on the multisite.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['edit_url'] = array( - 'description' => __( 'URL to edit the order', 'woocommerce' ), + 'description' => __( 'URL to edit the order', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['customer'][] = array( - 'description' => __( 'Name of the customer for the order', 'woocommerce' ), + 'description' => __( 'Name of the customer for the order', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['status_name'][] = array( - 'description' => __( 'Order Status', 'woocommerce' ), + 'description' => __( 'Order Status', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ); $schema['properties']['formatted_total'][] = array( - 'description' => __( 'Order total formatted for locale', 'woocommerce' ), + 'description' => __( 'Order total formatted for locale', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, @@ -138,7 +138,7 @@ class NetworkOrders extends Orders { $current_order['blog'] = get_blog_details( get_current_blog_id() ); $current_order['edit_url'] = get_admin_url( $blog_id, 'post.php?post=' . absint( $order->get_id() ) . '&action=edit' ); /* translators: 1: first name 2: last name */ - $current_order['customer'] = trim( sprintf( _x( '%1$s %2$s', 'full name', 'woocommerce' ), $order->get_billing_first_name(), $order->get_billing_last_name() ) ); + $current_order['customer'] = trim( sprintf( _x( '%1$s %2$s', 'full name', 'woocommerce-rest-api' ), $order->get_billing_first_name(), $order->get_billing_last_name() ) ); $current_order['status_name'] = wc_get_order_status_name( $order->get_status() ); $current_order['formatted_total'] = $order->get_formatted_order_total(); } diff --git a/src/Controllers/Version4/OrderNotes.php b/src/Controllers/Version4/OrderNotes.php index c2935e728d0..d95de72528f 100644 --- a/src/Controllers/Version4/OrderNotes.php +++ b/src/Controllers/Version4/OrderNotes.php @@ -42,7 +42,7 @@ class OrderNotes extends AbstractController { array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -61,7 +61,7 @@ class OrderNotes extends AbstractController { array( 'note' => array( 'type' => 'string', - 'description' => __( 'Order note content.', 'woocommerce' ), + 'description' => __( 'Order note content.', 'woocommerce-rest-api' ), 'required' => true, ), ) @@ -78,11 +78,11 @@ class OrderNotes extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -102,7 +102,7 @@ class OrderNotes extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -122,7 +122,7 @@ class OrderNotes extends AbstractController { $order = wc_get_order( (int) $request['order_id'] ); if ( $order && ! Permissions::user_can_read( $this->post_type, $order->get_id() ) ) { - return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -139,7 +139,7 @@ class OrderNotes extends AbstractController { $order = wc_get_order( (int) $request['order_id'] ); if ( $order && ! Permissions::user_can_delete( $this->post_type, $order->get_id() ) ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Sorry, you are not allowed to delete this resource.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; @@ -156,7 +156,7 @@ class OrderNotes extends AbstractController { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $args = array( @@ -208,20 +208,20 @@ class OrderNotes extends AbstractController { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new \WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Create the note. $note_id = $order->add_order_note( $request['note'], $request['customer_note'], $request['added_by_user'] ); if ( ! $note_id ) { - return new \WP_Error( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $note = get_comment( $note_id ); @@ -256,13 +256,13 @@ class OrderNotes extends AbstractController { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new \WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $note = get_comment( $id ); if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->get_id() ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $order_note = $this->prepare_item_for_response( $note, $request ); @@ -283,19 +283,19 @@ class OrderNotes extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order || $this->post_type !== $order->get_type() ) { - return new \WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_order_invalid_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $note = get_comment( $id ); if ( empty( $id ) || empty( $note ) || intval( $note->comment_post_ID ) !== intval( $order->get_id() ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $request->set_param( 'context', 'edit' ); @@ -303,7 +303,7 @@ class OrderNotes extends AbstractController { $result = wc_delete_order_note( $note->comment_ID ); if ( ! $result ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), 'order_note' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), 'order_note' ), array( 'status' => 500 ) ); } $response = new \WP_REST_Response(); @@ -336,7 +336,7 @@ class OrderNotes extends AbstractController { protected function get_data_for_response( $object, $request ) { return array( 'id' => (int) $object->comment_ID, - 'author' => __( 'WooCommerce', 'woocommerce' ) === $object->comment_author ? 'system' : $object->comment_author, + 'author' => __( 'woocommerce-rest-api', 'woocommerce-rest-api' ) === $object->comment_author ? 'system' : $object->comment_author, 'date_created' => wc_rest_prepare_date_response( $object->comment_date ), 'date_created_gmt' => wc_rest_prepare_date_response( $object->comment_date_gmt ), 'note' => $object->comment_content, @@ -381,42 +381,42 @@ class OrderNotes extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'author' => array( - 'description' => __( 'Order note author.', 'woocommerce' ), + 'description' => __( 'Order note author.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order note was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order note was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order note was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'note' => array( - 'description' => __( 'Order note content.', 'woocommerce' ), + 'description' => __( 'Order note content.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'customer_note' => array( - 'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce' ), + 'description' => __( 'If true, the note will be shown to customers and they will be notified. If false, the note will be for admin reference only.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'added_by_user' => array( - 'description' => __( 'If true, this note will be attributed to the current user. If false, the note will be attributed to the system.', 'woocommerce' ), + 'description' => __( 'If true, this note will be attributed to the current user. If false, the note will be attributed to the system.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'edit' ), @@ -437,7 +437,7 @@ class OrderNotes extends AbstractController { $params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['type'] = array( 'default' => 'any', - 'description' => __( 'Limit result to customers or internal notes.', 'woocommerce' ), + 'description' => __( 'Limit result to customers or internal notes.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array( 'any', 'customer', 'internal' ), 'sanitize_callback' => 'sanitize_key', diff --git a/src/Controllers/Version4/OrderRefunds.php b/src/Controllers/Version4/OrderRefunds.php index ff50b60c939..1f27254ef2c 100644 --- a/src/Controllers/Version4/OrderRefunds.php +++ b/src/Controllers/Version4/OrderRefunds.php @@ -47,7 +47,7 @@ class OrderRefunds extends Orders { array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -74,11 +74,11 @@ class OrderRefunds extends Orders { array( 'args' => array( 'order_id' => array( - 'description' => __( 'The order ID.', 'woocommerce' ), + 'description' => __( 'The order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -98,7 +98,7 @@ class OrderRefunds extends Orders { 'force' => array( 'default' => true, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -132,11 +132,11 @@ class OrderRefunds extends Orders { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), 404 ); } if ( ! $object || $object->get_parent_id() !== $order->get_id() ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 404 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce-rest-api' ), 404 ); } $data = $object->get_data(); @@ -277,17 +277,17 @@ class OrderRefunds extends Orders { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } $order_data = get_post( (int) $request['order_id'] ); if ( empty( $order_data ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_order', __( 'Order is invalid', 'woocommerce' ), 400 ); + return new \WP_Error( 'woocommerce_rest_invalid_order', __( 'Order is invalid', 'woocommerce-rest-api' ), 400 ); } if ( 0 > $request['amount'] ) { - return new \WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 ); + return new \WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce-rest-api' ), 400 ); } // Create the refund. @@ -306,7 +306,7 @@ class OrderRefunds extends Orders { } if ( ! $refund ) { - return new \WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 ); + return new \WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce-rest-api' ), 500 ); } $post = get_post( $refund->get_id() ); @@ -342,11 +342,11 @@ class OrderRefunds extends Orders { $order = wc_get_order( (int) $request['order_id'] ); if ( ! $order ) { - return new \WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 ); + return new \WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce-rest-api' ), 404 ); } if ( 0 > $request['amount'] ) { - return new \WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 ); + return new \WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce-rest-api' ), 400 ); } // Create the refund. @@ -366,7 +366,7 @@ class OrderRefunds extends Orders { } if ( ! $refund ) { - return new \WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 ); + return new \WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce-rest-api' ), 500 ); } if ( ! empty( $request['meta_data'] ) && is_array( $request['meta_data'] ) ) { @@ -425,64 +425,64 @@ class OrderRefunds extends Orders { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order refund was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order refund was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order refund was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order refund was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'amount' => array( - 'description' => __( 'Refund amount.', 'woocommerce' ), + 'description' => __( 'Refund amount.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'reason' => array( - 'description' => __( 'Reason for refund.', 'woocommerce' ), + 'description' => __( 'Reason for refund.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'refunded_by' => array( - 'description' => __( 'User ID of user who created the refund.', 'woocommerce' ), + 'description' => __( 'User ID of user who created the refund.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'refunded_payment' => array( - 'description' => __( 'If the payment was refunded via the API.', 'woocommerce' ), + 'description' => __( 'If the payment was refunded via the API.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -490,7 +490,7 @@ class OrderRefunds extends Orders { ), ), 'line_items' => array( - 'description' => __( 'Line items data.', 'woocommerce' ), + 'description' => __( 'Line items data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -498,67 +498,67 @@ class OrderRefunds extends Orders { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'variation_id' => array( - 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), + 'description' => __( 'Variation ID, if applicable.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'quantity' => array( - 'description' => __( 'Quantity ordered.', 'woocommerce' ), + 'description' => __( 'Quantity ordered.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tax_class' => array( - 'description' => __( 'Tax class of product.', 'woocommerce' ), + 'description' => __( 'Tax class of product.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal_tax' => array( - 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -566,19 +566,19 @@ class OrderRefunds extends Orders { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -587,7 +587,7 @@ class OrderRefunds extends Orders { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -595,19 +595,19 @@ class OrderRefunds extends Orders { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -616,13 +616,13 @@ class OrderRefunds extends Orders { ), ), 'sku' => array( - 'description' => __( 'Product SKU.', 'woocommerce' ), + 'description' => __( 'Product SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'price' => array( - 'description' => __( 'Product price.', 'woocommerce' ), + 'description' => __( 'Product price.', 'woocommerce-rest-api' ), 'type' => 'number', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -631,7 +631,7 @@ class OrderRefunds extends Orders { ), ), 'api_refund' => array( - 'description' => __( 'When true, the payment gateway API is used to generate the refund.', 'woocommerce' ), + 'description' => __( 'When true, the payment gateway API is used to generate the refund.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'edit' ), 'default' => true, @@ -652,7 +652,7 @@ class OrderRefunds extends Orders { $params['dp'] = array( 'default' => wc_get_price_decimals(), - 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce' ), + 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', diff --git a/src/Controllers/Version4/Orders.php b/src/Controllers/Version4/Orders.php index dfd16519546..25923a1c9b4 100644 --- a/src/Controllers/Version4/Orders.php +++ b/src/Controllers/Version4/Orders.php @@ -303,277 +303,277 @@ class Orders extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'parent_id' => array( - 'description' => __( 'Parent order ID.', 'woocommerce' ), + 'description' => __( 'Parent order ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'number' => array( - 'description' => __( 'Order number.', 'woocommerce' ), + 'description' => __( 'Order number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'order_key' => array( - 'description' => __( 'Order key.', 'woocommerce' ), + 'description' => __( 'Order key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'created_via' => array( - 'description' => __( 'Shows where the order was created.', 'woocommerce' ), + 'description' => __( 'Shows where the order was created.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'version' => array( - 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce' ), + 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( - 'description' => __( 'Order status.', 'woocommerce' ), + 'description' => __( 'Order status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'pending', 'enum' => $this->get_order_statuses(), 'context' => array( 'view', 'edit' ), ), 'currency' => array( - 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce' ), + 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => get_woocommerce_currency(), 'enum' => array_keys( get_woocommerce_currencies() ), 'context' => array( 'view', 'edit' ), ), 'currency_symbol' => array( - 'description' => __( 'Currency symbol.', 'woocommerce' ), + 'description' => __( 'Currency symbol.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the order was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the order was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the order was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_total' => array( - 'description' => __( 'Total discount amount for the order.', 'woocommerce' ), + 'description' => __( 'Total discount amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_tax' => array( - 'description' => __( 'Total discount tax amount for the order.', 'woocommerce' ), + 'description' => __( 'Total discount tax amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_total' => array( - 'description' => __( 'Total shipping amount for the order.', 'woocommerce' ), + 'description' => __( 'Total shipping amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_tax' => array( - 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce' ), + 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cart_tax' => array( - 'description' => __( 'Sum of line item taxes only.', 'woocommerce' ), + 'description' => __( 'Sum of line item taxes only.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Grand total.', 'woocommerce' ), + 'description' => __( 'Grand total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_tax' => array( - 'description' => __( 'Sum of all taxes.', 'woocommerce' ), + 'description' => __( 'Sum of all taxes.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'prices_include_tax' => array( - 'description' => __( 'True the prices included tax during checkout.', 'woocommerce' ), + 'description' => __( 'True the prices included tax during checkout.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_id' => array( - 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce' ), + 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 0, 'context' => array( 'view', 'edit' ), ), 'customer_ip_address' => array( - 'description' => __( "Customer's IP address.", 'woocommerce' ), + 'description' => __( "Customer's IP address.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_user_agent' => array( - 'description' => __( 'User agent of the customer.', 'woocommerce' ), + 'description' => __( 'User agent of the customer.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'customer_note' => array( - 'description' => __( 'Note left by customer during checkout.', 'woocommerce' ), + 'description' => __( 'Note left by customer during checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'billing' => array( - 'description' => __( 'Billing address.', 'woocommerce' ), + 'description' => __( 'Billing address.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), + 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'email' => array( - 'description' => __( 'Email address.', 'woocommerce' ), + 'description' => __( 'Email address.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'phone' => array( - 'description' => __( 'Phone number.', 'woocommerce' ), + 'description' => __( 'Phone number.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping' => array( - 'description' => __( 'Shipping address.', 'woocommerce' ), + 'description' => __( 'Shipping address.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'first_name' => array( - 'description' => __( 'First name.', 'woocommerce' ), + 'description' => __( 'First name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'last_name' => array( - 'description' => __( 'Last name.', 'woocommerce' ), + 'description' => __( 'Last name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'company' => array( - 'description' => __( 'Company name.', 'woocommerce' ), + 'description' => __( 'Company name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_1' => array( - 'description' => __( 'Address line 1', 'woocommerce' ), + 'description' => __( 'Address line 1', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'address_2' => array( - 'description' => __( 'Address line 2', 'woocommerce' ), + 'description' => __( 'Address line 2', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), + 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postal code.', 'woocommerce' ), + 'description' => __( 'Postal code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'country' => array( - 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), + 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'payment_method' => array( - 'description' => __( 'Payment method ID.', 'woocommerce' ), + 'description' => __( 'Payment method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'payment_method_title' => array( - 'description' => __( 'Payment method title.', 'woocommerce' ), + 'description' => __( 'Payment method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -581,60 +581,60 @@ class Orders extends AbstractObjectsController { ), ), 'transaction_id' => array( - 'description' => __( 'Unique transaction ID.', 'woocommerce' ), + 'description' => __( 'Unique transaction ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_paid' => array( - 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_paid_gmt' => array( - 'description' => __( 'The date the order was paid, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was paid, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_completed' => array( - 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_completed_gmt' => array( - 'description' => __( 'The date the order was completed, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the order was completed, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'cart_hash' => array( - 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce' ), + 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -642,67 +642,67 @@ class Orders extends AbstractObjectsController { ), ), 'line_items' => array( - 'description' => __( 'Line items data.', 'woocommerce' ), + 'description' => __( 'Line items data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'product_id' => array( - 'description' => __( 'Product ID.', 'woocommerce' ), + 'description' => __( 'Product ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'variation_id' => array( - 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), + 'description' => __( 'Variation ID, if applicable.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'quantity' => array( - 'description' => __( 'Quantity ordered.', 'woocommerce' ), + 'description' => __( 'Quantity ordered.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class of product.', 'woocommerce' ), + 'description' => __( 'Tax class of product.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal' => array( - 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal_tax' => array( - 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), + 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -710,17 +710,17 @@ class Orders extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -728,25 +728,25 @@ class Orders extends AbstractObjectsController { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -754,13 +754,13 @@ class Orders extends AbstractObjectsController { ), ), 'sku' => array( - 'description' => __( 'Product SKU.', 'woocommerce' ), + 'description' => __( 'Product SKU.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'price' => array( - 'description' => __( 'Product price.', 'woocommerce' ), + 'description' => __( 'Product price.', 'woocommerce-rest-api' ), 'type' => 'number', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -769,7 +769,7 @@ class Orders extends AbstractObjectsController { ), ), 'tax_lines' => array( - 'description' => __( 'Tax lines data.', 'woocommerce' ), + 'description' => __( 'Tax lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -777,67 +777,67 @@ class Orders extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rate_code' => array( - 'description' => __( 'Tax rate code.', 'woocommerce' ), + 'description' => __( 'Tax rate code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rate_id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'Tax rate label.', 'woocommerce' ), + 'description' => __( 'Tax rate label.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'compound' => array( - 'description' => __( 'Show if is a compound tax rate.', 'woocommerce' ), + 'description' => __( 'Show if is a compound tax rate.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tax_total' => array( - 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce' ), + 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_tax_total' => array( - 'description' => __( 'Shipping tax total.', 'woocommerce' ), + 'description' => __( 'Shipping tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -848,46 +848,46 @@ class Orders extends AbstractObjectsController { ), ), 'shipping_lines' => array( - 'description' => __( 'Shipping lines data.', 'woocommerce' ), + 'description' => __( 'Shipping lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_title' => array( - 'description' => __( 'Shipping method name.', 'woocommerce' ), + 'description' => __( 'Shipping method name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'method_id' => array( - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'instance_id' => array( - 'description' => __( 'Shipping instance ID.', 'woocommerce' ), + 'description' => __( 'Shipping instance ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -895,13 +895,13 @@ class Orders extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -910,25 +910,25 @@ class Orders extends AbstractObjectsController { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -939,47 +939,47 @@ class Orders extends AbstractObjectsController { ), ), 'fee_lines' => array( - 'description' => __( 'Fee lines data.', 'woocommerce' ), + 'description' => __( 'Fee lines data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Fee name.', 'woocommerce' ), + 'description' => __( 'Fee name.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class of fee.', 'woocommerce' ), + 'description' => __( 'Tax class of fee.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status of fee.', 'woocommerce' ), + 'description' => __( 'Tax status of fee.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'taxable', 'none' ), ), 'total' => array( - 'description' => __( 'Line total (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'total_tax' => array( - 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), + 'description' => __( 'Line total tax (after discounts).', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'taxes' => array( - 'description' => __( 'Line taxes.', 'woocommerce' ), + 'description' => __( 'Line taxes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -987,19 +987,19 @@ class Orders extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tax rate ID.', 'woocommerce' ), + 'description' => __( 'Tax rate ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Tax total.', 'woocommerce' ), + 'description' => __( 'Tax total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'subtotal' => array( - 'description' => __( 'Tax subtotal.', 'woocommerce' ), + 'description' => __( 'Tax subtotal.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1008,25 +1008,25 @@ class Orders extends AbstractObjectsController { ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1037,55 +1037,55 @@ class Orders extends AbstractObjectsController { ), ), 'coupon_lines' => array( - 'description' => __( 'Coupons line data.', 'woocommerce' ), + 'description' => __( 'Coupons line data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Item ID.', 'woocommerce' ), + 'description' => __( 'Item ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'code' => array( - 'description' => __( 'Coupon code.', 'woocommerce' ), + 'description' => __( 'Coupon code.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'discount' => array( - 'description' => __( 'Discount total.', 'woocommerce' ), + 'description' => __( 'Discount total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'discount_tax' => array( - 'description' => __( 'Discount total tax.', 'woocommerce' ), + 'description' => __( 'Discount total tax.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -1096,7 +1096,7 @@ class Orders extends AbstractObjectsController { ), ), 'refunds' => array( - 'description' => __( 'List of refunds.', 'woocommerce' ), + 'description' => __( 'List of refunds.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1104,19 +1104,19 @@ class Orders extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Refund ID.', 'woocommerce' ), + 'description' => __( 'Refund ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reason' => array( - 'description' => __( 'Refund reason.', 'woocommerce' ), + 'description' => __( 'Refund reason.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total' => array( - 'description' => __( 'Refund total.', 'woocommerce' ), + 'description' => __( 'Refund total.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -1125,7 +1125,7 @@ class Orders extends AbstractObjectsController { ), ), 'set_paid' => array( - 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ), + 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'edit' ), @@ -1146,7 +1146,7 @@ class Orders extends AbstractObjectsController { $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to orders which have specific statuses.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders which have specific statuses.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -1155,27 +1155,27 @@ class Orders extends AbstractObjectsController { 'validate_callback' => 'rest_validate_request_arg', ); $params['customer'] = array( - 'description' => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific customer.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['product'] = array( - 'description' => __( 'Limit result set to orders assigned a specific product.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders assigned a specific product.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['dp'] = array( 'default' => wc_get_price_decimals(), - 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce' ), + 'description' => __( 'Number of decimal points to use in each resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); // This needs to remain a string to support extensions that filter Order Number. $params['number'] = array( - 'description' => __( 'Limit result set to orders matching part of an order number.', 'woocommerce' ), + 'description' => __( 'Limit result set to orders matching part of an order number.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); diff --git a/src/Controllers/Version4/PaymentGateways.php b/src/Controllers/Version4/PaymentGateways.php index 0304d8dfd1f..9cb4001e727 100644 --- a/src/Controllers/Version4/PaymentGateways.php +++ b/src/Controllers/Version4/PaymentGateways.php @@ -57,7 +57,7 @@ class PaymentGateways extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -109,7 +109,7 @@ class PaymentGateways extends AbstractController { $gateway = $this->get_gateway( $request ); if ( is_null( $gateway ) ) { - return new \WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $gateway = $this->prepare_item_for_response( $gateway, $request ); @@ -126,7 +126,7 @@ class PaymentGateways extends AbstractController { $gateway = $this->get_gateway( $request ); if ( is_null( $gateway ) ) { - return new \WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_payment_gateway_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Get settings. @@ -152,7 +152,7 @@ class PaymentGateways extends AbstractController { } if ( $errors_found ) { - return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -302,23 +302,23 @@ class PaymentGateways extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Payment gateway ID.', 'woocommerce' ), + 'description' => __( 'Payment gateway ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Payment gateway title on checkout.', 'woocommerce' ), + 'description' => __( 'Payment gateway title on checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Payment gateway description on checkout.', 'woocommerce' ), + 'description' => __( 'Payment gateway description on checkout.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'order' => array( - 'description' => __( 'Payment gateway sort order.', 'woocommerce' ), + 'description' => __( 'Payment gateway sort order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -326,24 +326,24 @@ class PaymentGateways extends AbstractController { ), ), 'enabled' => array( - 'description' => __( 'Payment gateway enabled status.', 'woocommerce' ), + 'description' => __( 'Payment gateway enabled status.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ), 'method_title' => array( - 'description' => __( 'Payment gateway method title.', 'woocommerce' ), + 'description' => __( 'Payment gateway method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_description' => array( - 'description' => __( 'Payment gateway method description.', 'woocommerce' ), + 'description' => __( 'Payment gateway method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_supports' => array( - 'description' => __( 'Supported features for this payment gateway.', 'woocommerce' ), + 'description' => __( 'Supported features for this payment gateway.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -352,54 +352,54 @@ class PaymentGateways extends AbstractController { ), ), 'settings' => array( - 'description' => __( 'Payment gateway settings.', 'woocommerce' ), + 'description' => __( 'Payment gateway settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ProductAttributeTerms.php b/src/Controllers/Version4/ProductAttributeTerms.php index 1ba1d73bd63..119f2b290c9 100644 --- a/src/Controllers/Version4/ProductAttributeTerms.php +++ b/src/Controllers/Version4/ProductAttributeTerms.php @@ -33,7 +33,7 @@ class ProductAttributeTerms extends AbstractTermsContoller { array( 'args' => array( 'attribute_id' => array( - 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -52,7 +52,7 @@ class ProductAttributeTerms extends AbstractTermsContoller { array( 'name' => array( 'type' => 'string', - 'description' => __( 'Name for the resource.', 'woocommerce' ), + 'description' => __( 'Name for the resource.', 'woocommerce-rest-api' ), 'required' => true, ), ) @@ -69,11 +69,11 @@ class ProductAttributeTerms extends AbstractTermsContoller { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'attribute_id' => array( - 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -99,7 +99,7 @@ class ProductAttributeTerms extends AbstractTermsContoller { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -114,7 +114,7 @@ class ProductAttributeTerms extends AbstractTermsContoller { array( 'args' => array( 'attribute_id' => array( - 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the attribute of the terms.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -177,13 +177,13 @@ class ProductAttributeTerms extends AbstractTermsContoller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Term name.', 'woocommerce' ), + 'description' => __( 'Term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -191,7 +191,7 @@ class ProductAttributeTerms extends AbstractTermsContoller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -199,7 +199,7 @@ class ProductAttributeTerms extends AbstractTermsContoller { ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -207,12 +207,12 @@ class ProductAttributeTerms extends AbstractTermsContoller { ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ProductAttributes.php b/src/Controllers/Version4/ProductAttributes.php index b2176689ac7..115dc709d14 100644 --- a/src/Controllers/Version4/ProductAttributes.php +++ b/src/Controllers/Version4/ProductAttributes.php @@ -59,7 +59,7 @@ class ProductAttributes extends AbstractController { $this->get_endpoint_args_for_item_schema( \WP_REST_Server::CREATABLE ), array( 'name' => array( - 'description' => __( 'Name for the resource.', 'woocommerce' ), + 'description' => __( 'Name for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'required' => true, ), @@ -77,7 +77,7 @@ class ProductAttributes extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -103,7 +103,7 @@ class ProductAttributes extends AbstractController { 'force' => array( 'default' => true, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -261,7 +261,7 @@ class ProductAttributes extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $attribute = $this->get_attribute( (int) $request['id'] ); @@ -275,7 +275,7 @@ class ProductAttributes extends AbstractController { $deleted = wc_delete_attribute( $attribute->attribute_id ); if ( false === $deleted ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $response = new \WP_REST_Response(); @@ -349,13 +349,13 @@ class ProductAttributes extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -363,7 +363,7 @@ class ProductAttributes extends AbstractController { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -371,21 +371,21 @@ class ProductAttributes extends AbstractController { ), ), 'type' => array( - 'description' => __( 'Type of attribute.', 'woocommerce' ), + 'description' => __( 'Type of attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'select', 'enum' => array_keys( wc_get_attribute_types() ), 'context' => array( 'view', 'edit' ), ), 'order_by' => array( - 'description' => __( 'Default sort order.', 'woocommerce' ), + 'description' => __( 'Default sort order.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'menu_order', 'enum' => array( 'menu_order', 'name', 'name_num', 'id' ), 'context' => array( 'view', 'edit' ), ), 'has_archives' => array( - 'description' => __( 'Enable/Disable attribute archives.', 'woocommerce' ), + 'description' => __( 'Enable/Disable attribute archives.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), @@ -449,7 +449,7 @@ class ProductAttributes extends AbstractController { ); if ( is_wp_error( $attribute ) || is_null( $attribute ) ) { - return new \WP_Error( 'woocommerce_rest_attribute_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_attribute_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $attribute; @@ -466,13 +466,13 @@ class ProductAttributes extends AbstractController { protected function validate_attribute_slug( $slug, $new_data = true ) { if ( strlen( $slug ) >= 28 ) { /* Translators: %s slug. */ - return new \WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max). Shorten it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max). Shorten it, please.', 'woocommerce-rest-api' ), $slug ), array( 'status' => 400 ) ); } elseif ( wc_check_if_attribute_name_is_reserved( $slug ) ) { /* Translators: %s slug. */ - return new \WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce-rest-api' ), $slug ), array( 'status' => 400 ) ); } elseif ( $new_data && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) { /* Translators: %s slug. */ - return new \WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce-rest-api' ), $slug ), array( 'status' => 400 ) ); } return true; diff --git a/src/Controllers/Version4/ProductCategories.php b/src/Controllers/Version4/ProductCategories.php index 5ad40a1eb28..cf863a2342d 100644 --- a/src/Controllers/Version4/ProductCategories.php +++ b/src/Controllers/Version4/ProductCategories.php @@ -141,13 +141,13 @@ class ProductCategories extends AbstractTermsContoller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -155,7 +155,7 @@ class ProductCategories extends AbstractTermsContoller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -163,12 +163,12 @@ class ProductCategories extends AbstractTermsContoller { ), ), 'parent' => array( - 'description' => __( 'The ID for the parent of the resource.', 'woocommerce' ), + 'description' => __( 'The ID for the parent of the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -176,71 +176,71 @@ class ProductCategories extends AbstractTermsContoller { ), ), 'display' => array( - 'description' => __( 'Category archive display type.', 'woocommerce' ), + 'description' => __( 'Category archive display type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'default', 'enum' => array( 'default', 'products', 'subcategories', 'both' ), 'context' => array( 'view', 'edit' ), ), 'image' => array( - 'description' => __( 'Image data.', 'woocommerce' ), + 'description' => __( 'Image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ProductReviews.php b/src/Controllers/Version4/ProductReviews.php index 7c307aa80e3..9941ae93b67 100644 --- a/src/Controllers/Version4/ProductReviews.php +++ b/src/Controllers/Version4/ProductReviews.php @@ -57,23 +57,23 @@ class ProductReviews extends AbstractController { array( 'product_id' => array( 'required' => true, - 'description' => __( 'Unique identifier for the product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'review' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Review content.', 'woocommerce' ), + 'description' => __( 'Review content.', 'woocommerce-rest-api' ), ), 'reviewer' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Name of the reviewer.', 'woocommerce' ), + 'description' => __( 'Name of the reviewer.', 'woocommerce-rest-api' ), ), 'reviewer_email' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Email of the reviewer.', 'woocommerce' ), + 'description' => __( 'Email of the reviewer.', 'woocommerce-rest-api' ), ), ) ), @@ -89,7 +89,7 @@ class ProductReviews extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -115,7 +115,7 @@ class ProductReviews extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -256,13 +256,13 @@ class ProductReviews extends AbstractController { */ public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { - return new \WP_Error( 'woocommerce_rest_review_exists', __( 'Cannot create existing product review.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_review_exists', __( 'Cannot create existing product review.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $product_id = (int) $request['product_id']; if ( 'product' !== get_post_type( $product_id ) ) { - return new \WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $prepared_review = $this->prepare_item_for_database( $request ); @@ -276,7 +276,7 @@ class ProductReviews extends AbstractController { * Do not allow a comment to be created with missing or empty comment_content. See wp_handle_comment_submission(). */ if ( empty( $prepared_review['comment_content'] ) ) { - return new \WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Setting remaining values before wp_insert_comment so we can use wp_allow_comment(). @@ -301,7 +301,7 @@ class ProductReviews extends AbstractController { $check_comment_lengths = wp_check_comment_data_max_lengths( $prepared_review ); if ( is_wp_error( $check_comment_lengths ) ) { $error_code = str_replace( array( 'comment_author', 'comment_content' ), array( 'reviewer', 'review_content' ), $check_comment_lengths->get_error_code() ); - return new \WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $prepared_review['comment_parent'] = 0; @@ -342,7 +342,7 @@ class ProductReviews extends AbstractController { $review_id = wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_review ) ) ); if ( ! $review_id ) { - return new \WP_Error( 'woocommerce_rest_review_failed_create', __( 'Creating product review failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_review_failed_create', __( 'Creating product review failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } if ( isset( $request['status'] ) ) { @@ -408,7 +408,7 @@ class ProductReviews extends AbstractController { $id = (int) $review->comment_ID; if ( isset( $request['type'] ) && 'review' !== get_comment_type( $id ) ) { - return new \WP_Error( 'woocommerce_rest_review_invalid_type', __( 'Sorry, you are not allowed to change the comment type.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_review_invalid_type', __( 'Sorry, you are not allowed to change the comment type.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $prepared_args = $this->prepare_item_for_database( $request ); @@ -418,7 +418,7 @@ class ProductReviews extends AbstractController { if ( ! empty( $prepared_args['comment_post_ID'] ) ) { if ( 'product' !== get_post_type( (int) $prepared_args['comment_post_ID'] ) ) { - return new \WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } } @@ -427,7 +427,7 @@ class ProductReviews extends AbstractController { $change = $this->handle_status_param( $request['status'], $id ); if ( ! $change ) { - return new \WP_Error( 'woocommerce_rest_review_failed_edit', __( 'Updating review status failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_review_failed_edit', __( 'Updating review status failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } } elseif ( ! empty( $prepared_args ) ) { if ( is_wp_error( $prepared_args ) ) { @@ -435,7 +435,7 @@ class ProductReviews extends AbstractController { } if ( isset( $prepared_args['comment_content'] ) && empty( $prepared_args['comment_content'] ) ) { - return new \WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_review_content_invalid', __( 'Invalid review content.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $prepared_args['comment_ID'] = $id; @@ -443,13 +443,13 @@ class ProductReviews extends AbstractController { $check_comment_lengths = wp_check_comment_data_max_lengths( $prepared_args ); if ( is_wp_error( $check_comment_lengths ) ) { $error_code = str_replace( array( 'comment_author', 'comment_content' ), array( 'reviewer', 'review_content' ), $check_comment_lengths->get_error_code() ); - return new \WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_' . $error_code, __( 'Product review field exceeds maximum length allowed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $updated = wp_update_comment( wp_slash( (array) $prepared_args ) ); if ( false === $updated ) { - return new \WP_Error( 'woocommerce_rest_comment_failed_edit', __( 'Updating review failed.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_comment_failed_edit', __( 'Updating review failed.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } if ( isset( $request['status'] ) ) { @@ -518,11 +518,11 @@ class ProductReviews extends AbstractController { // If this type doesn't support trashing, error out. if ( ! $supports_trash ) { /* translators: %s: force=true */ - return new \WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( "The object does not support trashing. Set '%s' to delete.", 'woocommerce' ), 'force=true' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', sprintf( __( "The object does not support trashing. Set '%s' to delete.", 'woocommerce-rest-api' ), 'force=true' ), array( 'status' => 501 ) ); } if ( 'trash' === $review->comment_approved ) { - return new \WP_Error( 'woocommerce_rest_already_trashed', __( 'The object has already been trashed.', 'woocommerce' ), array( 'status' => 410 ) ); + return new \WP_Error( 'woocommerce_rest_already_trashed', __( 'The object has already been trashed.', 'woocommerce-rest-api' ), array( 'status' => 410 ) ); } $result = wp_trash_comment( $review->comment_ID ); @@ -531,7 +531,7 @@ class ProductReviews extends AbstractController { } if ( ! $result ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The object cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The object cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -655,48 +655,48 @@ class ProductReviews extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the review was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the review was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the review was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'product_id' => array( - 'description' => __( 'Unique identifier for the product that the review belongs to.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the product that the review belongs to.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Status of the review.', 'woocommerce' ), + 'description' => __( 'Status of the review.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'approved', 'enum' => array( 'approved', 'hold', 'spam', 'unspam', 'trash', 'untrash' ), 'context' => array( 'view', 'edit' ), ), 'reviewer' => array( - 'description' => __( 'Reviewer name.', 'woocommerce' ), + 'description' => __( 'Reviewer name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'reviewer_email' => array( - 'description' => __( 'Reviewer email.', 'woocommerce' ), + 'description' => __( 'Reviewer email.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'email', 'context' => array( 'view', 'edit' ), ), 'review' => array( - 'description' => __( 'The content of the review.', 'woocommerce' ), + 'description' => __( 'The content of the review.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -704,12 +704,12 @@ class ProductReviews extends AbstractController { ), ), 'rating' => array( - 'description' => __( 'Review rating (0 to 5).', 'woocommerce' ), + 'description' => __( 'Review rating (0 to 5).', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'verified' => array( - 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce' ), + 'description' => __( 'Shows if the reviewer bought the product or not.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -724,14 +724,14 @@ class ProductReviews extends AbstractController { foreach ( $avatar_sizes as $size ) { $avatar_properties[ $size ] = array( /* translators: %d: avatar image size in pixels */ - 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce' ), $size ), + 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce-rest-api' ), $size ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'embed', 'view', 'edit' ), ); } $schema['properties']['reviewer_avatar_urls'] = array( - 'description' => __( 'Avatar URLs for the object reviewer.', 'woocommerce' ), + 'description' => __( 'Avatar URLs for the object reviewer.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -753,17 +753,17 @@ class ProductReviews extends AbstractController { $params['context']['default'] = 'view'; $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', ); $params['before'] = array( - 'description' => __( 'Limit response to reviews published before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to reviews published before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -771,7 +771,7 @@ class ProductReviews extends AbstractController { 'default' => array(), ); $params['include'] = array( - 'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -779,11 +779,11 @@ class ProductReviews extends AbstractController { 'default' => array(), ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( @@ -792,7 +792,7 @@ class ProductReviews extends AbstractController { ), ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date_gmt', 'enum' => array( @@ -804,14 +804,14 @@ class ProductReviews extends AbstractController { ), ); $params['reviewer'] = array( - 'description' => __( 'Limit result set to reviews assigned to specific user IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to reviews assigned to specific user IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', ), ); $params['reviewer_exclude'] = array( - 'description' => __( 'Ensure result set excludes reviews assigned to specific user IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes reviews assigned to specific user IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -819,13 +819,13 @@ class ProductReviews extends AbstractController { ); $params['reviewer_email'] = array( 'default' => null, - 'description' => __( 'Limit result set to that from a specific author email.', 'woocommerce' ), + 'description' => __( 'Limit result set to that from a specific author email.', 'woocommerce-rest-api' ), 'format' => 'email', 'type' => 'string', ); $params['product'] = array( 'default' => array(), - 'description' => __( 'Limit result set to reviews assigned to specific product IDs.', 'woocommerce' ), + 'description' => __( 'Limit result set to reviews assigned to specific product IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -833,7 +833,7 @@ class ProductReviews extends AbstractController { ); $params['status'] = array( 'default' => 'approved', - 'description' => __( 'Limit result set to reviews assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to reviews assigned a specific status.', 'woocommerce-rest-api' ), 'sanitize_callback' => 'sanitize_key', 'type' => 'string', 'enum' => array( @@ -867,7 +867,7 @@ class ProductReviews extends AbstractController { */ protected function get_review( $id ) { $id = (int) $id; - $error = new \WP_Error( 'woocommerce_rest_review_invalid_id', __( 'Invalid review ID.', 'woocommerce' ), array( 'status' => 404 ) ); + $error = new \WP_Error( 'woocommerce_rest_review_invalid_id', __( 'Invalid review ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); if ( 0 >= $id ) { return $error; @@ -882,7 +882,7 @@ class ProductReviews extends AbstractController { $post = get_post( (int) $review->comment_post_ID ); if ( 'product' !== get_post_type( (int) $review->comment_post_ID ) ) { - return new \WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_product_invalid_id', __( 'Invalid product ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } } diff --git a/src/Controllers/Version4/ProductShippingClasses.php b/src/Controllers/Version4/ProductShippingClasses.php index 3353034f847..230cb312eb7 100644 --- a/src/Controllers/Version4/ProductShippingClasses.php +++ b/src/Controllers/Version4/ProductShippingClasses.php @@ -59,13 +59,13 @@ class ProductShippingClasses extends AbstractTermsContoller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Shipping class name.', 'woocommerce' ), + 'description' => __( 'Shipping class name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -73,7 +73,7 @@ class ProductShippingClasses extends AbstractTermsContoller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -81,7 +81,7 @@ class ProductShippingClasses extends AbstractTermsContoller { ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -89,7 +89,7 @@ class ProductShippingClasses extends AbstractTermsContoller { ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ProductTags.php b/src/Controllers/Version4/ProductTags.php index edc0c7610a6..752d270afd3 100644 --- a/src/Controllers/Version4/ProductTags.php +++ b/src/Controllers/Version4/ProductTags.php @@ -59,13 +59,13 @@ class ProductTags extends AbstractTermsContoller { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Tag name.', 'woocommerce' ), + 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -73,7 +73,7 @@ class ProductTags extends AbstractTermsContoller { ), ), 'slug' => array( - 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ), + 'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -81,7 +81,7 @@ class ProductTags extends AbstractTermsContoller { ), ), 'description' => array( - 'description' => __( 'HTML description of the resource.', 'woocommerce' ), + 'description' => __( 'HTML description of the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -89,7 +89,7 @@ class ProductTags extends AbstractTermsContoller { ), ), 'count' => array( - 'description' => __( 'Number of published products for the resource.', 'woocommerce' ), + 'description' => __( 'Number of published products for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ProductVariations.php b/src/Controllers/Version4/ProductVariations.php index bdcb73b4573..e0a6bbad5a1 100644 --- a/src/Controllers/Version4/ProductVariations.php +++ b/src/Controllers/Version4/ProductVariations.php @@ -44,7 +44,7 @@ class ProductVariations extends Products { array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -70,11 +70,11 @@ class ProductVariations extends Products { array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'id' => array( - 'description' => __( 'Unique identifier for the variation.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variation.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -104,7 +104,7 @@ class ProductVariations extends Products { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -118,7 +118,7 @@ class ProductVariations extends Products { array( 'args' => array( 'product_id' => array( - 'description' => __( 'Unique identifier for the variable product.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the variable product.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -148,42 +148,42 @@ class ProductVariations extends Products { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product parent name.', 'woocommerce' ), + 'description' => __( 'Product parent name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'type' => array( - 'description' => __( 'Product type.', 'woocommerce' ), + 'description' => __( 'Product type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'variation', 'enum' => array( 'variation' ), 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'Product parent ID.', 'woocommerce' ), + 'description' => __( 'Product parent ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the variation was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Variation description.', 'woocommerce' ), + 'description' => __( 'Variation description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -191,14 +191,14 @@ class ProductVariations extends Products { ), ), 'permalink' => array( - 'description' => __( 'Variation URL.', 'woocommerce' ), + 'description' => __( 'Variation URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -206,91 +206,91 @@ class ProductVariations extends Products { ), ), 'price' => array( - 'description' => __( 'Current variation price.', 'woocommerce' ), + 'description' => __( 'Current variation price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Variation regular price.', 'woocommerce' ), + 'description' => __( 'Variation regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Variation sale price.', 'woocommerce' ), + 'description' => __( 'Variation sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from_gmt' => array( - 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to_gmt' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'on_sale' => array( - 'description' => __( 'Shows if the variation is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'status' => array( - 'description' => __( 'Variation status.', 'woocommerce' ), + 'description' => __( 'Variation status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'publish', 'enum' => array_keys( get_post_statuses() ), 'context' => array( 'view', 'edit' ), ), 'purchasable' => array( - 'description' => __( 'Shows if the variation can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the variation can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the variation is virtual.', 'woocommerce' ), + 'description' => __( 'If the variation is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the variation is downloadable.', 'woocommerce' ), + 'description' => __( 'If the variation is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -298,179 +298,179 @@ class ProductVariations extends Products { ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at variation level.', 'woocommerce' ), + 'description' => __( 'Stock management at variation level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'stock_status' => array( - 'description' => __( 'Controls the stock status of the product.', 'woocommerce' ), + 'description' => __( 'Controls the stock status of the product.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'instock', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the variation is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Variation weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Variation dimensions.', 'woocommerce' ), + 'description' => __( 'Variation dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Variation height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'image' => array( - 'description' => __( 'Variation image data.', 'woocommerce' ), + 'description' => __( 'Variation image data.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -478,30 +478,30 @@ class ProductVariations extends Products { ), ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -533,7 +533,7 @@ class ProductVariations extends Products { ); $params['stock_status'] = array( - 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'sanitize_callback' => 'sanitize_text_field', @@ -541,7 +541,7 @@ class ProductVariations extends Products { ); $params['search'] = array( - 'description' => __( 'Search by similar product name or sku.', 'woocommerce' ), + 'description' => __( 'Search by similar product name or sku.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); @@ -571,12 +571,12 @@ class ProductVariations extends Products { $object = $this->get_object( $id ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } // Check if variation belongs to the correct parent product. if ( $object && 0 !== $object->get_parent_id() && absint( $request['product_id'] ) !== $object->get_parent_id() ) { - return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Parent product does not match current variation.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) ); + return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Parent product does not match current variation.', 'woocommerce-rest-api' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } @@ -751,7 +751,7 @@ class ProductVariations extends Products { if ( ! $object || 0 === $object->get_id() ) { return new \WP_Error( - "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( + "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404, ) ); @@ -772,7 +772,7 @@ class ProductVariations extends Products { if ( ! Permissions::user_can_delete( $this->post_type, $object->get_id() ) ) { return new \WP_Error( /* translators: %s: post type */ - "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), array( + "woocommerce_rest_user_cannot_delete_{$this->post_type}", sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code(), ) ); @@ -799,7 +799,7 @@ class ProductVariations extends Products { if ( ! $supports_trash ) { return new \WP_Error( /* translators: %s: post type */ - 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), array( + 'woocommerce_rest_trash_not_supported', sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501, ) ); @@ -810,7 +810,7 @@ class ProductVariations extends Products { if ( 'trash' === $object->get_status() ) { return new \WP_Error( /* translators: %s: post type */ - 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), array( + 'woocommerce_rest_already_trashed', sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410, ) ); @@ -826,7 +826,7 @@ class ProductVariations extends Products { if ( ! $result ) { return new \WP_Error( /* translators: %s: post type */ - 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( + 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500, ) ); diff --git a/src/Controllers/Version4/Products.php b/src/Controllers/Version4/Products.php index 888250eb535..592d54b4a20 100644 --- a/src/Controllers/Version4/Products.php +++ b/src/Controllers/Version4/Products.php @@ -55,13 +55,13 @@ class Products extends AbstractObjectsController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Product name.', 'woocommerce' ), + 'description' => __( 'Product name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( @@ -69,68 +69,68 @@ class Products extends AbstractObjectsController { ), ), 'slug' => array( - 'description' => __( 'Product slug.', 'woocommerce' ), + 'description' => __( 'Product slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), ), 'permalink' => array( - 'description' => __( 'Product URL.', 'woocommerce' ), + 'description' => __( 'Product URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit', 'embed' ), 'readonly' => true, ), 'date_created' => array( - 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_created_gmt' => array( - 'description' => __( 'The date the product was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the product was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_modified' => array( - 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the product was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the product was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Product type.', 'woocommerce' ), + 'description' => __( 'Product type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'simple', 'enum' => array_keys( wc_get_product_types() ), 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Product status (post status).', 'woocommerce' ), + 'description' => __( 'Product status (post status).', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'publish', 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), 'context' => array( 'view', 'edit' ), ), 'featured' => array( - 'description' => __( 'Featured product.', 'woocommerce' ), + 'description' => __( 'Featured product.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'catalog_visibility' => array( - 'description' => __( 'Catalog visibility.', 'woocommerce' ), + 'description' => __( 'Catalog visibility.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'visible', 'enum' => array( 'visible', 'catalog', 'search', 'hidden' ), 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'Product description.', 'woocommerce' ), + 'description' => __( 'Product description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( @@ -138,7 +138,7 @@ class Products extends AbstractObjectsController { ), ), 'short_description' => array( - 'description' => __( 'Product short description.', 'woocommerce' ), + 'description' => __( 'Product short description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit', 'embed' ), 'arg_options' => array( @@ -146,7 +146,7 @@ class Products extends AbstractObjectsController { ), ), 'sku' => array( - 'description' => __( 'Unique identifier.', 'woocommerce' ), + 'description' => __( 'Unique identifier.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -154,96 +154,96 @@ class Products extends AbstractObjectsController { ), ), 'price' => array( - 'description' => __( 'Current product price.', 'woocommerce' ), + 'description' => __( 'Current product price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'regular_price' => array( - 'description' => __( 'Product regular price.', 'woocommerce' ), + 'description' => __( 'Product regular price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sale_price' => array( - 'description' => __( 'Product sale price.', 'woocommerce' ), + 'description' => __( 'Product sale price.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from' => array( - 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "Start date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_from_gmt' => array( - 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce' ), + 'description' => __( 'Start date of sale price, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'date_on_sale_to_gmt' => array( - 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce' ), + 'description' => __( "End date of sale price, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), ), 'price_html' => array( - 'description' => __( 'Price formatted in HTML.', 'woocommerce' ), + 'description' => __( 'Price formatted in HTML.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'on_sale' => array( - 'description' => __( 'Shows if the product is on sale.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'purchasable' => array( - 'description' => __( 'Shows if the product can be bought.', 'woocommerce' ), + 'description' => __( 'Shows if the product can be bought.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'total_sales' => array( - 'description' => __( 'Amount of sales.', 'woocommerce' ), + 'description' => __( 'Amount of sales.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'virtual' => array( - 'description' => __( 'If the product is virtual.', 'woocommerce' ), + 'description' => __( 'If the product is virtual.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloadable' => array( - 'description' => __( 'If the product is downloadable.', 'woocommerce' ), + 'description' => __( 'If the product is downloadable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'downloads' => array( - 'description' => __( 'List of downloadable files.', 'woocommerce' ), + 'description' => __( 'List of downloadable files.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'File ID.', 'woocommerce' ), + 'description' => __( 'File ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'File name.', 'woocommerce' ), + 'description' => __( 'File name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'file' => array( - 'description' => __( 'File URL.', 'woocommerce' ), + 'description' => __( 'File URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -251,157 +251,157 @@ class Products extends AbstractObjectsController { ), ), 'download_limit' => array( - 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce' ), + 'description' => __( 'Number of times downloadable files can be downloaded after purchase.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'download_expiry' => array( - 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce' ), + 'description' => __( 'Number of days until access to downloadable files expires.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => -1, 'context' => array( 'view', 'edit' ), ), 'external_url' => array( - 'description' => __( 'Product external URL. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external URL. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'button_text' => array( - 'description' => __( 'Product external button text. Only for external products.', 'woocommerce' ), + 'description' => __( 'Product external button text. Only for external products.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'tax_status' => array( - 'description' => __( 'Tax status.', 'woocommerce' ), + 'description' => __( 'Tax status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'taxable', 'enum' => array( 'taxable', 'shipping', 'none' ), 'context' => array( 'view', 'edit' ), ), 'tax_class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'manage_stock' => array( - 'description' => __( 'Stock management at product level.', 'woocommerce' ), + 'description' => __( 'Stock management at product level.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'stock_quantity' => array( - 'description' => __( 'Stock quantity.', 'woocommerce' ), + 'description' => __( 'Stock quantity.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'stock_status' => array( - 'description' => __( 'Controls the stock status of the product.', 'woocommerce' ), + 'description' => __( 'Controls the stock status of the product.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'instock', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'context' => array( 'view', 'edit' ), ), 'backorders' => array( - 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'If managing stock, this controls if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'no', 'enum' => array( 'no', 'notify', 'yes' ), 'context' => array( 'view', 'edit' ), ), 'backorders_allowed' => array( - 'description' => __( 'Shows if backorders are allowed.', 'woocommerce' ), + 'description' => __( 'Shows if backorders are allowed.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'backordered' => array( - 'description' => __( 'Shows if the product is on backordered.', 'woocommerce' ), + 'description' => __( 'Shows if the product is on backordered.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'sold_individually' => array( - 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce' ), + 'description' => __( 'Allow one item to be bought in a single order.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'weight' => array( /* translators: %s: weight unit */ - 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce' ), $weight_unit ), + 'description' => sprintf( __( 'Product weight (%s).', 'woocommerce-rest-api' ), $weight_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'dimensions' => array( - 'description' => __( 'Product dimensions.', 'woocommerce' ), + 'description' => __( 'Product dimensions.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'length' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product length (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product length (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'width' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product width (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product width (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'height' => array( /* translators: %s: dimension unit */ - 'description' => sprintf( __( 'Product height (%s).', 'woocommerce' ), $dimension_unit ), + 'description' => sprintf( __( 'Product height (%s).', 'woocommerce-rest-api' ), $dimension_unit ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), ), ), 'shipping_required' => array( - 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce' ), + 'description' => __( 'Shows if the product need to be shipped.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_taxable' => array( - 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce' ), + 'description' => __( 'Shows whether or not the product shipping is taxable.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'shipping_class' => array( - 'description' => __( 'Shipping class slug.', 'woocommerce' ), + 'description' => __( 'Shipping class slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'shipping_class_id' => array( - 'description' => __( 'Shipping class ID.', 'woocommerce' ), + 'description' => __( 'Shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'reviews_allowed' => array( - 'description' => __( 'Allow reviews.', 'woocommerce' ), + 'description' => __( 'Allow reviews.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'average_rating' => array( - 'description' => __( 'Reviews average rating.', 'woocommerce' ), + 'description' => __( 'Reviews average rating.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'rating_count' => array( - 'description' => __( 'Amount of reviews that the product have.', 'woocommerce' ), + 'description' => __( 'Amount of reviews that the product have.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'related_ids' => array( - 'description' => __( 'List of related products IDs.', 'woocommerce' ), + 'description' => __( 'List of related products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -410,7 +410,7 @@ class Products extends AbstractObjectsController { 'readonly' => true, ), 'upsell_ids' => array( - 'description' => __( 'List of up-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of up-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -418,7 +418,7 @@ class Products extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'cross_sell_ids' => array( - 'description' => __( 'List of cross-sell products IDs.', 'woocommerce' ), + 'description' => __( 'List of cross-sell products IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -426,12 +426,12 @@ class Products extends AbstractObjectsController { 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'Product parent ID.', 'woocommerce' ), + 'description' => __( 'Product parent ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'purchase_note' => array( - 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce' ), + 'description' => __( 'Optional note to send the customer after purchase.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -439,25 +439,25 @@ class Products extends AbstractObjectsController { ), ), 'categories' => array( - 'description' => __( 'List of categories.', 'woocommerce' ), + 'description' => __( 'List of categories.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Category ID.', 'woocommerce' ), + 'description' => __( 'Category ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Category name.', 'woocommerce' ), + 'description' => __( 'Category name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Category slug.', 'woocommerce' ), + 'description' => __( 'Category slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -466,25 +466,25 @@ class Products extends AbstractObjectsController { ), ), 'tags' => array( - 'description' => __( 'List of tags.', 'woocommerce' ), + 'description' => __( 'List of tags.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Tag ID.', 'woocommerce' ), + 'description' => __( 'Tag ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Tag name.', 'woocommerce' ), + 'description' => __( 'Tag name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'slug' => array( - 'description' => __( 'Tag slug.', 'woocommerce' ), + 'description' => __( 'Tag slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -493,54 +493,54 @@ class Products extends AbstractObjectsController { ), ), 'images' => array( - 'description' => __( 'List of images.', 'woocommerce' ), + 'description' => __( 'List of images.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit', 'embed' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Image ID.', 'woocommerce' ), + 'description' => __( 'Image ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the image was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the image was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the image was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'src' => array( - 'description' => __( 'Image URL.', 'woocommerce' ), + 'description' => __( 'Image URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Image name.', 'woocommerce' ), + 'description' => __( 'Image name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'alt' => array( - 'description' => __( 'Image alternative text.', 'woocommerce' ), + 'description' => __( 'Image alternative text.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -548,41 +548,41 @@ class Products extends AbstractObjectsController { ), ), 'attributes' => array( - 'description' => __( 'List of attributes.', 'woocommerce' ), + 'description' => __( 'List of attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'position' => array( - 'description' => __( 'Attribute position.', 'woocommerce' ), + 'description' => __( 'Attribute position.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'visible' => array( - 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce' ), + 'description' => __( "Define if the attribute is visible on the \"Additional information\" tab in the product's page.", 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'variation' => array( - 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce' ), + 'description' => __( 'Define if the attribute can be used as variation.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'options' => array( - 'description' => __( 'List of available term names of the attribute.', 'woocommerce' ), + 'description' => __( 'List of available term names of the attribute.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'string', @@ -593,24 +593,24 @@ class Products extends AbstractObjectsController { ), ), 'default_attributes' => array( - 'description' => __( 'Defaults variation attributes.', 'woocommerce' ), + 'description' => __( 'Defaults variation attributes.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Attribute ID.', 'woocommerce' ), + 'description' => __( 'Attribute ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Attribute name.', 'woocommerce' ), + 'description' => __( 'Attribute name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'option' => array( - 'description' => __( 'Selected attribute term name.', 'woocommerce' ), + 'description' => __( 'Selected attribute term name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), @@ -618,7 +618,7 @@ class Products extends AbstractObjectsController { ), ), 'variations' => array( - 'description' => __( 'List of variations IDs.', 'woocommerce' ), + 'description' => __( 'List of variations IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -627,7 +627,7 @@ class Products extends AbstractObjectsController { 'readonly' => true, ), 'grouped_products' => array( - 'description' => __( 'List of grouped products ID.', 'woocommerce' ), + 'description' => __( 'List of grouped products ID.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -636,30 +636,30 @@ class Products extends AbstractObjectsController { 'readonly' => true, ), 'menu_order' => array( - 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce' ), + 'description' => __( 'Menu order, used to custom sort products.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'meta_data' => array( - 'description' => __( 'Meta data.', 'woocommerce' ), + 'description' => __( 'Meta data.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Meta ID.', 'woocommerce' ), + 'description' => __( 'Meta ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'key' => array( - 'description' => __( 'Meta key.', 'woocommerce' ), + 'description' => __( 'Meta key.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'value' => array( - 'description' => __( 'Meta value.', 'woocommerce' ), + 'description' => __( 'Meta value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), @@ -681,14 +681,14 @@ class Products extends AbstractObjectsController { $params = parent::get_collection_params(); $params['slug'] = array( - 'description' => __( 'Limit result set to products with a specific slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); $params['status'] = array( 'default' => 'any', - 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'any', 'future' ), array_keys( get_post_statuses() ) ), 'sanitize_callback' => 'sanitize_key', @@ -696,7 +696,7 @@ class Products extends AbstractObjectsController { ); $params['type'] = array( - 'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific type.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_types() ), 'sanitize_callback' => 'sanitize_key', @@ -704,49 +704,49 @@ class Products extends AbstractObjectsController { ); $params['sku'] = array( - 'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['featured'] = array( - 'description' => __( 'Limit result set to featured products.', 'woocommerce' ), + 'description' => __( 'Limit result set to featured products.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'sanitize_callback' => 'wc_string_to_bool', 'validate_callback' => 'rest_validate_request_arg', ); $params['category'] = array( - 'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific category ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['tag'] = array( - 'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific tag ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['shipping_class'] = array( - 'description' => __( 'Limit result set to products assigned a specific shipping class ID.', 'woocommerce' ), + 'description' => __( 'Limit result set to products assigned a specific shipping class ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $params['attribute'] = array( - 'description' => __( 'Limit result set to products with a specific attribute. Use the taxonomy name/attribute slug.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific attribute. Use the taxonomy name/attribute slug.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['attribute_term'] = array( - 'description' => __( 'Limit result set to products with a specific attribute term ID (required an assigned attribute).', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific attribute term ID (required an assigned attribute).', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', @@ -754,7 +754,7 @@ class Products extends AbstractObjectsController { if ( wc_tax_enabled() ) { $params['tax_class'] = array( - 'description' => __( 'Limit result set to products with a specific tax class.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with a specific tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_merge( array( 'standard' ), \WC_Tax::get_tax_class_slugs() ), 'sanitize_callback' => 'sanitize_text_field', @@ -763,28 +763,28 @@ class Products extends AbstractObjectsController { } $params['on_sale'] = array( - 'description' => __( 'Limit result set to products on sale.', 'woocommerce' ), + 'description' => __( 'Limit result set to products on sale.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'sanitize_callback' => 'wc_string_to_bool', 'validate_callback' => 'rest_validate_request_arg', ); $params['min_price'] = array( - 'description' => __( 'Limit result set to products based on a minimum price.', 'woocommerce' ), + 'description' => __( 'Limit result set to products based on a minimum price.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['max_price'] = array( - 'description' => __( 'Limit result set to products based on a maximum price.', 'woocommerce' ), + 'description' => __( 'Limit result set to products based on a maximum price.', 'woocommerce-rest-api' ), 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'validate_callback' => 'rest_validate_request_arg', ); $params['stock_status'] = array( - 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce' ), + 'description' => __( 'Limit result set to products with specified stock status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array_keys( wc_get_product_stock_status_options() ), 'sanitize_callback' => 'sanitize_text_field', @@ -792,14 +792,14 @@ class Products extends AbstractObjectsController { ); $params['low_in_stock'] = array( - 'description' => __( 'Limit result set to products that are low or out of stock.', 'woocommerce' ), + 'description' => __( 'Limit result set to products that are low or out of stock.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'sanitize_callback' => 'wc_string_to_bool', ); $params['search'] = array( - 'description' => __( 'Search by similar product name or sku.', 'woocommerce' ), + 'description' => __( 'Search by similar product name or sku.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); @@ -1113,7 +1113,7 @@ class Products extends AbstractObjectsController { if ( ! $object || 0 === $object->get_id() ) { return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", - __( 'Invalid ID.', 'woocommerce' ), + __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404, ) @@ -1123,7 +1123,7 @@ class Products extends AbstractObjectsController { if ( 'variation' === $object->get_type() ) { return new \WP_Error( "woocommerce_rest_invalid_{$this->post_type}_id", - __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), + __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), array( 'status' => 404, ) @@ -1146,7 +1146,7 @@ class Products extends AbstractObjectsController { return new \WP_Error( "woocommerce_rest_user_cannot_delete_{$this->post_type}", /* translators: %s: post type */ - sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'Sorry, you are not allowed to delete %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => rest_authorization_required_code(), ) @@ -1175,7 +1175,7 @@ class Products extends AbstractObjectsController { return new \WP_Error( 'woocommerce_rest_trash_not_supported', /* translators: %s: post type */ - sprintf( __( 'The %s does not support trashing.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'The %s does not support trashing.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 501, ) @@ -1188,7 +1188,7 @@ class Products extends AbstractObjectsController { return new \WP_Error( 'woocommerce_rest_already_trashed', /* translators: %s: post type */ - sprintf( __( 'The %s has already been deleted.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'The %s has already been deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 410, ) @@ -1206,7 +1206,7 @@ class Products extends AbstractObjectsController { return new \WP_Error( 'woocommerce_rest_cannot_delete', /* translators: %s: post type */ - sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), + sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500, ) diff --git a/src/Controllers/Version4/Requests/CustomerRequest.php b/src/Controllers/Version4/Requests/CustomerRequest.php index f852f39669e..eee26f94961 100644 --- a/src/Controllers/Version4/Requests/CustomerRequest.php +++ b/src/Controllers/Version4/Requests/CustomerRequest.php @@ -25,7 +25,7 @@ class CustomerRequest extends AbstractObjectRequest { $object = new \WC_Customer( $id ); if ( $id !== $object->get_id() ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), 400 ); } $this->set_props( $object ); @@ -60,13 +60,13 @@ class CustomerRequest extends AbstractObjectRequest { switch ( $prop ) { case 'email': if ( email_exists( $value ) && $value !== $object->get_email() ) { - throw new \WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce-rest-api' ), 400 ); } $prop_values[ $prop ] = $value; break; case 'username': if ( $object->get_id() && $value !== $object->get_username() ) { - throw new \WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce-rest-api' ), 400 ); } $prop_values[ $prop ] = $value; break; diff --git a/src/Controllers/Version4/Requests/OrderRequest.php b/src/Controllers/Version4/Requests/OrderRequest.php index 6a8af0b97ca..2e8109702f7 100644 --- a/src/Controllers/Version4/Requests/OrderRequest.php +++ b/src/Controllers/Version4/Requests/OrderRequest.php @@ -181,7 +181,7 @@ class OrderRequest extends AbstractObjectRequest { } elseif ( ! empty( $posted['variation_id'] ) ) { $product_id = (int) $posted['variation_id']; } else { - throw new \WC_REST_Exception( 'woocommerce_rest_required_product_reference', __( 'Product ID or SKU is required.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_required_product_reference', __( 'Product ID or SKU is required.', 'woocommerce-rest-api' ), 400 ); } return $product_id; } @@ -230,7 +230,7 @@ class OrderRequest extends AbstractObjectRequest { if ( 'create' === $action ) { if ( empty( $posted['method_id'] ) ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -254,7 +254,7 @@ class OrderRequest extends AbstractObjectRequest { if ( 'create' === $action ) { if ( empty( $posted['name'] ) ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_fee_item', __( 'Fee name is required.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_fee_item', __( 'Fee name is required.', 'woocommerce-rest-api' ), 400 ); } } @@ -289,7 +289,7 @@ class OrderRequest extends AbstractObjectRequest { $item = $order->get_item( absint( $posted['id'] ), false ); if ( ! $item ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce-rest-api' ), 400 ); } } @@ -335,7 +335,7 @@ class OrderRequest extends AbstractObjectRequest { if ( 0 !== $customer_id ) { // Make sure customer exists. if ( false === get_user_by( 'id', $customer_id ) ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce-rest-api' ), 400 ); } // Make sure customer is part of blog. @@ -370,7 +370,7 @@ class OrderRequest extends AbstractObjectRequest { if ( is_array( $item ) ) { if ( empty( $item['id'] ) ) { if ( empty( $item['code'] ) ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_coupon', __( 'Coupon code is required.', 'woocommerce' ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_coupon', __( 'Coupon code is required.', 'woocommerce-rest-api' ), 400 ); } $results = $order->apply_coupon( wc_clean( $item['code'] ) ); diff --git a/src/Controllers/Version4/Requests/ProductRequest.php b/src/Controllers/Version4/Requests/ProductRequest.php index 2593e4c4253..4187677a22c 100644 --- a/src/Controllers/Version4/Requests/ProductRequest.php +++ b/src/Controllers/Version4/Requests/ProductRequest.php @@ -71,11 +71,11 @@ class ProductRequest extends AbstractObjectRequest { } if ( ! $object ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_product_id', __( 'Invalid product.', 'woocommerce' ), 404 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_product_id', __( 'Invalid product.', 'woocommerce-rest-api' ), 404 ); } if ( $object->is_type( 'variation' ) ) { - throw new \WC_REST_Exception( 'woocommerce_rest_invalid_product_id', __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce' ), 404 ); + throw new \WC_REST_Exception( 'woocommerce_rest_invalid_product_id', __( 'To manipulate product variations you should use the /products/<product_id>/variations/<id> endpoint.', 'woocommerce-rest-api' ), 404 ); } return $object; diff --git a/src/Controllers/Version4/Requests/ProductVariationRequest.php b/src/Controllers/Version4/Requests/ProductVariationRequest.php index 76608c5d412..69059c66a6b 100644 --- a/src/Controllers/Version4/Requests/ProductVariationRequest.php +++ b/src/Controllers/Version4/Requests/ProductVariationRequest.php @@ -29,7 +29,7 @@ class ProductVariationRequest extends ProductRequest { $parent = wc_get_product( $object->get_parent_id() ); if ( ! $parent ) { - throw new \WC_REST_Exception( 'woocommerce_rest_product_variation_invalid_parent', __( 'Invalid parent product.', 'woocommerce' ), 404 ); + throw new \WC_REST_Exception( 'woocommerce_rest_product_variation_invalid_parent', __( 'Invalid parent product.', 'woocommerce-rest-api' ), 404 ); } $this->set_common_props( $object ); diff --git a/src/Controllers/Version4/Settings.php b/src/Controllers/Version4/Settings.php index de2cd12bc69..6d76f20bb9c 100644 --- a/src/Controllers/Version4/Settings.php +++ b/src/Controllers/Version4/Settings.php @@ -75,7 +75,7 @@ class Settings extends AbstractController { public function get_items( $request ) { $groups = apply_filters( 'woocommerce_settings_groups', array() ); if ( empty( $groups ) ) { - return new \WP_Error( 'rest_setting_groups_empty', __( 'No setting groups have been registered.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'rest_setting_groups_empty', __( 'No setting groups have been registered.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $defaults = $this->group_defaults(); @@ -176,27 +176,27 @@ class Settings extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce' ), + 'description' => __( 'A unique identifier that can be used to link settings together.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'parent_id' => array( - 'description' => __( 'ID of parent grouping.', 'woocommerce' ), + 'description' => __( 'ID of parent grouping.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'sub_groups' => array( - 'description' => __( 'IDs for settings sub groups.', 'woocommerce' ), + 'description' => __( 'IDs for settings sub groups.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version4/SettingsOptions.php b/src/Controllers/Version4/SettingsOptions.php index 7529ccb6580..992159bc4ea 100644 --- a/src/Controllers/Version4/SettingsOptions.php +++ b/src/Controllers/Version4/SettingsOptions.php @@ -45,7 +45,7 @@ class SettingsOptions extends AbstractController { array( 'args' => array( 'group' => array( - 'description' => __( 'Settings group ID.', 'woocommerce' ), + 'description' => __( 'Settings group ID.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -65,7 +65,7 @@ class SettingsOptions extends AbstractController { array( 'args' => array( 'group' => array( - 'description' => __( 'Settings group ID.', 'woocommerce' ), + 'description' => __( 'Settings group ID.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -86,11 +86,11 @@ class SettingsOptions extends AbstractController { array( 'args' => array( 'group' => array( - 'description' => __( 'Settings group ID.', 'woocommerce' ), + 'description' => __( 'Settings group ID.', 'woocommerce-rest-api' ), 'type' => 'string', ), 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -165,13 +165,13 @@ class SettingsOptions extends AbstractController { */ public function get_group_settings( $group_id ) { if ( empty( $group_id ) ) { - return new \WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $settings = apply_filters( 'woocommerce_settings-' . $group_id, array() ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores if ( empty( $settings ) ) { - return new \WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_setting_setting_group_invalid', __( 'Invalid setting group.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $filtered_settings = array(); @@ -252,7 +252,7 @@ class SettingsOptions extends AbstractController { */ public function get_setting( $group_id, $setting_id ) { if ( empty( $setting_id ) ) { - return new \WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $settings = $this->get_group_settings( $group_id ); @@ -264,13 +264,13 @@ class SettingsOptions extends AbstractController { $array_key = array_keys( wp_list_pluck( $settings, 'id' ), $setting_id ); if ( empty( $array_key ) ) { - return new \WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $setting = $settings[ $array_key[0] ]; if ( ! $this->is_setting_type_valid( $setting['type'] ) ) { - return new \WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'rest_setting_setting_invalid', __( 'Invalid setting.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } if ( is_wp_error( $setting ) ) { @@ -493,7 +493,7 @@ class SettingsOptions extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_title', @@ -502,7 +502,7 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'group_id' => array( - 'description' => __( 'An identifier for the group this setting belongs to.', 'woocommerce' ), + 'description' => __( 'An identifier for the group this setting belongs to.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_title', @@ -511,7 +511,7 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -520,7 +520,7 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -529,18 +529,18 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'mixed', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -549,7 +549,7 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -558,7 +558,7 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -568,7 +568,7 @@ class SettingsOptions extends AbstractController { 'readonly' => true, ), 'options' => array( - 'description' => __( 'Array of options (key value pairs) for inputs such as select, multiselect, and radio buttons.', 'woocommerce' ), + 'description' => __( 'Array of options (key value pairs) for inputs such as select, multiselect, and radio buttons.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ShippingMethods.php b/src/Controllers/Version4/ShippingMethods.php index 229e9db0f8d..8aa7d3def17 100644 --- a/src/Controllers/Version4/ShippingMethods.php +++ b/src/Controllers/Version4/ShippingMethods.php @@ -54,7 +54,7 @@ class ShippingMethods extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -99,7 +99,7 @@ class ShippingMethods extends AbstractController { $wc_shipping = \WC_Shipping::instance(); $methods = $wc_shipping->get_shipping_methods(); if ( empty( $methods[ $request['id'] ] ) ) { - return new \WP_Error( 'woocommerce_rest_shipping_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $method = $methods[ $request['id'] ]; @@ -155,19 +155,19 @@ class ShippingMethods extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Method ID.', 'woocommerce' ), + 'description' => __( 'Method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Shipping method title.', 'woocommerce' ), + 'description' => __( 'Shipping method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'Shipping method description.', 'woocommerce' ), + 'description' => __( 'Shipping method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ShippingZoneLocations.php b/src/Controllers/Version4/ShippingZoneLocations.php index 1171b90e559..503b6ff3845 100644 --- a/src/Controllers/Version4/ShippingZoneLocations.php +++ b/src/Controllers/Version4/ShippingZoneLocations.php @@ -26,7 +26,7 @@ class ShippingZoneLocations extends AbstractShippingZonesController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique ID for the resource.', 'woocommerce' ), + 'description' => __( 'Unique ID for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -86,7 +86,7 @@ class ShippingZoneLocations extends AbstractShippingZonesController { } if ( 0 === $zone->get_id() ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_locations_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce' ), array( 'status' => 403 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_locations_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce-rest-api' ), array( 'status' => 403 ) ); } $raw_locations = $request->get_json_params(); @@ -148,12 +148,12 @@ class ShippingZoneLocations extends AbstractShippingZonesController { 'type' => 'object', 'properties' => array( 'code' => array( - 'description' => __( 'Shipping zone location code.', 'woocommerce' ), + 'description' => __( 'Shipping zone location code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'type' => array( - 'description' => __( 'Shipping zone location type.', 'woocommerce' ), + 'description' => __( 'Shipping zone location type.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'country', 'enum' => array( diff --git a/src/Controllers/Version4/ShippingZoneMethods.php b/src/Controllers/Version4/ShippingZoneMethods.php index d252ab17ef3..ca547399671 100644 --- a/src/Controllers/Version4/ShippingZoneMethods.php +++ b/src/Controllers/Version4/ShippingZoneMethods.php @@ -29,7 +29,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { array( 'args' => array( 'zone_id' => array( - 'description' => __( 'Unique ID for the zone.', 'woocommerce' ), + 'description' => __( 'Unique ID for the zone.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -48,7 +48,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { 'method_id' => array( 'required' => true, 'readonly' => false, - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), ), ) ), @@ -64,11 +64,11 @@ class ShippingZoneMethods extends AbstractShippingZonesController { array( 'args' => array( 'zone_id' => array( - 'description' => __( 'Unique ID for the zone.', 'woocommerce' ), + 'description' => __( 'Unique ID for the zone.', 'woocommerce-rest-api' ), 'type' => 'integer', ), 'instance_id' => array( - 'description' => __( 'Unique ID for the instance.', 'woocommerce' ), + 'description' => __( 'Unique ID for the instance.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -91,7 +91,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -126,7 +126,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { } if ( false === $method ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $data = $this->prepare_item_for_response( $method, $request ); @@ -182,7 +182,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { } if ( false === $method ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( 'Resource cannot be created.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( 'Resource cannot be created.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } $method = $this->update_fields( $instance_id, $method, $request ); @@ -211,7 +211,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Shipping methods do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Shipping methods do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $methods = $zone->get_shipping_methods(); @@ -225,7 +225,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { } if ( false === $method ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $method = $this->update_fields( $instance_id, $method, $request ); @@ -282,7 +282,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { } if ( false === $method ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_method_invalid', __( 'Resource does not exist.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $method = $this->update_fields( $instance_id, $method, $request ); @@ -327,7 +327,7 @@ class ShippingZoneMethods extends AbstractShippingZonesController { } if ( $errors_found ) { - return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } update_option( $method->get_instance_option_key(), apply_filters( 'woocommerce_shipping_' . $method->id . '_instance_settings_values', $instance_settings, $method ) ); @@ -449,100 +449,100 @@ class ShippingZoneMethods extends AbstractShippingZonesController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Shipping method instance ID.', 'woocommerce' ), + 'description' => __( 'Shipping method instance ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'instance_id' => array( - 'description' => __( 'Shipping method instance ID.', 'woocommerce' ), + 'description' => __( 'Shipping method instance ID.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'title' => array( - 'description' => __( 'Shipping method customer facing title.', 'woocommerce' ), + 'description' => __( 'Shipping method customer facing title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'order' => array( - 'description' => __( 'Shipping method sort order.', 'woocommerce' ), + 'description' => __( 'Shipping method sort order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'enabled' => array( - 'description' => __( 'Shipping method enabled status.', 'woocommerce' ), + 'description' => __( 'Shipping method enabled status.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view', 'edit' ), ), 'method_id' => array( - 'description' => __( 'Shipping method ID.', 'woocommerce' ), + 'description' => __( 'Shipping method ID.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_title' => array( - 'description' => __( 'Shipping method title.', 'woocommerce' ), + 'description' => __( 'Shipping method title.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'method_description' => array( - 'description' => __( 'Shipping method description.', 'woocommerce' ), + 'description' => __( 'Shipping method description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'settings' => array( - 'description' => __( 'Shipping method settings.', 'woocommerce' ), + 'description' => __( 'Shipping method settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), 'readonly' => true, ), 'value' => array( - 'description' => __( 'Setting value.', 'woocommerce' ), + 'description' => __( 'Setting value.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'default' => array( - 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'description' => __( 'Default value for the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'placeholder' => array( - 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/src/Controllers/Version4/ShippingZones.php b/src/Controllers/Version4/ShippingZones.php index af9da032b05..a80af9c47f5 100644 --- a/src/Controllers/Version4/ShippingZones.php +++ b/src/Controllers/Version4/ShippingZones.php @@ -39,7 +39,7 @@ class ShippingZones extends AbstractShippingZonesController { 'name' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Shipping zone name.', 'woocommerce' ), + 'description' => __( 'Shipping zone name.', 'woocommerce-rest-api' ), ), ) ), @@ -55,7 +55,7 @@ class ShippingZones extends AbstractShippingZonesController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique ID for the resource.', 'woocommerce' ), + 'description' => __( 'Unique ID for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -78,7 +78,7 @@ class ShippingZones extends AbstractShippingZonesController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce' ), + 'description' => __( 'Whether to bypass trash and force deletion.', 'woocommerce-rest-api' ), ), ), ), @@ -156,7 +156,7 @@ class ShippingZones extends AbstractShippingZonesController { $response->header( 'Location', rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $zone->get_id() ) ) ); return $response; } else { - return new \WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( "Resource cannot be created. Check to make sure 'order' and 'name' are present.", 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_not_created', __( "Resource cannot be created. Check to make sure 'order' and 'name' are present.", 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } } @@ -174,7 +174,7 @@ class ShippingZones extends AbstractShippingZonesController { } if ( 0 === $zone->get_id() ) { - return new \WP_Error( 'woocommerce_rest_shipping_zone_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce' ), array( 'status' => 403 ) ); + return new \WP_Error( 'woocommerce_rest_shipping_zone_invalid_zone', __( 'The "locations not covered by your other zones" zone cannot be updated.', 'woocommerce-rest-api' ), array( 'status' => 403 ) ); } $zone_changed = false; @@ -213,7 +213,7 @@ class ShippingZones extends AbstractShippingZonesController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Shipping zones do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Shipping zones do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $previous = $this->get_item( $request ); @@ -280,13 +280,13 @@ class ShippingZones extends AbstractShippingZonesController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Shipping zone name.', 'woocommerce' ), + 'description' => __( 'Shipping zone name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -294,7 +294,7 @@ class ShippingZones extends AbstractShippingZonesController { ), ), 'order' => array( - 'description' => __( 'Shipping zone order.', 'woocommerce' ), + 'description' => __( 'Shipping zone order.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), diff --git a/src/Controllers/Version4/SystemStatus.php b/src/Controllers/Version4/SystemStatus.php index 36239c6b7f6..f2f458c4090 100644 --- a/src/Controllers/Version4/SystemStatus.php +++ b/src/Controllers/Version4/SystemStatus.php @@ -82,195 +82,195 @@ class SystemStatus extends AbstractController { 'type' => 'object', 'properties' => array( 'environment' => array( - 'description' => __( 'Environment.', 'woocommerce' ), + 'description' => __( 'Environment.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'home_url' => array( - 'description' => __( 'Home URL.', 'woocommerce' ), + 'description' => __( 'Home URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'site_url' => array( - 'description' => __( 'Site URL.', 'woocommerce' ), + 'description' => __( 'Site URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'wc_version' => array( - 'description' => __( 'WooCommerce version.', 'woocommerce' ), + 'description' => __( 'WooCommerce version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'log_directory' => array( - 'description' => __( 'Log directory.', 'woocommerce' ), + 'description' => __( 'Log directory.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'log_directory_writable' => array( - 'description' => __( 'Is log directory writable?', 'woocommerce' ), + 'description' => __( 'Is log directory writable?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_version' => array( - 'description' => __( 'WordPress version.', 'woocommerce' ), + 'description' => __( 'WordPress version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_multisite' => array( - 'description' => __( 'Is WordPress multisite?', 'woocommerce' ), + 'description' => __( 'Is WordPress multisite?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_memory_limit' => array( - 'description' => __( 'WordPress memory limit.', 'woocommerce' ), + 'description' => __( 'WordPress memory limit.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_debug_mode' => array( - 'description' => __( 'Is WordPress debug mode active?', 'woocommerce' ), + 'description' => __( 'Is WordPress debug mode active?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'wp_cron' => array( - 'description' => __( 'Are WordPress cron jobs enabled?', 'woocommerce' ), + 'description' => __( 'Are WordPress cron jobs enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'language' => array( - 'description' => __( 'WordPress language.', 'woocommerce' ), + 'description' => __( 'WordPress language.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'server_info' => array( - 'description' => __( 'Server info.', 'woocommerce' ), + 'description' => __( 'Server info.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'php_version' => array( - 'description' => __( 'PHP version.', 'woocommerce' ), + 'description' => __( 'PHP version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'php_post_max_size' => array( - 'description' => __( 'PHP post max size.', 'woocommerce' ), + 'description' => __( 'PHP post max size.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'php_max_execution_time' => array( - 'description' => __( 'PHP max execution time.', 'woocommerce' ), + 'description' => __( 'PHP max execution time.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'php_max_input_vars' => array( - 'description' => __( 'PHP max input vars.', 'woocommerce' ), + 'description' => __( 'PHP max input vars.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'curl_version' => array( - 'description' => __( 'cURL version.', 'woocommerce' ), + 'description' => __( 'cURL version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'suhosin_installed' => array( - 'description' => __( 'Is SUHOSIN installed?', 'woocommerce' ), + 'description' => __( 'Is SUHOSIN installed?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'max_upload_size' => array( - 'description' => __( 'Max upload size.', 'woocommerce' ), + 'description' => __( 'Max upload size.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'mysql_version' => array( - 'description' => __( 'MySQL version.', 'woocommerce' ), + 'description' => __( 'MySQL version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'mysql_version_string' => array( - 'description' => __( 'MySQL version string.', 'woocommerce' ), + 'description' => __( 'MySQL version string.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'default_timezone' => array( - 'description' => __( 'Default timezone.', 'woocommerce' ), + 'description' => __( 'Default timezone.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'fsockopen_or_curl_enabled' => array( - 'description' => __( 'Is fsockopen/cURL enabled?', 'woocommerce' ), + 'description' => __( 'Is fsockopen/cURL enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'soapclient_enabled' => array( - 'description' => __( 'Is SoapClient class enabled?', 'woocommerce' ), + 'description' => __( 'Is SoapClient class enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'domdocument_enabled' => array( - 'description' => __( 'Is DomDocument class enabled?', 'woocommerce' ), + 'description' => __( 'Is DomDocument class enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'gzip_enabled' => array( - 'description' => __( 'Is GZip enabled?', 'woocommerce' ), + 'description' => __( 'Is GZip enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'mbstring_enabled' => array( - 'description' => __( 'Is mbstring enabled?', 'woocommerce' ), + 'description' => __( 'Is mbstring enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_post_successful' => array( - 'description' => __( 'Remote POST successful?', 'woocommerce' ), + 'description' => __( 'Remote POST successful?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_post_response' => array( - 'description' => __( 'Remote POST response.', 'woocommerce' ), + 'description' => __( 'Remote POST response.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_get_successful' => array( - 'description' => __( 'Remote GET successful?', 'woocommerce' ), + 'description' => __( 'Remote GET successful?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'remote_get_response' => array( - 'description' => __( 'Remote GET response.', 'woocommerce' ), + 'description' => __( 'Remote GET response.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, @@ -278,31 +278,31 @@ class SystemStatus extends AbstractController { ), ), 'database' => array( - 'description' => __( 'Database.', 'woocommerce' ), + 'description' => __( 'Database.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'wc_database_version' => array( - 'description' => __( 'WC database version.', 'woocommerce' ), + 'description' => __( 'WC database version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'database_prefix' => array( - 'description' => __( 'Database prefix.', 'woocommerce' ), + 'description' => __( 'Database prefix.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'maxmind_geoip_database' => array( - 'description' => __( 'MaxMind GeoIP database.', 'woocommerce' ), + 'description' => __( 'MaxMind GeoIP database.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'database_tables' => array( - 'description' => __( 'Database tables.', 'woocommerce' ), + 'description' => __( 'Database tables.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -313,7 +313,7 @@ class SystemStatus extends AbstractController { ), ), 'active_plugins' => array( - 'description' => __( 'Active plugins.', 'woocommerce' ), + 'description' => __( 'Active plugins.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -322,7 +322,7 @@ class SystemStatus extends AbstractController { ), ), 'inactive_plugins' => array( - 'description' => __( 'Inactive plugins.', 'woocommerce' ), + 'description' => __( 'Inactive plugins.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -331,7 +331,7 @@ class SystemStatus extends AbstractController { ), ), 'dropins_mu_plugins' => array( - 'description' => __( 'Dropins & MU plugins.', 'woocommerce' ), + 'description' => __( 'Dropins & MU plugins.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -340,62 +340,62 @@ class SystemStatus extends AbstractController { ), ), 'theme' => array( - 'description' => __( 'Theme.', 'woocommerce' ), + 'description' => __( 'Theme.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'name' => array( - 'description' => __( 'Theme name.', 'woocommerce' ), + 'description' => __( 'Theme name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'version' => array( - 'description' => __( 'Theme version.', 'woocommerce' ), + 'description' => __( 'Theme version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'version_latest' => array( - 'description' => __( 'Latest version of theme.', 'woocommerce' ), + 'description' => __( 'Latest version of theme.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'author_url' => array( - 'description' => __( 'Theme author URL.', 'woocommerce' ), + 'description' => __( 'Theme author URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), 'readonly' => true, ), 'is_child_theme' => array( - 'description' => __( 'Is this theme a child theme?', 'woocommerce' ), + 'description' => __( 'Is this theme a child theme?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'has_woocommerce_support' => array( - 'description' => __( 'Does the theme declare WooCommerce support?', 'woocommerce' ), + 'description' => __( 'Does the theme declare WooCommerce support?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'has_woocommerce_file' => array( - 'description' => __( 'Does the theme have a woocommerce.php file?', 'woocommerce' ), + 'description' => __( 'Does the theme have a woocommerce.php file?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'has_outdated_templates' => array( - 'description' => __( 'Does this theme have outdated templates?', 'woocommerce' ), + 'description' => __( 'Does this theme have outdated templates?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'overrides' => array( - 'description' => __( 'Template overrides.', 'woocommerce' ), + 'description' => __( 'Template overrides.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -404,19 +404,19 @@ class SystemStatus extends AbstractController { ), ), 'parent_name' => array( - 'description' => __( 'Parent theme name.', 'woocommerce' ), + 'description' => __( 'Parent theme name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'parent_version' => array( - 'description' => __( 'Parent theme version.', 'woocommerce' ), + 'description' => __( 'Parent theme version.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'parent_author_url' => array( - 'description' => __( 'Parent theme author URL.', 'woocommerce' ), + 'description' => __( 'Parent theme author URL.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view' ), @@ -425,67 +425,67 @@ class SystemStatus extends AbstractController { ), ), 'settings' => array( - 'description' => __( 'Settings.', 'woocommerce' ), + 'description' => __( 'Settings.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'api_enabled' => array( - 'description' => __( 'REST API enabled?', 'woocommerce' ), + 'description' => __( 'REST API enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'force_ssl' => array( - 'description' => __( 'SSL forced?', 'woocommerce' ), + 'description' => __( 'SSL forced?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'currency' => array( - 'description' => __( 'Currency.', 'woocommerce' ), + 'description' => __( 'Currency.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'currency_symbol' => array( - 'description' => __( 'Currency symbol.', 'woocommerce' ), + 'description' => __( 'Currency symbol.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'currency_position' => array( - 'description' => __( 'Currency position.', 'woocommerce' ), + 'description' => __( 'Currency position.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'thousand_separator' => array( - 'description' => __( 'Thousand separator.', 'woocommerce' ), + 'description' => __( 'Thousand separator.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'decimal_separator' => array( - 'description' => __( 'Decimal separator.', 'woocommerce' ), + 'description' => __( 'Decimal separator.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view' ), 'readonly' => true, ), 'number_of_decimals' => array( - 'description' => __( 'Number of decimals.', 'woocommerce' ), + 'description' => __( 'Number of decimals.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view' ), 'readonly' => true, ), 'geolocation_enabled' => array( - 'description' => __( 'Geolocation enabled?', 'woocommerce' ), + 'description' => __( 'Geolocation enabled?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'taxonomies' => array( - 'description' => __( 'Taxonomy terms for product/order statuses.', 'woocommerce' ), + 'description' => __( 'Taxonomy terms for product/order statuses.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -494,7 +494,7 @@ class SystemStatus extends AbstractController { ), ), 'product_visibility_terms' => array( - 'description' => __( 'Terms in the product visibility taxonomy.', 'woocommerce' ), + 'description' => __( 'Terms in the product visibility taxonomy.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -505,19 +505,19 @@ class SystemStatus extends AbstractController { ), ), 'security' => array( - 'description' => __( 'Security.', 'woocommerce' ), + 'description' => __( 'Security.', 'woocommerce-rest-api' ), 'type' => 'object', 'context' => array( 'view' ), 'readonly' => true, 'properties' => array( 'secure_connection' => array( - 'description' => __( 'Is the connection to your store secure?', 'woocommerce' ), + 'description' => __( 'Is the connection to your store secure?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, ), 'hide_errors' => array( - 'description' => __( 'Hide errors from visitors?', 'woocommerce' ), + 'description' => __( 'Hide errors from visitors?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'view' ), 'readonly' => true, @@ -525,7 +525,7 @@ class SystemStatus extends AbstractController { ), ), 'pages' => array( - 'description' => __( 'WooCommerce pages.', 'woocommerce' ), + 'description' => __( 'WooCommerce pages.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, @@ -534,7 +534,7 @@ class SystemStatus extends AbstractController { ), ), 'post_type_counts' => array( - 'description' => __( 'Post type counts.', 'woocommerce' ), + 'description' => __( 'Post type counts.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view' ), 'readonly' => true, diff --git a/src/Controllers/Version4/SystemStatusTools.php b/src/Controllers/Version4/SystemStatusTools.php index e6aaa94d0d9..72fc9b8e513 100644 --- a/src/Controllers/Version4/SystemStatusTools.php +++ b/src/Controllers/Version4/SystemStatusTools.php @@ -55,7 +55,7 @@ class SystemStatusTools extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -85,79 +85,79 @@ class SystemStatusTools extends AbstractController { public function get_tools() { $tools = array( 'clear_transients' => array( - 'name' => __( 'WooCommerce transients', 'woocommerce' ), - 'button' => __( 'Clear transients', 'woocommerce' ), - 'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce' ), + 'name' => __( 'WooCommerce transients', 'woocommerce-rest-api' ), + 'button' => __( 'Clear transients', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will clear the product/shop transients cache.', 'woocommerce-rest-api' ), ), 'clear_expired_transients' => array( - 'name' => __( 'Expired transients', 'woocommerce' ), - 'button' => __( 'Clear transients', 'woocommerce' ), - 'desc' => __( 'This tool will clear ALL expired transients from WordPress.', 'woocommerce' ), + 'name' => __( 'Expired transients', 'woocommerce-rest-api' ), + 'button' => __( 'Clear transients', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will clear ALL expired transients from WordPress.', 'woocommerce-rest-api' ), ), 'delete_orphaned_variations' => array( - 'name' => __( 'Orphaned variations', 'woocommerce' ), - 'button' => __( 'Delete orphaned variations', 'woocommerce' ), - 'desc' => __( 'This tool will delete all variations which have no parent.', 'woocommerce' ), + 'name' => __( 'Orphaned variations', 'woocommerce-rest-api' ), + 'button' => __( 'Delete orphaned variations', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will delete all variations which have no parent.', 'woocommerce-rest-api' ), ), 'clear_expired_download_permissions' => array( - 'name' => __( 'Used-up download permissions', 'woocommerce' ), - 'button' => __( 'Clean up download permissions', 'woocommerce' ), - 'desc' => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce' ), + 'name' => __( 'Used-up download permissions', 'woocommerce-rest-api' ), + 'button' => __( 'Clean up download permissions', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will delete expired download permissions and permissions with 0 remaining downloads.', 'woocommerce-rest-api' ), ), 'regenerate_product_lookup_tables' => array( - 'name' => __( 'Product lookup tables', 'woocommerce' ), - 'button' => __( 'Regenerate', 'woocommerce' ), - 'desc' => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce' ), + 'name' => __( 'Product lookup tables', 'woocommerce-rest-api' ), + 'button' => __( 'Regenerate', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will regenerate product lookup table data. This process may take a while.', 'woocommerce-rest-api' ), ), 'recount_terms' => array( - 'name' => __( 'Term counts', 'woocommerce' ), - 'button' => __( 'Recount terms', 'woocommerce' ), - 'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce' ), + 'name' => __( 'Term counts', 'woocommerce-rest-api' ), + 'button' => __( 'Recount terms', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.', 'woocommerce-rest-api' ), ), 'reset_roles' => array( - 'name' => __( 'Capabilities', 'woocommerce' ), - 'button' => __( 'Reset capabilities', 'woocommerce' ), - 'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce' ), + 'name' => __( 'Capabilities', 'woocommerce-rest-api' ), + 'button' => __( 'Reset capabilities', 'woocommerce-rest-api' ), + 'desc' => __( 'This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.', 'woocommerce-rest-api' ), ), 'clear_sessions' => array( - 'name' => __( 'Clear customer sessions', 'woocommerce' ), - 'button' => __( 'Clear', 'woocommerce' ), + 'name' => __( 'Clear customer sessions', 'woocommerce-rest-api' ), + 'button' => __( 'Clear', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This tool will delete all customer session data from the database, including current carts and saved carts in the database.', 'woocommerce-rest-api' ) ), ), 'install_pages' => array( - 'name' => __( 'Create default WooCommerce pages', 'woocommerce' ), - 'button' => __( 'Create pages', 'woocommerce' ), + 'name' => __( 'Create default WooCommerce pages', 'woocommerce-rest-api' ), + 'button' => __( 'Create pages', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.', 'woocommerce-rest-api' ) ), ), 'delete_taxes' => array( - 'name' => __( 'Delete WooCommerce tax rates', 'woocommerce' ), - 'button' => __( 'Delete tax rates', 'woocommerce' ), + 'name' => __( 'Delete WooCommerce tax rates', 'woocommerce-rest-api' ), + 'button' => __( 'Delete tax rates', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This option will delete ALL of your tax rates, use with caution. This action cannot be reversed.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This option will delete ALL of your tax rates, use with caution. This action cannot be reversed.', 'woocommerce-rest-api' ) ), ), 'regenerate_thumbnails' => array( - 'name' => __( 'Regenerate shop thumbnails', 'woocommerce' ), - 'button' => __( 'Regenerate', 'woocommerce' ), - 'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce' ), + 'name' => __( 'Regenerate shop thumbnails', 'woocommerce-rest-api' ), + 'button' => __( 'Regenerate', 'woocommerce-rest-api' ), + 'desc' => __( 'This will regenerate all shop thumbnails to match your theme and/or image settings.', 'woocommerce-rest-api' ), ), 'db_update_routine' => array( - 'name' => __( 'Update database', 'woocommerce' ), - 'button' => __( 'Update database', 'woocommerce' ), + 'name' => __( 'Update database', 'woocommerce-rest-api' ), + 'button' => __( 'Update database', 'woocommerce-rest-api' ), 'desc' => sprintf( '%1$s %2$s', - __( 'Note:', 'woocommerce' ), - __( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce' ) + __( 'Note:', 'woocommerce-rest-api' ), + __( 'This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.', 'woocommerce-rest-api' ) ), ), ); @@ -205,7 +205,7 @@ class SystemStatusTools extends AbstractController { public function get_item( $request ) { $tools = $this->get_tools(); if ( empty( $tools[ $request['id'] ] ) ) { - return new \WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tool = $tools[ $request['id'] ]; return rest_ensure_response( @@ -230,7 +230,7 @@ class SystemStatusTools extends AbstractController { public function update_item( $request ) { $tools = $this->get_tools(); if ( empty( $tools[ $request['id'] ] ) ) { - return new \WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_system_status_tool_invalid_id', __( 'Invalid tool ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tool = $tools[ $request['id'] ]; @@ -269,7 +269,7 @@ class SystemStatusTools extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'A unique identifier for the tool.', 'woocommerce' ), + 'description' => __( 'A unique identifier for the tool.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -277,7 +277,7 @@ class SystemStatusTools extends AbstractController { ), ), 'name' => array( - 'description' => __( 'Tool name.', 'woocommerce' ), + 'description' => __( 'Tool name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -285,7 +285,7 @@ class SystemStatusTools extends AbstractController { ), ), 'action' => array( - 'description' => __( 'What running the tool will do.', 'woocommerce' ), + 'description' => __( 'What running the tool will do.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -293,7 +293,7 @@ class SystemStatusTools extends AbstractController { ), ), 'description' => array( - 'description' => __( 'Tool description.', 'woocommerce' ), + 'description' => __( 'Tool description.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'arg_options' => array( @@ -301,12 +301,12 @@ class SystemStatusTools extends AbstractController { ), ), 'success' => array( - 'description' => __( 'Did the tool run successfully?', 'woocommerce' ), + 'description' => __( 'Did the tool run successfully?', 'woocommerce-rest-api' ), 'type' => 'boolean', 'context' => array( 'edit' ), ), 'message' => array( - 'description' => __( 'Tool return message.', 'woocommerce' ), + 'description' => __( 'Tool return message.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), 'arg_options' => array( @@ -362,23 +362,23 @@ class SystemStatusTools extends AbstractController { try { if ( ! isset( $tools[ $tool ] ) ) { - throw new Exception( __( 'There was an error calling this tool. There is no callback present.', 'woocommerce' ) ); + throw new Exception( __( 'There was an error calling this tool. There is no callback present.', 'woocommerce-rest-api' ) ); } $callback = isset( $tools[ $tool ]['callback'] ) ? $tools[ $tool ]['callback'] : array( $this, $tool ); if ( ! is_callable( $callback ) ) { - throw new Exception( __( 'There was an error calling this tool. Invalid callback.', 'woocommerce' ) ); + throw new Exception( __( 'There was an error calling this tool. Invalid callback.', 'woocommerce-rest-api' ) ); } $message = call_user_func( $callback ); if ( false === $message ) { - throw new Exception( __( 'There was an error calling this tool. Invalid callback.', 'woocommerce' ) ); + throw new Exception( __( 'There was an error calling this tool. Invalid callback.', 'woocommerce-rest-api' ) ); } if ( empty( $message ) || ! is_string( $message ) ) { - $message = __( 'Tool ran.', 'woocommerce' ); + $message = __( 'Tool ran.', 'woocommerce-rest-api' ); } $ran = true; @@ -412,7 +412,7 @@ class SystemStatusTools extends AbstractController { } \WC_Cache_Helper::get_transient_version( 'shipping', true ); - return __( 'Product transients cleared', 'woocommerce' ); + return __( 'Product transients cleared', 'woocommerce-rest-api' ); } /** @@ -422,7 +422,7 @@ class SystemStatusTools extends AbstractController { */ protected function clear_expired_transients() { /* translators: %d: amount of expired transients */ - return sprintf( __( '%d transients rows cleared', 'woocommerce' ), wc_delete_expired_transients() ); + return sprintf( __( '%d transients rows cleared', 'woocommerce-rest-api' ), wc_delete_expired_transients() ); } /** @@ -442,7 +442,7 @@ class SystemStatusTools extends AbstractController { ) ); /* translators: %d: amount of orphaned variations */ - return sprintf( __( '%d orphaned variations deleted', 'woocommerce' ), $result ); + return sprintf( __( '%d orphaned variations deleted', 'woocommerce-rest-api' ), $result ); } /** @@ -463,7 +463,7 @@ class SystemStatusTools extends AbstractController { ) ); /* translators: %d: amount of permissions */ - return sprintf( __( '%d permissions deleted', 'woocommerce' ), $result ); + return sprintf( __( '%d permissions deleted', 'woocommerce-rest-api' ), $result ); } /** @@ -475,7 +475,7 @@ class SystemStatusTools extends AbstractController { if ( ! wc_update_product_lookup_tables_is_running() ) { wc_update_product_lookup_tables(); } - return __( 'Lookup tables are regenerating', 'woocommerce' ); + return __( 'Lookup tables are regenerating', 'woocommerce-rest-api' ); } /** @@ -486,7 +486,7 @@ class SystemStatusTools extends AbstractController { protected function reset_roles() { \WC_Install::remove_roles(); \WC_Install::create_roles(); - return __( 'Roles successfully reset', 'woocommerce' ); + return __( 'Roles successfully reset', 'woocommerce-rest-api' ); } /** @@ -511,7 +511,7 @@ class SystemStatusTools extends AbstractController { ) ); _wc_term_recount( $product_tags, get_taxonomy( 'product_tag' ), true, false ); - return __( 'Terms successfully recounted', 'woocommerce' ); + return __( 'Terms successfully recounted', 'woocommerce-rest-api' ); } /** @@ -526,7 +526,7 @@ class SystemStatusTools extends AbstractController { $result = absint( $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE meta_key='_woocommerce_persistent_cart_" . get_current_blog_id() . "';" ) ); // WPCS: unprepared SQL ok. wp_cache_flush(); /* translators: %d: amount of sessions */ - return sprintf( __( 'Deleted all active sessions, and %d saved carts.', 'woocommerce' ), absint( $result ) ); + return sprintf( __( 'Deleted all active sessions, and %d saved carts.', 'woocommerce-rest-api' ), absint( $result ) ); } /** @@ -536,7 +536,7 @@ class SystemStatusTools extends AbstractController { */ protected function install_pages() { \WC_Install::create_pages(); - return __( 'All missing WooCommerce pages successfully installed', 'woocommerce' ); + return __( 'All missing WooCommerce pages successfully installed', 'woocommerce-rest-api' ); } /** @@ -549,7 +549,7 @@ class SystemStatusTools extends AbstractController { $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rates;" ); $wpdb->query( "TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rate_locations;" ); \WC_Cache_Helper::incr_cache_prefix( 'taxes' ); - return __( 'Tax rates successfully deleted', 'woocommerce' ); + return __( 'Tax rates successfully deleted', 'woocommerce-rest-api' ); } /** @@ -559,7 +559,7 @@ class SystemStatusTools extends AbstractController { */ protected function regenerate_thumbnails() { \WC_Regenerate_Images::queue_image_regeneration(); - return __( 'Thumbnail regeneration has been scheduled to run in the background.', 'woocommerce' ); + return __( 'Thumbnail regeneration has been scheduled to run in the background.', 'woocommerce-rest-api' ); } /** @@ -572,6 +572,6 @@ class SystemStatusTools extends AbstractController { // Used to fire an action added in WP_Background_Process::_construct() that calls WP_Background_Process::handle_cron_healthcheck(). // This method will make sure the database updates are executed even if cron is disabled. Nothing will happen if the updates are already running. do_action( 'wp_' . $blog_id . '_wc_updater_cron' ); - return __( 'Database upgrade routine has been scheduled to run in the background.', 'woocommerce' ); + return __( 'Database upgrade routine has been scheduled to run in the background.', 'woocommerce-rest-api' ); } } diff --git a/src/Controllers/Version4/TaxClasses.php b/src/Controllers/Version4/TaxClasses.php index 2c60d447aa1..3f3a527f2de 100644 --- a/src/Controllers/Version4/TaxClasses.php +++ b/src/Controllers/Version4/TaxClasses.php @@ -61,7 +61,7 @@ class TaxClasses extends AbstractController { array( 'args' => array( 'slug' => array( - 'description' => __( 'Unique slug for the resource.', 'woocommerce' ), + 'description' => __( 'Unique slug for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', ), ), @@ -73,7 +73,7 @@ class TaxClasses extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -95,7 +95,7 @@ class TaxClasses extends AbstractController { // Add standard class. $tax_classes[] = array( 'slug' => 'standard', - 'name' => __( 'Standard rate', 'woocommerce' ), + 'name' => __( 'Standard rate', 'woocommerce-rest-api' ), ); $classes = \WC_Tax::get_tax_classes(); @@ -141,7 +141,7 @@ class TaxClasses extends AbstractController { // Return error if tax class already exists. if ( $exists ) { - return new \WP_Error( 'woocommerce_rest_tax_class_exists', __( 'Cannot create existing resource.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_tax_class_exists', __( 'Cannot create existing resource.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Add the new class. @@ -182,7 +182,7 @@ class TaxClasses extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $tax_class = array( @@ -202,7 +202,7 @@ class TaxClasses extends AbstractController { } if ( ! $deleted ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource id.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $request->set_param( 'context', 'edit' ); @@ -277,13 +277,13 @@ class TaxClasses extends AbstractController { 'type' => 'object', 'properties' => array( 'slug' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'Tax class name.', 'woocommerce' ), + 'description' => __( 'Tax class name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'required' => true, diff --git a/src/Controllers/Version4/Taxes.php b/src/Controllers/Version4/Taxes.php index e7ee48b7a7d..b1adf12669f 100644 --- a/src/Controllers/Version4/Taxes.php +++ b/src/Controllers/Version4/Taxes.php @@ -63,7 +63,7 @@ class Taxes extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -89,7 +89,7 @@ class Taxes extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -272,7 +272,7 @@ class Taxes extends AbstractController { */ public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { - return new \WP_Error( 'woocommerce_rest_tax_exists', __( 'Cannot create existing resource.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_tax_exists', __( 'Cannot create existing resource.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $tax = $this->create_or_update_tax( $request ); @@ -308,7 +308,7 @@ class Taxes extends AbstractController { $tax_obj = \WC_Tax::_get_tax_rate( $id, OBJECT ); if ( empty( $id ) || empty( $tax_obj ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tax = $this->prepare_item_for_response( $tax_obj, $request ); @@ -328,7 +328,7 @@ class Taxes extends AbstractController { $tax_obj = \WC_Tax::_get_tax_rate( $id, OBJECT ); if ( empty( $id ) || empty( $tax_obj ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $tax = $this->create_or_update_tax( $request, $tax_obj ); @@ -365,13 +365,13 @@ class Taxes extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Taxes do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $tax = \WC_Tax::_get_tax_rate( $id, OBJECT ); if ( empty( $id ) || empty( $tax ) ) { - return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'woocommerce_rest_invalid_id', __( 'Invalid resource ID.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $request->set_param( 'context', 'edit' ); @@ -380,7 +380,7 @@ class Taxes extends AbstractController { \WC_Tax::_delete_tax_rate( $id ); if ( 0 === $wpdb->rows_affected ) { - return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) ); + return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'The resource cannot be deleted.', 'woocommerce-rest-api' ), array( 'status' => 500 ) ); } /** @@ -473,66 +473,66 @@ class Taxes extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'country' => array( - 'description' => __( 'Country ISO 3166 code.', 'woocommerce' ), + 'description' => __( 'Country ISO 3166 code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'state' => array( - 'description' => __( 'State code.', 'woocommerce' ), + 'description' => __( 'State code.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'postcode' => array( - 'description' => __( 'Postcode / ZIP.', 'woocommerce' ), + 'description' => __( 'Postcode / ZIP.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'city' => array( - 'description' => __( 'City name.', 'woocommerce' ), + 'description' => __( 'City name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'rate' => array( - 'description' => __( 'Tax rate.', 'woocommerce' ), + 'description' => __( 'Tax rate.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'name' => array( - 'description' => __( 'Tax rate name.', 'woocommerce' ), + 'description' => __( 'Tax rate name.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'priority' => array( - 'description' => __( 'Tax priority.', 'woocommerce' ), + 'description' => __( 'Tax priority.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 1, 'context' => array( 'view', 'edit' ), ), 'compound' => array( - 'description' => __( 'Whether or not this is a compound rate.', 'woocommerce' ), + 'description' => __( 'Whether or not this is a compound rate.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => false, 'context' => array( 'view', 'edit' ), ), 'shipping' => array( - 'description' => __( 'Whether or not this tax rate also gets applied to shipping.', 'woocommerce' ), + 'description' => __( 'Whether or not this tax rate also gets applied to shipping.', 'woocommerce-rest-api' ), 'type' => 'boolean', 'default' => true, 'context' => array( 'view', 'edit' ), ), 'order' => array( - 'description' => __( 'Indicates the order that will appear in queries.', 'woocommerce' ), + 'description' => __( 'Indicates the order that will appear in queries.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), ), 'class' => array( - 'description' => __( 'Tax class.', 'woocommerce' ), + 'description' => __( 'Tax class.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'standard', 'enum' => array_merge( array( 'standard' ), \WC_Tax::get_tax_class_slugs() ), @@ -555,7 +555,7 @@ class Taxes extends AbstractController { $params['context']['default'] = 'view'; $params['page'] = array( - 'description' => __( 'Current page of the collection.', 'woocommerce' ), + 'description' => __( 'Current page of the collection.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 1, 'sanitize_callback' => 'absint', @@ -563,7 +563,7 @@ class Taxes extends AbstractController { 'minimum' => 1, ); $params['per_page'] = array( - 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ), + 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-rest-api' ), 'type' => 'integer', 'default' => 10, 'minimum' => 1, @@ -572,14 +572,14 @@ class Taxes extends AbstractController { 'validate_callback' => 'rest_validate_request_arg', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( 'default' => 'asc', - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'enum' => array( 'asc', 'desc' ), 'sanitize_callback' => 'sanitize_key', 'type' => 'string', @@ -587,7 +587,7 @@ class Taxes extends AbstractController { ); $params['orderby'] = array( 'default' => 'order', - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'enum' => array( 'id', 'order', @@ -597,19 +597,19 @@ class Taxes extends AbstractController { 'validate_callback' => 'rest_validate_request_arg', ); $params['class'] = array( - 'description' => __( 'Sort by tax class.', 'woocommerce' ), + 'description' => __( 'Sort by tax class.', 'woocommerce-rest-api' ), 'enum' => array_merge( array( 'standard' ), \WC_Tax::get_tax_class_slugs() ), 'sanitize_callback' => 'sanitize_title', 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); $params['code'] = array( - 'description' => __( 'Search by similar tax code.', 'woocommerce' ), + 'description' => __( 'Search by similar tax code.', 'woocommerce-rest-api' ), 'type' => 'string', 'validate_callback' => 'rest_validate_request_arg', ); $params['include'] = array( - 'description' => __( 'Limit result set to items that have the specified rate ID(s) assigned.', 'woocommerce' ), + 'description' => __( 'Limit result set to items that have the specified rate ID(s) assigned.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', diff --git a/src/Controllers/Version4/Utilities/BatchTrait.php b/src/Controllers/Version4/Utilities/BatchTrait.php index f35f7eba96e..74870676955 100644 --- a/src/Controllers/Version4/Utilities/BatchTrait.php +++ b/src/Controllers/Version4/Utilities/BatchTrait.php @@ -94,7 +94,7 @@ trait BatchTrait { 'type' => 'object', 'properties' => array( 'create' => array( - 'description' => __( 'List of created resources.', 'woocommerce' ), + 'description' => __( 'List of created resources.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -102,7 +102,7 @@ trait BatchTrait { ), ), 'update' => array( - 'description' => __( 'List of updated resources.', 'woocommerce' ), + 'description' => __( 'List of updated resources.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -110,7 +110,7 @@ trait BatchTrait { ), ), 'delete' => array( - 'description' => __( 'List of delete resources.', 'woocommerce' ), + 'description' => __( 'List of delete resources.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'items' => array( @@ -152,7 +152,7 @@ trait BatchTrait { if ( $total > $limit ) { /* translators: %s: items limit */ - return new \WP_Error( 'woocommerce_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), array( 'status' => 413 ) ); + return new \WP_Error( 'woocommerce_rest_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce-rest-api' ), $limit ), array( 'status' => 413 ) ); } return true; diff --git a/src/Controllers/Version4/Utilities/DatabaseInformation.php b/src/Controllers/Version4/Utilities/DatabaseInformation.php index be946dc9e9e..b5d9f0a37d7 100644 --- a/src/Controllers/Version4/Utilities/DatabaseInformation.php +++ b/src/Controllers/Version4/Utilities/DatabaseInformation.php @@ -78,7 +78,7 @@ class DatabaseInformation { * To ensure we include all WC tables, even if they do not exist, pre-populate the WC array with all the tables. */ $tables = array( - 'woocommerce' => array_fill_keys( $core_tables, false ), + 'woocommerce-rest-api' => array_fill_keys( $core_tables, false ), 'other' => array(), ); @@ -94,7 +94,7 @@ class DatabaseInformation { if ( is_multisite() && 0 !== strpos( $table->name, $site_tables_prefix ) && ! in_array( $table->name, $global_tables, true ) ) { continue; } - $table_type = in_array( $table->name, $core_tables, true ) ? 'woocommerce' : 'other'; + $table_type = in_array( $table->name, $core_tables, true ) ? 'woocommerce-rest-api' : 'other'; $tables[ $table_type ][ $table->name ] = array( 'data' => $table->data, diff --git a/src/Controllers/Version4/Utilities/ServerEnvironment.php b/src/Controllers/Version4/Utilities/ServerEnvironment.php index 1c7612a3bac..9d89040e51e 100644 --- a/src/Controllers/Version4/Utilities/ServerEnvironment.php +++ b/src/Controllers/Version4/Utilities/ServerEnvironment.php @@ -157,7 +157,7 @@ class ServerEnvironment { $curl_version = curl_version(); $curl_version = $curl_version['version'] . ', ' . $curl_version['ssl_version']; } elseif ( extension_loaded( 'curl' ) ) { - $curl_version = __( 'cURL installed but unable to retrieve version.', 'woocommerce' ); + $curl_version = __( 'cURL installed but unable to retrieve version.', 'woocommerce-rest-api' ); } return $curl_version; } diff --git a/src/Controllers/Version4/Utilities/SettingsTrait.php b/src/Controllers/Version4/Utilities/SettingsTrait.php index 68c04657177..f5ac8f64590 100644 --- a/src/Controllers/Version4/Utilities/SettingsTrait.php +++ b/src/Controllers/Version4/Utilities/SettingsTrait.php @@ -36,7 +36,7 @@ trait SettingsTrait { if ( array_key_exists( $value, $setting['options'] ) ) { return $value; } else { - return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -54,7 +54,7 @@ trait SettingsTrait { } if ( ! is_array( $values ) ) { - return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $final_values = array(); @@ -77,7 +77,7 @@ trait SettingsTrait { */ public function validate_setting_image_width_field( $values, $setting ) { if ( ! is_array( $values ) ) { - return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $current = $setting['value']; @@ -120,7 +120,7 @@ trait SettingsTrait { $value = isset( $setting['default'] ) ? $setting['default'] : 'no'; return $value; } else { - return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( 'rest_setting_value_invalid', __( 'An invalid setting value was passed.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } diff --git a/src/Controllers/Version4/Utilities/ThemeInformation.php b/src/Controllers/Version4/Utilities/ThemeInformation.php index fb99a3a48aa..489832351cb 100644 --- a/src/Controllers/Version4/Utilities/ThemeInformation.php +++ b/src/Controllers/Version4/Utilities/ThemeInformation.php @@ -85,7 +85,7 @@ class ThemeInformation { 'version_latest' => \WC_Admin_Status::get_latest_theme_version( $active_theme ), 'author_url' => esc_url_raw( $active_theme->{'Author URI'} ), 'is_child_theme' => is_child_theme(), - 'has_woocommerce_support' => current_theme_supports( 'woocommerce' ), + 'has_woocommerce_support' => current_theme_supports( 'woocommerce-rest-api' ), 'has_woocommerce_file' => ( file_exists( get_stylesheet_directory() . '/woocommerce.php' ) || file_exists( get_template_directory() . '/woocommerce.php' ) ), 'has_outdated_templates' => $outdated_templates, 'overrides' => $override_files, diff --git a/src/Controllers/Version4/Utilities/WPEnvironment.php b/src/Controllers/Version4/Utilities/WPEnvironment.php index 5ebc5acb6d6..1e0b2edf449 100644 --- a/src/Controllers/Version4/Utilities/WPEnvironment.php +++ b/src/Controllers/Version4/Utilities/WPEnvironment.php @@ -46,23 +46,23 @@ class WPEnvironment { public function get_pages() { // WC pages to check against. $check_pages = array( - _x( 'Shop base', 'Page setting', 'woocommerce' ) => array( + _x( 'Shop base', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_shop_page_id', 'shortcode' => '', ), - _x( 'Cart', 'Page setting', 'woocommerce' ) => array( + _x( 'Cart', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_cart_page_id', 'shortcode' => '[' . apply_filters( 'woocommerce_cart_shortcode_tag', 'woocommerce_cart' ) . ']', ), - _x( 'Checkout', 'Page setting', 'woocommerce' ) => array( + _x( 'Checkout', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_checkout_page_id', 'shortcode' => '[' . apply_filters( 'woocommerce_checkout_shortcode_tag', 'woocommerce_checkout' ) . ']', ), - _x( 'My account', 'Page setting', 'woocommerce' ) => array( + _x( 'My account', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_myaccount_page_id', 'shortcode' => '[' . apply_filters( 'woocommerce_my_account_shortcode_tag', 'woocommerce_my_account' ) . ']', ), - _x( 'Terms and conditions', 'Page setting', 'woocommerce' ) => array( + _x( 'Terms and conditions', 'Page setting', 'woocommerce-rest-api' ) => array( 'option' => 'woocommerce_terms_page_id', 'shortcode' => '', ), diff --git a/src/Controllers/Version4/Webhooks.php b/src/Controllers/Version4/Webhooks.php index 17c1e911059..360661844a9 100644 --- a/src/Controllers/Version4/Webhooks.php +++ b/src/Controllers/Version4/Webhooks.php @@ -63,12 +63,12 @@ class Webhooks extends AbstractController { 'topic' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Webhook topic.', 'woocommerce' ), + 'description' => __( 'Webhook topic.', 'woocommerce-rest-api' ), ), 'delivery_url' => array( 'required' => true, 'type' => 'string', - 'description' => __( 'Webhook delivery URL.', 'woocommerce' ), + 'description' => __( 'Webhook delivery URL.', 'woocommerce-rest-api' ), ), ) ), @@ -84,7 +84,7 @@ class Webhooks extends AbstractController { array( 'args' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', ), ), @@ -110,7 +110,7 @@ class Webhooks extends AbstractController { 'force' => array( 'default' => false, 'type' => 'boolean', - 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce' ), + 'description' => __( 'Required to be true, as resource does not support trashing.', 'woocommerce-rest-api' ), ), ), ), @@ -216,7 +216,7 @@ class Webhooks extends AbstractController { $object = $this->get_object( (int) $request['id'] ); if ( ! $object || 0 === $object->get_id() ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } return $this->prepare_item_for_response( $object, $request ); @@ -231,17 +231,17 @@ class Webhooks extends AbstractController { public function create_item( $request ) { if ( ! empty( $request['id'] ) ) { /* translators: %s: post type */ - return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 400 ) ); } // Validate topic. if ( empty( $request['topic'] ) || ! wc_is_webhook_valid_topic( strtolower( $request['topic'] ) ) ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic is required and must be valid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic is required and must be valid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Validate delivery URL. if ( empty( $request['delivery_url'] ) || ! wc_is_valid_url( $request['delivery_url'] ) ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } $post = $this->prepare_item_for_database( $request ); @@ -293,7 +293,7 @@ class Webhooks extends AbstractController { $webhook = wc_get_webhook( $id ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'ID is invalid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } // Update topic. @@ -301,7 +301,7 @@ class Webhooks extends AbstractController { if ( wc_is_webhook_valid_topic( strtolower( $request['topic'] ) ) ) { $webhook->set_topic( $request['topic'] ); } else { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic must be valid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_topic", __( 'Webhook topic must be valid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -310,7 +310,7 @@ class Webhooks extends AbstractController { if ( wc_is_valid_url( $request['delivery_url'] ) ) { $webhook->set_delivery_url( $request['delivery_url'] ); } else { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_delivery_url", __( 'Webhook delivery URL must be a valid URL starting with http:// or https://.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -324,7 +324,7 @@ class Webhooks extends AbstractController { if ( wc_is_webhook_valid_status( strtolower( $request['status'] ) ) ) { $webhook->set_status( $request['status'] ); } else { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_status", __( 'Webhook status must be valid.', 'woocommerce' ), array( 'status' => 400 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_status", __( 'Webhook status must be valid.', 'woocommerce-rest-api' ), array( 'status' => 400 ) ); } } @@ -368,13 +368,13 @@ class Webhooks extends AbstractController { // We don't support trashing for this type, error out. if ( ! $force ) { - return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce' ), array( 'status' => 501 ) ); + return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Webhooks do not support trashing.', 'woocommerce-rest-api' ), array( 'status' => 501 ) ); } $webhook = wc_get_webhook( $id ); if ( empty( $webhook ) || is_null( $webhook ) ) { - return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) ); + return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce-rest-api' ), array( 'status' => 404 ) ); } $request->set_param( 'context', 'edit' ); @@ -382,7 +382,7 @@ class Webhooks extends AbstractController { $result = $webhook->delete( true ); if ( ! $result ) { /* translators: %s: post type */ - return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), $this->post_type ), array( 'status' => 500 ) ); + return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce-rest-api' ), $this->post_type ), array( 'status' => 500 ) ); } $response = new \WP_REST_Response(); $response->set_data( @@ -420,7 +420,7 @@ class Webhooks extends AbstractController { // Validate required POST fields. if ( 'POST' === $request->get_method() && empty( $data->ID ) ) { - $data->post_title = ! empty( $request['name'] ) ? $request['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ); // @codingStandardsIgnoreLine + $data->post_title = ! empty( $request['name'] ) ? $request['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce-rest-api' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce-rest-api' ) ) ); // @codingStandardsIgnoreLine // Post author. $data->post_author = get_current_user_id(); @@ -513,42 +513,42 @@ class Webhooks extends AbstractController { 'type' => 'object', 'properties' => array( 'id' => array( - 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), + 'description' => __( 'Unique identifier for the resource.', 'woocommerce-rest-api' ), 'type' => 'integer', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'name' => array( - 'description' => __( 'A friendly name for the webhook.', 'woocommerce' ), + 'description' => __( 'A friendly name for the webhook.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'status' => array( - 'description' => __( 'Webhook status.', 'woocommerce' ), + 'description' => __( 'Webhook status.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'active', 'enum' => array_keys( wc_get_webhook_statuses() ), 'context' => array( 'view', 'edit' ), ), 'topic' => array( - 'description' => __( 'Webhook topic.', 'woocommerce' ), + 'description' => __( 'Webhook topic.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), ), 'resource' => array( - 'description' => __( 'Webhook resource.', 'woocommerce' ), + 'description' => __( 'Webhook resource.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'event' => array( - 'description' => __( 'Webhook event.', 'woocommerce' ), + 'description' => __( 'Webhook event.', 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'hooks' => array( - 'description' => __( 'WooCommerce action names associated with the webhook.', 'woocommerce' ), + 'description' => __( 'WooCommerce action names associated with the webhook.', 'woocommerce-rest-api' ), 'type' => 'array', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -557,37 +557,37 @@ class Webhooks extends AbstractController { ), ), 'delivery_url' => array( - 'description' => __( 'The URL where the webhook payload is delivered.', 'woocommerce' ), + 'description' => __( 'The URL where the webhook payload is delivered.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'uri', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'secret' => array( - 'description' => __( "Secret key used to generate a hash of the delivered webhook and provided in the request headers. This will default to a MD5 hash from the current user's ID|username if not provided.", 'woocommerce' ), + 'description' => __( "Secret key used to generate a hash of the delivered webhook and provided in the request headers. This will default to a MD5 hash from the current user's ID|username if not provided.", 'woocommerce-rest-api' ), 'type' => 'string', 'context' => array( 'edit' ), ), 'date_created' => array( - 'description' => __( "The date the webhook was created, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook was created, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_created_gmt' => array( - 'description' => __( 'The date the webhook was created, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the webhook was created, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified' => array( - 'description' => __( "The date the webhook was last modified, in the site's timezone.", 'woocommerce' ), + 'description' => __( "The date the webhook was last modified, in the site's timezone.", 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'date_modified_gmt' => array( - 'description' => __( 'The date the webhook was last modified, as GMT.', 'woocommerce' ), + 'description' => __( 'The date the webhook was last modified, as GMT.', 'woocommerce-rest-api' ), 'type' => 'date-time', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -609,19 +609,19 @@ class Webhooks extends AbstractController { $params['context']['default'] = 'view'; $params['after'] = array( - 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['before'] = array( - 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ), + 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-rest-api' ), 'type' => 'string', 'format' => 'date-time', 'validate_callback' => 'rest_validate_request_arg', ); $params['exclude'] = array( - 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), + 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' => 'integer', @@ -630,7 +630,7 @@ class Webhooks extends AbstractController { 'sanitize_callback' => 'wp_parse_id_list', ); $params['include'] = array( - 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ), + 'description' => __( 'Limit result set to specific ids.', 'woocommerce-rest-api' ), 'type' => 'array', 'items' => array( 'type' > 'integer', @@ -639,20 +639,20 @@ class Webhooks extends AbstractController { 'sanitize_callback' => 'wp_parse_id_list', ); $params['offset'] = array( - 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), + 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-rest-api' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $params['order'] = array( - 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), + 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'desc', 'enum' => array( 'asc', 'desc' ), 'validate_callback' => 'rest_validate_request_arg', ); $params['orderby'] = array( - 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), + 'description' => __( 'Sort collection by object attribute.', 'woocommerce-rest-api' ), 'type' => 'string', 'default' => 'date', 'enum' => array( @@ -664,7 +664,7 @@ class Webhooks extends AbstractController { ); $params['status'] = array( 'default' => 'all', - 'description' => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce' ), + 'description' => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce-rest-api' ), 'type' => 'string', 'enum' => array( 'all', 'active', 'paused', 'disabled' ), 'sanitize_callback' => 'sanitize_key', diff --git a/src/Utilities/ImageAttachment.php b/src/Utilities/ImageAttachment.php index a9fab68b8c7..115aa7d0279 100644 --- a/src/Utilities/ImageAttachment.php +++ b/src/Utilities/ImageAttachment.php @@ -58,7 +58,7 @@ class ImageAttachment { if ( ! wp_attachment_is_image( $this->id ) ) { /* translators: %s: image ID */ - throw new \WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce' ), $this->id ), 400 ); + throw new \WC_REST_Exception( 'woocommerce_product_invalid_image_id', sprintf( __( '#%s is an invalid image ID.', 'woocommerce-rest-api' ), $this->id ), 400 ); } } diff --git a/woocommerce-rest-api.php b/woocommerce-rest-api.php index 1be24fe5ee4..ec068e1e999 100644 --- a/woocommerce-rest-api.php +++ b/woocommerce-rest-api.php @@ -36,7 +36,7 @@ if ( is_readable( $autoloader ) ) { error_log( // phpcs:ignore sprintf( /* translators: 1: composer command. 2: plugin directory */ - esc_html__( 'Your installation of the WooCommerce REST API feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce' ), + esc_html__( 'Your installation of the WooCommerce REST API feature plugin is incomplete. Please run %1$s within the %2$s directory.', 'woocommerce-rest-api' ), '`composer install`', '`' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '`' ) @@ -54,7 +54,7 @@ if ( is_readable( $autoloader ) ) { composer install', '' . esc_html( str_replace( ABSPATH, '', __DIR__ ) ) . '' );