Codemod to change php i18n text domain from 'woocommerce-admin' to 'woocommerce' in post-merge WCA folders

This commit is contained in:
RJChow 2022-03-31 19:26:53 +08:00
parent 6e8d620f00
commit 09a0d2568e
156 changed files with 1320 additions and 1320 deletions

View File

@ -23,25 +23,25 @@ function wc_admin_get_core_pages_to_connect() {
return array( return array(
'wc-addons' => array( 'wc-addons' => array(
'title' => __( 'Extensions', 'woocommerce-admin' ), 'title' => __( 'Extensions', 'woocommerce' ),
'tabs' => array(), 'tabs' => array(),
), ),
'wc-reports' => array( 'wc-reports' => array(
'title' => __( 'Reports', 'woocommerce-admin' ), 'title' => __( 'Reports', 'woocommerce' ),
'tabs' => $report_tabs, 'tabs' => $report_tabs,
), ),
'wc-settings' => array( 'wc-settings' => array(
'title' => __( 'Settings', 'woocommerce-admin' ), 'title' => __( 'Settings', 'woocommerce' ),
'tabs' => apply_filters( 'woocommerce_settings_tabs_array', array() ), 'tabs' => apply_filters( 'woocommerce_settings_tabs_array', array() ),
), ),
'wc-status' => array( 'wc-status' => array(
'title' => __( 'Status', 'woocommerce-admin' ), 'title' => __( 'Status', 'woocommerce' ),
'tabs' => apply_filters( 'tabs' => apply_filters(
'woocommerce_admin_status_tabs', 'woocommerce_admin_status_tabs',
array( array(
'status' => __( 'System status', 'woocommerce-admin' ), 'status' => __( 'System status', 'woocommerce' ),
'tools' => __( 'Tools', 'woocommerce-admin' ), 'tools' => __( 'Tools', 'woocommerce' ),
'logs' => __( 'Logs', 'woocommerce-admin' ), 'logs' => __( 'Logs', 'woocommerce' ),
) )
), ),
), ),
@ -59,7 +59,7 @@ function wc_admin_filter_core_page_breadcrumbs( $breadcrumbs ) {
$pages_to_connect = wc_admin_get_core_pages_to_connect(); $pages_to_connect = wc_admin_get_core_pages_to_connect();
$woocommerce_breadcrumb = array( $woocommerce_breadcrumb = array(
'admin.php?page=wc-admin', 'admin.php?page=wc-admin',
__( 'WooCommerce', 'woocommerce-admin' ), __( 'WooCommerce', 'woocommerce' ),
); );
foreach ( $pages_to_connect as $page_id => $page_data ) { foreach ( $pages_to_connect as $page_id => $page_data ) {
@ -129,7 +129,7 @@ wc_admin_connect_page(
array( array(
'id' => 'woocommerce-orders', 'id' => 'woocommerce-orders',
'screen_id' => 'edit-shop_order', 'screen_id' => 'edit-shop_order',
'title' => __( 'Orders', 'woocommerce-admin' ), 'title' => __( 'Orders', 'woocommerce' ),
'path' => add_query_arg( 'post_type', 'shop_order', $posttype_list_base ), 'path' => add_query_arg( 'post_type', 'shop_order', $posttype_list_base ),
) )
); );
@ -140,7 +140,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-add-order', 'id' => 'woocommerce-add-order',
'parent' => 'woocommerce-orders', 'parent' => 'woocommerce-orders',
'screen_id' => 'shop_order-add', 'screen_id' => 'shop_order-add',
'title' => __( 'Add New', 'woocommerce-admin' ), 'title' => __( 'Add New', 'woocommerce' ),
) )
); );
@ -150,7 +150,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-edit-order', 'id' => 'woocommerce-edit-order',
'parent' => 'woocommerce-orders', 'parent' => 'woocommerce-orders',
'screen_id' => 'shop_order', 'screen_id' => 'shop_order',
'title' => __( 'Edit Order', 'woocommerce-admin' ), 'title' => __( 'Edit Order', 'woocommerce' ),
) )
); );
@ -160,7 +160,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-coupons', 'id' => 'woocommerce-coupons',
'parent' => Features::is_enabled( 'coupons' ) ? 'woocommerce-marketing' : null, 'parent' => Features::is_enabled( 'coupons' ) ? 'woocommerce-marketing' : null,
'screen_id' => 'edit-shop_coupon', 'screen_id' => 'edit-shop_coupon',
'title' => __( 'Coupons', 'woocommerce-admin' ), 'title' => __( 'Coupons', 'woocommerce' ),
'path' => add_query_arg( 'post_type', 'shop_coupon', $posttype_list_base ), 'path' => add_query_arg( 'post_type', 'shop_coupon', $posttype_list_base ),
) )
); );
@ -171,7 +171,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-add-coupon', 'id' => 'woocommerce-add-coupon',
'parent' => 'woocommerce-coupons', 'parent' => 'woocommerce-coupons',
'screen_id' => 'shop_coupon-add', 'screen_id' => 'shop_coupon-add',
'title' => __( 'Add New', 'woocommerce-admin' ), 'title' => __( 'Add New', 'woocommerce' ),
) )
); );
@ -181,7 +181,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-edit-coupon', 'id' => 'woocommerce-edit-coupon',
'parent' => 'woocommerce-coupons', 'parent' => 'woocommerce-coupons',
'screen_id' => 'shop_coupon', 'screen_id' => 'shop_coupon',
'title' => __( 'Edit Coupon', 'woocommerce-admin' ), 'title' => __( 'Edit Coupon', 'woocommerce' ),
) )
); );
@ -190,7 +190,7 @@ wc_admin_connect_page(
array( array(
'id' => 'woocommerce-products', 'id' => 'woocommerce-products',
'screen_id' => 'edit-product', 'screen_id' => 'edit-product',
'title' => __( 'Products', 'woocommerce-admin' ), 'title' => __( 'Products', 'woocommerce' ),
'path' => add_query_arg( 'post_type', 'product', $posttype_list_base ), 'path' => add_query_arg( 'post_type', 'product', $posttype_list_base ),
) )
); );
@ -201,7 +201,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-add-product', 'id' => 'woocommerce-add-product',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product-add', 'screen_id' => 'product-add',
'title' => __( 'Add New', 'woocommerce-admin' ), 'title' => __( 'Add New', 'woocommerce' ),
) )
); );
@ -211,7 +211,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-edit-product', 'id' => 'woocommerce-edit-product',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product', 'screen_id' => 'product',
'title' => __( 'Edit Product', 'woocommerce-admin' ), 'title' => __( 'Edit Product', 'woocommerce' ),
) )
); );
@ -221,7 +221,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-import-products', 'id' => 'woocommerce-import-products',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product_page_product_importer', 'screen_id' => 'product_page_product_importer',
'title' => __( 'Import Products', 'woocommerce-admin' ), 'title' => __( 'Import Products', 'woocommerce' ),
) )
); );
@ -231,7 +231,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-export-products', 'id' => 'woocommerce-export-products',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product_page_product_exporter', 'screen_id' => 'product_page_product_exporter',
'title' => __( 'Export Products', 'woocommerce-admin' ), 'title' => __( 'Export Products', 'woocommerce' ),
) )
); );
@ -241,7 +241,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-product-categories', 'id' => 'woocommerce-product-categories',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'edit-product_cat', 'screen_id' => 'edit-product_cat',
'title' => __( 'Product categories', 'woocommerce-admin' ), 'title' => __( 'Product categories', 'woocommerce' ),
) )
); );
@ -251,7 +251,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-product-edit-category', 'id' => 'woocommerce-product-edit-category',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product_cat', 'screen_id' => 'product_cat',
'title' => __( 'Edit category', 'woocommerce-admin' ), 'title' => __( 'Edit category', 'woocommerce' ),
) )
); );
@ -261,7 +261,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-product-tags', 'id' => 'woocommerce-product-tags',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'edit-product_tag', 'screen_id' => 'edit-product_tag',
'title' => __( 'Product tags', 'woocommerce-admin' ), 'title' => __( 'Product tags', 'woocommerce' ),
) )
); );
@ -271,7 +271,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-product-edit-tag', 'id' => 'woocommerce-product-edit-tag',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product_tag', 'screen_id' => 'product_tag',
'title' => __( 'Edit tag', 'woocommerce-admin' ), 'title' => __( 'Edit tag', 'woocommerce' ),
) )
); );
@ -281,7 +281,7 @@ wc_admin_connect_page(
'id' => 'woocommerce-product-attributes', 'id' => 'woocommerce-product-attributes',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product_page_product_attributes', 'screen_id' => 'product_page_product_attributes',
'title' => __( 'Attributes', 'woocommerce-admin' ), 'title' => __( 'Attributes', 'woocommerce' ),
) )
); );
@ -291,6 +291,6 @@ wc_admin_connect_page(
'id' => 'woocommerce-product-edit-attribute', 'id' => 'woocommerce-product-edit-attribute',
'parent' => 'woocommerce-products', 'parent' => 'woocommerce-products',
'screen_id' => 'product_page_product_attribute-edit', 'screen_id' => 'product_page_product_attribute-edit',
'title' => __( 'Edit attribute', 'woocommerce-admin' ), 'title' => __( 'Edit attribute', 'woocommerce' ),
) )
); );

View File

@ -16,7 +16,7 @@ do_action( 'woocommerce_email_header', $email_heading, $email );
<a href="<?php echo esc_url( $download_url ); ?>"> <a href="<?php echo esc_url( $download_url ); ?>">
<?php <?php
/* translators: %s: report name */ /* translators: %s: report name */
echo esc_html( sprintf( __( 'Download your %s Report', 'woocommerce-admin' ), $report_name ) ); echo esc_html( sprintf( __( 'Download your %s Report', 'woocommerce' ), $report_name ) );
?> ?>
</a> </a>
<?php <?php

View File

@ -12,7 +12,7 @@ echo esc_html( wp_strip_all_tags( $email_heading ) );
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
/* translators: %1$s: report name, %2$s: download URL */ /* translators: %1$s: report name, %2$s: download URL */
echo wp_kses_post( sprintf( __( 'Download your %1$s Report: %2$s', 'woocommerce-admin' ), $report_name, $download_url ) ); echo wp_kses_post( sprintf( __( 'Download your %1$s Report: %2$s', 'woocommerce' ), $report_name, $download_url ) );
echo "\n\n----------------------------------------\n\n"; echo "\n\n----------------------------------------\n\n";

View File

@ -16,7 +16,7 @@ echo wp_kses_post( $email_content );
foreach ( $email_actions as $an_action ) { foreach ( $email_actions as $an_action ) {
echo "\n"; echo "\n";
/* translators: %1$s: action label, %2$s: action URL */ /* translators: %1$s: action label, %2$s: action URL */
echo wp_kses_post( sprintf( __( '%1$s: %2$s', 'woocommerce-admin' ), $an_action->label, $trigger_note_action_url . $an_action->id ) ); echo wp_kses_post( sprintf( __( '%1$s: %2$s', 'woocommerce' ), $an_action->label, $trigger_note_action_url . $an_action->id ) );
} }
echo "\n\n----------------------------------------\n\n"; echo "\n\n----------------------------------------\n\n";

View File

@ -32,7 +32,7 @@ class Coupons extends \WC_REST_Coupons_Controller {
public function get_collection_params() { public function get_collection_params() {
$params = parent::get_collection_params(); $params = parent::get_collection_params();
$params['search'] = array( $params['search'] = array(
'description' => __( 'Limit results to coupons with codes matching a given string.', 'woocommerce-admin' ), 'description' => __( 'Limit results to coupons with codes matching a given string.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );

View File

@ -26,7 +26,7 @@ trait CustomAttributeTraits {
if ( empty( $matching_attributes ) ) { if ( empty( $matching_attributes ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_product_attribute_not_found', 'woocommerce_rest_product_attribute_not_found',
__( 'No product attribute with that slug was found.', 'woocommerce-admin' ), __( 'No product attribute with that slug was found.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }

View File

@ -48,7 +48,7 @@ class Customers extends \Automattic\WooCommerce\Admin\API\Reports\Customers\Cont
array( array(
'args' => array( 'args' => array(
'id' => array( 'id' => array(
'description' => __( 'Unique ID for the resource.', 'woocommerce-admin' ), 'description' => __( 'Unique ID for the resource.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
), ),
), ),

View File

@ -36,7 +36,7 @@ class Data extends \WC_REST_Data_Controller {
$this->prepare_item_for_response( $this->prepare_item_for_response(
(object) array( (object) array(
'slug' => 'download-ips', 'slug' => 'download-ips',
'description' => __( 'An endpoint used for searching download logs for a specific IP address.', 'woocommerce-admin' ), 'description' => __( 'An endpoint used for searching download logs for a specific IP address.', 'woocommerce' ),
), ),
$request $request
) )

View File

@ -70,7 +70,7 @@ class DataDownloadIPs extends \WC_REST_Data_Controller {
) )
); );
} else { } else {
return new \WP_Error( 'woocommerce_rest_data_download_ips_invalid_request', __( 'Invalid request. Please pass the match parameter.', 'woocommerce-admin' ), array( 'status' => 400 ) ); return new \WP_Error( 'woocommerce_rest_data_download_ips_invalid_request', __( 'Invalid request. Please pass the match parameter.', 'woocommerce' ), array( 'status' => 400 ) );
} }
$data = array(); $data = array();
@ -134,7 +134,7 @@ class DataDownloadIPs extends \WC_REST_Data_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['match'] = array( $params['match'] = array(
'description' => __( 'A partial IP address can be passed and matching results will be returned.', 'woocommerce-admin' ), 'description' => __( 'A partial IP address can be passed and matching results will be returned.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
@ -155,7 +155,7 @@ class DataDownloadIPs extends \WC_REST_Data_Controller {
'properties' => array( 'properties' => array(
'user_ip_address' => array( 'user_ip_address' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'IP address.', 'woocommerce-admin' ), 'description' => __( 'IP address.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),

View File

@ -62,7 +62,7 @@ class Experiments extends \WC_REST_Data_Controller {
if ( ! isset( $args['experiment_name'] ) ) { if ( ! isset( $args['experiment_name'] ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_experiment_name_required', 'woocommerce_rest_experiment_name_required',
__( 'Sorry, experiment_name is required.', 'woocommerce-admin' ), __( 'Sorry, experiment_name is required.', 'woocommerce' ),
array( 'status' => 400 ) array( 'status' => 400 )
); );
} }

View File

@ -59,7 +59,7 @@ class Features extends \WC_REST_Data_Controller {
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;

View File

@ -120,16 +120,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
return array( return array(
'id' => 'coupons', 'id' => 'coupons',
'label' => __( 'Top Coupons - Number of Orders', 'woocommerce-admin' ), 'label' => __( 'Top Coupons - Number of Orders', 'woocommerce' ),
'headers' => array( 'headers' => array(
array( array(
'label' => __( 'Coupon code', 'woocommerce-admin' ), 'label' => __( 'Coupon code', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Orders', 'woocommerce-admin' ), 'label' => __( 'Orders', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Amount discounted', 'woocommerce-admin' ), 'label' => __( 'Amount discounted', 'woocommerce' ),
), ),
), ),
'rows' => $rows, 'rows' => $rows,
@ -189,16 +189,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
return array( return array(
'id' => 'categories', 'id' => 'categories',
'label' => __( 'Top categories - Items sold', 'woocommerce-admin' ), 'label' => __( 'Top categories - Items sold', 'woocommerce' ),
'headers' => array( 'headers' => array(
array( array(
'label' => __( 'Category', 'woocommerce-admin' ), 'label' => __( 'Category', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Items sold', 'woocommerce-admin' ), 'label' => __( 'Items sold', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Net sales', 'woocommerce-admin' ), 'label' => __( 'Net sales', 'woocommerce' ),
), ),
), ),
'rows' => $rows, 'rows' => $rows,
@ -256,16 +256,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
return array( return array(
'id' => 'customers', 'id' => 'customers',
'label' => __( 'Top Customers - Total Spend', 'woocommerce-admin' ), 'label' => __( 'Top Customers - Total Spend', 'woocommerce' ),
'headers' => array( 'headers' => array(
array( array(
'label' => __( 'Customer Name', 'woocommerce-admin' ), 'label' => __( 'Customer Name', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Orders', 'woocommerce-admin' ), 'label' => __( 'Orders', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Total Spend', 'woocommerce-admin' ), 'label' => __( 'Total Spend', 'woocommerce' ),
), ),
), ),
'rows' => $rows, 'rows' => $rows,
@ -325,16 +325,16 @@ class Leaderboards extends \WC_REST_Data_Controller {
return array( return array(
'id' => 'products', 'id' => 'products',
'label' => __( 'Top products - Items sold', 'woocommerce-admin' ), 'label' => __( 'Top products - Items sold', 'woocommerce' ),
'headers' => array( 'headers' => array(
array( array(
'label' => __( 'Product', 'woocommerce-admin' ), 'label' => __( 'Product', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Items sold', 'woocommerce-admin' ), 'label' => __( 'Items sold', 'woocommerce' ),
), ),
array( array(
'label' => __( 'Net sales', 'woocommerce-admin' ), 'label' => __( 'Net sales', 'woocommerce' ),
), ),
), ),
'rows' => $rows, 'rows' => $rows,
@ -445,7 +445,7 @@ class Leaderboards extends \WC_REST_Data_Controller {
public function get_collection_params() { public function get_collection_params() {
$params = array(); $params = array();
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -453,7 +453,7 @@ class Leaderboards extends \WC_REST_Data_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 5, 'default' => 5,
'minimum' => 1, 'minimum' => 1,
@ -462,19 +462,19 @@ class Leaderboards extends \WC_REST_Data_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['persisted_query'] = array( $params['persisted_query'] = array(
'description' => __( 'URL query to persist across links.', 'woocommerce-admin' ), 'description' => __( 'URL query to persist across links.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
@ -494,26 +494,26 @@ class Leaderboards extends \WC_REST_Data_Controller {
'properties' => array( 'properties' => array(
'id' => array( 'id' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Leaderboard ID.', 'woocommerce-admin' ), 'description' => __( 'Leaderboard ID.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),
'label' => array( 'label' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Displayed title for the leaderboard.', 'woocommerce-admin' ), 'description' => __( 'Displayed title for the leaderboard.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),
'headers' => array( 'headers' => array(
'type' => 'array', 'type' => 'array',
'description' => __( 'Table headers.', 'woocommerce-admin' ), 'description' => __( 'Table headers.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
'properties' => array( 'properties' => array(
'label' => array( 'label' => array(
'description' => __( 'Table column header.', 'woocommerce-admin' ), 'description' => __( 'Table column header.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -523,20 +523,20 @@ class Leaderboards extends \WC_REST_Data_Controller {
), ),
'rows' => array( 'rows' => array(
'type' => 'array', 'type' => 'array',
'description' => __( 'Table rows.', 'woocommerce-admin' ), 'description' => __( 'Table rows.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
'properties' => array( 'properties' => array(
'display' => array( 'display' => array(
'description' => __( 'Table cell display.', 'woocommerce-admin' ), 'description' => __( 'Table cell display.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'value' => array( 'value' => array(
'description' => __( 'Table cell value.', 'woocommerce-admin' ), 'description' => __( 'Table cell value.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,

View File

@ -88,7 +88,7 @@ class Marketing extends \WC_REST_Data_Controller {
*/ */
public function get_recommended_plugins_permissions_check( $request ) { public function get_recommended_plugins_permissions_check( $request ) {
if ( ! current_user_can( 'install_plugins' ) ) { if ( ! current_user_can( 'install_plugins' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;

View File

@ -84,13 +84,13 @@ class MarketingOverview extends \WC_REST_Data_Controller {
$plugin_slug = $request->get_param( 'plugin' ); $plugin_slug = $request->get_param( 'plugin' );
if ( ! PluginsHelper::is_plugin_installed( $plugin_slug ) ) { if ( ! PluginsHelper::is_plugin_installed( $plugin_slug ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_plugin', __( 'Invalid plugin.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_invalid_plugin', __( 'Invalid plugin.', 'woocommerce' ), 404 );
} }
$result = activate_plugin( PluginsHelper::get_plugin_path_from_slug( $plugin_slug ) ); $result = activate_plugin( PluginsHelper::get_plugin_path_from_slug( $plugin_slug ) );
if ( ! is_null( $result ) ) { if ( ! is_null( $result ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_plugin', __( 'The plugin could not be activated.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_invalid_plugin', __( 'The plugin could not be activated.', 'woocommerce' ), 500 );
} }
// IMPORTANT - Don't return the active plugins data here. // IMPORTANT - Don't return the active plugins data here.
@ -111,7 +111,7 @@ class MarketingOverview extends \WC_REST_Data_Controller {
*/ */
public function install_plugins_permissions_check( $request ) { public function install_plugins_permissions_check( $request ) {
if ( ! current_user_can( 'install_plugins' ) ) { if ( ! current_user_can( 'install_plugins' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;

View File

@ -118,7 +118,7 @@ class NavigationFavorites extends \WC_REST_Data_Controller {
return $this->prepare_error( return $this->prepare_error(
new \WP_Error( new \WP_Error(
'woocommerce_favorites_invalid_user', 'woocommerce_favorites_invalid_user',
__( 'Invalid user_id provided', 'woocommerce-admin' ) __( 'Invalid user_id provided', 'woocommerce' )
) )
); );
} }

View File

@ -30,11 +30,11 @@ class NoteActions extends Notes {
array( array(
'args' => array( 'args' => array(
'note_id' => array( 'note_id' => array(
'description' => __( 'Unique ID for the Note.', 'woocommerce-admin' ), 'description' => __( 'Unique ID for the Note.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
), ),
'action_id' => array( 'action_id' => array(
'description' => __( 'Unique ID for the Note Action.', 'woocommerce-admin' ), 'description' => __( 'Unique ID for the Note Action.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
), ),
), ),
@ -61,7 +61,7 @@ class NoteActions extends Notes {
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_invalid_id', 'woocommerce_note_invalid_id',
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ), __( 'Sorry, there is no resource with that ID.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }
@ -74,7 +74,7 @@ class NoteActions extends Notes {
if ( ! $triggered_action ) { if ( ! $triggered_action ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_action_invalid_id', 'woocommerce_note_action_invalid_id',
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ), __( 'Sorry, there is no resource with that ID.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }

View File

@ -67,7 +67,7 @@ class Notes extends \WC_REST_CRUD_Controller {
array( array(
'args' => array( 'args' => array(
'id' => array( 'id' => array(
'description' => __( 'Unique ID for the resource.', 'woocommerce-admin' ), 'description' => __( 'Unique ID for the resource.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
), ),
), ),
@ -108,7 +108,7 @@ class Notes extends \WC_REST_CRUD_Controller {
'permission_callback' => array( $this, 'update_items_permissions_check' ), 'permission_callback' => array( $this, 'update_items_permissions_check' ),
'args' => array( 'args' => array(
'status' => array( 'status' => array(
'description' => __( 'Status of note.', 'woocommerce-admin' ), 'description' => __( 'Status of note.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -175,7 +175,7 @@ class Notes extends \WC_REST_CRUD_Controller {
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_invalid_id', 'woocommerce_note_invalid_id',
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ), __( 'Sorry, there is no resource with that ID.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }
@ -295,7 +295,7 @@ class Notes extends \WC_REST_CRUD_Controller {
*/ */
public function get_item_permissions_check( $request ) { public function get_item_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -309,7 +309,7 @@ class Notes extends \WC_REST_CRUD_Controller {
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'system_status', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -327,7 +327,7 @@ class Notes extends \WC_REST_CRUD_Controller {
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_invalid_id', 'woocommerce_note_invalid_id',
__( 'Sorry, there is no resource with that ID.', 'woocommerce-admin' ), __( 'Sorry, there is no resource with that ID.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }
@ -348,7 +348,7 @@ class Notes extends \WC_REST_CRUD_Controller {
if ( ! $note ) { if ( ! $note ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_invalid_id', 'woocommerce_note_invalid_id',
__( 'Sorry, there is no note with that ID.', 'woocommerce-admin' ), __( 'Sorry, there is no note with that ID.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }
@ -434,7 +434,7 @@ class Notes extends \WC_REST_CRUD_Controller {
if ( ! isset( $note_ids ) || ! is_array( $note_ids ) ) { if ( ! isset( $note_ids ) || ! is_array( $note_ids ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_invalid_ids', 'woocommerce_note_invalid_ids',
__( 'Please provide an array of IDs through the noteIds param.', 'woocommerce-admin' ), __( 'Please provide an array of IDs through the noteIds param.', 'woocommerce' ),
array( 'status' => 422 ) array( 'status' => 422 )
); );
} }
@ -464,7 +464,7 @@ class Notes extends \WC_REST_CRUD_Controller {
if ( ! in_array( $promo_note_name, $this->allowed_promo_notes, true ) ) { if ( ! in_array( $promo_note_name, $this->allowed_promo_notes, true ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_note_invalid_promo_note_name', 'woocommerce_note_invalid_promo_note_name',
__( 'Please provide a valid promo note name.', 'woocommerce-admin' ), __( 'Please provide a valid promo note name.', 'woocommerce' ),
array( 'status' => 422 ) array( 'status' => 422 )
); );
} }
@ -505,7 +505,7 @@ class Notes extends \WC_REST_CRUD_Controller {
*/ */
public function update_items_permissions_check( $request ) { public function update_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
} }
@ -634,14 +634,14 @@ class Notes extends \WC_REST_CRUD_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -654,7 +654,7 @@ class Notes extends \WC_REST_CRUD_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -662,7 +662,7 @@ class Notes extends \WC_REST_CRUD_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -671,7 +671,7 @@ class Notes extends \WC_REST_CRUD_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['type'] = array( $params['type'] = array(
'description' => __( 'Type of note.', 'woocommerce-admin' ), 'description' => __( 'Type of note.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -681,7 +681,7 @@ class Notes extends \WC_REST_CRUD_Controller {
), ),
); );
$params['status'] = array( $params['status'] = array(
'description' => __( 'Status of note.', 'woocommerce-admin' ), 'description' => __( 'Status of note.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -691,7 +691,7 @@ class Notes extends \WC_REST_CRUD_Controller {
), ),
); );
$params['source'] = array( $params['source'] = array(
'description' => __( 'Source of note.', 'woocommerce-admin' ), 'description' => __( 'Source of note.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_list', 'sanitize_callback' => 'wp_parse_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -714,108 +714,108 @@ class Notes extends \WC_REST_CRUD_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'id' => array( 'id' => array(
'description' => __( 'ID of the note record.', 'woocommerce-admin' ), 'description' => __( 'ID of the note record.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),
'name' => array( 'name' => array(
'description' => __( 'Name of the note.', 'woocommerce-admin' ), 'description' => __( 'Name of the note.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'type' => array( 'type' => array(
'description' => __( 'The type of the note (e.g. error, warning, etc.).', 'woocommerce-admin' ), 'description' => __( 'The type of the note (e.g. error, warning, etc.).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'locale' => array( 'locale' => array(
'description' => __( 'Locale used for the note title and content.', 'woocommerce-admin' ), 'description' => __( 'Locale used for the note title and content.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'title' => array( 'title' => array(
'description' => __( 'Title of the note.', 'woocommerce-admin' ), 'description' => __( 'Title of the note.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'content' => array( 'content' => array(
'description' => __( 'Content of the note.', 'woocommerce-admin' ), 'description' => __( 'Content of the note.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'content_data' => array( 'content_data' => array(
'description' => __( 'Content data for the note. JSON string. Available for re-localization.', 'woocommerce-admin' ), 'description' => __( 'Content data for the note. JSON string. Available for re-localization.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'status' => array( 'status' => array(
'description' => __( 'The status of the note (e.g. unactioned, actioned).', 'woocommerce-admin' ), 'description' => __( 'The status of the note (e.g. unactioned, actioned).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
), ),
'source' => array( 'source' => array(
'description' => __( 'Source of the note.', 'woocommerce-admin' ), 'description' => __( 'Source of the note.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_created' => array( 'date_created' => array(
'description' => __( 'Date the note was created.', 'woocommerce-admin' ), 'description' => __( 'Date the note was created.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_created_gmt' => array( 'date_created_gmt' => array(
'description' => __( 'Date the note was created (GMT).', 'woocommerce-admin' ), 'description' => __( 'Date the note was created (GMT).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_reminder' => array( 'date_reminder' => array(
'description' => __( 'Date after which the user should be reminded of the note, if any.', 'woocommerce-admin' ), 'description' => __( 'Date after which the user should be reminded of the note, if any.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, // @todo Allow date_reminder to be updated. 'readonly' => true, // @todo Allow date_reminder to be updated.
), ),
'date_reminder_gmt' => array( 'date_reminder_gmt' => array(
'description' => __( 'Date after which the user should be reminded of the note, if any (GMT).', 'woocommerce-admin' ), 'description' => __( 'Date after which the user should be reminded of the note, if any (GMT).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'is_snoozable' => array( 'is_snoozable' => array(
'description' => __( 'Whether or not a user can request to be reminded about the note.', 'woocommerce-admin' ), 'description' => __( 'Whether or not a user can request to be reminded about the note.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'actions' => array( 'actions' => array(
'description' => __( 'An array of actions, if any, for the note.', 'woocommerce-admin' ), 'description' => __( 'An array of actions, if any, for the note.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'layout' => array( 'layout' => array(
'description' => __( 'The layout of the note (e.g. banner, thumbnail, plain).', 'woocommerce-admin' ), 'description' => __( 'The layout of the note (e.g. banner, thumbnail, plain).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'image' => array( 'image' => array(
'description' => __( 'The image of the note, if any.', 'woocommerce-admin' ), 'description' => __( 'The image of the note, if any.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'is_deleted' => array( 'is_deleted' => array(
'description' => __( 'Registers whether the note is deleted or not', 'woocommerce-admin' ), 'description' => __( 'Registers whether the note is deleted or not', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,

View File

@ -59,7 +59,7 @@ class OnboardingFreeExtensions extends \WC_REST_Data_Controller {
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;

View File

@ -59,7 +59,7 @@ class OnboardingProductTypes extends \WC_REST_Data_Controller {
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;

View File

@ -87,7 +87,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -101,7 +101,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
*/ */
public function update_items_permissions_check( $request ) { public function update_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot edit this resource.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -162,7 +162,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
$result = array( $result = array(
'status' => 'success', 'status' => 'success',
'message' => __( 'Onboarding profile data has been updated.', 'woocommerce-admin' ), 'message' => __( 'Onboarding profile data has been updated.', 'woocommerce' ),
); );
$response = $this->prepare_item_for_response( $result, $request ); $response = $this->prepare_item_for_response( $result, $request );
@ -263,21 +263,21 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
$properties = array( $properties = array(
'completed' => array( 'completed' => array(
'type' => 'boolean', 'type' => 'boolean',
'description' => __( 'Whether or not the profile was completed.', 'woocommerce-admin' ), 'description' => __( 'Whether or not the profile was completed.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
), ),
'skipped' => array( 'skipped' => array(
'type' => 'boolean', 'type' => 'boolean',
'description' => __( 'Whether or not the profile was skipped.', 'woocommerce-admin' ), 'description' => __( 'Whether or not the profile was skipped.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
), ),
'industry' => array( 'industry' => array(
'type' => 'array', 'type' => 'array',
'description' => __( 'Industry.', 'woocommerce-admin' ), 'description' => __( 'Industry.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -287,7 +287,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'product_types' => array( 'product_types' => array(
'type' => 'array', 'type' => 'array',
'description' => __( 'Types of products sold.', 'woocommerce-admin' ), 'description' => __( 'Types of products sold.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
@ -299,7 +299,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'product_count' => array( 'product_count' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Number of products to be added.', 'woocommerce-admin' ), 'description' => __( 'Number of products to be added.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -313,7 +313,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'selling_venues' => array( 'selling_venues' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Other places the store is selling products.', 'woocommerce-admin' ), 'description' => __( 'Other places the store is selling products.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -327,7 +327,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'number_employees' => array( 'number_employees' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Number of employees of the store.', 'woocommerce-admin' ), 'description' => __( 'Number of employees of the store.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -342,7 +342,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'revenue' => array( 'revenue' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Current annual revenue of the store.', 'woocommerce-admin' ), 'description' => __( 'Current annual revenue of the store.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -358,7 +358,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'other_platform' => array( 'other_platform' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Name of other platform used to sell.', 'woocommerce-admin' ), 'description' => __( 'Name of other platform used to sell.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -376,14 +376,14 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'other_platform_name' => array( 'other_platform_name' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Name of other platform used to sell (not listed).', 'woocommerce-admin' ), 'description' => __( 'Name of other platform used to sell (not listed).', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
), ),
'business_extensions' => array( 'business_extensions' => array(
'type' => 'array', 'type' => 'array',
'description' => __( 'Extra business extensions to install.', 'woocommerce-admin' ), 'description' => __( 'Extra business extensions to install.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
@ -404,7 +404,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'theme' => array( 'theme' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Selected store theme.', 'woocommerce-admin' ), 'description' => __( 'Selected store theme.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'sanitize_callback' => 'sanitize_title_with_dashes', 'sanitize_callback' => 'sanitize_title_with_dashes',
@ -412,28 +412,28 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
), ),
'setup_client' => array( 'setup_client' => array(
'type' => 'boolean', 'type' => 'boolean',
'description' => __( 'Whether or not this store was setup for a client.', 'woocommerce-admin' ), 'description' => __( 'Whether or not this store was setup for a client.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
), ),
'wccom_connected' => array( 'wccom_connected' => array(
'type' => 'boolean', 'type' => 'boolean',
'description' => __( 'Whether or not the store was connected to WooCommerce.com during the extension flow.', 'woocommerce-admin' ), 'description' => __( 'Whether or not the store was connected to WooCommerce.com during the extension flow.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
), ),
'is_agree_marketing' => array( 'is_agree_marketing' => array(
'type' => 'boolean', 'type' => 'boolean',
'description' => __( 'Whether or not this store agreed to receiving marketing contents from WooCommerce.com.', 'woocommerce-admin' ), 'description' => __( 'Whether or not this store agreed to receiving marketing contents from WooCommerce.com.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
), ),
'store_email' => array( 'store_email' => array(
'type' => 'string', 'type' => 'string',
'description' => __( 'Store email address.', 'woocommerce-admin' ), 'description' => __( 'Store email address.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
'validate_callback' => array( __CLASS__, 'rest_validate_marketing_email' ), 'validate_callback' => array( __CLASS__, 'rest_validate_marketing_email' ),
@ -456,7 +456,7 @@ class OnboardingProfile extends \WC_REST_Data_Controller {
if ( if (
( $is_agree_marketing || ! empty( $value ) ) && ( $is_agree_marketing || ! empty( $value ) ) &&
! is_email( $value ) ) { ! is_email( $value ) ) {
return new \WP_Error( 'rest_invalid_email', __( 'Invalid email address', 'woocommerce-admin' ) ); return new \WP_Error( 'rest_invalid_email', __( 'Invalid email address', 'woocommerce' ) );
}; };
return true; return true;
} }

View File

@ -91,7 +91,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
'template_name' => array( 'template_name' => array(
'required' => true, 'required' => true,
'type' => 'string', 'type' => 'string',
'description' => __( 'Product template name.', 'woocommerce-admin' ), 'description' => __( 'Product template name.', 'woocommerce' ),
), ),
) )
), ),
@ -110,7 +110,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
'permission_callback' => array( $this, 'get_tasks_permission_check' ), 'permission_callback' => array( $this, 'get_tasks_permission_check' ),
'args' => array( 'args' => array(
'ids' => array( 'ids' => array(
'description' => __( 'Optional parameter to get only specific task lists by id.', 'woocommerce-admin' ), 'description' => __( 'Optional parameter to get only specific task lists by id.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -189,14 +189,14 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
array( array(
'args' => array( 'args' => array(
'duration' => array( 'duration' => array(
'description' => __( 'Time period to snooze the task.', 'woocommerce-admin' ), 'description' => __( 'Time period to snooze the task.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => function( $param, $request, $key ) { 'validate_callback' => function( $param, $request, $key ) {
return in_array( $param, array_keys( $this->duration_to_ms ), true ); return in_array( $param, array_keys( $this->duration_to_ms ), true );
}, },
), ),
'task_list_id' => array( 'task_list_id' => array(
'description' => __( 'Optional parameter to query specific task list.', 'woocommerce-admin' ), 'description' => __( 'Optional parameter to query specific task list.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
), ),
), ),
@ -244,7 +244,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
*/ */
public function create_products_permission_check( $request ) { public function create_products_permission_check( $request ) {
if ( ! wc_rest_check_post_permissions( 'product', 'create' ) ) { if ( ! wc_rest_check_post_permissions( 'product', 'create' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -258,7 +258,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
*/ */
public function create_pages_permission_check( $request ) { public function create_pages_permission_check( $request ) {
if ( ! wc_rest_check_post_permissions( 'page', 'create' ) || ! current_user_can( 'manage_options' ) ) { if ( ! wc_rest_check_post_permissions( 'page', 'create' ) || ! current_user_can( 'manage_options' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create new pages.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to create new pages.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -272,7 +272,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
*/ */
public function get_tasks_permission_check( $request ) { public function get_tasks_permission_check( $request ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) { if ( ! current_user_can( 'manage_woocommerce' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to retrieve onboarding tasks.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to retrieve onboarding tasks.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -286,7 +286,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
*/ */
public function hide_task_list_permission_check( $request ) { public function hide_task_list_permission_check( $request ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) { if ( ! current_user_can( 'manage_woocommerce' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you are not allowed to hide task lists.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you are not allowed to hide task lists.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -300,7 +300,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
*/ */
public function snooze_task_permissions_check( $request ) { public function snooze_task_permissions_check( $request ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) { if ( ! current_user_can( 'manage_woocommerce' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to snooze onboarding tasks.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_create', __( 'Sorry, you are not allowed to snooze onboarding tasks.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -329,7 +329,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
$import = $importer->import(); $import = $importer->import();
return $import; return $import;
} else { } else {
return new \WP_Error( 'woocommerce_rest_import_error', __( 'Sorry, the sample products data file was not found.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_rest_import_error', __( 'Sorry, the sample products data file was not found.', 'woocommerce' ) );
} }
} }
@ -365,7 +365,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_product_creation_error', 'woocommerce_rest_product_creation_error',
/* translators: %s is template name */ /* translators: %s is template name */
__( 'Sorry, creating the product with template failed.', 'woocommerce-admin' ), __( 'Sorry, creating the product with template failed.', 'woocommerce' ),
array( 'status' => 500 ) array( 'status' => 500 )
); );
} }
@ -439,31 +439,31 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
$shop_url = get_permalink( wc_get_page_id( 'shop' ) ); $shop_url = get_permalink( wc_get_page_id( 'shop' ) );
if ( ! empty( $image['url'] ) && ! empty( $image['id'] ) ) { if ( ! empty( $image['url'] ) && ! empty( $image['id'] ) ) {
return '<!-- wp:cover {"url":"' . esc_url( $image['url'] ) . '","id":' . intval( $image['id'] ) . ',"dimRatio":0} --> return '<!-- wp:cover {"url":"' . esc_url( $image['url'] ) . '","id":' . intval( $image['id'] ) . ',"dimRatio":0} -->
<div class="wp-block-cover" style="background-image:url(' . esc_url( $image['url'] ) . ')"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"' . __( 'Write title…', 'woocommerce-admin' ) . '","textColor":"white","fontSize":"large"} --> <div class="wp-block-cover" style="background-image:url(' . esc_url( $image['url'] ) . ')"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"' . __( 'Write title…', 'woocommerce' ) . '","textColor":"white","fontSize":"large"} -->
<p class="has-text-align-center has-large-font-size">' . __( 'Welcome to the store', 'woocommerce-admin' ) . '</p> <p class="has-text-align-center has-large-font-size">' . __( 'Welcome to the store', 'woocommerce' ) . '</p>
<!-- /wp:paragraph --> <!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"center","textColor":"white"} --> <!-- wp:paragraph {"align":"center","textColor":"white"} -->
<p class="has-text-color has-text-align-center">' . __( 'Write a short welcome message here', 'woocommerce-admin' ) . '</p> <p class="has-text-color has-text-align-center">' . __( 'Write a short welcome message here', 'woocommerce' ) . '</p>
<!-- /wp:paragraph --> <!-- /wp:paragraph -->
<!-- wp:button {"align":"center"} --> <!-- wp:button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a href="' . esc_url( $shop_url ) . '" class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce-admin' ) . '</a></div> <div class="wp-block-button aligncenter"><a href="' . esc_url( $shop_url ) . '" class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce' ) . '</a></div>
<!-- /wp:button --></div></div> <!-- /wp:button --></div></div>
<!-- /wp:cover -->'; <!-- /wp:cover -->';
} }
return '<!-- wp:cover {"dimRatio":0} --> return '<!-- wp:cover {"dimRatio":0} -->
<div class="wp-block-cover"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"' . __( 'Write title…', 'woocommerce-admin' ) . '","textColor":"white","fontSize":"large"} --> <div class="wp-block-cover"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"' . __( 'Write title…', 'woocommerce' ) . '","textColor":"white","fontSize":"large"} -->
<p class="has-text-color has-text-align-center has-large-font-size">' . __( 'Welcome to the store', 'woocommerce-admin' ) . '</p> <p class="has-text-color has-text-align-center has-large-font-size">' . __( 'Welcome to the store', 'woocommerce' ) . '</p>
<!-- /wp:paragraph --> <!-- /wp:paragraph -->
<!-- wp:paragraph {"align":"center","textColor":"white"} --> <!-- wp:paragraph {"align":"center","textColor":"white"} -->
<p class="has-text-color has-text-align-center">' . __( 'Write a short welcome message here', 'woocommerce-admin' ) . '</p> <p class="has-text-color has-text-align-center">' . __( 'Write a short welcome message here', 'woocommerce' ) . '</p>
<!-- /wp:paragraph --> <!-- /wp:paragraph -->
<!-- wp:button {"align":"center"} --> <!-- wp:button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a href="' . esc_url( $shop_url ) . '" class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce-admin' ) . '</a></div> <div class="wp-block-button aligncenter"><a href="' . esc_url( $shop_url ) . '" class="wp-block-button__link">' . __( 'Go shopping', 'woocommerce' ) . '</a></div>
<!-- /wp:button --></div></div> <!-- /wp:button --></div></div>
<!-- /wp:cover -->'; <!-- /wp:cover -->';
} }
@ -482,14 +482,14 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! empty( $image['url'] ) && ! empty( $image['id'] ) ) { if ( ! empty( $image['url'] ) && ! empty( $image['id'] ) ) {
return '<!-- wp:media-text {' . $media_position . '"mediaId":' . intval( $image['id'] ) . ',"mediaType":"image"} --> return '<!-- wp:media-text {' . $media_position . '"mediaId":' . intval( $image['id'] ) . ',"mediaType":"image"} -->
<div class="wp-block-media-text alignwide' . $css_class . '""><figure class="wp-block-media-text__media"><img src="' . esc_url( $image['url'] ) . '" alt="" class="wp-image-' . intval( $image['id'] ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:paragraph {"placeholder":"' . __( 'Content…', 'woocommerce-admin' ) . '","fontSize":"large"} --> <div class="wp-block-media-text alignwide' . $css_class . '""><figure class="wp-block-media-text__media"><img src="' . esc_url( $image['url'] ) . '" alt="" class="wp-image-' . intval( $image['id'] ) . '"/></figure><div class="wp-block-media-text__content"><!-- wp:paragraph {"placeholder":"' . __( 'Content…', 'woocommerce' ) . '","fontSize":"large"} -->
<p class="has-large-font-size"></p> <p class="has-large-font-size"></p>
<!-- /wp:paragraph --></div></div> <!-- /wp:paragraph --></div></div>
<!-- /wp:media-text -->'; <!-- /wp:media-text -->';
} }
return '<!-- wp:media-text {' . $media_position . '} --> return '<!-- wp:media-text {' . $media_position . '} -->
<div class="wp-block-media-text alignwide' . $css_class . '"><figure class="wp-block-media-text__media"></figure><div class="wp-block-media-text__content"><!-- wp:paragraph {"placeholder":"' . __( 'Content…', 'woocommerce-admin' ) . '","fontSize":"large"} --> <div class="wp-block-media-text alignwide' . $css_class . '"><figure class="wp-block-media-text__media"></figure><div class="wp-block-media-text__content"><!-- wp:paragraph {"placeholder":"' . __( 'Content…', 'woocommerce' ) . '","fontSize":"large"} -->
<p class="has-large-font-size"></p> <p class="has-large-font-size"></p>
<!-- /wp:paragraph --></div></div> <!-- /wp:paragraph --></div></div>
<!-- /wp:media-text -->'; <!-- /wp:media-text -->';
@ -509,25 +509,25 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
$image_1 = ! empty( $images[0] ) ? $images[0] : ''; $image_1 = ! empty( $images[0] ) ? $images[0] : '';
$template = self::get_homepage_cover_block( $image_1 ) . ' $template = self::get_homepage_cover_block( $image_1 ) . '
<!-- wp:heading {"align":"center"} --> <!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">' . __( 'Shop by Category', 'woocommerce-admin' ) . '</h2> <h2 style="text-align:center">' . __( 'Shop by Category', 'woocommerce' ) . '</h2>
<!-- /wp:heading --> <!-- /wp:heading -->
<!-- wp:shortcode --> <!-- wp:shortcode -->
[product_categories number="0" parent="0"] [product_categories number="0" parent="0"]
<!-- /wp:shortcode --> <!-- /wp:shortcode -->
<!-- wp:heading {"align":"center"} --> <!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">' . __( 'New In', 'woocommerce-admin' ) . '</h2> <h2 style="text-align:center">' . __( 'New In', 'woocommerce' ) . '</h2>
<!-- /wp:heading --> <!-- /wp:heading -->
<!-- wp:woocommerce/product-new {"columns":4} /--> <!-- wp:woocommerce/product-new {"columns":4} /-->
<!-- wp:heading {"align":"center"} --> <!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">' . __( 'Fan Favorites', 'woocommerce-admin' ) . '</h2> <h2 style="text-align:center">' . __( 'Fan Favorites', 'woocommerce' ) . '</h2>
<!-- /wp:heading --> <!-- /wp:heading -->
<!-- wp:woocommerce/product-top-rated {"columns":4} /--> <!-- wp:woocommerce/product-top-rated {"columns":4} /-->
<!-- wp:heading {"align":"center"} --> <!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">' . __( 'On Sale', 'woocommerce-admin' ) . '</h2> <h2 style="text-align:center">' . __( 'On Sale', 'woocommerce' ) . '</h2>
<!-- /wp:heading --> <!-- /wp:heading -->
<!-- wp:woocommerce/product-on-sale {"columns":4} /--> <!-- wp:woocommerce/product-on-sale {"columns":4} /-->
<!-- wp:heading {"align":"center"} --> <!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">' . __( 'Best Sellers', 'woocommerce-admin' ) . '</h2> <h2 style="text-align:center">' . __( 'Best Sellers', 'woocommerce' ) . '</h2>
<!-- /wp:heading --> <!-- /wp:heading -->
<!-- wp:woocommerce/product-best-sellers {"columns":4} /--> <!-- wp:woocommerce/product-best-sellers {"columns":4} /-->
'; ';
@ -546,7 +546,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
$image_3 = ! empty( $images[2] ) ? $images[2] : ''; $image_3 = ! empty( $images[2] ) ? $images[2] : '';
$template = self::get_homepage_cover_block( $image_1 ) . ' $template = self::get_homepage_cover_block( $image_1 ) . '
<!-- wp:heading {"align":"center"} --> <!-- wp:heading {"align":"center"} -->
<h2 style="text-align:center">' . __( 'New Products', 'woocommerce-admin' ) . '</h2> <h2 style="text-align:center">' . __( 'New Products', 'woocommerce' ) . '</h2>
<!-- /wp:heading --> <!-- /wp:heading -->
<!-- wp:woocommerce/product-new /--> ' . <!-- wp:woocommerce/product-new /--> ' .
@ -648,7 +648,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
public static function create_homepage() { public static function create_homepage() {
$post_id = wp_insert_post( $post_id = wp_insert_post(
array( array(
'post_title' => __( 'Homepage', 'woocommerce-admin' ), 'post_title' => __( 'Homepage', 'woocommerce' ),
'post_type' => 'page', 'post_type' => 'page',
'post_status' => 'publish', 'post_status' => 'publish',
'post_content' => '', // Template content is updated below, so images can be attached to the post. 'post_content' => '', // Template content is updated below, so images can be attached to the post.
@ -676,7 +676,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
return array( return array(
'status' => 'success', 'status' => 'success',
'message' => __( 'Homepage created', 'woocommerce-admin' ), 'message' => __( 'Homepage created', 'woocommerce' ),
'post_id' => $post_id, 'post_id' => $post_id,
'edit_post_link' => htmlspecialchars_decode( get_edit_post_link( $post_id ) ), 'edit_post_link' => htmlspecialchars_decode( get_edit_post_link( $post_id ) ),
); );
@ -693,7 +693,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
public function get_task_list_params() { public function get_task_list_params() {
$params = array(); $params = array();
$params['ids'] = array( $params['ids'] = array(
'description' => __( 'Optional parameter to get only specific task lists by id.', 'woocommerce-admin' ), 'description' => __( 'Optional parameter to get only specific task lists by id.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -703,7 +703,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
), ),
); );
$params['extended_tasks'] = array( $params['extended_tasks'] = array(
'description' => __( 'List of extended deprecated tasks from the client side filter.', 'woocommerce-admin' ), 'description' => __( 'List of extended deprecated tasks from the client side filter.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => function( $param, $request, $key ) { 'validate_callback' => function( $param, $request, $key ) {
$has_valid_keys = true; $has_valid_keys = true;
@ -764,7 +764,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task || ! $task->is_dismissable() ) { if ( ! $task || ! $task->is_dismissable() ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_invalid_task', 'woocommerce_rest_invalid_task',
__( 'Sorry, no dismissable task with that ID was found.', 'woocommerce-admin' ), __( 'Sorry, no dismissable task with that ID was found.', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )
@ -797,7 +797,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task || ! $task->is_dismissable() ) { if ( ! $task || ! $task->is_dismissable() ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_invalid_task', 'woocommerce_rest_invalid_task',
__( 'Sorry, no dismissable task with that ID was found.', 'woocommerce-admin' ), __( 'Sorry, no dismissable task with that ID was found.', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )
@ -835,7 +835,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task || ! $task->is_snoozeable() ) { if ( ! $task || ! $task->is_snoozeable() ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_invalid_task', 'woocommerce_rest_invalid_task',
__( 'Sorry, no snoozeable task with that ID was found.', 'woocommerce-admin' ), __( 'Sorry, no snoozeable task with that ID was found.', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )
@ -868,7 +868,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task || ! $task->is_snoozeable() ) { if ( ! $task || ! $task->is_snoozeable() ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_invalid_task', 'woocommerce_rest_invalid_task',
__( 'Sorry, no snoozeable task with that ID was found.', 'woocommerce-admin' ), __( 'Sorry, no snoozeable task with that ID was found.', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )
@ -893,7 +893,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task_list ) { if ( ! $task_list ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_invalid_task_list', 'woocommerce_rest_invalid_task_list',
__( 'Sorry, that task list was not found', 'woocommerce-admin' ), __( 'Sorry, that task list was not found', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )
@ -920,7 +920,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task_list ) { if ( ! $task_list ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_tasks_invalid_task_list', 'woocommerce_tasks_invalid_task_list',
__( 'Sorry, that task list was not found', 'woocommerce-admin' ), __( 'Sorry, that task list was not found', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )
@ -954,7 +954,7 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
if ( ! $task ) { if ( ! $task ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_rest_invalid_task', 'woocommerce_rest_invalid_task',
__( 'Sorry, no task with that ID was found.', 'woocommerce-admin' ), __( 'Sorry, no task with that ID was found.', 'woocommerce' ),
array( array(
'status' => 404, 'status' => 404,
) )

View File

@ -71,7 +71,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
*/ */
public function update_item_permissions_check( $request ) { public function update_item_permissions_check( $request ) {
if ( ! current_user_can( 'switch_themes' ) ) { if ( ! current_user_can( 'switch_themes' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage themes.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage themes.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
} }
@ -87,7 +87,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
$theme = sanitize_text_field( $request['theme'] ); $theme = sanitize_text_field( $request['theme'] );
if ( ! in_array( $theme, $allowed_themes, true ) ) { if ( ! in_array( $theme, $allowed_themes, true ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_theme', __( 'Invalid theme.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_invalid_theme', __( 'Invalid theme.', 'woocommerce' ), 404 );
} }
$installed_themes = wp_get_themes(); $installed_themes = wp_get_themes();
@ -121,7 +121,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
'woocommerce_rest_theme_install', 'woocommerce_rest_theme_install',
sprintf( sprintf(
/* translators: %s: theme slug (example: woocommerce-services) */ /* translators: %s: theme slug (example: woocommerce-services) */
__( 'The requested theme `%s` could not be installed. Theme API call failed.', 'woocommerce-admin' ), __( 'The requested theme `%s` could not be installed. Theme API call failed.', 'woocommerce' ),
$theme $theme
), ),
500 500
@ -136,7 +136,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
'woocommerce_rest_theme_install', 'woocommerce_rest_theme_install',
sprintf( sprintf(
/* translators: %s: theme slug (example: woocommerce-services) */ /* translators: %s: theme slug (example: woocommerce-services) */
__( 'The requested theme `%s` could not be installed.', 'woocommerce-admin' ), __( 'The requested theme `%s` could not be installed.', 'woocommerce' ),
$theme $theme
), ),
500 500
@ -160,7 +160,7 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
$allowed_themes = Themes::get_allowed_themes(); $allowed_themes = Themes::get_allowed_themes();
$theme = sanitize_text_field( $request['theme'] ); $theme = sanitize_text_field( $request['theme'] );
if ( ! in_array( $theme, $allowed_themes, true ) ) { if ( ! in_array( $theme, $allowed_themes, true ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_theme', __( 'Invalid theme.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_invalid_theme', __( 'Invalid theme.', 'woocommerce' ), 404 );
} }
require_once ABSPATH . 'wp-admin/includes/theme.php'; require_once ABSPATH . 'wp-admin/includes/theme.php';
@ -169,12 +169,12 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
if ( ! in_array( $theme, array_keys( $installed_themes ), true ) ) { if ( ! in_array( $theme, array_keys( $installed_themes ), true ) ) {
/* translators: %s: theme slug (example: woocommerce-services) */ /* translators: %s: theme slug (example: woocommerce-services) */
return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'Invalid theme %s.', 'woocommerce-admin' ), $theme ), 404 ); return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'Invalid theme %s.', 'woocommerce' ), $theme ), 404 );
} }
$result = switch_theme( $theme ); $result = switch_theme( $theme );
if ( ! is_null( $result ) ) { if ( ! is_null( $result ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'The requested theme could not be activated.', 'woocommerce-admin' ), $theme ), 500 ); return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'The requested theme could not be activated.', 'woocommerce' ), $theme ), 500 );
} }
return( array( return( array(
@ -196,19 +196,19 @@ class OnboardingThemes extends \WC_REST_Data_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'slug' => array( 'slug' => array(
'description' => __( 'Theme slug.', 'woocommerce-admin' ), 'description' => __( 'Theme slug.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'name' => array( 'name' => array(
'description' => __( 'Theme name.', 'woocommerce-admin' ), 'description' => __( 'Theme name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'status' => array( 'status' => array(
'description' => __( 'Theme status.', 'woocommerce-admin' ), 'description' => __( 'Theme status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,

View File

@ -72,12 +72,12 @@ class Options extends \WC_REST_Data_Controller {
$params = explode( ',', $request['options'] ); $params = explode( ',', $request['options'] );
if ( ! isset( $request['options'] ) || ! is_array( $params ) ) { if ( ! isset( $request['options'] ) || ! is_array( $params ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'You must supply an array of options.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'You must supply an array of options.', 'woocommerce' ), 500 );
} }
foreach ( $params as $option ) { foreach ( $params as $option ) {
if ( ! $this->user_has_permission( $option, $request ) ) { if ( ! $this->user_has_permission( $option, $request ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view these options.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot view these options.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
} }
@ -113,12 +113,12 @@ class Options extends \WC_REST_Data_Controller {
$params = $request->get_json_params(); $params = $request->get_json_params();
if ( ! is_array( $params ) ) { if ( ! is_array( $params ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'You must supply an array of options and values.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'You must supply an array of options and values.', 'woocommerce' ), 500 );
} }
foreach ( $params as $option_name => $option_value ) { foreach ( $params as $option_name => $option_value ) {
if ( ! $this->user_has_permission( $option_name, $request, true ) ) { if ( ! $this->user_has_permission( $option_name, $request, true ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage these options.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage these options.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
} }
@ -248,7 +248,7 @@ class Options extends \WC_REST_Data_Controller {
'properties' => array( 'properties' => array(
'options' => array( 'options' => array(
'type' => 'array', 'type' => 'array',
'description' => __( 'Array of options with associated values.', 'woocommerce-admin' ), 'description' => __( 'Array of options with associated values.', 'woocommerce' ),
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),

View File

@ -34,7 +34,7 @@ class Orders extends \WC_REST_Orders_Controller {
$params = parent::get_collection_params(); $params = parent::get_collection_params();
// This needs to remain a string to support extensions that filter Order Number. // This needs to remain a string to support extensions that filter Order Number.
$params['number'] = array( $params['number'] = array(
'description' => __( 'Limit result set to orders matching part of an order number.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders matching part of an order number.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );

View File

@ -73,7 +73,7 @@ class PaymentGatewaySuggestions extends \WC_REST_Data_Controller {
*/ */
public function get_permission_check( $request ) { public function get_permission_check( $request ) {
if ( ! current_user_can( 'install_plugins' ) ) { if ( ! current_user_can( 'install_plugins' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
} }
@ -114,43 +114,43 @@ class PaymentGatewaySuggestions extends \WC_REST_Data_Controller {
'type' => 'array', 'type' => 'array',
'properties' => array( 'properties' => array(
'content' => array( 'content' => array(
'description' => __( 'Suggestion description.', 'woocommerce-admin' ), 'description' => __( 'Suggestion description.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'id' => array( 'id' => array(
'description' => __( 'Suggestion ID.', 'woocommerce-admin' ), 'description' => __( 'Suggestion ID.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'image' => array( 'image' => array(
'description' => __( 'Gateway image.', 'woocommerce-admin' ), 'description' => __( 'Gateway image.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'is_visible' => array( 'is_visible' => array(
'description' => __( 'Suggestion visibility.', 'woocommerce-admin' ), 'description' => __( 'Suggestion visibility.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'plugins' => array( 'plugins' => array(
'description' => __( 'Array of plugin slugs.', 'woocommerce-admin' ), 'description' => __( 'Array of plugin slugs.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'recommendation_priority' => array( 'recommendation_priority' => array(
'description' => __( 'Priority of recommendation.', 'woocommerce-admin' ), 'description' => __( 'Priority of recommendation.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'title' => array( 'title' => array(
'description' => __( 'Gateway title.', 'woocommerce-admin' ), 'description' => __( 'Gateway title.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,

View File

@ -217,7 +217,7 @@ class Plugins extends \WC_REST_Data_Controller {
*/ */
public function update_item_permissions_check( $request ) { public function update_item_permissions_check( $request ) {
if ( ! current_user_can( 'install_plugins' ) ) { if ( ! current_user_can( 'install_plugins' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_update', __( 'Sorry, you cannot manage plugins.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
} }
@ -245,7 +245,7 @@ class Plugins extends \WC_REST_Data_Controller {
$plugins = explode( ',', $request['plugins'] ); $plugins = explode( ',', $request['plugins'] );
if ( empty( $request['plugins'] ) || ! is_array( $plugins ) ) { if ( empty( $request['plugins'] ) || ! is_array( $plugins ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ), 404 );
} }
if ( isset( $request['async'] ) && $request['async'] ) { if ( isset( $request['async'] ) && $request['async'] ) {
@ -256,7 +256,7 @@ class Plugins extends \WC_REST_Data_Controller {
'job_id' => $job_id, 'job_id' => $job_id,
'plugins' => $plugins, 'plugins' => $plugins,
), ),
'message' => __( 'Plugin installation has been scheduled.', 'woocommerce-admin' ), 'message' => __( 'Plugin installation has been scheduled.', 'woocommerce' ),
); );
} }
@ -271,8 +271,8 @@ class Plugins extends \WC_REST_Data_Controller {
'errors' => $data['errors'], 'errors' => $data['errors'],
'success' => count( $data['errors']->errors ) === 0, 'success' => count( $data['errors']->errors ) === 0,
'message' => count( $data['errors']->errors ) === 0 'message' => count( $data['errors']->errors ) === 0
? __( 'Plugins were successfully installed.', 'woocommerce-admin' ) ? __( 'Plugins were successfully installed.', 'woocommerce' )
: __( 'There was a problem installing some of the requested plugins.', 'woocommerce-admin' ), : __( 'There was a problem installing some of the requested plugins.', 'woocommerce' ),
); );
} }
@ -340,7 +340,7 @@ class Plugins extends \WC_REST_Data_Controller {
$plugins = explode( ',', $request['plugins'] ); $plugins = explode( ',', $request['plugins'] );
if ( empty( $request['plugins'] ) || ! is_array( $plugins ) ) { if ( empty( $request['plugins'] ) || ! is_array( $plugins ) ) {
return new \WP_Error( 'woocommerce_rest_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ), 404 );
} }
if ( isset( $request['async'] ) && $request['async'] ) { if ( isset( $request['async'] ) && $request['async'] ) {
@ -351,7 +351,7 @@ class Plugins extends \WC_REST_Data_Controller {
'job_id' => $job_id, 'job_id' => $job_id,
'plugins' => $plugins, 'plugins' => $plugins,
), ),
'message' => __( 'Plugin activation has been scheduled.', 'woocommerce-admin' ), 'message' => __( 'Plugin activation has been scheduled.', 'woocommerce' ),
); );
} }
@ -365,8 +365,8 @@ class Plugins extends \WC_REST_Data_Controller {
'errors' => $data['errors'], 'errors' => $data['errors'],
'success' => count( $data['errors']->errors ) === 0, 'success' => count( $data['errors']->errors ) === 0,
'message' => count( $data['errors']->errors ) === 0 'message' => count( $data['errors']->errors ) === 0
? __( 'Plugins were successfully activated.', 'woocommerce-admin' ) ? __( 'Plugins were successfully activated.', 'woocommerce' )
: __( 'There was a problem activating some of the requested plugins.', 'woocommerce-admin' ), : __( 'There was a problem activating some of the requested plugins.', 'woocommerce' ),
) ); ) );
} }
@ -400,7 +400,7 @@ class Plugins extends \WC_REST_Data_Controller {
*/ */
public function connect_jetpack( $request ) { public function connect_jetpack( $request ) {
if ( ! class_exists( '\Jetpack' ) ) { if ( ! class_exists( '\Jetpack' ) ) {
return new \WP_Error( 'woocommerce_rest_jetpack_not_active', __( 'Jetpack is not installed or active.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_jetpack_not_active', __( 'Jetpack is not installed or active.', 'woocommerce' ), 404 );
} }
$redirect_url = apply_filters( 'woocommerce_admin_onboarding_jetpack_connect_redirect_url', esc_url_raw( $request['redirect_url'] ) ); $redirect_url = apply_filters( 'woocommerce_admin_onboarding_jetpack_connect_redirect_url', esc_url_raw( $request['redirect_url'] ) );
@ -411,7 +411,7 @@ class Plugins extends \WC_REST_Data_Controller {
return( array( return( array(
'slug' => 'jetpack', 'slug' => 'jetpack',
'name' => __( 'Jetpack', 'woocommerce-admin' ), 'name' => __( 'Jetpack', 'woocommerce' ),
'connectAction' => $connect_url, 'connectAction' => $connect_url,
) ); ) );
} }
@ -424,7 +424,7 @@ class Plugins extends \WC_REST_Data_Controller {
public function request_wccom_connect() { public function request_wccom_connect() {
include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-api.php'; include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-api.php';
if ( ! class_exists( 'WC_Helper_API' ) ) { if ( ! class_exists( 'WC_Helper_API' ) ) {
return new \WP_Error( 'woocommerce_rest_helper_not_active', __( 'There was an error loading the WooCommerce.com Helper API.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_helper_not_active', __( 'There was an error loading the WooCommerce.com Helper API.', 'woocommerce' ), 404 );
} }
$redirect_uri = wc_admin_url( '&task=connect&wccom-connected=1' ); $redirect_uri = wc_admin_url( '&task=connect&wccom-connected=1' );
@ -441,12 +441,12 @@ class Plugins extends \WC_REST_Data_Controller {
$code = wp_remote_retrieve_response_code( $request ); $code = wp_remote_retrieve_response_code( $request );
if ( 200 !== $code ) { if ( 200 !== $code ) {
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
} }
$secret = json_decode( wp_remote_retrieve_body( $request ) ); $secret = json_decode( wp_remote_retrieve_body( $request ) );
if ( empty( $secret ) ) { if ( empty( $secret ) ) {
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
} }
do_action( 'woocommerce_helper_connect_start' ); do_action( 'woocommerce_helper_connect_start' );
@ -487,7 +487,7 @@ class Plugins extends \WC_REST_Data_Controller {
include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-updater.php'; include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-updater.php';
include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-options.php'; include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-options.php';
if ( ! class_exists( 'WC_Helper_API' ) ) { if ( ! class_exists( 'WC_Helper_API' ) ) {
return new \WP_Error( 'woocommerce_rest_helper_not_active', __( 'There was an error loading the WooCommerce.com Helper API.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_rest_helper_not_active', __( 'There was an error loading the WooCommerce.com Helper API.', 'woocommerce' ), 404 );
} }
// Obtain an access token. // Obtain an access token.
@ -503,12 +503,12 @@ class Plugins extends \WC_REST_Data_Controller {
$code = wp_remote_retrieve_response_code( $request ); $code = wp_remote_retrieve_response_code( $request );
if ( 200 !== $code ) { if ( 200 !== $code ) {
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
} }
$access_token = json_decode( wp_remote_retrieve_body( $request ), true ); $access_token = json_decode( wp_remote_retrieve_body( $request ), true );
if ( ! $access_token ) { if ( ! $access_token ) {
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
} }
\WC_Helper_Options::update( \WC_Helper_Options::update(
@ -524,7 +524,7 @@ class Plugins extends \WC_REST_Data_Controller {
if ( ! \WC_Helper::_flush_authentication_cache() ) { if ( ! \WC_Helper::_flush_authentication_cache() ) {
\WC_Helper_Options::update( 'auth', array() ); \WC_Helper_Options::update( 'auth', array() );
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to WooCommerce.com. Please try again.', 'woocommerce' ), 500 );
} }
delete_transient( '_woocommerce_helper_subscriptions' ); delete_transient( '_woocommerce_helper_subscriptions' );
@ -545,7 +545,7 @@ class Plugins extends \WC_REST_Data_Controller {
*/ */
public function connect_square() { public function connect_square() {
if ( ! class_exists( '\WooCommerce\Square\Handlers\Connection' ) ) { if ( ! class_exists( '\WooCommerce\Square\Handlers\Connection' ) ) {
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to Square.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error connecting to Square.', 'woocommerce' ), 500 );
} }
if ( 'US' === WC()->countries->get_base_country() ) { if ( 'US' === WC()->countries->get_base_country() ) {
@ -597,7 +597,7 @@ class Plugins extends \WC_REST_Data_Controller {
*/ */
public function connect_wcpay() { public function connect_wcpay() {
if ( ! class_exists( 'WC_Payments_Account' ) ) { if ( ! class_exists( 'WC_Payments_Account' ) ) {
return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error communicating with the WooCommerce Payments plugin.', 'woocommerce-admin' ), 500 ); return new \WP_Error( 'woocommerce_rest_helper_connect', __( 'There was an error communicating with the WooCommerce Payments plugin.', 'woocommerce' ), 500 );
} }
$connect_url = add_query_arg( $connect_url = add_query_arg(
@ -625,19 +625,19 @@ class Plugins extends \WC_REST_Data_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'slug' => array( 'slug' => array(
'description' => __( 'Plugin slug.', 'woocommerce-admin' ), 'description' => __( 'Plugin slug.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'name' => array( 'name' => array(
'description' => __( 'Plugin name.', 'woocommerce-admin' ), 'description' => __( 'Plugin name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'status' => array( 'status' => array(
'description' => __( 'Plugin status.', 'woocommerce-admin' ), 'description' => __( 'Plugin status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -657,7 +657,7 @@ class Plugins extends \WC_REST_Data_Controller {
$schema = $this->get_item_schema(); $schema = $this->get_item_schema();
unset( $schema['properties']['status'] ); unset( $schema['properties']['status'] );
$schema['properties']['connectAction'] = array( $schema['properties']['connectAction'] = array(
'description' => __( 'Action that should be completed to connect Jetpack.', 'woocommerce-admin' ), 'description' => __( 'Action that should be completed to connect Jetpack.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,

View File

@ -38,7 +38,7 @@ class ProductAttributeTerms extends \WC_REST_Product_Attribute_Terms_Controller
array( array(
'args' => array( 'args' => array(
'slug' => array( 'slug' => array(
'description' => __( 'Slug identifier for the resource.', 'woocommerce-admin' ), 'description' => __( 'Slug identifier for the resource.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
), ),
), ),
@ -63,7 +63,7 @@ class ProductAttributeTerms extends \WC_REST_Product_Attribute_Terms_Controller
if ( ! wc_rest_check_manager_permissions( 'attributes', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'attributes', 'read' ) ) {
return new WP_Error( return new WP_Error(
'woocommerce_rest_cannot_view', 'woocommerce_rest_cannot_view',
__( 'Sorry, you cannot view this resource.', 'woocommerce-admin' ), __( 'Sorry, you cannot view this resource.', 'woocommerce' ),
array( array(
'status' => rest_authorization_required_code(), 'status' => rest_authorization_required_code(),
) )

View File

@ -37,7 +37,7 @@ class ProductAttributes extends \WC_REST_Product_Attributes_Controller {
array( array(
'args' => array( 'args' => array(
'slug' => array( 'slug' => array(
'description' => __( 'Slug identifier for the resource.', 'woocommerce-admin' ), 'description' => __( 'Slug identifier for the resource.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
), ),
), ),
@ -59,7 +59,7 @@ class ProductAttributes extends \WC_REST_Product_Attributes_Controller {
public function get_collection_params() { public function get_collection_params() {
$params = parent::get_collection_params(); $params = parent::get_collection_params();
$params['search'] = array( $params['search'] = array(
'description' => __( 'Search by similar attribute name.', 'woocommerce-admin' ), 'description' => __( 'Search by similar attribute name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );

View File

@ -53,7 +53,7 @@ class ProductVariations extends \WC_REST_Product_Variations_Controller {
public function get_collection_params() { public function get_collection_params() {
$params = parent::get_collection_params(); $params = parent::get_collection_params();
$params['search'] = array( $params['search'] = array(
'description' => __( 'Search by similar product name, sku, or attribute value.', 'woocommerce-admin' ), 'description' => __( 'Search by similar product name, sku, or attribute value.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
@ -163,19 +163,19 @@ class ProductVariations extends \WC_REST_Product_Variations_Controller {
$schema = parent::get_item_schema(); $schema = parent::get_item_schema();
$schema['properties']['name'] = array( $schema['properties']['name'] = array(
'description' => __( 'Product parent name.', 'woocommerce-admin' ), 'description' => __( 'Product parent name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
); );
$schema['properties']['type'] = array( $schema['properties']['type'] = array(
'description' => __( 'Product type.', 'woocommerce-admin' ), 'description' => __( 'Product type.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'variation', 'default' => 'variation',
'enum' => array( 'variation' ), 'enum' => array( 'variation' ),
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
); );
$schema['properties']['parent_id'] = array( $schema['properties']['parent_id'] = array(
'description' => __( 'Product parent ID.', 'woocommerce-admin' ), 'description' => __( 'Product parent ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
); );

View File

@ -54,7 +54,7 @@ class Products extends \WC_REST_Products_Controller {
} }
$schema['properties']['last_order_date'] = array( $schema['properties']['last_order_date'] = array(
'description' => __( "The date the last order for this product was placed, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the last order for this product was placed, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -71,13 +71,13 @@ class Products extends \WC_REST_Products_Controller {
public function get_collection_params() { public function get_collection_params() {
$params = parent::get_collection_params(); $params = parent::get_collection_params();
$params['low_in_stock'] = array( $params['low_in_stock'] = array(
'description' => __( 'Limit result set to products that are low or out of stock. (Deprecated)', 'woocommerce-admin' ), 'description' => __( 'Limit result set to products that are low or out of stock. (Deprecated)', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
); );
$params['search'] = array( $params['search'] = array(
'description' => __( 'Search by similar product name or sku.', 'woocommerce-admin' ), 'description' => __( 'Search by similar product name or sku.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );

View File

@ -288,7 +288,7 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
$params['context']['default'] = 'view'; $params['context']['default'] = 'view';
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -296,7 +296,7 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -307,7 +307,7 @@ final class ProductsLowInStock extends \WC_REST_Products_Controller {
$params['status'] = array( $params['status'] = array(
'default' => 'publish', 'default' => 'publish',
'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to products assigned a specific status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ), 'enum' => array_merge( array_keys( get_post_statuses() ), array( 'future' ) ),
'sanitize_callback' => 'sanitize_key', 'sanitize_callback' => 'sanitize_key',

View File

@ -73,7 +73,7 @@ class Controller extends ReportsController implements ExportableInterface {
} }
if ( ! isset( $report_data->data ) || ! isset( $report_data->page_no ) || ! isset( $report_data->pages ) ) { if ( ! isset( $report_data->data ) || ! isset( $report_data->page_no ) || ! isset( $report_data->pages ) ) {
return new \WP_Error( 'woocommerce_rest_reports_categories_invalid_response', __( 'Invalid response from data store.', 'woocommerce-admin' ), array( 'status' => 500 ) ); return new \WP_Error( 'woocommerce_rest_reports_categories_invalid_response', __( 'Invalid response from data store.', 'woocommerce' ), array( 'status' => 500 ) );
} }
$out_data = array(); $out_data = array();
@ -165,31 +165,31 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'category_id' => array( 'category_id' => array(
'description' => __( 'Category ID.', 'woocommerce-admin' ), 'description' => __( 'Category ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'items_sold' => array( 'items_sold' => array(
'description' => __( 'Amount of items sold.', 'woocommerce-admin' ), 'description' => __( 'Amount of items sold.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'net_revenue' => array( 'net_revenue' => array(
'description' => __( 'Total sales.', 'woocommerce-admin' ), 'description' => __( 'Total sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'products_count' => array( 'products_count' => array(
'description' => __( 'Amount of products.', 'woocommerce-admin' ), 'description' => __( 'Amount of products.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -199,7 +199,7 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Category name.', 'woocommerce-admin' ), 'description' => __( 'Category name.', 'woocommerce' ),
), ),
), ),
), ),
@ -217,7 +217,7 @@ class Controller extends ReportsController implements ExportableInterface {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -225,7 +225,7 @@ class Controller extends ReportsController implements ExportableInterface {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -234,26 +234,26 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'category_id', 'default' => 'category_id',
'enum' => array( 'enum' => array(
@ -267,7 +267,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -281,7 +281,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['status_is'] = array( $params['status_is'] = array(
'description' => __( 'Limit result set to items that have the specified order status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified order status.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -291,7 +291,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['status_is_not'] = array( $params['status_is_not'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -301,7 +301,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['categories'] = array( $params['categories'] = array(
'description' => __( 'Limit result set to all items that have the specified term assigned in the categories taxonomy.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to all items that have the specified term assigned in the categories taxonomy.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -310,7 +310,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['extended_info'] = array( $params['extended_info'] = array(
'description' => __( 'Add additional piece of info about each category to the report.', 'woocommerce-admin' ), 'description' => __( 'Add additional piece of info about each category to the report.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
@ -327,11 +327,11 @@ class Controller extends ReportsController implements ExportableInterface {
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'category' => __( 'Category', 'woocommerce-admin' ), 'category' => __( 'Category', 'woocommerce' ),
'items_sold' => __( 'Items sold', 'woocommerce-admin' ), 'items_sold' => __( 'Items sold', 'woocommerce' ),
'net_revenue' => __( 'Net Revenue', 'woocommerce-admin' ), 'net_revenue' => __( 'Net Revenue', 'woocommerce' ),
'products_count' => __( 'Products', 'woocommerce-admin' ), 'products_count' => __( 'Products', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
); );
/** /**

View File

@ -272,7 +272,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
); );
if ( null === $categories_data ) { if ( null === $categories_data ) {
return new \WP_Error( 'woocommerce_analytics_categories_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ), array( 'status' => 500 ) ); return new \WP_Error( 'woocommerce_analytics_categories_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ), array( 'status' => 500 ) );
} }
$record_count = count( $categories_data ); $record_count = count( $categories_data );

View File

@ -58,7 +58,7 @@ class Controller extends \WC_REST_Reports_Controller {
*/ */
public function get_items_permissions_check( $request ) { public function get_items_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'reports', 'read' ) ) { if ( ! wc_rest_check_manager_permissions( 'reports', 'read' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you cannot list resources.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -76,71 +76,71 @@ class Controller extends \WC_REST_Reports_Controller {
$reports = array( $reports = array(
array( array(
'slug' => 'performance-indicators', 'slug' => 'performance-indicators',
'description' => __( 'Batch endpoint for getting specific performance indicators from `stats` endpoints.', 'woocommerce-admin' ), 'description' => __( 'Batch endpoint for getting specific performance indicators from `stats` endpoints.', 'woocommerce' ),
), ),
array( array(
'slug' => 'revenue/stats', 'slug' => 'revenue/stats',
'description' => __( 'Stats about revenue.', 'woocommerce-admin' ), 'description' => __( 'Stats about revenue.', 'woocommerce' ),
), ),
array( array(
'slug' => 'orders/stats', 'slug' => 'orders/stats',
'description' => __( 'Stats about orders.', 'woocommerce-admin' ), 'description' => __( 'Stats about orders.', 'woocommerce' ),
), ),
array( array(
'slug' => 'products', 'slug' => 'products',
'description' => __( 'Products detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Products detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'products/stats', 'slug' => 'products/stats',
'description' => __( 'Stats about products.', 'woocommerce-admin' ), 'description' => __( 'Stats about products.', 'woocommerce' ),
), ),
array( array(
'slug' => 'variations', 'slug' => 'variations',
'description' => __( 'Variations detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Variations detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'variations/stats', 'slug' => 'variations/stats',
'description' => __( 'Stats about variations.', 'woocommerce-admin' ), 'description' => __( 'Stats about variations.', 'woocommerce' ),
), ),
array( array(
'slug' => 'categories', 'slug' => 'categories',
'description' => __( 'Product categories detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Product categories detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'categories/stats', 'slug' => 'categories/stats',
'description' => __( 'Stats about product categories.', 'woocommerce-admin' ), 'description' => __( 'Stats about product categories.', 'woocommerce' ),
), ),
array( array(
'slug' => 'coupons', 'slug' => 'coupons',
'description' => __( 'Coupons detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Coupons detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'coupons/stats', 'slug' => 'coupons/stats',
'description' => __( 'Stats about coupons.', 'woocommerce-admin' ), 'description' => __( 'Stats about coupons.', 'woocommerce' ),
), ),
array( array(
'slug' => 'taxes', 'slug' => 'taxes',
'description' => __( 'Taxes detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Taxes detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'taxes/stats', 'slug' => 'taxes/stats',
'description' => __( 'Stats about taxes.', 'woocommerce-admin' ), 'description' => __( 'Stats about taxes.', 'woocommerce' ),
), ),
array( array(
'slug' => 'downloads', 'slug' => 'downloads',
'description' => __( 'Product downloads detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Product downloads detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'downloads/files', 'slug' => 'downloads/files',
'description' => __( 'Product download files detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Product download files detailed reports.', 'woocommerce' ),
), ),
array( array(
'slug' => 'downloads/stats', 'slug' => 'downloads/stats',
'description' => __( 'Stats about product downloads.', 'woocommerce-admin' ), 'description' => __( 'Stats about product downloads.', 'woocommerce' ),
), ),
array( array(
'slug' => 'customers', 'slug' => 'customers',
'description' => __( 'Customers detailed reports.', 'woocommerce-admin' ), 'description' => __( 'Customers detailed reports.', 'woocommerce' ),
), ),
); );
@ -285,19 +285,19 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'slug' => array( 'slug' => array(
'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce-admin' ), 'description' => __( 'An alphanumeric identifier for the resource.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),
'description' => array( 'description' => array(
'description' => __( 'A human-readable description of the resource.', 'woocommerce-admin' ), 'description' => __( 'A human-readable description of the resource.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,
), ),
'path' => array( 'path' => array(
'description' => __( 'API path.', 'woocommerce-admin' ), 'description' => __( 'API path.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view' ), 'context' => array( 'view' ),
'readonly' => true, 'readonly' => true,

View File

@ -152,19 +152,19 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'coupon_id' => array( 'coupon_id' => array(
'description' => __( 'Coupon ID.', 'woocommerce-admin' ), 'description' => __( 'Coupon ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'amount' => array( 'amount' => array(
'description' => __( 'Net discount amount.', 'woocommerce-admin' ), 'description' => __( 'Net discount amount.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -174,38 +174,38 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Coupon code.', 'woocommerce-admin' ), 'description' => __( 'Coupon code.', 'woocommerce' ),
), ),
'date_created' => array( 'date_created' => array(
'type' => 'date-time', 'type' => 'date-time',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Coupon creation date.', 'woocommerce-admin' ), 'description' => __( 'Coupon creation date.', 'woocommerce' ),
), ),
'date_created_gmt' => array( 'date_created_gmt' => array(
'type' => 'date-time', 'type' => 'date-time',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Coupon creation date in GMT.', 'woocommerce-admin' ), 'description' => __( 'Coupon creation date in GMT.', 'woocommerce' ),
), ),
'date_expires' => array( 'date_expires' => array(
'type' => 'date-time', 'type' => 'date-time',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Coupon expiration date.', 'woocommerce-admin' ), 'description' => __( 'Coupon expiration date.', 'woocommerce' ),
), ),
'date_expires_gmt' => array( 'date_expires_gmt' => array(
'type' => 'date-time', 'type' => 'date-time',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Coupon expiration date in GMT.', 'woocommerce-admin' ), 'description' => __( 'Coupon expiration date in GMT.', 'woocommerce' ),
), ),
'discount_type' => array( 'discount_type' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'enum' => array_keys( wc_get_coupon_types() ), 'enum' => array_keys( wc_get_coupon_types() ),
'description' => __( 'Coupon discount type.', 'woocommerce-admin' ), 'description' => __( 'Coupon discount type.', 'woocommerce' ),
), ),
), ),
), ),
@ -223,7 +223,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -231,7 +231,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -240,26 +240,26 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'coupon_id', 'default' => 'coupon_id',
'enum' => array( 'enum' => array(
@ -271,7 +271,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['coupons'] = array( $params['coupons'] = array(
'description' => __( 'Limit result set to coupons assigned specific coupon IDs.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to coupons assigned specific coupon IDs.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -280,7 +280,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['extended_info'] = array( $params['extended_info'] = array(
'description' => __( 'Add additional piece of info about each coupon to the report.', 'woocommerce-admin' ), 'description' => __( 'Add additional piece of info about each coupon to the report.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
@ -297,12 +297,12 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'code' => __( 'Coupon code', 'woocommerce-admin' ), 'code' => __( 'Coupon code', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
'amount' => __( 'Amount discounted', 'woocommerce-admin' ), 'amount' => __( 'Amount discounted', 'woocommerce' ),
'created' => __( 'Created', 'woocommerce-admin' ), 'created' => __( 'Created', 'woocommerce' ),
'expires' => __( 'Expires', 'woocommerce-admin' ), 'expires' => __( 'Expires', 'woocommerce' ),
'type' => __( 'Type', 'woocommerce-admin' ), 'type' => __( 'Type', 'woocommerce' ),
); );
/** /**
@ -325,7 +325,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function prepare_item_for_export( $item ) { public function prepare_item_for_export( $item ) {
$date_expires = empty( $item['extended_info']['date_expires'] ) $date_expires = empty( $item['extended_info']['date_expires'] )
? __( 'N/A', 'woocommerce-admin' ) ? __( 'N/A', 'woocommerce' )
: $item['extended_info']['date_expires']; : $item['extended_info']['date_expires'];
$export_item = array( $export_item = array(

View File

@ -170,12 +170,12 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
if ( 0 === $coupon->get_id() ) { if ( 0 === $coupon->get_id() ) {
// Deleted or otherwise invalid coupon. // Deleted or otherwise invalid coupon.
$extended_info = array( $extended_info = array(
'code' => __( '(Deleted)', 'woocommerce-admin' ), 'code' => __( '(Deleted)', 'woocommerce' ),
'date_created' => '', 'date_created' => '',
'date_created_gmt' => '', 'date_created_gmt' => '',
'date_expires' => '', 'date_expires' => '',
'date_expires_gmt' => '', 'date_expires_gmt' => '',
'discount_type' => __( 'N/A', 'woocommerce-admin' ), 'discount_type' => __( 'N/A', 'woocommerce' ),
); );
} else { } else {
$gmt_timzone = new \DateTimeZone( 'UTC' ); $gmt_timzone = new \DateTimeZone( 'UTC' );

View File

@ -142,7 +142,7 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_item_schema() { public function get_item_schema() {
$data_values = array( $data_values = array(
'amount' => array( 'amount' => array(
'description' => __( 'Net discount amount.', 'woocommerce-admin' ), 'description' => __( 'Net discount amount.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -150,14 +150,14 @@ class Controller extends \WC_REST_Reports_Controller {
'format' => 'currency', 'format' => 'currency',
), ),
'coupons_count' => array( 'coupons_count' => array(
'description' => __( 'Number of coupons.', 'woocommerce-admin' ), 'description' => __( 'Number of coupons.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'orders_count' => array( 'orders_count' => array(
'title' => __( 'Discounted orders', 'woocommerce-admin' ), 'title' => __( 'Discounted orders', 'woocommerce' ),
'description' => __( 'Number of discounted orders.', 'woocommerce-admin' ), 'description' => __( 'Number of discounted orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -167,7 +167,7 @@ class Controller extends \WC_REST_Reports_Controller {
$segments = array( $segments = array(
'segments' => array( 'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -175,13 +175,13 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'segment_id' => array( 'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce-admin' ), 'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -200,14 +200,14 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -215,38 +215,38 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -270,7 +270,7 @@ class Controller extends \WC_REST_Reports_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -278,7 +278,7 @@ class Controller extends \WC_REST_Reports_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -287,26 +287,26 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -318,7 +318,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -332,7 +332,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['coupons'] = array( $params['coupons'] = array(
'description' => __( 'Limit result set to coupons assigned specific coupon IDs.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to coupons assigned specific coupon IDs.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -341,7 +341,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['segmentby'] = array( $params['segmentby'] = array(
'description' => __( 'Segment the response by additional constraint.', 'woocommerce-admin' ), 'description' => __( 'Segment the response by additional constraint.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'product', 'product',
@ -352,7 +352,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -280,7 +280,7 @@ class Segmenter extends ReportsSegmenter {
$segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table ); $segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table );
} elseif ( 'variation' === $this->query_args['segmentby'] ) { } elseif ( 'variation' === $this->query_args['segmentby'] ) {
if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) { if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) {
throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce-admin' ) ); throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce' ) );
} }
$product_level_columns = $this->get_segment_selections_product_level( $product_segmenting_table ); $product_level_columns = $this->get_segment_selections_product_level( $product_segmenting_table );

View File

@ -222,91 +222,91 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'id' => array( 'id' => array(
'description' => __( 'Customer ID.', 'woocommerce-admin' ), 'description' => __( 'Customer ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'user_id' => array( 'user_id' => array(
'description' => __( 'User ID.', 'woocommerce-admin' ), 'description' => __( 'User ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'name' => array( 'name' => array(
'description' => __( 'Name.', 'woocommerce-admin' ), 'description' => __( 'Name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'username' => array( 'username' => array(
'description' => __( 'Username.', 'woocommerce-admin' ), 'description' => __( 'Username.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'country' => array( 'country' => array(
'description' => __( 'Country / Region.', 'woocommerce-admin' ), 'description' => __( 'Country / Region.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'city' => array( 'city' => array(
'description' => __( 'City.', 'woocommerce-admin' ), 'description' => __( 'City.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'state' => array( 'state' => array(
'description' => __( 'Region.', 'woocommerce-admin' ), 'description' => __( 'Region.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'postcode' => array( 'postcode' => array(
'description' => __( 'Postal code.', 'woocommerce-admin' ), 'description' => __( 'Postal code.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_registered' => array( 'date_registered' => array(
'description' => __( 'Date registered.', 'woocommerce-admin' ), 'description' => __( 'Date registered.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_registered_gmt' => array( 'date_registered_gmt' => array(
'description' => __( 'Date registered GMT.', 'woocommerce-admin' ), 'description' => __( 'Date registered GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_last_active' => array( 'date_last_active' => array(
'description' => __( 'Date last active.', 'woocommerce-admin' ), 'description' => __( 'Date last active.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_last_active_gmt' => array( 'date_last_active_gmt' => array(
'description' => __( 'Date last active GMT.', 'woocommerce-admin' ), 'description' => __( 'Date last active GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Order count.', 'woocommerce-admin' ), 'description' => __( 'Order count.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'total_spend' => array( 'total_spend' => array(
'description' => __( 'Total spend.', 'woocommerce-admin' ), 'description' => __( 'Total spend.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'avg_order_value' => array( 'avg_order_value' => array(
'description' => __( 'Avg order value.', 'woocommerce-admin' ), 'description' => __( 'Avg order value.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -325,31 +325,31 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['registered_before'] = array( $params['registered_before'] = array(
'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['registered_after'] = array( $params['registered_after'] = array(
'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources with orders published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources with orders published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources with orders published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources with orders published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -357,7 +357,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -366,14 +366,14 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date_registered', 'default' => 'date_registered',
'enum' => array( 'enum' => array(
@ -392,7 +392,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -402,7 +402,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['search'] = array( $params['search'] = array(
'description' => __( 'Limit response to objects with a customer field containing the search term. Searches the field provided by `searchby`.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a customer field containing the search term. Searches the field provided by `searchby`.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
@ -417,59 +417,59 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['name_includes'] = array( $params['name_includes'] = array(
'description' => __( 'Limit response to objects with specfic names.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with specfic names.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['name_excludes'] = array( $params['name_excludes'] = array(
'description' => __( 'Limit response to objects excluding specfic names.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding specfic names.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['username_includes'] = array( $params['username_includes'] = array(
'description' => __( 'Limit response to objects with specfic usernames.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with specfic usernames.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['username_excludes'] = array( $params['username_excludes'] = array(
'description' => __( 'Limit response to objects excluding specfic usernames.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding specfic usernames.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['email_includes'] = array( $params['email_includes'] = array(
'description' => __( 'Limit response to objects including emails.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects including emails.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['email_excludes'] = array( $params['email_excludes'] = array(
'description' => __( 'Limit response to objects excluding emails.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding emails.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['country_includes'] = array( $params['country_includes'] = array(
'description' => __( 'Limit response to objects with specfic countries.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with specfic countries.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['country_excludes'] = array( $params['country_excludes'] = array(
'description' => __( 'Limit response to objects excluding specfic countries.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding specfic countries.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_active_before'] = array( $params['last_active_before'] = array(
'description' => __( 'Limit response to objects last active before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_active_after'] = array( $params['last_active_after'] = array(
'description' => __( 'Limit response to objects last active after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_active_between'] = array( $params['last_active_between'] = array(
'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ),
'items' => array( 'items' => array(
@ -477,19 +477,19 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['registered_before'] = array( $params['registered_before'] = array(
'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['registered_after'] = array( $params['registered_after'] = array(
'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['registered_between'] = array( $params['registered_between'] = array(
'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ),
'items' => array( 'items' => array(
@ -497,19 +497,19 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['orders_count_min'] = array( $params['orders_count_min'] = array(
'description' => __( 'Limit response to objects with an order count greater than or equal to given integer.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an order count greater than or equal to given integer.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orders_count_max'] = array( $params['orders_count_max'] = array(
'description' => __( 'Limit response to objects with an order count less than or equal to given integer.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an order count less than or equal to given integer.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orders_count_between'] = array( $params['orders_count_between'] = array(
'description' => __( 'Limit response to objects with an order count between two given integers.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an order count between two given integers.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
'items' => array( 'items' => array(
@ -517,17 +517,17 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['total_spend_min'] = array( $params['total_spend_min'] = array(
'description' => __( 'Limit response to objects with a total order spend greater than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a total order spend greater than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['total_spend_max'] = array( $params['total_spend_max'] = array(
'description' => __( 'Limit response to objects with a total order spend less than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a total order spend less than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['total_spend_between'] = array( $params['total_spend_between'] = array(
'description' => __( 'Limit response to objects with a total order spend between two given numbers.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a total order spend between two given numbers.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
'items' => array( 'items' => array(
@ -535,17 +535,17 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['avg_order_value_min'] = array( $params['avg_order_value_min'] = array(
'description' => __( 'Limit response to objects with an average order spend greater than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an average order spend greater than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['avg_order_value_max'] = array( $params['avg_order_value_max'] = array(
'description' => __( 'Limit response to objects with an average order spend less than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an average order spend less than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['avg_order_value_between'] = array( $params['avg_order_value_between'] = array(
'description' => __( 'Limit response to objects with an average order spend between two given numbers.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an average order spend between two given numbers.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
'items' => array( 'items' => array(
@ -553,19 +553,19 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['last_order_before'] = array( $params['last_order_before'] = array(
'description' => __( 'Limit response to objects with last order before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with last order before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_order_after'] = array( $params['last_order_after'] = array(
'description' => __( 'Limit response to objects with last order after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with last order after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['customers'] = array( $params['customers'] = array(
'description' => __( 'Limit result to items with specified customer ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified customer ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -584,18 +584,18 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'name' => __( 'Name', 'woocommerce-admin' ), 'name' => __( 'Name', 'woocommerce' ),
'username' => __( 'Username', 'woocommerce-admin' ), 'username' => __( 'Username', 'woocommerce' ),
'last_active' => __( 'Last Active', 'woocommerce-admin' ), 'last_active' => __( 'Last Active', 'woocommerce' ),
'registered' => __( 'Sign Up', 'woocommerce-admin' ), 'registered' => __( 'Sign Up', 'woocommerce' ),
'email' => __( 'Email', 'woocommerce-admin' ), 'email' => __( 'Email', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
'total_spend' => __( 'Total Spend', 'woocommerce-admin' ), 'total_spend' => __( 'Total Spend', 'woocommerce' ),
'avg_order_value' => __( 'AOV', 'woocommerce-admin' ), 'avg_order_value' => __( 'AOV', 'woocommerce' ),
'country' => __( 'Country / Region', 'woocommerce-admin' ), 'country' => __( 'Country / Region', 'woocommerce' ),
'city' => __( 'City', 'woocommerce-admin' ), 'city' => __( 'City', 'woocommerce' ),
'region' => __( 'Region', 'woocommerce-admin' ), 'region' => __( 'Region', 'woocommerce' ),
'postcode' => __( 'Postal Code', 'woocommerce-admin' ), 'postcode' => __( 'Postal Code', 'woocommerce' ),
); );
/** /**

View File

@ -129,26 +129,26 @@ class Controller extends \WC_REST_Reports_Controller {
// @todo Should any of these be 'indicator's? // @todo Should any of these be 'indicator's?
$totals = array( $totals = array(
'customers_count' => array( 'customers_count' => array(
'description' => __( 'Number of customers.', 'woocommerce-admin' ), 'description' => __( 'Number of customers.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'avg_orders_count' => array( 'avg_orders_count' => array(
'description' => __( 'Average number of orders.', 'woocommerce-admin' ), 'description' => __( 'Average number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'avg_total_spend' => array( 'avg_total_spend' => array(
'description' => __( 'Average total spend per customer.', 'woocommerce-admin' ), 'description' => __( 'Average total spend per customer.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'format' => 'currency', 'format' => 'currency',
), ),
'avg_avg_order_value' => array( 'avg_avg_order_value' => array(
'description' => __( 'Average AOV per customer.', 'woocommerce-admin' ), 'description' => __( 'Average AOV per customer.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -162,7 +162,7 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -183,19 +183,19 @@ class Controller extends \WC_REST_Reports_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['registered_before'] = array( $params['registered_before'] = array(
'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['registered_after'] = array( $params['registered_after'] = array(
'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -205,7 +205,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['search'] = array( $params['search'] = array(
'description' => __( 'Limit response to objects with a customer field containing the search term. Searches the field provided by `searchby`.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a customer field containing the search term. Searches the field provided by `searchby`.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
@ -220,59 +220,59 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['name_includes'] = array( $params['name_includes'] = array(
'description' => __( 'Limit response to objects with specfic names.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with specfic names.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['name_excludes'] = array( $params['name_excludes'] = array(
'description' => __( 'Limit response to objects excluding specfic names.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding specfic names.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['username_includes'] = array( $params['username_includes'] = array(
'description' => __( 'Limit response to objects with specfic usernames.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with specfic usernames.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['username_excludes'] = array( $params['username_excludes'] = array(
'description' => __( 'Limit response to objects excluding specfic usernames.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding specfic usernames.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['email_includes'] = array( $params['email_includes'] = array(
'description' => __( 'Limit response to objects including emails.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects including emails.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['email_excludes'] = array( $params['email_excludes'] = array(
'description' => __( 'Limit response to objects excluding emails.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding emails.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['country_includes'] = array( $params['country_includes'] = array(
'description' => __( 'Limit response to objects with specfic countries.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with specfic countries.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['country_excludes'] = array( $params['country_excludes'] = array(
'description' => __( 'Limit response to objects excluding specfic countries.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects excluding specfic countries.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_active_before'] = array( $params['last_active_before'] = array(
'description' => __( 'Limit response to objects last active before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_active_after'] = array( $params['last_active_after'] = array(
'description' => __( 'Limit response to objects last active after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_active_between'] = array( $params['last_active_between'] = array(
'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ),
'items' => array( 'items' => array(
@ -280,19 +280,19 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['registered_before'] = array( $params['registered_before'] = array(
'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['registered_after'] = array( $params['registered_after'] = array(
'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['registered_between'] = array( $params['registered_between'] = array(
'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ),
'items' => array( 'items' => array(
@ -300,19 +300,19 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['orders_count_min'] = array( $params['orders_count_min'] = array(
'description' => __( 'Limit response to objects with an order count greater than or equal to given integer.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an order count greater than or equal to given integer.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orders_count_max'] = array( $params['orders_count_max'] = array(
'description' => __( 'Limit response to objects with an order count less than or equal to given integer.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an order count less than or equal to given integer.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orders_count_between'] = array( $params['orders_count_between'] = array(
'description' => __( 'Limit response to objects with an order count between two given integers.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an order count between two given integers.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
'items' => array( 'items' => array(
@ -320,17 +320,17 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['total_spend_min'] = array( $params['total_spend_min'] = array(
'description' => __( 'Limit response to objects with a total order spend greater than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a total order spend greater than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['total_spend_max'] = array( $params['total_spend_max'] = array(
'description' => __( 'Limit response to objects with a total order spend less than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a total order spend less than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['total_spend_between'] = array( $params['total_spend_between'] = array(
'description' => __( 'Limit response to objects with a total order spend between two given numbers.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with a total order spend between two given numbers.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
'items' => array( 'items' => array(
@ -338,17 +338,17 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['avg_order_value_min'] = array( $params['avg_order_value_min'] = array(
'description' => __( 'Limit response to objects with an average order spend greater than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an average order spend greater than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['avg_order_value_max'] = array( $params['avg_order_value_max'] = array(
'description' => __( 'Limit response to objects with an average order spend less than or equal to given number.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an average order spend less than or equal to given number.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['avg_order_value_between'] = array( $params['avg_order_value_between'] = array(
'description' => __( 'Limit response to objects with an average order spend between two given numbers.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with an average order spend between two given numbers.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ), 'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
'items' => array( 'items' => array(
@ -356,19 +356,19 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['last_order_before'] = array( $params['last_order_before'] = array(
'description' => __( 'Limit response to objects with last order before (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with last order before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['last_order_after'] = array( $params['last_order_after'] = array(
'description' => __( 'Limit response to objects with last order after (or at) a given ISO8601 compliant datetime.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects with last order after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['customers'] = array( $params['customers'] = array(
'description' => __( 'Limit result to items with specified customer ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified customer ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -377,7 +377,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -167,22 +167,22 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'ID.', 'woocommerce-admin' ), 'description' => __( 'ID.', 'woocommerce' ),
), ),
'product_id' => array( 'product_id' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product ID.', 'woocommerce-admin' ), 'description' => __( 'Product ID.', 'woocommerce' ),
), ),
'date' => array( 'date' => array(
'description' => __( "The date of the download, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date of the download, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_gmt' => array( 'date_gmt' => array(
'description' => __( 'The date of the download, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date of the download, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -191,49 +191,49 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Download ID.', 'woocommerce-admin' ), 'description' => __( 'Download ID.', 'woocommerce' ),
), ),
'file_name' => array( 'file_name' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'File name.', 'woocommerce-admin' ), 'description' => __( 'File name.', 'woocommerce' ),
), ),
'file_path' => array( 'file_path' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'File URL.', 'woocommerce-admin' ), 'description' => __( 'File URL.', 'woocommerce' ),
), ),
'order_id' => array( 'order_id' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Order ID.', 'woocommerce-admin' ), 'description' => __( 'Order ID.', 'woocommerce' ),
), ),
'order_number' => array( 'order_number' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Order Number.', 'woocommerce-admin' ), 'description' => __( 'Order Number.', 'woocommerce' ),
), ),
'user_id' => array( 'user_id' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'User ID for the downloader.', 'woocommerce-admin' ), 'description' => __( 'User ID for the downloader.', 'woocommerce' ),
), ),
'username' => array( 'username' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'User name of the downloader.', 'woocommerce-admin' ), 'description' => __( 'User name of the downloader.', 'woocommerce' ),
), ),
'ip_address' => array( 'ip_address' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'IP address for the downloader.', 'woocommerce-admin' ), 'description' => __( 'IP address for the downloader.', 'woocommerce' ),
), ),
), ),
); );
@ -250,7 +250,7 @@ class Controller extends ReportsController implements ExportableInterface {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -258,7 +258,7 @@ class Controller extends ReportsController implements ExportableInterface {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -267,26 +267,26 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -296,7 +296,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: products, orders, username, ip_address.', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: products, orders, username, ip_address.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -306,7 +306,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_includes'] = array( $params['product_includes'] = array(
'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -316,7 +316,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_excludes'] = array( $params['product_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -326,7 +326,7 @@ class Controller extends ReportsController implements ExportableInterface {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['order_includes'] = array( $params['order_includes'] = array(
'description' => __( 'Limit result set to items that have the specified order ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified order ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -335,7 +335,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['order_excludes'] = array( $params['order_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified order ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified order ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -344,7 +344,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['customer_includes'] = array( $params['customer_includes'] = array(
'description' => __( 'Limit response to objects that have the specified user ids.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that have the specified user ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -353,7 +353,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['customer_excludes'] = array( $params['customer_excludes'] = array(
'description' => __( 'Limit response to objects that don\'t have the specified user ids.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that don\'t have the specified user ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -362,7 +362,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['ip_address_includes'] = array( $params['ip_address_includes'] = array(
'description' => __( 'Limit response to objects that have a specified ip address.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that have a specified ip address.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'items' => array( 'items' => array(
@ -371,7 +371,7 @@ class Controller extends ReportsController implements ExportableInterface {
); );
$params['ip_address_excludes'] = array( $params['ip_address_excludes'] = array(
'description' => __( 'Limit response to objects that don\'t have a specified ip address.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that don\'t have a specified ip address.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'items' => array( 'items' => array(
@ -389,12 +389,12 @@ class Controller extends ReportsController implements ExportableInterface {
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'date' => __( 'Date', 'woocommerce-admin' ), 'date' => __( 'Date', 'woocommerce' ),
'product' => __( 'Product title', 'woocommerce-admin' ), 'product' => __( 'Product title', 'woocommerce' ),
'file_name' => __( 'File name', 'woocommerce-admin' ), 'file_name' => __( 'File name', 'woocommerce' ),
'order_number' => __( 'Order #', 'woocommerce-admin' ), 'order_number' => __( 'Order #', 'woocommerce' ),
'user_id' => __( 'User Name', 'woocommerce-admin' ), 'user_id' => __( 'User Name', 'woocommerce' ),
'ip_address' => __( 'IP', 'woocommerce-admin' ), 'ip_address' => __( 'IP', 'woocommerce' ),
); );
/** /**

View File

@ -142,8 +142,8 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_item_schema() { public function get_item_schema() {
$totals = array( $totals = array(
'download_count' => array( 'download_count' => array(
'title' => __( 'Downloads', 'woocommerce-admin' ), 'title' => __( 'Downloads', 'woocommerce' ),
'description' => __( 'Number of downloads.', 'woocommerce-admin' ), 'description' => __( 'Number of downloads.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -157,14 +157,14 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -172,38 +172,38 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -227,7 +227,7 @@ class Controller extends \WC_REST_Reports_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -235,7 +235,7 @@ class Controller extends \WC_REST_Reports_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -244,26 +244,26 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -273,7 +273,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -287,7 +287,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -297,7 +297,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_includes'] = array( $params['product_includes'] = array(
'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -307,7 +307,7 @@ class Controller extends \WC_REST_Reports_Controller {
); );
$params['product_excludes'] = array( $params['product_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -316,7 +316,7 @@ class Controller extends \WC_REST_Reports_Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['order_includes'] = array( $params['order_includes'] = array(
'description' => __( 'Limit result set to items that have the specified order ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified order ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -325,7 +325,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['order_excludes'] = array( $params['order_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified order ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified order ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -334,7 +334,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['customer_includes'] = array( $params['customer_includes'] = array(
'description' => __( 'Limit response to objects that have the specified customer ids.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that have the specified customer ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -343,7 +343,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['customer_excludes'] = array( $params['customer_excludes'] = array(
'description' => __( 'Limit response to objects that don\'t have the specified customer ids.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that don\'t have the specified customer ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -352,7 +352,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['ip_address_includes'] = array( $params['ip_address_includes'] = array(
'description' => __( 'Limit response to objects that have a specified ip address.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that have a specified ip address.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'items' => array( 'items' => array(
@ -361,7 +361,7 @@ class Controller extends \WC_REST_Reports_Controller {
); );
$params['ip_address_excludes'] = array( $params['ip_address_excludes'] = array(
'description' => __( 'Limit response to objects that don\'t have a specified ip address.', 'woocommerce-admin' ), 'description' => __( 'Limit response to objects that don\'t have a specified ip address.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'items' => array( 'items' => array(
@ -369,7 +369,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -117,7 +117,7 @@ class DataStore extends DownloadsDataStore implements DataStoreInterface {
ARRAY_A ARRAY_A
); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok. ); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok.
if ( null === $totals ) { if ( null === $totals ) {
return new \WP_Error( 'woocommerce_analytics_downloads_stats_result_failed', __( 'Sorry, fetching downloads data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_downloads_stats_result_failed', __( 'Sorry, fetching downloads data failed.', 'woocommerce' ) );
} }
$this->interval_query->add_sql_clause( 'order_by', $this->get_sql_clause( 'order_by' ) ); $this->interval_query->add_sql_clause( 'order_by', $this->get_sql_clause( 'order_by' ) );
@ -133,7 +133,7 @@ class DataStore extends DownloadsDataStore implements DataStoreInterface {
); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok. ); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok.
if ( null === $intervals ) { if ( null === $intervals ) {
return new \WP_Error( 'woocommerce_analytics_downloads_stats_result_failed', __( 'Sorry, fetching downloads data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_downloads_stats_result_failed', __( 'Sorry, fetching downloads data failed.', 'woocommerce' ) );
} }
$totals = (object) $this->cast_numbers( $totals[0] ); $totals = (object) $this->cast_numbers( $totals[0] );

View File

@ -74,12 +74,12 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
protected function get_export_collection_params() { protected function get_export_collection_params() {
$params = array(); $params = array();
$params['report_args'] = array( $params['report_args'] = array(
'description' => __( 'Parameters to pass on to the exported report.', 'woocommerce-admin' ), 'description' => __( 'Parameters to pass on to the exported report.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'validate_callback' => 'rest_validate_request_arg', // @todo: use each controller's schema? 'validate_callback' => 'rest_validate_request_arg', // @todo: use each controller's schema?
); );
$params['email'] = array( $params['email'] = array(
'description' => __( 'When true, email a link to download the export to the requesting user.', 'woocommerce-admin' ), 'description' => __( 'When true, email a link to download the export to the requesting user.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
@ -98,19 +98,19 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'status' => array( 'status' => array(
'description' => __( 'Export status.', 'woocommerce-admin' ), 'description' => __( 'Export status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'message' => array( 'message' => array(
'description' => __( 'Export status message.', 'woocommerce-admin' ), 'description' => __( 'Export status message.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'export_id' => array( 'export_id' => array(
'description' => __( 'Export ID.', 'woocommerce-admin' ), 'description' => __( 'Export ID.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -133,13 +133,13 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'percent_complete' => array( 'percent_complete' => array(
'description' => __( 'Percentage complete.', 'woocommerce-admin' ), 'description' => __( 'Percentage complete.', 'woocommerce' ),
'type' => 'int', 'type' => 'int',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'download_url' => array( 'download_url' => array(
'description' => __( 'Export download URL.', 'woocommerce-admin' ), 'description' => __( 'Export download URL.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -170,7 +170,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
if ( 0 === $total_rows ) { if ( 0 === $total_rows ) {
return rest_ensure_response( return rest_ensure_response(
array( array(
'message' => __( 'There is no data to export for the given request.', 'woocommerce-admin' ), 'message' => __( 'There is no data to export for the given request.', 'woocommerce' ),
) )
); );
} }
@ -179,7 +179,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
$response = rest_ensure_response( $response = rest_ensure_response(
array( array(
'message' => __( 'Your report file is being generated.', 'woocommerce-admin' ), 'message' => __( 'Your report file is being generated.', 'woocommerce' ),
'export_id' => $export_id, 'export_id' => $export_id,
) )
); );
@ -212,7 +212,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
if ( false === $percentage ) { if ( false === $percentage ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_admin_reports_export_invalid_id', 'woocommerce_admin_reports_export_invalid_id',
__( 'Sorry, there is no export with that ID.', 'woocommerce-admin' ), __( 'Sorry, there is no export with that ID.', 'woocommerce' ),
array( 'status' => 404 ) array( 'status' => 404 )
); );
} }

View File

@ -108,7 +108,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
*/ */
public function import_permissions_check( $request ) { public function import_permissions_check( $request ) {
if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) { if ( ! wc_rest_check_manager_permissions( 'settings', 'edit' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_edit', __( 'Sorry, you cannot edit this resource.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
} }
@ -185,14 +185,14 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
public function get_import_collection_params() { public function get_import_collection_params() {
$params = array(); $params = array();
$params['days'] = array( $params['days'] = array(
'description' => __( 'Number of days to import.', 'woocommerce-admin' ), 'description' => __( 'Number of days to import.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
'minimum' => 0, 'minimum' => 0,
); );
$params['skip_existing'] = array( $params['skip_existing'] = array(
'description' => __( 'Skip importing existing order data.', 'woocommerce-admin' ), 'description' => __( 'Skip importing existing order data.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
@ -213,13 +213,13 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'status' => array( 'status' => array(
'description' => __( 'Regeneration status.', 'woocommerce-admin' ), 'description' => __( 'Regeneration status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'message' => array( 'message' => array(
'description' => __( 'Regenerate data message.', 'woocommerce-admin' ), 'description' => __( 'Regenerate data message.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -241,7 +241,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
$result = array( $result = array(
'status' => 'success', 'status' => 'success',
'message' => __( 'All pending and in-progress import actions have been cancelled.', 'woocommerce-admin' ), 'message' => __( 'All pending and in-progress import actions have been cancelled.', 'woocommerce' ),
); );
$response = $this->prepare_item_for_response( $result, $request ); $response = $this->prepare_item_for_response( $result, $request );

View File

@ -172,61 +172,61 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'order_id' => array( 'order_id' => array(
'description' => __( 'Order ID.', 'woocommerce-admin' ), 'description' => __( 'Order ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'order_number' => array( 'order_number' => array(
'description' => __( 'Order Number.', 'woocommerce-admin' ), 'description' => __( 'Order Number.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_created' => array( 'date_created' => array(
'description' => __( "Date the order was created, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "Date the order was created, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_created_gmt' => array( 'date_created_gmt' => array(
'description' => __( 'Date the order was created, as GMT.', 'woocommerce-admin' ), 'description' => __( 'Date the order was created, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'status' => array( 'status' => array(
'description' => __( 'Order status.', 'woocommerce-admin' ), 'description' => __( 'Order status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'customer_id' => array( 'customer_id' => array(
'description' => __( 'Customer ID.', 'woocommerce-admin' ), 'description' => __( 'Customer ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'num_items_sold' => array( 'num_items_sold' => array(
'description' => __( 'Number of items sold.', 'woocommerce-admin' ), 'description' => __( 'Number of items sold.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'net_total' => array( 'net_total' => array(
'description' => __( 'Net total revenue.', 'woocommerce-admin' ), 'description' => __( 'Net total revenue.', 'woocommerce' ),
'type' => 'float', 'type' => 'float',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'total_formatted' => array( 'total_formatted' => array(
'description' => __( 'Net total revenue (formatted).', 'woocommerce-admin' ), 'description' => __( 'Net total revenue (formatted).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'customer_type' => array( 'customer_type' => array(
'description' => __( 'Returning or new customer.', 'woocommerce-admin' ), 'description' => __( 'Returning or new customer.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -236,19 +236,19 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'array', 'type' => 'array',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'List of order product IDs, names, quantities.', 'woocommerce-admin' ), 'description' => __( 'List of order product IDs, names, quantities.', 'woocommerce' ),
), ),
'coupons' => array( 'coupons' => array(
'type' => 'array', 'type' => 'array',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'List of order coupons.', 'woocommerce-admin' ), 'description' => __( 'List of order coupons.', 'woocommerce' ),
), ),
'customer' => array( 'customer' => array(
'type' => 'object', 'type' => 'object',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Order customer information.', 'woocommerce-admin' ), 'description' => __( 'Order customer information.', 'woocommerce' ),
), ),
), ),
), ),
@ -266,7 +266,7 @@ class Controller extends ReportsController implements ExportableInterface {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -274,7 +274,7 @@ class Controller extends ReportsController implements ExportableInterface {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 0, 'minimum' => 0,
@ -283,26 +283,26 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -313,7 +313,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_includes'] = array( $params['product_includes'] = array(
'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -323,7 +323,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_excludes'] = array( $params['product_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -333,7 +333,7 @@ class Controller extends ReportsController implements ExportableInterface {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['variation_includes'] = array( $params['variation_includes'] = array(
'description' => __( 'Limit result set to items that have the specified variation(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified variation(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -343,7 +343,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['variation_excludes'] = array( $params['variation_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified variation(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified variation(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -353,7 +353,7 @@ class Controller extends ReportsController implements ExportableInterface {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['coupon_includes'] = array( $params['coupon_includes'] = array(
'description' => __( 'Limit result set to items that have the specified coupon(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified coupon(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -363,7 +363,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['coupon_excludes'] = array( $params['coupon_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified coupon(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified coupon(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -373,7 +373,7 @@ class Controller extends ReportsController implements ExportableInterface {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['tax_rate_includes'] = array( $params['tax_rate_includes'] = array(
'description' => __( 'Limit result set to items that have the specified tax rate(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified tax rate(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -383,7 +383,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['tax_rate_excludes'] = array( $params['tax_rate_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified tax rate(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified tax rate(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -393,7 +393,7 @@ class Controller extends ReportsController implements ExportableInterface {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['status_is'] = array( $params['status_is'] = array(
'description' => __( 'Limit result set to items that have the specified order status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified order status.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -403,7 +403,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['status_is_not'] = array( $params['status_is_not'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -413,7 +413,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['customer_type'] = array( $params['customer_type'] = array(
'description' => __( 'Limit result set to returning or new customers.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to returning or new customers.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'enum' => array( 'enum' => array(
@ -424,7 +424,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['refunds'] = array( $params['refunds'] = array(
'description' => __( 'Limit result set to specific types of refunds.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to specific types of refunds.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'enum' => array( 'enum' => array(
@ -437,14 +437,14 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['extended_info'] = array( $params['extended_info'] = array(
'description' => __( 'Add additional piece of info about each coupon to the report.', 'woocommerce-admin' ), 'description' => __( 'Add additional piece of info about each coupon to the report.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order_includes'] = array( $params['order_includes'] = array(
'description' => __( 'Limit result set to items that have the specified order ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified order ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -453,7 +453,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['order_excludes'] = array( $params['order_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified order ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified order ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -462,7 +462,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['attribute_is'] = array( $params['attribute_is'] = array(
'description' => __( 'Limit result set to orders that include products with the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that include products with the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -471,7 +471,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['attribute_is_not'] = array( $params['attribute_is_not'] = array(
'description' => __( 'Limit result set to orders that don\'t include products with the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that don\'t include products with the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -505,7 +505,7 @@ class Controller extends ReportsController implements ExportableInterface {
foreach ( $products as $product ) { foreach ( $products as $product ) {
$products_list[] = sprintf( $products_list[] = sprintf(
/* translators: 1: numeric product quantity, 2: name of product */ /* translators: 1: numeric product quantity, 2: name of product */
__( '%1$s× %2$s', 'woocommerce-admin' ), __( '%1$s× %2$s', 'woocommerce' ),
$product['quantity'], $product['quantity'],
$product['name'] $product['name']
); );
@ -531,16 +531,16 @@ class Controller extends ReportsController implements ExportableInterface {
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'date_created' => __( 'Date', 'woocommerce-admin' ), 'date_created' => __( 'Date', 'woocommerce' ),
'order_number' => __( 'Order #', 'woocommerce-admin' ), 'order_number' => __( 'Order #', 'woocommerce' ),
'total_formatted' => __( 'N. Revenue (formatted)', 'woocommerce-admin' ), 'total_formatted' => __( 'N. Revenue (formatted)', 'woocommerce' ),
'status' => __( 'Status', 'woocommerce-admin' ), 'status' => __( 'Status', 'woocommerce' ),
'customer_name' => __( 'Customer', 'woocommerce-admin' ), 'customer_name' => __( 'Customer', 'woocommerce' ),
'customer_type' => __( 'Customer type', 'woocommerce-admin' ), 'customer_type' => __( 'Customer type', 'woocommerce' ),
'products' => __( 'Product(s)', 'woocommerce-admin' ), 'products' => __( 'Product(s)', 'woocommerce' ),
'num_items_sold' => __( 'Items sold', 'woocommerce-admin' ), 'num_items_sold' => __( 'Items sold', 'woocommerce' ),
'coupons' => __( 'Coupon(s)', 'woocommerce-admin' ), 'coupons' => __( 'Coupon(s)', 'woocommerce' ),
'net_total' => __( 'N. Revenue', 'woocommerce-admin' ), 'net_total' => __( 'N. Revenue', 'woocommerce' ),
); );
/** /**

View File

@ -161,22 +161,22 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
public function get_item_schema() { public function get_item_schema() {
$data_values = array( $data_values = array(
'net_revenue' => array( 'net_revenue' => array(
'description' => __( 'Net sales.', 'woocommerce-admin' ), 'description' => __( 'Net sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'format' => 'currency', 'format' => 'currency',
), ),
'orders_count' => array( 'orders_count' => array(
'title' => __( 'Orders', 'woocommerce-admin' ), 'title' => __( 'Orders', 'woocommerce' ),
'description' => __( 'Number of orders', 'woocommerce-admin' ), 'description' => __( 'Number of orders', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'indicator' => true, 'indicator' => true,
), ),
'avg_order_value' => array( 'avg_order_value' => array(
'description' => __( 'Average order value.', 'woocommerce-admin' ), 'description' => __( 'Average order value.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -184,37 +184,37 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'format' => 'currency', 'format' => 'currency',
), ),
'avg_items_per_order' => array( 'avg_items_per_order' => array(
'description' => __( 'Average items per order', 'woocommerce-admin' ), 'description' => __( 'Average items per order', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'num_items_sold' => array( 'num_items_sold' => array(
'description' => __( 'Number of items sold', 'woocommerce-admin' ), 'description' => __( 'Number of items sold', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'coupons' => array( 'coupons' => array(
'description' => __( 'Amount discounted by coupons.', 'woocommerce-admin' ), 'description' => __( 'Amount discounted by coupons.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'coupons_count' => array( 'coupons_count' => array(
'description' => __( 'Unique coupons count.', 'woocommerce-admin' ), 'description' => __( 'Unique coupons count.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'total_customers' => array( 'total_customers' => array(
'description' => __( 'Total distinct customers.', 'woocommerce-admin' ), 'description' => __( 'Total distinct customers.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'products' => array( 'products' => array(
'description' => __( 'Number of distinct products sold.', 'woocommerce-admin' ), 'description' => __( 'Number of distinct products sold.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -223,7 +223,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
$segments = array( $segments = array(
'segments' => array( 'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -231,13 +231,13 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'segment_id' => array( 'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce-admin' ), 'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -261,14 +261,14 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -276,38 +276,38 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -331,7 +331,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -339,7 +339,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -348,26 +348,26 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -379,7 +379,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -393,7 +393,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -403,7 +403,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['status_is'] = array( $params['status_is'] = array(
'description' => __( 'Limit result set to items that have the specified order status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified order status.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -414,7 +414,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
), ),
); );
$params['status_is_not'] = array( $params['status_is_not'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified order status.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -424,7 +424,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
), ),
); );
$params['product_includes'] = array( $params['product_includes'] = array(
'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -434,7 +434,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
); );
$params['product_excludes'] = array( $params['product_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified product(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -443,7 +443,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['variation_includes'] = array( $params['variation_includes'] = array(
'description' => __( 'Limit result set to items that have the specified variation(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified variation(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -453,7 +453,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['variation_excludes'] = array( $params['variation_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified variation(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified variation(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -463,7 +463,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['coupon_includes'] = array( $params['coupon_includes'] = array(
'description' => __( 'Limit result set to items that have the specified coupon(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified coupon(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -472,7 +472,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['coupon_excludes'] = array( $params['coupon_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified coupon(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified coupon(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -481,7 +481,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['tax_rate_includes'] = array( $params['tax_rate_includes'] = array(
'description' => __( 'Limit result set to items that have the specified tax rate(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified tax rate(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -491,7 +491,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['tax_rate_excludes'] = array( $params['tax_rate_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified tax rate(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified tax rate(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -501,7 +501,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['customer'] = array( $params['customer'] = array(
'description' => __( 'Alias for customer_type (deprecated).', 'woocommerce-admin' ), 'description' => __( 'Alias for customer_type (deprecated).', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'new', 'new',
@ -510,7 +510,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['customer_type'] = array( $params['customer_type'] = array(
'description' => __( 'Limit result set to orders that have the specified customer_type', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that have the specified customer_type', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'new', 'new',
@ -519,7 +519,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['refunds'] = array( $params['refunds'] = array(
'description' => __( 'Limit result set to specific types of refunds.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to specific types of refunds.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => '', 'default' => '',
'enum' => array( 'enum' => array(
@ -532,7 +532,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['attribute_is'] = array( $params['attribute_is'] = array(
'description' => __( 'Limit result set to orders that include products with the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that include products with the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -541,7 +541,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['attribute_is_not'] = array( $params['attribute_is_not'] = array(
'description' => __( 'Limit result set to orders that don\'t include products with the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that don\'t include products with the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -550,7 +550,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['segmentby'] = array( $params['segmentby'] = array(
'description' => __( 'Segment the response by additional constraint.', 'woocommerce-admin' ), 'description' => __( 'Segment the response by additional constraint.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'product', 'product',
@ -562,7 +562,7 @@ class Controller extends \Automattic\WooCommerce\Admin\API\Reports\Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -332,7 +332,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
ARRAY_A ARRAY_A
); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok. ); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok.
if ( null === $totals ) { if ( null === $totals ) {
return new \WP_Error( 'woocommerce_analytics_revenue_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_revenue_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
// @todo Remove these assignements when refactoring segmenter classes to use query objects. // @todo Remove these assignements when refactoring segmenter classes to use query objects.
@ -385,7 +385,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok. ); // phpcs:ignore cache ok, DB call ok, unprepared SQL ok.
if ( null === $intervals ) { if ( null === $intervals ) {
return new \WP_Error( 'woocommerce_analytics_revenue_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_revenue_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
if ( isset( $intervals[0] ) ) { if ( isset( $intervals[0] ) ) {

View File

@ -375,7 +375,7 @@ class Segmenter extends ReportsSegmenter {
$segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table ); $segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table );
} elseif ( 'variation' === $this->query_args['segmentby'] ) { } elseif ( 'variation' === $this->query_args['segmentby'] ) {
if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) { if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) {
throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce-admin' ) ); throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce' ) );
} }
$product_level_columns = $this->get_segment_selections_product_level( $product_segmenting_table ); $product_level_columns = $this->get_segment_selections_product_level( $product_segmenting_table );

View File

@ -141,7 +141,7 @@ class Controller extends \WC_REST_Reports_Controller {
} }
if ( 200 !== $response->get_status() ) { if ( 200 !== $response->get_status() ) {
return new \WP_Error( 'woocommerce_analytics_performance_indicators_result_failed', __( 'Sorry, fetching performance indicators failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_performance_indicators_result_failed', __( 'Sorry, fetching performance indicators failed.', 'woocommerce' ) );
} }
$endpoints = $response->get_data(); $endpoints = $response->get_data();
@ -223,13 +223,13 @@ class Controller extends \WC_REST_Reports_Controller {
'woocommerce_rest_performance_indicators_jetpack_items', 'woocommerce_rest_performance_indicators_jetpack_items',
array( array(
'stats/visitors' => array( 'stats/visitors' => array(
'label' => __( 'Visitors', 'woocommerce-admin' ), 'label' => __( 'Visitors', 'woocommerce' ),
'permission' => 'view_stats', 'permission' => 'view_stats',
'format' => 'number', 'format' => 'number',
'module' => 'stats', 'module' => 'stats',
), ),
'stats/views' => array( 'stats/views' => array(
'label' => __( 'Views', 'woocommerce-admin' ), 'label' => __( 'Views', 'woocommerce' ),
'permission' => 'view_stats', 'permission' => 'view_stats',
'format' => 'number', 'format' => 'number',
'module' => 'stats', 'module' => 'stats',
@ -405,7 +405,7 @@ class Controller extends \WC_REST_Reports_Controller {
$query_args = $this->prepare_reports_query( $request ); $query_args = $this->prepare_reports_query( $request );
if ( empty( $query_args['stats'] ) ) { if ( empty( $query_args['stats'] ) ) {
return new \WP_Error( 'woocommerce_analytics_performance_indicators_empty_query', __( 'A list of stats to query must be provided.', 'woocommerce-admin' ), 400 ); return new \WP_Error( 'woocommerce_analytics_performance_indicators_empty_query', __( 'A list of stats to query must be provided.', 'woocommerce' ), 400 );
} }
$stats = array(); $stats = array();
@ -594,33 +594,33 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'stat' => array( 'stat' => array(
'description' => __( 'Unique identifier for the resource.', 'woocommerce-admin' ), 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => $allowed_stats, 'enum' => $allowed_stats,
), ),
'chart' => array( 'chart' => array(
'description' => __( 'The specific chart this stat referrers to.', 'woocommerce-admin' ), 'description' => __( 'The specific chart this stat referrers to.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'label' => array( 'label' => array(
'description' => __( 'Human readable label for the stat.', 'woocommerce-admin' ), 'description' => __( 'Human readable label for the stat.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'format' => array( 'format' => array(
'description' => __( 'Format of the stat.', 'woocommerce-admin' ), 'description' => __( 'Format of the stat.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'number', 'currency' ), 'enum' => array( 'number', 'currency' ),
), ),
'value' => array( 'value' => array(
'description' => __( 'Value of the stat. Returns null if the stat does not exist or cannot be loaded.', 'woocommerce-admin' ), 'description' => __( 'Value of the stat. Returns null if the stat does not exist or cannot be loaded.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -651,7 +651,7 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_collection_params() { public function get_collection_params() {
$indicator_data = $this->get_indicator_data(); $indicator_data = $this->get_indicator_data();
if ( is_wp_error( $indicator_data ) ) { if ( is_wp_error( $indicator_data ) ) {
$allowed_stats = __( 'There was an issue loading the report endpoints', 'woocommerce-admin' ); $allowed_stats = __( 'There was an issue loading the report endpoints', 'woocommerce' );
} else { } else {
$allowed_stats = implode( ', ', $this->allowed_stats ); $allowed_stats = implode( ', ', $this->allowed_stats );
} }
@ -661,7 +661,7 @@ class Controller extends \WC_REST_Reports_Controller {
$params['stats'] = array( $params['stats'] = array(
'description' => sprintf( 'description' => sprintf(
/* translators: Allowed values is a list of stat endpoints. */ /* translators: Allowed values is a list of stat endpoints. */
__( 'Limit response to specific report stats. Allowed values: %s.', 'woocommerce-admin' ), __( 'Limit response to specific report stats. Allowed values: %s.', 'woocommerce' ),
$allowed_stats $allowed_stats
), ),
'type' => 'array', 'type' => 'array',
@ -673,13 +673,13 @@ class Controller extends \WC_REST_Reports_Controller {
'default' => $this->allowed_stats, 'default' => $this->allowed_stats,
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -162,86 +162,86 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product ID.', 'woocommerce-admin' ), 'description' => __( 'Product ID.', 'woocommerce' ),
), ),
'items_sold' => array( 'items_sold' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Number of items sold.', 'woocommerce-admin' ), 'description' => __( 'Number of items sold.', 'woocommerce' ),
), ),
'net_revenue' => array( 'net_revenue' => array(
'type' => 'number', 'type' => 'number',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Total Net sales of all items sold.', 'woocommerce-admin' ), 'description' => __( 'Total Net sales of all items sold.', 'woocommerce' ),
), ),
'orders_count' => array( 'orders_count' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Number of orders product appeared in.', 'woocommerce-admin' ), 'description' => __( 'Number of orders product appeared in.', 'woocommerce' ),
), ),
'extended_info' => array( 'extended_info' => array(
'name' => array( 'name' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product name.', 'woocommerce-admin' ), 'description' => __( 'Product name.', 'woocommerce' ),
), ),
'price' => array( 'price' => array(
'type' => 'number', 'type' => 'number',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product price.', 'woocommerce-admin' ), 'description' => __( 'Product price.', 'woocommerce' ),
), ),
'image' => array( 'image' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product image.', 'woocommerce-admin' ), 'description' => __( 'Product image.', 'woocommerce' ),
), ),
'permalink' => array( 'permalink' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product link.', 'woocommerce-admin' ), 'description' => __( 'Product link.', 'woocommerce' ),
), ),
'category_ids' => array( 'category_ids' => array(
'type' => 'array', 'type' => 'array',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product category IDs.', 'woocommerce-admin' ), 'description' => __( 'Product category IDs.', 'woocommerce' ),
), ),
'stock_status' => array( 'stock_status' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product inventory status.', 'woocommerce-admin' ), 'description' => __( 'Product inventory status.', 'woocommerce' ),
), ),
'stock_quantity' => array( 'stock_quantity' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product inventory quantity.', 'woocommerce-admin' ), 'description' => __( 'Product inventory quantity.', 'woocommerce' ),
), ),
'low_stock_amount' => array( 'low_stock_amount' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product inventory threshold for low stock.', 'woocommerce-admin' ), 'description' => __( 'Product inventory threshold for low stock.', 'woocommerce' ),
), ),
'variations' => array( 'variations' => array(
'type' => 'array', 'type' => 'array',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product variations IDs.', 'woocommerce-admin' ), 'description' => __( 'Product variations IDs.', 'woocommerce' ),
), ),
'sku' => array( 'sku' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product SKU.', 'woocommerce-admin' ), 'description' => __( 'Product SKU.', 'woocommerce' ),
), ),
), ),
), ),
@ -259,7 +259,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -267,7 +267,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -276,26 +276,26 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -310,7 +310,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['categories'] = array( $params['categories'] = array(
'description' => __( 'Limit result to items from the specified categories.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items from the specified categories.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -319,7 +319,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
), ),
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -329,7 +329,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['products'] = array( $params['products'] = array(
'description' => __( 'Limit result to items with specified product ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified product ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -339,7 +339,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
); );
$params['extended_info'] = array( $params['extended_info'] = array(
'description' => __( 'Add additional piece of info about each product to the report.', 'woocommerce-admin' ), 'description' => __( 'Add additional piece of info about each product to the report.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
@ -386,18 +386,18 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'product_name' => __( 'Product title', 'woocommerce-admin' ), 'product_name' => __( 'Product title', 'woocommerce' ),
'sku' => __( 'SKU', 'woocommerce-admin' ), 'sku' => __( 'SKU', 'woocommerce' ),
'items_sold' => __( 'Items sold', 'woocommerce-admin' ), 'items_sold' => __( 'Items sold', 'woocommerce' ),
'net_revenue' => __( 'N. Revenue', 'woocommerce-admin' ), 'net_revenue' => __( 'N. Revenue', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
'product_cat' => __( 'Category', 'woocommerce-admin' ), 'product_cat' => __( 'Category', 'woocommerce' ),
'variations' => __( 'Variations', 'woocommerce-admin' ), 'variations' => __( 'Variations', 'woocommerce' ),
); );
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) { if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
$export_columns['stock_status'] = __( 'Status', 'woocommerce-admin' ); $export_columns['stock_status'] = __( 'Status', 'woocommerce' );
$export_columns['stock'] = __( 'Stock', 'woocommerce-admin' ); $export_columns['stock'] = __( 'Stock', 'woocommerce' );
} }
/** /**
@ -434,8 +434,8 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$export_item['stock_status'] = $this->get_stock_status( $item['extended_info']['stock_status'] ); $export_item['stock_status'] = $this->get_stock_status( $item['extended_info']['stock_status'] );
$export_item['stock'] = $item['extended_info']['stock_quantity']; $export_item['stock'] = $item['extended_info']['stock_quantity'];
} else { } else {
$export_item['stock_status'] = __( 'N/A', 'woocommerce-admin' ); $export_item['stock_status'] = __( 'N/A', 'woocommerce' );
$export_item['stock'] = __( 'N/A', 'woocommerce-admin' ); $export_item['stock'] = __( 'N/A', 'woocommerce' );
} }
} }

View File

@ -224,7 +224,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
} }
/* translators: %s is product name */ /* translators: %s is product name */
$products_data[ $key ]['extended_info']['name'] = $product_names[ $product_id ] ? sprintf( __( '%s (Deleted)', 'woocommerce-admin' ), $product_names[ $product_id ] ) : __( '(Deleted)', 'woocommerce-admin' ); $products_data[ $key ]['extended_info']['name'] = $product_names[ $product_id ] ? sprintf( __( '%s (Deleted)', 'woocommerce' ), $product_names[ $product_id ] ) : __( '(Deleted)', 'woocommerce' );
continue; continue;
} }

View File

@ -157,22 +157,22 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_item_schema() { public function get_item_schema() {
$data_values = array( $data_values = array(
'items_sold' => array( 'items_sold' => array(
'title' => __( 'Products sold', 'woocommerce-admin' ), 'title' => __( 'Products sold', 'woocommerce' ),
'description' => __( 'Number of product items sold.', 'woocommerce-admin' ), 'description' => __( 'Number of product items sold.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'indicator' => true, 'indicator' => true,
), ),
'net_revenue' => array( 'net_revenue' => array(
'description' => __( 'Net sales.', 'woocommerce-admin' ), 'description' => __( 'Net sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'format' => 'currency', 'format' => 'currency',
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -181,7 +181,7 @@ class Controller extends \WC_REST_Reports_Controller {
$segments = array( $segments = array(
'segments' => array( 'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -189,20 +189,20 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'segment_id' => array( 'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce-admin' ), 'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'segment_label' => array( 'segment_label' => array(
'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce-admin' ), 'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -221,14 +221,14 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -236,38 +236,38 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -313,7 +313,7 @@ class Controller extends \WC_REST_Reports_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -321,7 +321,7 @@ class Controller extends \WC_REST_Reports_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -330,26 +330,26 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -366,7 +366,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -380,7 +380,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['categories'] = array( $params['categories'] = array(
'description' => __( 'Limit result to items from the specified categories.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items from the specified categories.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -389,7 +389,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['products'] = array( $params['products'] = array(
'description' => __( 'Limit result to items with specified product ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified product ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -398,7 +398,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['variations'] = array( $params['variations'] = array(
'description' => __( 'Limit result to items with specified variation ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified variation ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -407,7 +407,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['segmentby'] = array( $params['segmentby'] = array(
'description' => __( 'Segment the response by additional constraint.', 'woocommerce-admin' ), 'description' => __( 'Segment the response by additional constraint.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'product', 'product',
@ -417,7 +417,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -183,7 +183,7 @@ class DataStore extends ProductsDataStore implements DataStoreInterface {
$totals[0]['segments'] = $segmenter->get_totals_segments( $totals_query, $table_name ); $totals[0]['segments'] = $segmenter->get_totals_segments( $totals_query, $table_name );
if ( null === $totals ) { if ( null === $totals ) {
return new \WP_Error( 'woocommerce_analytics_products_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_products_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
$this->interval_query->add_sql_clause( 'order_by', $this->get_sql_clause( 'order_by' ) ); $this->interval_query->add_sql_clause( 'order_by', $this->get_sql_clause( 'order_by' ) );
@ -199,7 +199,7 @@ class DataStore extends ProductsDataStore implements DataStoreInterface {
); // WPCS: cache ok, DB call ok, unprepared SQL ok. ); // WPCS: cache ok, DB call ok, unprepared SQL ok.
if ( null === $intervals ) { if ( null === $intervals ) {
return new \WP_Error( 'woocommerce_analytics_products_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_products_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
$totals = (object) $this->cast_numbers( $totals[0] ); $totals = (object) $this->cast_numbers( $totals[0] );

View File

@ -166,7 +166,7 @@ class Segmenter extends ReportsSegmenter {
$segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table ); $segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table );
} elseif ( 'variation' === $this->query_args['segmentby'] ) { } elseif ( 'variation' === $this->query_args['segmentby'] ) {
if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) { if ( ! isset( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) {
throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce-admin' ) ); throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce' ) );
} }
$product_level_columns = $this->get_segment_selections_product_level( $product_segmenting_table ); $product_level_columns = $this->get_segment_selections_product_level( $product_segmenting_table );

View File

@ -19,6 +19,6 @@ abstract class Query extends \WC_Object_Query {
*/ */
public function get_data() { public function get_data() {
/* translators: %s: Method name */ /* translators: %s: Method name */
return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce-admin' ), __METHOD__ ), array( 'status' => 405 ) ); return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
} }
} }

View File

@ -165,7 +165,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
public function get_item_schema() { public function get_item_schema() {
$data_values = array( $data_values = array(
'total_sales' => array( 'total_sales' => array(
'description' => __( 'Total sales.', 'woocommerce-admin' ), 'description' => __( 'Total sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -173,7 +173,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'format' => 'currency', 'format' => 'currency',
), ),
'net_revenue' => array( 'net_revenue' => array(
'description' => __( 'Net sales.', 'woocommerce-admin' ), 'description' => __( 'Net sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -181,21 +181,21 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'format' => 'currency', 'format' => 'currency',
), ),
'coupons' => array( 'coupons' => array(
'description' => __( 'Amount discounted by coupons.', 'woocommerce-admin' ), 'description' => __( 'Amount discounted by coupons.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'coupons_count' => array( 'coupons_count' => array(
'description' => __( 'Unique coupons count.', 'woocommerce-admin' ), 'description' => __( 'Unique coupons count.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'format' => 'currency', 'format' => 'currency',
), ),
'shipping' => array( 'shipping' => array(
'title' => __( 'Shipping', 'woocommerce-admin' ), 'title' => __( 'Shipping', 'woocommerce' ),
'description' => __( 'Total of shipping.', 'woocommerce-admin' ), 'description' => __( 'Total of shipping.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -203,15 +203,15 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'format' => 'currency', 'format' => 'currency',
), ),
'taxes' => array( 'taxes' => array(
'description' => __( 'Total of taxes.', 'woocommerce-admin' ), 'description' => __( 'Total of taxes.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'format' => 'currency', 'format' => 'currency',
), ),
'refunds' => array( 'refunds' => array(
'title' => __( 'Returns', 'woocommerce-admin' ), 'title' => __( 'Returns', 'woocommerce' ),
'description' => __( 'Total of returns.', 'woocommerce-admin' ), 'description' => __( 'Total of returns.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -219,25 +219,25 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'format' => 'currency', 'format' => 'currency',
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'num_items_sold' => array( 'num_items_sold' => array(
'description' => __( 'Items sold.', 'woocommerce-admin' ), 'description' => __( 'Items sold.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'products' => array( 'products' => array(
'description' => __( 'Products sold.', 'woocommerce-admin' ), 'description' => __( 'Products sold.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'gross_sales' => array( 'gross_sales' => array(
'description' => __( 'Gross sales.', 'woocommerce-admin' ), 'description' => __( 'Gross sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -248,7 +248,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$segments = array( $segments = array(
'segments' => array( 'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -256,13 +256,13 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'segment_id' => array( 'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce-admin' ), 'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -286,14 +286,14 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -301,38 +301,38 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -356,7 +356,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -364,7 +364,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -373,26 +373,26 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -410,7 +410,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -424,7 +424,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['segmentby'] = array( $params['segmentby'] = array(
'description' => __( 'Segment the response by additional constraint.', 'woocommerce-admin' ), 'description' => __( 'Segment the response by additional constraint.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'product', 'product',
@ -446,15 +446,15 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function get_export_columns() { public function get_export_columns() {
return array( return array(
'date' => __( 'Date', 'woocommerce-admin' ), 'date' => __( 'Date', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
'gross_sales' => __( 'Gross sales', 'woocommerce-admin' ), 'gross_sales' => __( 'Gross sales', 'woocommerce' ),
'total_sales' => __( 'Total sales', 'woocommerce-admin' ), 'total_sales' => __( 'Total sales', 'woocommerce' ),
'refunds' => __( 'Returns', 'woocommerce-admin' ), 'refunds' => __( 'Returns', 'woocommerce' ),
'coupons' => __( 'Coupons', 'woocommerce-admin' ), 'coupons' => __( 'Coupons', 'woocommerce' ),
'taxes' => __( 'Taxes', 'woocommerce-admin' ), 'taxes' => __( 'Taxes', 'woocommerce' ),
'shipping' => __( 'Shipping', 'woocommerce-admin' ), 'shipping' => __( 'Shipping', 'woocommerce' ),
'net_revenue' => __( 'Net Revenue', 'woocommerce-admin' ), 'net_revenue' => __( 'Net Revenue', 'woocommerce' ),
); );
} }

View File

@ -387,44 +387,44 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'id' => array( 'id' => array(
'description' => __( 'Unique identifier for the resource.', 'woocommerce-admin' ), 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'parent_id' => array( 'parent_id' => array(
'description' => __( 'Product parent ID.', 'woocommerce-admin' ), 'description' => __( 'Product parent ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'name' => array( 'name' => array(
'description' => __( 'Product name.', 'woocommerce-admin' ), 'description' => __( 'Product name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'sku' => array( 'sku' => array(
'description' => __( 'Unique identifier.', 'woocommerce-admin' ), 'description' => __( 'Unique identifier.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'stock_status' => array( 'stock_status' => array(
'description' => __( 'Stock status.', 'woocommerce-admin' ), 'description' => __( 'Stock status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array_keys( wc_get_product_stock_status_options() ), 'enum' => array_keys( wc_get_product_stock_status_options() ),
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'stock_quantity' => array( 'stock_quantity' => array(
'description' => __( 'Stock quantity.', 'woocommerce-admin' ), 'description' => __( 'Stock quantity.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'manage_stock' => array( 'manage_stock' => array(
'description' => __( 'Manage stock.', 'woocommerce-admin' ), 'description' => __( 'Manage stock.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -444,7 +444,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -452,7 +452,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -461,7 +461,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['exclude'] = array( $params['exclude'] = array(
'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce-admin' ), 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -470,7 +470,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['include'] = array( $params['include'] = array(
'description' => __( 'Limit result set to specific ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to specific ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -479,20 +479,20 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['offset'] = array( $params['offset'] = array(
'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce-admin' ), 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'asc', 'default' => 'asc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'stock_status', 'default' => 'stock_status',
'enum' => array( 'enum' => array(
@ -507,7 +507,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['parent'] = array( $params['parent'] = array(
'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -516,7 +516,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'default' => array(), 'default' => array(),
); );
$params['parent_exclude'] = array( $params['parent_exclude'] = array(
'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -525,7 +525,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'default' => array(), 'default' => array(),
); );
$params['type'] = array( $params['type'] = array(
'description' => __( 'Limit result set to items assigned a stock report type.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items assigned a stock report type.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array_merge( array( 'all', 'lowstock' ), array_keys( wc_get_product_stock_status_options() ) ), 'enum' => array_merge( array( 'all', 'lowstock' ), array_keys( wc_get_product_stock_status_options() ) ),
@ -541,10 +541,10 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'title' => __( 'Product / Variation', 'woocommerce-admin' ), 'title' => __( 'Product / Variation', 'woocommerce' ),
'sku' => __( 'SKU', 'woocommerce-admin' ), 'sku' => __( 'SKU', 'woocommerce' ),
'stock_status' => __( 'Status', 'woocommerce-admin' ), 'stock_status' => __( 'Status', 'woocommerce' ),
'stock_quantity' => __( 'Stock', 'woocommerce-admin' ), 'stock_quantity' => __( 'Stock', 'woocommerce' ),
); );
/** /**

View File

@ -83,13 +83,13 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_item_schema() { public function get_item_schema() {
$totals = array( $totals = array(
'products' => array( 'products' => array(
'description' => __( 'Number of products.', 'woocommerce-admin' ), 'description' => __( 'Number of products.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'lowstock' => array( 'lowstock' => array(
'description' => __( 'Number of low stock products.', 'woocommerce-admin' ), 'description' => __( 'Number of low stock products.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -100,7 +100,7 @@ class Controller extends \WC_REST_Reports_Controller {
foreach ( $status_options as $status => $label ) { foreach ( $status_options as $status => $label ) {
$totals[ $status ] = array( $totals[ $status ] = array(
/* translators: Stock status. Example: "Number of low stock products */ /* translators: Stock status. Example: "Number of low stock products */
'description' => sprintf( __( 'Number of %s products.', 'woocommerce-admin' ), $label ), 'description' => sprintf( __( 'Number of %s products.', 'woocommerce' ), $label ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -113,7 +113,7 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,

View File

@ -155,61 +155,61 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'tax_rate_id' => array( 'tax_rate_id' => array(
'description' => __( 'Tax rate ID.', 'woocommerce-admin' ), 'description' => __( 'Tax rate ID.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'name' => array( 'name' => array(
'description' => __( 'Tax rate name.', 'woocommerce-admin' ), 'description' => __( 'Tax rate name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'tax_rate' => array( 'tax_rate' => array(
'description' => __( 'Tax rate.', 'woocommerce-admin' ), 'description' => __( 'Tax rate.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'country' => array( 'country' => array(
'description' => __( 'Country / Region.', 'woocommerce-admin' ), 'description' => __( 'Country / Region.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'state' => array( 'state' => array(
'description' => __( 'State.', 'woocommerce-admin' ), 'description' => __( 'State.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'priority' => array( 'priority' => array(
'description' => __( 'Priority.', 'woocommerce-admin' ), 'description' => __( 'Priority.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'total_tax' => array( 'total_tax' => array(
'description' => __( 'Total tax.', 'woocommerce-admin' ), 'description' => __( 'Total tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'order_tax' => array( 'order_tax' => array(
'description' => __( 'Order tax.', 'woocommerce-admin' ), 'description' => __( 'Order tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'shipping_tax' => array( 'shipping_tax' => array(
'description' => __( 'Shipping tax.', 'woocommerce-admin' ), 'description' => __( 'Shipping tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -229,7 +229,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -237,7 +237,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -246,26 +246,26 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'tax_rate_id', 'default' => 'tax_rate_id',
'enum' => array( 'enum' => array(
@ -281,7 +281,7 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['taxes'] = array( $params['taxes'] = array(
'description' => __( 'Limit result set to items assigned one or more tax rates.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items assigned one or more tax rates.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -300,12 +300,12 @@ class Controller extends \WC_REST_Reports_Controller implements ExportableInterf
*/ */
public function get_export_columns() { public function get_export_columns() {
return array( return array(
'tax_code' => __( 'Tax code', 'woocommerce-admin' ), 'tax_code' => __( 'Tax code', 'woocommerce' ),
'rate' => __( 'Rate', 'woocommerce-admin' ), 'rate' => __( 'Rate', 'woocommerce' ),
'total_tax' => __( 'Total tax', 'woocommerce-admin' ), 'total_tax' => __( 'Total tax', 'woocommerce' ),
'order_tax' => __( 'Order tax', 'woocommerce-admin' ), 'order_tax' => __( 'Order tax', 'woocommerce' ),
'shipping_tax' => __( 'Shipping tax', 'woocommerce-admin' ), 'shipping_tax' => __( 'Shipping tax', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
); );
} }

View File

@ -166,7 +166,7 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_item_schema() { public function get_item_schema() {
$data_values = array( $data_values = array(
'total_tax' => array( 'total_tax' => array(
'description' => __( 'Total tax.', 'woocommerce-admin' ), 'description' => __( 'Total tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -174,7 +174,7 @@ class Controller extends \WC_REST_Reports_Controller {
'format' => 'currency', 'format' => 'currency',
), ),
'order_tax' => array( 'order_tax' => array(
'description' => __( 'Order tax.', 'woocommerce-admin' ), 'description' => __( 'Order tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -182,7 +182,7 @@ class Controller extends \WC_REST_Reports_Controller {
'format' => 'currency', 'format' => 'currency',
), ),
'shipping_tax' => array( 'shipping_tax' => array(
'description' => __( 'Shipping tax.', 'woocommerce-admin' ), 'description' => __( 'Shipping tax.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -190,13 +190,13 @@ class Controller extends \WC_REST_Reports_Controller {
'format' => 'currency', 'format' => 'currency',
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'tax_codes' => array( 'tax_codes' => array(
'description' => __( 'Amount of tax codes.', 'woocommerce-admin' ), 'description' => __( 'Amount of tax codes.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -205,7 +205,7 @@ class Controller extends \WC_REST_Reports_Controller {
$segments = array( $segments = array(
'segments' => array( 'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -213,13 +213,13 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'segment_id' => array( 'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce-admin' ), 'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -238,14 +238,14 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -253,38 +253,38 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -308,7 +308,7 @@ class Controller extends \WC_REST_Reports_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -316,7 +316,7 @@ class Controller extends \WC_REST_Reports_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -325,26 +325,26 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -357,7 +357,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -371,7 +371,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['taxes'] = array( $params['taxes'] = array(
'description' => __( 'Limit result set to all items that have the specified term assigned in the taxes taxonomy.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to all items that have the specified term assigned in the taxes taxonomy.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -380,7 +380,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['segmentby'] = array( $params['segmentby'] = array(
'description' => __( 'Segment the response by additional constraint.', 'woocommerce-admin' ), 'description' => __( 'Segment the response by additional constraint.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'tax_rate_id', 'tax_rate_id',
@ -388,7 +388,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -192,7 +192,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
); // WPCS: cache ok, DB call ok, unprepared SQL ok. ); // WPCS: cache ok, DB call ok, unprepared SQL ok.
if ( null === $totals ) { if ( null === $totals ) {
return new \WP_Error( 'woocommerce_analytics_taxes_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_taxes_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
// @todo remove these assignements when refactoring segmenter classes to use query objects. // @todo remove these assignements when refactoring segmenter classes to use query objects.
@ -226,7 +226,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
); // WPCS: cache ok, DB call ok, unprepared SQL ok. ); // WPCS: cache ok, DB call ok, unprepared SQL ok.
if ( null === $intervals ) { if ( null === $intervals ) {
return new \WP_Error( 'woocommerce_analytics_taxes_stats_result_failed', __( 'Sorry, fetching tax data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_taxes_stats_result_failed', __( 'Sorry, fetching tax data failed.', 'woocommerce' ) );
} }
$totals = (object) $this->cast_numbers( $totals[0] ); $totals = (object) $this->cast_numbers( $totals[0] );

View File

@ -573,7 +573,7 @@ class TimeInterval {
return new \WP_Error( return new \WP_Error(
'rest_invalid_param', 'rest_invalid_param',
/* translators: 1: parameter name */ /* translators: 1: parameter name */
sprintf( __( '%1$s is not a numerically indexed array.', 'woocommerce-admin' ), $param ) sprintf( __( '%1$s is not a numerically indexed array.', 'woocommerce' ), $param )
); );
} }
@ -585,7 +585,7 @@ class TimeInterval {
return new \WP_Error( return new \WP_Error(
'rest_invalid_param', 'rest_invalid_param',
/* translators: %s: parameter name */ /* translators: %s: parameter name */
sprintf( __( '%s must contain 2 numbers.', 'woocommerce-admin' ), $param ) sprintf( __( '%s must contain 2 numbers.', 'woocommerce' ), $param )
); );
} }
@ -605,7 +605,7 @@ class TimeInterval {
return new \WP_Error( return new \WP_Error(
'rest_invalid_param', 'rest_invalid_param',
/* translators: 1: parameter name */ /* translators: 1: parameter name */
sprintf( __( '%1$s is not a numerically indexed array.', 'woocommerce-admin' ), $param ) sprintf( __( '%1$s is not a numerically indexed array.', 'woocommerce' ), $param )
); );
} }
@ -617,7 +617,7 @@ class TimeInterval {
return new \WP_Error( return new \WP_Error(
'rest_invalid_param', 'rest_invalid_param',
/* translators: %s: parameter name */ /* translators: %s: parameter name */
sprintf( __( '%s must contain 2 valid dates.', 'woocommerce-admin' ), $param ) sprintf( __( '%s must contain 2 valid dates.', 'woocommerce' ), $param )
); );
} }

View File

@ -177,80 +177,80 @@ class Controller extends ReportsController implements ExportableInterface {
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product ID.', 'woocommerce-admin' ), 'description' => __( 'Product ID.', 'woocommerce' ),
), ),
'variation_id' => array( 'variation_id' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product ID.', 'woocommerce-admin' ), 'description' => __( 'Product ID.', 'woocommerce' ),
), ),
'items_sold' => array( 'items_sold' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Number of items sold.', 'woocommerce-admin' ), 'description' => __( 'Number of items sold.', 'woocommerce' ),
), ),
'net_revenue' => array( 'net_revenue' => array(
'type' => 'number', 'type' => 'number',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Total Net sales of all items sold.', 'woocommerce-admin' ), 'description' => __( 'Total Net sales of all items sold.', 'woocommerce' ),
), ),
'orders_count' => array( 'orders_count' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Number of orders product appeared in.', 'woocommerce-admin' ), 'description' => __( 'Number of orders product appeared in.', 'woocommerce' ),
), ),
'extended_info' => array( 'extended_info' => array(
'name' => array( 'name' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product name.', 'woocommerce-admin' ), 'description' => __( 'Product name.', 'woocommerce' ),
), ),
'price' => array( 'price' => array(
'type' => 'number', 'type' => 'number',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product price.', 'woocommerce-admin' ), 'description' => __( 'Product price.', 'woocommerce' ),
), ),
'image' => array( 'image' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product image.', 'woocommerce-admin' ), 'description' => __( 'Product image.', 'woocommerce' ),
), ),
'permalink' => array( 'permalink' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product link.', 'woocommerce-admin' ), 'description' => __( 'Product link.', 'woocommerce' ),
), ),
'attributes' => array( 'attributes' => array(
'type' => 'array', 'type' => 'array',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product attributes.', 'woocommerce-admin' ), 'description' => __( 'Product attributes.', 'woocommerce' ),
), ),
'stock_status' => array( 'stock_status' => array(
'type' => 'string', 'type' => 'string',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product inventory status.', 'woocommerce-admin' ), 'description' => __( 'Product inventory status.', 'woocommerce' ),
), ),
'stock_quantity' => array( 'stock_quantity' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product inventory quantity.', 'woocommerce-admin' ), 'description' => __( 'Product inventory quantity.', 'woocommerce' ),
), ),
'low_stock_amount' => array( 'low_stock_amount' => array(
'type' => 'integer', 'type' => 'integer',
'readonly' => true, 'readonly' => true,
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'description' => __( 'Product inventory threshold for low stock.', 'woocommerce-admin' ), 'description' => __( 'Product inventory threshold for low stock.', 'woocommerce' ),
), ),
), ),
), ),
@ -268,7 +268,7 @@ class Controller extends ReportsController implements ExportableInterface {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -276,7 +276,7 @@ class Controller extends ReportsController implements ExportableInterface {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -285,19 +285,19 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -307,14 +307,14 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -327,7 +327,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_includes'] = array( $params['product_includes'] = array(
'description' => __( 'Limit result set to items that have the specified parent product(s).', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified parent product(s).', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -337,7 +337,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_excludes'] = array( $params['product_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified parent product(s).', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified parent product(s).', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -347,7 +347,7 @@ class Controller extends ReportsController implements ExportableInterface {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['variations'] = array( $params['variations'] = array(
'description' => __( 'Limit result to items with specified variation ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified variation ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -356,14 +356,14 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['extended_info'] = array( $params['extended_info'] = array(
'description' => __( 'Add additional piece of info about each variation to the report.', 'woocommerce-admin' ), 'description' => __( 'Add additional piece of info about each variation to the report.', 'woocommerce' ),
'type' => 'boolean', 'type' => 'boolean',
'default' => false, 'default' => false,
'sanitize_callback' => 'wc_string_to_bool', 'sanitize_callback' => 'wc_string_to_bool',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['attribute_is'] = array( $params['attribute_is'] = array(
'description' => __( 'Limit result set to variations that include the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to variations that include the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -372,7 +372,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['attribute_is_not'] = array( $params['attribute_is_not'] = array(
'description' => __( 'Limit result set to variations that don\'t include the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to variations that don\'t include the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -381,7 +381,7 @@ class Controller extends ReportsController implements ExportableInterface {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['category_includes'] = array( $params['category_includes'] = array(
'description' => __( 'Limit result set to variations in the specified categories.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to variations in the specified categories.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -390,7 +390,7 @@ class Controller extends ReportsController implements ExportableInterface {
), ),
); );
$params['category_excludes'] = array( $params['category_excludes'] = array(
'description' => __( 'Limit result set to variations not in the specified categories.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to variations not in the specified categories.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -421,16 +421,16 @@ class Controller extends ReportsController implements ExportableInterface {
*/ */
public function get_export_columns() { public function get_export_columns() {
$export_columns = array( $export_columns = array(
'product_name' => __( 'Product / Variation title', 'woocommerce-admin' ), 'product_name' => __( 'Product / Variation title', 'woocommerce' ),
'sku' => __( 'SKU', 'woocommerce-admin' ), 'sku' => __( 'SKU', 'woocommerce' ),
'items_sold' => __( 'Items sold', 'woocommerce-admin' ), 'items_sold' => __( 'Items sold', 'woocommerce' ),
'net_revenue' => __( 'N. Revenue', 'woocommerce-admin' ), 'net_revenue' => __( 'N. Revenue', 'woocommerce' ),
'orders_count' => __( 'Orders', 'woocommerce-admin' ), 'orders_count' => __( 'Orders', 'woocommerce' ),
); );
if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) { if ( 'yes' === get_option( 'woocommerce_manage_stock' ) ) {
$export_columns['stock_status'] = __( 'Status', 'woocommerce-admin' ); $export_columns['stock_status'] = __( 'Status', 'woocommerce' );
$export_columns['stock'] = __( 'Stock', 'woocommerce-admin' ); $export_columns['stock'] = __( 'Stock', 'woocommerce' );
} }
return $export_columns; return $export_columns;

View File

@ -161,22 +161,22 @@ class Controller extends \WC_REST_Reports_Controller {
public function get_item_schema() { public function get_item_schema() {
$data_values = array( $data_values = array(
'items_sold' => array( 'items_sold' => array(
'title' => __( 'Variations Sold', 'woocommerce-admin' ), 'title' => __( 'Variations Sold', 'woocommerce' ),
'description' => __( 'Number of variation items sold.', 'woocommerce-admin' ), 'description' => __( 'Number of variation items sold.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'indicator' => true, 'indicator' => true,
), ),
'net_revenue' => array( 'net_revenue' => array(
'description' => __( 'Net sales.', 'woocommerce-admin' ), 'description' => __( 'Net sales.', 'woocommerce' ),
'type' => 'number', 'type' => 'number',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'format' => 'currency', 'format' => 'currency',
), ),
'orders_count' => array( 'orders_count' => array(
'description' => __( 'Number of orders.', 'woocommerce-admin' ), 'description' => __( 'Number of orders.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -185,7 +185,7 @@ class Controller extends \WC_REST_Reports_Controller {
$segments = array( $segments = array(
'segments' => array( 'segments' => array(
'description' => __( 'Reports data grouped by segment condition.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by segment condition.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -193,20 +193,20 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'segment_id' => array( 'segment_id' => array(
'description' => __( 'Segment identificator.', 'woocommerce-admin' ), 'description' => __( 'Segment identificator.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'segment_label' => array( 'segment_label' => array(
'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce-admin' ), 'description' => __( 'Human readable segment label, either product or variation name.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -225,14 +225,14 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'totals' => array( 'totals' => array(
'description' => __( 'Totals data.', 'woocommerce-admin' ), 'description' => __( 'Totals data.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'properties' => $totals, 'properties' => $totals,
), ),
'intervals' => array( 'intervals' => array(
'description' => __( 'Reports data grouped by intervals.', 'woocommerce-admin' ), 'description' => __( 'Reports data grouped by intervals.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -240,38 +240,38 @@ class Controller extends \WC_REST_Reports_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'interval' => array( 'interval' => array(
'description' => __( 'Type of interval.', 'woocommerce-admin' ), 'description' => __( 'Type of interval.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
'enum' => array( 'day', 'week', 'month', 'year' ), 'enum' => array( 'day', 'week', 'month', 'year' ),
), ),
'date_start' => array( 'date_start' => array(
'description' => __( "The date the report start, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report start, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_start_gmt' => array( 'date_start_gmt' => array(
'description' => __( 'The date the report start, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report start, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end' => array( 'date_end' => array(
'description' => __( "The date the report end, in the site's timezone.", 'woocommerce-admin' ), 'description' => __( "The date the report end, in the site's timezone.", 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'date_end_gmt' => array( 'date_end_gmt' => array(
'description' => __( 'The date the report end, as GMT.', 'woocommerce-admin' ), 'description' => __( 'The date the report end, as GMT.', 'woocommerce' ),
'type' => 'date-time', 'type' => 'date-time',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'subtotals' => array( 'subtotals' => array(
'description' => __( 'Interval subtotals.', 'woocommerce-admin' ), 'description' => __( 'Interval subtotals.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -316,7 +316,7 @@ class Controller extends \WC_REST_Reports_Controller {
$params = array(); $params = array();
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['page'] = array( $params['page'] = array(
'description' => __( 'Current page of the collection.', 'woocommerce-admin' ), 'description' => __( 'Current page of the collection.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 1, 'default' => 1,
'sanitize_callback' => 'absint', 'sanitize_callback' => 'absint',
@ -324,7 +324,7 @@ class Controller extends \WC_REST_Reports_Controller {
'minimum' => 1, 'minimum' => 1,
); );
$params['per_page'] = array( $params['per_page'] = array(
'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce-admin' ), 'description' => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
'type' => 'integer', 'type' => 'integer',
'default' => 10, 'default' => 10,
'minimum' => 1, 'minimum' => 1,
@ -333,19 +333,19 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['after'] = array( $params['after'] = array(
'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['before'] = array( $params['before'] = array(
'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce-admin' ), 'description' => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'format' => 'date-time', 'format' => 'date-time',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['match'] = array( $params['match'] = array(
'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce-admin' ), 'description' => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'all', 'default' => 'all',
'enum' => array( 'enum' => array(
@ -355,14 +355,14 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['order'] = array( $params['order'] = array(
'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce-admin' ), 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'desc', 'default' => 'desc',
'enum' => array( 'asc', 'desc' ), 'enum' => array( 'asc', 'desc' ),
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['orderby'] = array( $params['orderby'] = array(
'description' => __( 'Sort collection by object attribute.', 'woocommerce-admin' ), 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'date', 'default' => 'date',
'enum' => array( 'enum' => array(
@ -379,7 +379,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['interval'] = array( $params['interval'] = array(
'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce-admin' ), 'description' => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'default' => 'week', 'default' => 'week',
'enum' => array( 'enum' => array(
@ -393,7 +393,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['category_includes'] = array( $params['category_includes'] = array(
'description' => __( 'Limit result to items from the specified categories.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items from the specified categories.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -402,7 +402,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['category_excludes'] = array( $params['category_excludes'] = array(
'description' => __( 'Limit result set to variations not in the specified categories.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to variations not in the specified categories.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -411,7 +411,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['product_includes'] = array( $params['product_includes'] = array(
'description' => __( 'Limit result set to items that have the specified parent product(s).', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified parent product(s).', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -421,7 +421,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['product_excludes'] = array( $params['product_excludes'] = array(
'description' => __( 'Limit result set to items that don\'t have the specified parent product(s).', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that don\'t have the specified parent product(s).', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',
@ -431,7 +431,7 @@ class Controller extends \WC_REST_Reports_Controller {
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
); );
$params['variations'] = array( $params['variations'] = array(
'description' => __( 'Limit result to items with specified variation ids.', 'woocommerce-admin' ), 'description' => __( 'Limit result to items with specified variation ids.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_id_list', 'sanitize_callback' => 'wp_parse_id_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -440,7 +440,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['segmentby'] = array( $params['segmentby'] = array(
'description' => __( 'Segment the response by additional constraint.', 'woocommerce-admin' ), 'description' => __( 'Segment the response by additional constraint.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'enum' => array( 'enum' => array(
'product', 'product',
@ -450,7 +450,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['fields'] = array( $params['fields'] = array(
'description' => __( 'Limit stats fields to the specified items.', 'woocommerce-admin' ), 'description' => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'sanitize_callback' => 'wp_parse_slug_list', 'sanitize_callback' => 'wp_parse_slug_list',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
@ -459,7 +459,7 @@ class Controller extends \WC_REST_Reports_Controller {
), ),
); );
$params['attribute_is'] = array( $params['attribute_is'] = array(
'description' => __( 'Limit result set to orders that include products with the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that include products with the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',
@ -468,7 +468,7 @@ class Controller extends \WC_REST_Reports_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['attribute_is_not'] = array( $params['attribute_is_not'] = array(
'description' => __( 'Limit result set to orders that don\'t include products with the specified attributes.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to orders that don\'t include products with the specified attributes.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'array', 'type' => 'array',

View File

@ -221,7 +221,7 @@ class DataStore extends VariationsDataStore implements DataStoreInterface {
$totals[0]['segments'] = $segmenter->get_totals_segments( $totals_query, $table_name ); $totals[0]['segments'] = $segmenter->get_totals_segments( $totals_query, $table_name );
if ( null === $totals ) { if ( null === $totals ) {
return new \WP_Error( 'woocommerce_analytics_variations_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_variations_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
$this->interval_query->add_sql_clause( 'order_by', $this->get_sql_clause( 'order_by' ) ); $this->interval_query->add_sql_clause( 'order_by', $this->get_sql_clause( 'order_by' ) );
@ -239,7 +239,7 @@ class DataStore extends VariationsDataStore implements DataStoreInterface {
/* phpcs:enable */ /* phpcs:enable */
if ( null === $intervals ) { if ( null === $intervals ) {
return new \WP_Error( 'woocommerce_analytics_variations_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_analytics_variations_stats_result_failed', __( 'Sorry, fetching revenue data failed.', 'woocommerce' ) );
} }
$totals = (object) $this->cast_numbers( $totals[0] ); $totals = (object) $this->cast_numbers( $totals[0] );

View File

@ -32,12 +32,12 @@ class Taxes extends \WC_REST_Taxes_Controller {
public function get_collection_params() { public function get_collection_params() {
$params = parent::get_collection_params(); $params = parent::get_collection_params();
$params['search'] = array( $params['search'] = array(
'description' => __( 'Search by similar tax code.', 'woocommerce-admin' ), 'description' => __( 'Search by similar tax code.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['include'] = array( $params['include'] = array(
'description' => __( 'Limit result set to items that have the specified rate ID(s) assigned.', 'woocommerce-admin' ), 'description' => __( 'Limit result set to items that have the specified rate ID(s) assigned.', 'woocommerce' ),
'type' => 'array', 'type' => 'array',
'items' => array( 'items' => array(
'type' => 'integer', 'type' => 'integer',

View File

@ -60,7 +60,7 @@ class Themes extends \WC_REST_Data_Controller {
*/ */
public function upload_theme_permissions_check( $request ) { public function upload_theme_permissions_check( $request ) {
if ( ! current_user_can( 'upload_themes' ) ) { if ( ! current_user_can( 'upload_themes' ) ) {
return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you are not allowed to install themes on this site.', 'woocommerce-admin' ), array( 'status' => rest_authorization_required_code() ) ); return new \WP_Error( 'woocommerce_rest_cannot_view', __( 'Sorry, you are not allowed to install themes on this site.', 'woocommerce' ), array( 'status' => rest_authorization_required_code() ) );
} }
return true; return true;
@ -75,7 +75,7 @@ class Themes extends \WC_REST_Data_Controller {
public function upload_theme( $request ) { public function upload_theme( $request ) {
if ( if (
! isset( $_FILES['pluginzip'] ) || ! isset( $_FILES['pluginzip']['tmp_name'] ) || ! is_uploaded_file( $_FILES['pluginzip']['tmp_name'] ) || ! is_file( $_FILES['pluginzip']['tmp_name'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized ! isset( $_FILES['pluginzip'] ) || ! isset( $_FILES['pluginzip']['tmp_name'] ) || ! is_uploaded_file( $_FILES['pluginzip']['tmp_name'] ) || ! is_file( $_FILES['pluginzip']['tmp_name'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
return new \WP_Error( 'woocommerce_rest_invalid_file', __( 'Specified file failed upload test.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_rest_invalid_file', __( 'Specified file failed upload test.', 'woocommerce' ) );
} }
include_once ABSPATH . 'wp-admin/includes/file.php'; include_once ABSPATH . 'wp-admin/includes/file.php';
@ -163,19 +163,19 @@ class Themes extends \WC_REST_Data_Controller {
'type' => 'object', 'type' => 'object',
'properties' => array( 'properties' => array(
'status' => array( 'status' => array(
'description' => __( 'Theme installation status.', 'woocommerce-admin' ), 'description' => __( 'Theme installation status.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'message' => array( 'message' => array(
'description' => __( 'Theme installation message.', 'woocommerce-admin' ), 'description' => __( 'Theme installation message.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
), ),
'theme' => array( 'theme' => array(
'description' => __( 'Uploaded theme.', 'woocommerce-admin' ), 'description' => __( 'Uploaded theme.', 'woocommerce' ),
'type' => 'object', 'type' => 'object',
'context' => array( 'view', 'edit' ), 'context' => array( 'view', 'edit' ),
'readonly' => true, 'readonly' => true,
@ -194,7 +194,7 @@ class Themes extends \WC_REST_Data_Controller {
public function get_collection_params() { public function get_collection_params() {
$params['context'] = $this->get_context_param( array( 'default' => 'view' ) ); $params['context'] = $this->get_context_param( array( 'default' => 'view' ) );
$params['pluginzip'] = array( $params['pluginzip'] = array(
'description' => __( 'A zip file of the theme to be uploaded.', 'woocommerce-admin' ), 'description' => __( 'A zip file of the theme to be uploaded.', 'woocommerce' ),
'type' => 'file', 'type' => 'file',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );

View File

@ -261,7 +261,7 @@ class Features {
return $sections; return $sections;
} }
$sections['features'] = __( 'Features', 'woocommerce-admin' ); $sections['features'] = __( 'Features', 'woocommerce' );
return $sections; return $sections;
} }
@ -288,8 +288,8 @@ class Features {
return $settings; return $settings;
} }
$desc = __( 'Start using new features that are being progressively rolled out to improve the store management experience.', 'woocommerce-admin' ); $desc = __( 'Start using new features that are being progressively rolled out to improve the store management experience.', 'woocommerce' );
$disabled_desc = __( 'WooCommerce features have been disabled.', 'woocommerce-admin' ); $disabled_desc = __( 'WooCommerce features have been disabled.', 'woocommerce' );
if ( $features_disabled ) { if ( $features_disabled ) {
$GLOBALS['hide_save_button'] = true; $GLOBALS['hide_save_button'] = true;
@ -298,7 +298,7 @@ class Features {
return array_merge( return array_merge(
array( array(
array( array(
'title' => __( 'Features', 'woocommerce-admin' ), 'title' => __( 'Features', 'woocommerce' ),
'type' => 'title', 'type' => 'title',
'desc' => $features_disabled ? $disabled_desc : $desc, 'desc' => $features_disabled ? $disabled_desc : $desc,
'id' => 'features_options', 'id' => 'features_options',

View File

@ -92,43 +92,43 @@ class CoreMenu {
$analytics_enabled = Features::is_enabled( 'analytics' ); $analytics_enabled = Features::is_enabled( 'analytics' );
return array( return array(
array( array(
'title' => __( 'Orders', 'woocommerce-admin' ), 'title' => __( 'Orders', 'woocommerce' ),
'id' => 'woocommerce-orders', 'id' => 'woocommerce-orders',
'badge' => self::get_shop_order_count(), 'badge' => self::get_shop_order_count(),
'order' => 10, 'order' => 10,
), ),
array( array(
'title' => __( 'Products', 'woocommerce-admin' ), 'title' => __( 'Products', 'woocommerce' ),
'id' => 'woocommerce-products', 'id' => 'woocommerce-products',
'order' => 20, 'order' => 20,
), ),
$analytics_enabled ? $analytics_enabled ?
array( array(
'title' => __( 'Analytics', 'woocommerce-admin' ), 'title' => __( 'Analytics', 'woocommerce' ),
'id' => 'woocommerce-analytics', 'id' => 'woocommerce-analytics',
'order' => 30, 'order' => 30,
) : null, ) : null,
$analytics_enabled ? $analytics_enabled ?
array( array(
'title' => __( 'Reports', 'woocommerce-admin' ), 'title' => __( 'Reports', 'woocommerce' ),
'id' => 'woocommerce-reports', 'id' => 'woocommerce-reports',
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'order' => 200, 'order' => 200,
) : null, ) : null,
array( array(
'title' => __( 'Marketing', 'woocommerce-admin' ), 'title' => __( 'Marketing', 'woocommerce' ),
'id' => 'woocommerce-marketing', 'id' => 'woocommerce-marketing',
'order' => 40, 'order' => 40,
), ),
array( array(
'title' => __( 'Settings', 'woocommerce-admin' ), 'title' => __( 'Settings', 'woocommerce' ),
'id' => 'woocommerce-settings', 'id' => 'woocommerce-settings',
'menuId' => 'secondary', 'menuId' => 'secondary',
'order' => 20, 'order' => 20,
'url' => 'admin.php?page=wc-settings', 'url' => 'admin.php?page=wc-settings',
), ),
array( array(
'title' => __( 'Tools', 'woocommerce-admin' ), 'title' => __( 'Tools', 'woocommerce' ),
'id' => 'woocommerce-tools', 'id' => 'woocommerce-tools',
'menuId' => 'secondary', 'menuId' => 'secondary',
'order' => 30, 'order' => 30,
@ -192,7 +192,7 @@ class CoreMenu {
if ( defined( '\Automattic\WooCommerce\Internal\Admin\Homescreen::MENU_SLUG' ) ) { if ( defined( '\Automattic\WooCommerce\Internal\Admin\Homescreen::MENU_SLUG' ) ) {
$home_item = array( $home_item = array(
'id' => 'woocommerce-home', 'id' => 'woocommerce-home',
'title' => __( 'Home', 'woocommerce-admin' ), 'title' => __( 'Home', 'woocommerce' ),
'url' => \Automattic\WooCommerce\Internal\Admin\Homescreen::MENU_SLUG, 'url' => \Automattic\WooCommerce\Internal\Admin\Homescreen::MENU_SLUG,
'order' => 0, 'order' => 0,
'matchExpression' => 'page=wc-admin((?!path=).)*$', 'matchExpression' => 'page=wc-admin((?!path=).)*$',
@ -203,7 +203,7 @@ class CoreMenu {
if ( Features::is_enabled( 'analytics' ) ) { if ( Features::is_enabled( 'analytics' ) ) {
$customers_item = array( $customers_item = array(
'id' => 'woocommerce-analytics-customers', 'id' => 'woocommerce-analytics-customers',
'title' => __( 'Customers', 'woocommerce-admin' ), 'title' => __( 'Customers', 'woocommerce' ),
'url' => 'wc-admin&path=/customers', 'url' => 'wc-admin&path=/customers',
'order' => 50, 'order' => 50,
); );
@ -220,7 +220,7 @@ class CoreMenu {
$product_tag_items['default'], $product_tag_items['default'],
array( array(
'id' => 'woocommerce-product-attributes', 'id' => 'woocommerce-product-attributes',
'title' => __( 'Attributes', 'woocommerce-admin' ), 'title' => __( 'Attributes', 'woocommerce' ),
'url' => 'edit.php?post_type=product&page=product_attributes', 'url' => 'edit.php?post_type=product&page=product_attributes',
'capability' => 'manage_product_terms', 'capability' => 'manage_product_terms',
'order' => 40, 'order' => 40,
@ -231,7 +231,7 @@ class CoreMenu {
$coupon_items['default'], $coupon_items['default'],
// Marketplace category. // Marketplace category.
array( array(
'title' => __( 'Marketplace', 'woocommerce-admin' ), 'title' => __( 'Marketplace', 'woocommerce' ),
'capability' => 'manage_woocommerce', 'capability' => 'manage_woocommerce',
'id' => 'woocommerce-marketplace', 'id' => 'woocommerce-marketplace',
'url' => 'wc-addons', 'url' => 'wc-addons',
@ -257,9 +257,9 @@ class CoreMenu {
*/ */
public static function get_tool_items() { public static function get_tool_items() {
$tabs = array( $tabs = array(
'status' => __( 'System status', 'woocommerce-admin' ), 'status' => __( 'System status', 'woocommerce' ),
'tools' => __( 'Utilities', 'woocommerce-admin' ), 'tools' => __( 'Utilities', 'woocommerce' ),
'logs' => __( 'Logs', 'woocommerce-admin' ), 'logs' => __( 'Logs', 'woocommerce' ),
); );
$tabs = apply_filters( 'woocommerce_admin_status_tabs', $tabs ); $tabs = apply_filters( 'woocommerce_admin_status_tabs', $tabs );
@ -267,7 +267,7 @@ class CoreMenu {
$items = array( $items = array(
array( array(
'parent' => 'woocommerce-tools', 'parent' => 'woocommerce-tools',
'title' => __( 'Import / Export', 'woocommerce-admin' ), 'title' => __( 'Import / Export', 'woocommerce' ),
'capability' => 'import', 'capability' => 'import',
'id' => 'tools-import-export', 'id' => 'tools-import-export',
'url' => 'import.php', 'url' => 'import.php',

View File

@ -55,7 +55,7 @@ class Favorites {
if ( in_array( $item_id, $all_favorites, true ) ) { if ( in_array( $item_id, $all_favorites, true ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_favorites_already_exists', 'woocommerce_favorites_already_exists',
__( 'Favorite already exists', 'woocommerce-admin' ) __( 'Favorite already exists', 'woocommerce' )
); );
} }
@ -79,7 +79,7 @@ class Favorites {
if ( ! in_array( $item_id, $all_favorites, true ) ) { if ( ! in_array( $item_id, $all_favorites, true ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_favorites_does_not_exist', 'woocommerce_favorites_does_not_exist',
__( 'Favorite item not found', 'woocommerce-admin' ) __( 'Favorite item not found', 'woocommerce' )
); );
} }

View File

@ -47,14 +47,14 @@ class Init {
public static function add_feature_toggle( $features ) { public static function add_feature_toggle( $features ) {
$description = __( $description = __(
'Adds the new WooCommerce navigation experience to the dashboard', 'Adds the new WooCommerce navigation experience to the dashboard',
'woocommerce-admin' 'woocommerce'
); );
$update_text = ''; $update_text = '';
$needs_update = version_compare( get_bloginfo( 'version' ), '5.6', '<' ); $needs_update = version_compare( get_bloginfo( 'version' ), '5.6', '<' );
if ( $needs_update && current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { if ( $needs_update && current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
$update_text = sprintf( $update_text = sprintf(
/* translators: 1: line break tag, 2: open link to WordPress update link, 3: close link tag. */ /* translators: 1: line break tag, 2: open link to WordPress update link, 3: close link tag. */
__( '%1$s %2$sUpdate WordPress to enable the new navigation%3$s', 'woocommerce-admin' ), __( '%1$s %2$sUpdate WordPress to enable the new navigation%3$s', 'woocommerce' ),
'<br/>', '<br/>',
'<a href="' . self_admin_url( 'update-core.php' ) . '" target="_blank">', '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_blank">',
'</a>' '</a>'
@ -62,7 +62,7 @@ class Init {
} }
$features[] = array( $features[] = array(
'title' => __( 'Navigation', 'woocommerce-admin' ), 'title' => __( 'Navigation', 'woocommerce' ),
'desc' => $description . $update_text, 'desc' => $description . $update_text,
'id' => self::TOGGLE_OPTION_NAME, 'id' => self::TOGGLE_OPTION_NAME,
'type' => 'checkbox', 'type' => 'checkbox',

View File

@ -188,7 +188,7 @@ class Menu {
$menu_item['parent'] = 'woocommerce'; $menu_item['parent'] = 'woocommerce';
$menu_item['backButtonLabel'] = __( $menu_item['backButtonLabel'] = __(
'WooCommerce Home', 'WooCommerce Home',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -226,7 +226,7 @@ class Menu {
error_log( // phpcs:ignore error_log( // phpcs:ignore
sprintf( sprintf(
/* translators: 1: Duplicate menu item path. */ /* translators: 1: Duplicate menu item path. */
esc_html__( 'You have attempted to register a duplicate item with WooCommerce Navigation: %1$s', 'woocommerce-admin' ), esc_html__( 'You have attempted to register a duplicate item with WooCommerce Navigation: %1$s', 'woocommerce' ),
'`' . $args['id'] . '`' '`' . $args['id'] . '`'
) )
); );
@ -371,7 +371,7 @@ class Menu {
error_log( // phpcs:ignore error_log( // phpcs:ignore
sprintf( sprintf(
/* translators: 1: Duplicate menu item path. */ /* translators: 1: Duplicate menu item path. */
esc_html__( 'The item ID %1$s attempted to register using an invalid option. The arguments `menuId` and `parent` are not allowed for add_setting_item()', 'woocommerce-admin' ), esc_html__( 'The item ID %1$s attempted to register using an invalid option. The arguments `menuId` and `parent` are not allowed for add_setting_item()', 'woocommerce' ),
'`' . $args['id'] . '`' '`' . $args['id'] . '`'
) )
); );

View File

@ -190,7 +190,7 @@ abstract class Task {
* @return string * @return string
*/ */
public function get_action_label() { public function get_action_label() {
return __( "Let's go", 'woocommerce-admin' ); return __( "Let's go", 'woocommerce' );
} }
/** /**

View File

@ -236,7 +236,7 @@ class TaskList {
if ( ! is_subclass_of( $task, 'Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task' ) ) { if ( ! is_subclass_of( $task, 'Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task' ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_task_list_invalid_task', 'woocommerce_task_list_invalid_task',
__( 'Task is not a subclass of `Task`', 'woocommerce-admin' ) __( 'Task is not a subclass of `Task`', 'woocommerce' )
); );
} }
if ( array_search( $task, $this->tasks, true ) ) { if ( array_search( $task, $this->tasks, true ) ) {

View File

@ -79,7 +79,7 @@ class TaskLists {
self::add_list( self::add_list(
array( array(
'id' => 'setup', 'id' => 'setup',
'title' => __( 'Get ready to start selling', 'woocommerce-admin' ), 'title' => __( 'Get ready to start selling', 'woocommerce' ),
'tasks' => array( 'tasks' => array(
'StoreDetails', 'StoreDetails',
'Purchase', 'Purchase',
@ -100,7 +100,7 @@ class TaskLists {
array( array(
'id' => 'setup_experiment_1', 'id' => 'setup_experiment_1',
'hidden_id' => 'setup', 'hidden_id' => 'setup',
'title' => __( 'Get ready to start selling', 'woocommerce-admin' ), 'title' => __( 'Get ready to start selling', 'woocommerce' ),
'tasks' => array( 'tasks' => array(
'StoreDetails', 'StoreDetails',
'Products', 'Products',
@ -123,7 +123,7 @@ class TaskLists {
self::add_list( self::add_list(
array( array(
'id' => 'extended', 'id' => 'extended',
'title' => __( 'Things to do next', 'woocommerce-admin' ), 'title' => __( 'Things to do next', 'woocommerce' ),
'sort_by' => array( 'sort_by' => array(
array( array(
'key' => 'is_complete', 'key' => 'is_complete',
@ -143,7 +143,7 @@ class TaskLists {
array( array(
'id' => 'setup_two_column', 'id' => 'setup_two_column',
'hidden_id' => 'setup', 'hidden_id' => 'setup',
'title' => __( 'Get ready to start selling', 'woocommerce-admin' ), 'title' => __( 'Get ready to start selling', 'woocommerce' ),
'tasks' => array( 'tasks' => array(
'Products', 'Products',
'WooCommercePayments', 'WooCommercePayments',
@ -160,7 +160,7 @@ class TaskLists {
array( array(
'id' => 'extended_two_column', 'id' => 'extended_two_column',
'hidden_id' => 'extended', 'hidden_id' => 'extended',
'title' => __( 'Things to do next', 'woocommerce-admin' ), 'title' => __( 'Things to do next', 'woocommerce' ),
'sort_by' => array( 'sort_by' => array(
array( array(
'key' => 'is_complete', 'key' => 'is_complete',
@ -227,7 +227,7 @@ class TaskLists {
if ( isset( self::$lists[ $args['id'] ] ) ) { if ( isset( self::$lists[ $args['id'] ] ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_task_list_exists', 'woocommerce_task_list_exists',
__( 'Task list ID already exists', 'woocommerce-admin' ) __( 'Task list ID already exists', 'woocommerce' )
); );
} }
@ -246,7 +246,7 @@ class TaskLists {
if ( ! isset( self::$lists[ $list_id ] ) ) { if ( ! isset( self::$lists[ $list_id ] ) ) {
return new \WP_Error( return new \WP_Error(
'woocommerce_task_list_invalid_list', 'woocommerce_task_list_invalid_list',
__( 'Task list ID does not exist', 'woocommerce-admin' ) __( 'Task list ID does not exist', 'woocommerce' )
); );
} }

View File

@ -27,7 +27,7 @@ class AdditionalPayments extends Payments {
* @return string * @return string
*/ */
public function get_title() { public function get_title() {
return __( 'Set up additional payment providers', 'woocommerce-admin' ); return __( 'Set up additional payment providers', 'woocommerce' );
} }
/** /**
@ -38,7 +38,7 @@ class AdditionalPayments extends Payments {
public function get_content() { public function get_content() {
return __( return __(
'Choose payment providers and enable payment methods at checkout.', 'Choose payment providers and enable payment methods at checkout.',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -48,7 +48,7 @@ class AdditionalPayments extends Payments {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '2 minutes', 'woocommerce-admin' ); return __( '2 minutes', 'woocommerce' );
} }
/** /**

View File

@ -41,11 +41,11 @@ class Appearance extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You personalized your store', 'woocommerce-admin' ); return __( 'You personalized your store', 'woocommerce' );
} }
return __( 'Personalize your store', 'woocommerce-admin' ); return __( 'Personalize your store', 'woocommerce' );
} }
return __( 'Personalize my store', 'woocommerce-admin' ); return __( 'Personalize my store', 'woocommerce' );
} }
/** /**
@ -56,7 +56,7 @@ class Appearance extends Task {
public function get_content() { public function get_content() {
return __( return __(
'Add your logo, create a homepage, and start designing your store.', 'Add your logo, create a homepage, and start designing your store.',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -66,7 +66,7 @@ class Appearance extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '2 minutes', 'woocommerce-admin' ); return __( '2 minutes', 'woocommerce' );
} }
/** /**

View File

@ -27,11 +27,11 @@ class Marketing extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You added sales channels', 'woocommerce-admin' ); return __( 'You added sales channels', 'woocommerce' );
} }
return __( 'Get more sales', 'woocommerce-admin' ); return __( 'Get more sales', 'woocommerce' );
} }
return __( 'Set up marketing tools', 'woocommerce-admin' ); return __( 'Set up marketing tools', 'woocommerce' );
} }
/** /**
@ -42,7 +42,7 @@ class Marketing extends Task {
public function get_content() { public function get_content() {
return __( return __(
'Add recommended marketing tools to reach new customers and grow your business', 'Add recommended marketing tools to reach new customers and grow your business',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -52,7 +52,7 @@ class Marketing extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '1 minute', 'woocommerce-admin' ); return __( '1 minute', 'woocommerce' );
} }
/** /**

View File

@ -27,11 +27,11 @@ class Payments extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You set up payments', 'woocommerce-admin' ); return __( 'You set up payments', 'woocommerce' );
} }
return __( 'Set up payments', 'woocommerce-admin' ); return __( 'Set up payments', 'woocommerce' );
} }
return __( 'Set up payments', 'woocommerce-admin' ); return __( 'Set up payments', 'woocommerce' );
} }
/** /**
@ -42,7 +42,7 @@ class Payments extends Task {
public function get_content() { public function get_content() {
return __( return __(
'Choose payment providers and enable payment methods at checkout.', 'Choose payment providers and enable payment methods at checkout.',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -52,7 +52,7 @@ class Payments extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '2 minutes', 'woocommerce-admin' ); return __( '2 minutes', 'woocommerce' );
} }
/** /**

View File

@ -38,11 +38,11 @@ class Products extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You added products', 'woocommerce-admin' ); return __( 'You added products', 'woocommerce' );
} }
return __( 'Add products', 'woocommerce-admin' ); return __( 'Add products', 'woocommerce' );
} }
return __( 'Add my products', 'woocommerce-admin' ); return __( 'Add my products', 'woocommerce' );
} }
/** /**
@ -53,7 +53,7 @@ class Products extends Task {
public function get_content() { public function get_content() {
return __( return __(
'Start by adding the first product to your store. You can add your products manually, via CSV, or import them from another service.', 'Start by adding the first product to your store. You can add your products manually, via CSV, or import them from another service.',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -63,7 +63,7 @@ class Products extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '1 minute per product', 'woocommerce-admin' ); return __( '1 minute per product', 'woocommerce' );
} }
/** /**

View File

@ -61,13 +61,13 @@ class Purchase extends Task {
/* translators: %1$s: list of product names comma separated, %2%s the last product name */ /* translators: %1$s: list of product names comma separated, %2%s the last product name */
__( __(
'Add %s to my store', 'Add %s to my store',
'woocommerce-admin' 'woocommerce'
), ),
$products['remaining'][0] $products['remaining'][0]
) )
: __( : __(
'Add paid extensions to my store', 'Add paid extensions to my store',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -86,7 +86,7 @@ class Purchase extends Task {
/* translators: %1$s: list of product names comma separated, %2%s the last product name */ /* translators: %1$s: list of product names comma separated, %2%s the last product name */
__( __(
'Good choice! You chose to add %1$s and %2$s to your store.', 'Good choice! You chose to add %1$s and %2$s to your store.',
'woocommerce-admin' 'woocommerce'
), ),
implode( ', ', array_slice( $products['remaining'], 0, -1 ) ) . ( count( $products['remaining'] ) > 2 ? ',' : '' ), implode( ', ', array_slice( $products['remaining'], 0, -1 ) ) . ( count( $products['remaining'] ) > 2 ? ',' : '' ),
end( $products['remaining'] ) end( $products['remaining'] )
@ -99,7 +99,7 @@ class Purchase extends Task {
* @return string * @return string
*/ */
public function get_action_label() { public function get_action_label() {
return __( 'Purchase & install now', 'woocommerce-admin' ); return __( 'Purchase & install now', 'woocommerce' );
} }
@ -109,7 +109,7 @@ class Purchase extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '2 minutes', 'woocommerce-admin' ); return __( '2 minutes', 'woocommerce' );
} }
/** /**

View File

@ -26,11 +26,11 @@ class Shipping extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You added shipping costs', 'woocommerce-admin' ); return __( 'You added shipping costs', 'woocommerce' );
} }
return __( 'Add shipping costs', 'woocommerce-admin' ); return __( 'Add shipping costs', 'woocommerce' );
} }
return __( 'Set up shipping', 'woocommerce-admin' ); return __( 'Set up shipping', 'woocommerce' );
} }
/** /**
@ -41,7 +41,7 @@ class Shipping extends Task {
public function get_content() { public function get_content() {
return __( return __(
"Set your store location and where you'll ship to.", "Set your store location and where you'll ship to.",
'woocommerce-admin' 'woocommerce'
); );
} }
@ -51,7 +51,7 @@ class Shipping extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '1 minute', 'woocommerce-admin' ); return __( '1 minute', 'woocommerce' );
} }
/** /**

View File

@ -26,11 +26,11 @@ class StoreDetails extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You added store details', 'woocommerce-admin' ); return __( 'You added store details', 'woocommerce' );
} }
return __( 'Add store details', 'woocommerce-admin' ); return __( 'Add store details', 'woocommerce' );
} }
return __( 'Store details', 'woocommerce-admin' ); return __( 'Store details', 'woocommerce' );
} }
/** /**
@ -41,7 +41,7 @@ class StoreDetails extends Task {
public function get_content() { public function get_content() {
return __( return __(
'Your store address is required to set the origin country for shipping, currencies, and payment options.', 'Your store address is required to set the origin country for shipping, currencies, and payment options.',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -51,7 +51,7 @@ class StoreDetails extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '4 minutes', 'woocommerce-admin' ); return __( '4 minutes', 'woocommerce' );
} }
/** /**

View File

@ -67,11 +67,11 @@ class Tax extends Task {
public function get_title() { public function get_title() {
if ( true === $this->get_parent_option( 'use_completed_title' ) ) { if ( true === $this->get_parent_option( 'use_completed_title' ) ) {
if ( $this->is_complete() ) { if ( $this->is_complete() ) {
return __( 'You added tax rates', 'woocommerce-admin' ); return __( 'You added tax rates', 'woocommerce' );
} }
return __( 'Add tax rates', 'woocommerce-admin' ); return __( 'Add tax rates', 'woocommerce' );
} }
return __( 'Set up tax', 'woocommerce-admin' ); return __( 'Set up tax', 'woocommerce' );
} }
/** /**
@ -83,11 +83,11 @@ class Tax extends Task {
return self::can_use_automated_taxes() return self::can_use_automated_taxes()
? __( ? __(
'Good news! WooCommerce Services and Jetpack can automate your sales tax calculations for you.', 'Good news! WooCommerce Services and Jetpack can automate your sales tax calculations for you.',
'woocommerce-admin' 'woocommerce'
) )
: __( : __(
'Set your store location and configure tax rate settings.', 'Set your store location and configure tax rate settings.',
'woocommerce-admin' 'woocommerce'
); );
} }
@ -97,7 +97,7 @@ class Tax extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '1 minute', 'woocommerce-admin' ); return __( '1 minute', 'woocommerce' );
} }
/** /**
@ -107,8 +107,8 @@ class Tax extends Task {
*/ */
public function get_action_label() { public function get_action_label() {
return self::can_use_automated_taxes() return self::can_use_automated_taxes()
? __( 'Yes please', 'woocommerce-admin' ) ? __( 'Yes please', 'woocommerce' )
: __( "Let's go", 'woocommerce-admin' ); : __( "Let's go", 'woocommerce' );
} }
/** /**

View File

@ -34,7 +34,7 @@ class WooCommercePayments extends Task {
* @return string * @return string
*/ */
public function get_title() { public function get_title() {
return __( 'Get paid with WooCommerce Payments', 'woocommerce-admin' ); return __( 'Get paid with WooCommerce Payments', 'woocommerce' );
} }
/** /**
@ -45,7 +45,7 @@ class WooCommercePayments extends Task {
public function get_content() { public function get_content() {
return __( return __(
"You're only one step away from getting paid. Verify your business details to start managing transactions with WooCommerce Payments.", "You're only one step away from getting paid. Verify your business details to start managing transactions with WooCommerce Payments.",
'woocommerce-admin' 'woocommerce'
); );
} }
@ -55,7 +55,7 @@ class WooCommercePayments extends Task {
* @return string * @return string
*/ */
public function get_time() { public function get_time() {
return __( '2 minutes', 'woocommerce-admin' ); return __( '2 minutes', 'woocommerce' );
} }
/** /**
@ -64,7 +64,7 @@ class WooCommercePayments extends Task {
* @return string * @return string
*/ */
public function get_action_label() { public function get_action_label() {
return __( 'Finish setup', 'woocommerce-admin' ); return __( 'Finish setup', 'woocommerce' );
} }
/** /**
@ -75,7 +75,7 @@ class WooCommercePayments extends Task {
public function get_additional_info() { public function get_additional_info() {
return __( return __(
'By setting up, you are agreeing to the <a href="https://wordpress.com/tos/" target="_blank">Terms of Service</a>', 'By setting up, you are agreeing to the <a href="https://wordpress.com/tos/" target="_blank">Terms of Service</a>',
'woocommerce-admin' 'woocommerce'
); );
} }

View File

@ -23,8 +23,8 @@ class DefaultPaymentGateways {
return array( return array(
array( array(
'id' => 'payfast', 'id' => 'payfast',
'title' => __( 'PayFast', 'woocommerce-admin' ), 'title' => __( 'PayFast', 'woocommerce' ),
'content' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africas most popular payment gateways. No setup fees or monthly subscription costs. Selecting this extension will configure your store to use South African rands as the selected currency.', 'woocommerce-admin' ), 'content' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africas most popular payment gateways. No setup fees or monthly subscription costs. Selecting this extension will configure your store to use South African rands as the selected currency.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/payfast.png', 'image' => WC()->plugin_url() . '/assets/images/payfast.png',
'plugins' => array( 'woocommerce-payfast-gateway' ), 'plugins' => array( 'woocommerce-payfast-gateway' ),
'is_visible' => array( 'is_visible' => array(
@ -38,8 +38,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'stripe', 'id' => 'stripe',
'title' => __( ' Stripe', 'woocommerce-admin' ), 'title' => __( ' Stripe', 'woocommerce' ),
'content' => __( 'Accept debit and credit cards in 135+ currencies, methods such as Alipay, and one-touch checkout with Apple Pay.', 'woocommerce-admin' ), 'content' => __( 'Accept debit and credit cards in 135+ currencies, methods such as Alipay, and one-touch checkout with Apple Pay.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/stripe.png', 'image' => WC()->plugin_url() . '/assets/images/stripe.png',
'plugins' => array( 'woocommerce-gateway-stripe' ), 'plugins' => array( 'woocommerce-gateway-stripe' ),
'is_visible' => array( 'is_visible' => array(
@ -94,8 +94,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'paystack', 'id' => 'paystack',
'title' => __( 'Paystack', 'woocommerce-admin' ), 'title' => __( 'Paystack', 'woocommerce' ),
'content' => __( 'Paystack helps African merchants accept one-time and recurring payments online with a modern, safe, and secure payment gateway.', 'woocommerce-admin' ), 'content' => __( 'Paystack helps African merchants accept one-time and recurring payments online with a modern, safe, and secure payment gateway.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/paystack.png', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/paystack.png',
'plugins' => array( 'woo-paystack' ), 'plugins' => array( 'woo-paystack' ),
'is_visible' => array( 'is_visible' => array(
@ -105,8 +105,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'kco', 'id' => 'kco',
'title' => __( 'Klarna Checkout', 'woocommerce-admin' ), 'title' => __( 'Klarna Checkout', 'woocommerce' ),
'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce-admin' ), 'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/klarna-black.png', 'image' => WC()->plugin_url() . '/assets/images/klarna-black.png',
'plugins' => array( 'klarna-checkout-for-woocommerce' ), 'plugins' => array( 'klarna-checkout-for-woocommerce' ),
'is_visible' => array( 'is_visible' => array(
@ -116,8 +116,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'klarna_payments', 'id' => 'klarna_payments',
'title' => __( 'Klarna Payments', 'woocommerce-admin' ), 'title' => __( 'Klarna Payments', 'woocommerce' ),
'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce-admin' ), 'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/klarna-black.png', 'image' => WC()->plugin_url() . '/assets/images/klarna-black.png',
'plugins' => array( 'klarna-payments-for-woocommerce' ), 'plugins' => array( 'klarna-payments-for-woocommerce' ),
'is_visible' => array( 'is_visible' => array(
@ -141,8 +141,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'mollie_wc_gateway_banktransfer', 'id' => 'mollie_wc_gateway_banktransfer',
'title' => __( 'Mollie', 'woocommerce-admin' ), 'title' => __( 'Mollie', 'woocommerce' ),
'content' => __( 'Effortless payments by Mollie: Offer global and local payment methods, get onboarded in minutes, and supported in your language.', 'woocommerce-admin' ), 'content' => __( 'Effortless payments by Mollie: Offer global and local payment methods, get onboarded in minutes, and supported in your language.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mollie.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mollie.svg',
'plugins' => array( 'mollie-payments-for-woocommerce' ), 'plugins' => array( 'mollie-payments-for-woocommerce' ),
'is_visible' => array( 'is_visible' => array(
@ -165,8 +165,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'woo-mercado-pago-custom', 'id' => 'woo-mercado-pago-custom',
'title' => __( 'Mercado Pago Checkout Pro & Custom', 'woocommerce-admin' ), 'title' => __( 'Mercado Pago Checkout Pro & Custom', 'woocommerce' ),
'content' => __( 'Accept credit and debit cards, offline (cash or bank transfer) and logged-in payments with money in Mercado Pago. Safe and secure payments with the leading payment processor in LATAM.', 'woocommerce-admin' ), 'content' => __( 'Accept credit and debit cards, offline (cash or bank transfer) and logged-in payments with money in Mercado Pago. Safe and secure payments with the leading payment processor in LATAM.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mercadopago.png', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mercadopago.png',
'plugins' => array( 'woocommerce-mercadopago' ), 'plugins' => array( 'woocommerce-mercadopago' ),
'is_visible' => array( 'is_visible' => array(
@ -177,8 +177,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'ppcp-gateway', 'id' => 'ppcp-gateway',
'title' => __( 'PayPal Payments', 'woocommerce-admin' ), 'title' => __( 'PayPal Payments', 'woocommerce' ),
'content' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce-admin' ), 'content' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/paypal.png', 'image' => WC()->plugin_url() . '/assets/images/paypal.png',
'plugins' => array( 'woocommerce-paypal-payments' ), 'plugins' => array( 'woocommerce-paypal-payments' ),
'is_visible' => array( 'is_visible' => array(
@ -192,8 +192,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'cod', 'id' => 'cod',
'title' => __( 'Cash on delivery', 'woocommerce-admin' ), 'title' => __( 'Cash on delivery', 'woocommerce' ),
'content' => __( 'Take payments in cash upon delivery.', 'woocommerce-admin' ), 'content' => __( 'Take payments in cash upon delivery.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/cod.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/cod.svg',
'is_visible' => array( 'is_visible' => array(
self::get_rules_for_cbd( false ), self::get_rules_for_cbd( false ),
@ -201,8 +201,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'bacs', 'id' => 'bacs',
'title' => __( 'Direct bank transfer', 'woocommerce-admin' ), 'title' => __( 'Direct bank transfer', 'woocommerce' ),
'content' => __( 'Take payments via bank transfer.', 'woocommerce-admin' ), 'content' => __( 'Take payments via bank transfer.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/bacs.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/bacs.svg',
'is_visible' => array( 'is_visible' => array(
self::get_rules_for_cbd( false ), self::get_rules_for_cbd( false ),
@ -210,10 +210,10 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'woocommerce_payments', 'id' => 'woocommerce_payments',
'title' => __( 'WooCommerce Payments', 'woocommerce-admin' ), 'title' => __( 'WooCommerce Payments', 'woocommerce' ),
'content' => __( 'content' => __(
'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.', 'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.',
'woocommerce-admin' 'woocommerce'
), ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
'plugins' => array( 'woocommerce-payments' ), 'plugins' => array( 'woocommerce-payments' ),
@ -252,10 +252,10 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'woocommerce_payments:non-us', 'id' => 'woocommerce_payments:non-us',
'title' => __( 'WooCommerce Payments', 'woocommerce-admin' ), 'title' => __( 'WooCommerce Payments', 'woocommerce' ),
'content' => __( 'content' => __(
'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.', 'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.',
'woocommerce-admin' 'woocommerce'
), ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
'plugins' => array( 'woocommerce-payments' ), 'plugins' => array( 'woocommerce-payments' ),
@ -286,10 +286,10 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'woocommerce_payments:us', 'id' => 'woocommerce_payments:us',
'title' => __( 'WooCommerce Payments', 'woocommerce-admin' ), 'title' => __( 'WooCommerce Payments', 'woocommerce' ),
'content' => __( 'content' => __(
'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.', 'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.',
'woocommerce-admin' 'woocommerce'
), ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
'plugins' => array( 'woocommerce-payments' ), 'plugins' => array( 'woocommerce-payments' ),
@ -320,8 +320,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'razorpay', 'id' => 'razorpay',
'title' => __( 'Razorpay', 'woocommerce-admin' ), 'title' => __( 'Razorpay', 'woocommerce' ),
'content' => __( 'The official Razorpay extension for WooCommerce allows you to accept credit cards, debit cards, netbanking, wallet, and UPI payments.', 'woocommerce-admin' ), 'content' => __( 'The official Razorpay extension for WooCommerce allows you to accept credit cards, debit cards, netbanking, wallet, and UPI payments.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/razorpay.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/razorpay.svg',
'plugins' => array( 'woo-razorpay' ), 'plugins' => array( 'woo-razorpay' ),
'is_visible' => array( 'is_visible' => array(
@ -335,8 +335,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'payubiz', 'id' => 'payubiz',
'title' => __( 'PayU for WooCommerce', 'woocommerce-admin' ), 'title' => __( 'PayU for WooCommerce', 'woocommerce' ),
'content' => __( 'Enable PayUs exclusive plugin for WooCommerce to start accepting payments in 100+ payment methods available in India including credit cards, debit cards, UPI, & more!', 'woocommerce-admin' ), 'content' => __( 'Enable PayUs exclusive plugin for WooCommerce to start accepting payments in 100+ payment methods available in India including credit cards, debit cards, UPI, & more!', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/payu.svg', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/payu.svg',
'plugins' => array( 'payu-india' ), 'plugins' => array( 'payu-india' ),
'is_visible' => array( 'is_visible' => array(
@ -350,8 +350,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'eway', 'id' => 'eway',
'title' => __( 'Eway', 'woocommerce-admin' ), 'title' => __( 'Eway', 'woocommerce' ),
'content' => __( 'The Eway extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce-admin' ), 'content' => __( 'The Eway extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/eway.png', 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/eway.png',
'plugins' => array( 'woocommerce-gateway-eway' ), 'plugins' => array( 'woocommerce-gateway-eway' ),
'is_visible' => array( 'is_visible' => array(
@ -361,8 +361,8 @@ class DefaultPaymentGateways {
), ),
array( array(
'id' => 'square_credit_card', 'id' => 'square_credit_card',
'title' => __( 'Square', 'woocommerce-admin' ), 'title' => __( 'Square', 'woocommerce' ),
'content' => __( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place.', 'woocommerce-admin' ), 'content' => __( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place.', 'woocommerce' ),
'image' => WC()->plugin_url() . '/assets/images/square-black.png', 'image' => WC()->plugin_url() . '/assets/images/square-black.png',
'plugins' => array( 'woocommerce-square' ), 'plugins' => array( 'woocommerce-square' ),
'is_visible' => array( 'is_visible' => array(

View File

@ -130,7 +130,7 @@ class PaymentGatewaysController {
'status' => 'success', 'status' => 'success',
'content' => sprintf( 'content' => sprintf(
/* translators: the title of the payment gateway */ /* translators: the title of the payment gateway */
__( '%s connected successfully', 'woocommerce-admin' ), __( '%s connected successfully', 'woocommerce' ),
$payment_gateway->method_title $payment_gateway->method_title
), ),
) )

View File

@ -121,7 +121,7 @@ class DataStore extends \WC_Data_Store_WP implements \WC_Object_Data_Store_Inter
*/ */
do_action( 'woocommerce_note_loaded', $note ); do_action( 'woocommerce_note_loaded', $note );
} else { } else {
throw new \Exception( __( 'Invalid admin note', 'woocommerce-admin' ) ); throw new \Exception( __( 'Invalid admin note', 'woocommerce' ) );
} }
} }

View File

@ -374,7 +374,7 @@ class Note extends \WC_Data {
public function set_name( $name ) { public function set_name( $name ) {
// Don't allow empty names. // Don't allow empty names.
if ( empty( $name ) ) { if ( empty( $name ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note name prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note name prop cannot be empty.', 'woocommerce' ) );
} }
$this->set_prop( 'name', $name ); $this->set_prop( 'name', $name );
@ -387,7 +387,7 @@ class Note extends \WC_Data {
*/ */
public function set_type( $type ) { public function set_type( $type ) {
if ( empty( $type ) ) { if ( empty( $type ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note type prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note type prop cannot be empty.', 'woocommerce' ) );
} }
if ( ! in_array( $type, self::get_allowed_types(), true ) ) { if ( ! in_array( $type, self::get_allowed_types(), true ) ) {
@ -395,7 +395,7 @@ class Note extends \WC_Data {
'admin_note_invalid_data', 'admin_note_invalid_data',
sprintf( sprintf(
/* translators: %s: admin note type. */ /* translators: %s: admin note type. */
__( 'The admin note type prop (%s) is not one of the supported types.', 'woocommerce-admin' ), __( 'The admin note type prop (%s) is not one of the supported types.', 'woocommerce' ),
$type $type
) )
); );
@ -411,7 +411,7 @@ class Note extends \WC_Data {
*/ */
public function set_locale( $locale ) { public function set_locale( $locale ) {
if ( empty( $locale ) ) { if ( empty( $locale ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note locale prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note locale prop cannot be empty.', 'woocommerce' ) );
} }
$this->set_prop( 'locale', $locale ); $this->set_prop( 'locale', $locale );
@ -424,7 +424,7 @@ class Note extends \WC_Data {
*/ */
public function set_title( $title ) { public function set_title( $title ) {
if ( empty( $title ) ) { if ( empty( $title ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note title prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note title prop cannot be empty.', 'woocommerce' ) );
} }
$this->set_prop( 'title', $title ); $this->set_prop( 'title', $title );
@ -464,7 +464,7 @@ class Note extends \WC_Data {
$content = wp_kses( $content, $allowed_html ); $content = wp_kses( $content, $allowed_html );
if ( empty( $content ) ) { if ( empty( $content ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note content prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note content prop cannot be empty.', 'woocommerce' ) );
} }
$this->set_prop( 'content', $content ); $this->set_prop( 'content', $content );
@ -481,7 +481,7 @@ class Note extends \WC_Data {
// Make sure $content_data is stdClass Object or an array. // Make sure $content_data is stdClass Object or an array.
if ( ! ( $content_data instanceof \stdClass ) ) { if ( ! ( $content_data instanceof \stdClass ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note content_data prop must be an instance of stdClass.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note content_data prop must be an instance of stdClass.', 'woocommerce' ) );
} }
$this->set_prop( 'content_data', $content_data ); $this->set_prop( 'content_data', $content_data );
@ -494,7 +494,7 @@ class Note extends \WC_Data {
*/ */
public function set_status( $status ) { public function set_status( $status ) {
if ( empty( $status ) ) { if ( empty( $status ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note status prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note status prop cannot be empty.', 'woocommerce' ) );
} }
if ( ! in_array( $status, self::get_allowed_statuses(), true ) ) { if ( ! in_array( $status, self::get_allowed_statuses(), true ) ) {
@ -502,7 +502,7 @@ class Note extends \WC_Data {
'admin_note_invalid_data', 'admin_note_invalid_data',
sprintf( sprintf(
/* translators: %s: admin note status property. */ /* translators: %s: admin note status property. */
__( 'The admin note status prop (%s) is not one of the supported statuses.', 'woocommerce-admin' ), __( 'The admin note status prop (%s) is not one of the supported statuses.', 'woocommerce' ),
$status $status
) )
); );
@ -518,7 +518,7 @@ class Note extends \WC_Data {
*/ */
public function set_source( $source ) { public function set_source( $source ) {
if ( empty( $source ) ) { if ( empty( $source ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note source prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note source prop cannot be empty.', 'woocommerce' ) );
} }
$this->set_prop( 'source', $source ); $this->set_prop( 'source', $source );
@ -531,7 +531,7 @@ class Note extends \WC_Data {
*/ */
public function set_date_created( $date ) { public function set_date_created( $date ) {
if ( empty( $date ) ) { if ( empty( $date ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note date prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note date prop cannot be empty.', 'woocommerce' ) );
} }
if ( is_string( $date ) ) { if ( is_string( $date ) ) {
@ -582,7 +582,7 @@ class Note extends \WC_Data {
if ( in_array( $layout, $valid_layouts, true ) ) { if ( in_array( $layout, $valid_layouts, true ) ) {
$this->set_prop( 'layout', $layout ); $this->set_prop( 'layout', $layout );
} else { } else {
$this->error( 'admin_note_invalid_data', __( 'The admin note layout has a wrong prop value.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note layout has a wrong prop value.', 'woocommerce' ) );
} }
} }
@ -638,11 +638,11 @@ class Note extends \WC_Data {
$actioned_text = wc_clean( $actioned_text ); $actioned_text = wc_clean( $actioned_text );
if ( empty( $name ) ) { if ( empty( $name ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note action name prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note action name prop cannot be empty.', 'woocommerce' ) );
} }
if ( empty( $label ) ) { if ( empty( $label ) ) {
$this->error( 'admin_note_invalid_data', __( 'The admin note action label prop cannot be empty.', 'woocommerce-admin' ) ); $this->error( 'admin_note_invalid_data', __( 'The admin note action label prop cannot be empty.', 'woocommerce' ) );
} }
$action = array( $action = array(

View File

@ -465,7 +465,7 @@ class Notes {
} catch ( \Exception $e ) { } catch ( \Exception $e ) {
throw new NotesUnavailableException( throw new NotesUnavailableException(
'woocommerce_admin_notes_unavailable', 'woocommerce_admin_notes_unavailable',
__( 'Notes are unavailable because the "admin-note" data store cannot be loaded.', 'woocommerce-admin' ) __( 'Notes are unavailable because the "admin-note" data store cannot be loaded.', 'woocommerce' )
); );
} }
} }

View File

@ -198,7 +198,7 @@ class PageController {
} }
} }
$woocommerce_breadcrumb = array( 'admin.php?page=' . self::PAGE_ROOT, __( 'WooCommerce', 'woocommerce-admin' ) ); $woocommerce_breadcrumb = array( 'admin.php?page=' . self::PAGE_ROOT, __( 'WooCommerce', 'woocommerce' ) );
array_unshift( $breadcrumbs, $woocommerce_breadcrumb ); array_unshift( $breadcrumbs, $woocommerce_breadcrumb );
@ -220,7 +220,7 @@ class PageController {
// If 'current_screen' hasn't fired yet, the current page calculation // If 'current_screen' hasn't fired yet, the current page calculation
// will fail which causes `false` to be returned for all subsquent calls. // will fail which causes `false` to be returned for all subsquent calls.
if ( ! did_action( 'current_screen' ) ) { if ( ! did_action( 'current_screen' ) ) {
_doing_it_wrong( __FUNCTION__, esc_html__( 'Current page retrieval should be called on or after the `current_screen` hook.', 'woocommerce-admin' ), '0.16.0' ); _doing_it_wrong( __FUNCTION__, esc_html__( 'Current page retrieval should be called on or after the `current_screen` hook.', 'woocommerce' ), '0.16.0' );
} }
if ( is_null( $this->current_page ) ) { if ( is_null( $this->current_page ) ) {
@ -507,7 +507,7 @@ class PageController {
public function register_store_details_page() { public function register_store_details_page() {
wc_admin_register_page( wc_admin_register_page(
array( array(
'title' => __( 'Setup Wizard', 'woocommerce-admin' ), 'title' => __( 'Setup Wizard', 'woocommerce' ),
'parent' => '', 'parent' => '',
'path' => '/setup-wizard', 'path' => '/setup-wizard',
) )

View File

@ -154,7 +154,7 @@ class PluginsHelper {
$plugins = apply_filters( 'woocommerce_admin_plugins_pre_install', $plugins ); $plugins = apply_filters( 'woocommerce_admin_plugins_pre_install', $plugins );
if ( empty( $plugins ) || ! is_array( $plugins ) ) { if ( empty( $plugins ) || ! is_array( $plugins ) ) {
return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ) ); return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ) );
} }
require_once ABSPATH . 'wp-admin/includes/plugin.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php';
@ -193,7 +193,7 @@ class PluginsHelper {
if ( is_wp_error( $api ) ) { if ( is_wp_error( $api ) ) {
$properties = array( $properties = array(
/* translators: %s: plugin slug (example: woocommerce-services) */ /* translators: %s: plugin slug (example: woocommerce-services) */
'error_message' => __( 'The requested plugin `%s` could not be installed. Plugin API call failed.', 'woocommerce-admin' ), 'error_message' => __( 'The requested plugin `%s` could not be installed. Plugin API call failed.', 'woocommerce' ),
'api' => $api, 'api' => $api,
'slug' => $slug, 'slug' => $slug,
); );
@ -205,7 +205,7 @@ class PluginsHelper {
$plugin, $plugin,
sprintf( sprintf(
/* translators: %s: plugin slug (example: woocommerce-services) */ /* translators: %s: plugin slug (example: woocommerce-services) */
__( 'The requested plugin `%s` could not be installed. Plugin API call failed.', 'woocommerce-admin' ), __( 'The requested plugin `%s` could not be installed. Plugin API call failed.', 'woocommerce' ),
$slug $slug
) )
); );
@ -221,7 +221,7 @@ class PluginsHelper {
if ( is_wp_error( $result ) || is_null( $result ) ) { if ( is_wp_error( $result ) || is_null( $result ) ) {
$properties = array( $properties = array(
/* translators: %s: plugin slug (example: woocommerce-services) */ /* translators: %s: plugin slug (example: woocommerce-services) */
'error_message' => __( 'The requested plugin `%s` could not be installed.', 'woocommerce-admin' ), 'error_message' => __( 'The requested plugin `%s` could not be installed.', 'woocommerce' ),
'slug' => $slug, 'slug' => $slug,
'api' => $api, 'api' => $api,
'upgrader' => $upgrader, 'upgrader' => $upgrader,
@ -235,7 +235,7 @@ class PluginsHelper {
$plugin, $plugin,
sprintf( sprintf(
/* translators: %s: plugin slug (example: woocommerce-services) */ /* translators: %s: plugin slug (example: woocommerce-services) */
__( 'The requested plugin `%s` could not be installed. Upgrader install failed.', 'woocommerce-admin' ), __( 'The requested plugin `%s` could not be installed. Upgrader install failed.', 'woocommerce' ),
$slug $slug
) )
); );
@ -263,7 +263,7 @@ class PluginsHelper {
*/ */
public static function schedule_install_plugins( $plugins ) { public static function schedule_install_plugins( $plugins ) {
if ( empty( $plugins ) || ! is_array( $plugins ) ) { if ( empty( $plugins ) || ! is_array( $plugins ) ) {
return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ), 404 );
} }
$job_id = uniqid(); $job_id = uniqid();
@ -280,7 +280,7 @@ class PluginsHelper {
*/ */
public static function activate_plugins( $plugins ) { public static function activate_plugins( $plugins ) {
if ( empty( $plugins ) || ! is_array( $plugins ) ) { if ( empty( $plugins ) || ! is_array( $plugins ) ) {
return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ), 404 );
} }
require_once ABSPATH . 'wp-admin/includes/plugin.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php';
@ -307,7 +307,7 @@ class PluginsHelper {
$errors->add( $errors->add(
$plugin, $plugin,
/* translators: %s: plugin slug (example: woocommerce-services) */ /* translators: %s: plugin slug (example: woocommerce-services) */
sprintf( __( 'The requested plugin `%s`. is not yet installed.', 'woocommerce-admin' ), $slug ) sprintf( __( 'The requested plugin `%s`. is not yet installed.', 'woocommerce' ), $slug )
); );
continue; continue;
} }
@ -319,7 +319,7 @@ class PluginsHelper {
$errors->add( $errors->add(
$plugin, $plugin,
/* translators: %s: plugin slug (example: woocommerce-services) */ /* translators: %s: plugin slug (example: woocommerce-services) */
sprintf( __( 'The requested plugin `%s` could not be activated.', 'woocommerce-admin' ), $slug ) sprintf( __( 'The requested plugin `%s` could not be activated.', 'woocommerce' ), $slug )
); );
continue; continue;
} }
@ -344,7 +344,7 @@ class PluginsHelper {
*/ */
public static function schedule_activate_plugins( $plugins ) { public static function schedule_activate_plugins( $plugins ) {
if ( empty( $plugins ) || ! is_array( $plugins ) ) { if ( empty( $plugins ) || ! is_array( $plugins ) ) {
return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce-admin' ), 404 ); return new \WP_Error( 'woocommerce_plugins_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ), 404 );
} }
$job_id = uniqid(); $job_id = uniqid();

View File

@ -29,16 +29,16 @@ class ReportCSVEmail extends \WC_Email {
$this->template_html = 'html-admin-report-export-download.php'; $this->template_html = 'html-admin-report-export-download.php';
$this->template_plain = 'plain-admin-report-export-download.php'; $this->template_plain = 'plain-admin-report-export-download.php';
$this->report_labels = array( $this->report_labels = array(
'categories' => __( 'Categories', 'woocommerce-admin' ), 'categories' => __( 'Categories', 'woocommerce' ),
'coupons' => __( 'Coupons', 'woocommerce-admin' ), 'coupons' => __( 'Coupons', 'woocommerce' ),
'customers' => __( 'Customers', 'woocommerce-admin' ), 'customers' => __( 'Customers', 'woocommerce' ),
'downloads' => __( 'Downloads', 'woocommerce-admin' ), 'downloads' => __( 'Downloads', 'woocommerce' ),
'orders' => __( 'Orders', 'woocommerce-admin' ), 'orders' => __( 'Orders', 'woocommerce' ),
'products' => __( 'Products', 'woocommerce-admin' ), 'products' => __( 'Products', 'woocommerce' ),
'revenue' => __( 'Revenue', 'woocommerce-admin' ), 'revenue' => __( 'Revenue', 'woocommerce' ),
'stock' => __( 'Stock', 'woocommerce-admin' ), 'stock' => __( 'Stock', 'woocommerce' ),
'taxes' => __( 'Taxes', 'woocommerce-admin' ), 'taxes' => __( 'Taxes', 'woocommerce' ),
'variations' => __( 'Variations', 'woocommerce-admin' ), 'variations' => __( 'Variations', 'woocommerce' ),
); );
// Call parent constructor. // Call parent constructor.
@ -70,7 +70,7 @@ class ReportCSVEmail extends \WC_Email {
* @return string * @return string
*/ */
public function get_default_heading() { public function get_default_heading() {
return __( 'Your Report Download', 'woocommerce-admin' ); return __( 'Your Report Download', 'woocommerce' );
} }
/** /**
@ -79,7 +79,7 @@ class ReportCSVEmail extends \WC_Email {
* @return string * @return string
*/ */
public function get_default_subject() { public function get_default_subject() {
return __( '[{site_title}]: Your {report_name} Report download is ready', 'woocommerce-admin' ); return __( '[{site_title}]: Your {report_name} Report download is ready', 'woocommerce' );
} }
/** /**

View File

@ -46,7 +46,7 @@ class ReportsSync {
foreach ( $schedulers as $scheduler ) { foreach ( $schedulers as $scheduler ) {
if ( ! is_subclass_of( $scheduler, 'Automattic\WooCommerce\Internal\Admin\Schedulers\ImportScheduler' ) ) { if ( ! is_subclass_of( $scheduler, 'Automattic\WooCommerce\Internal\Admin\Schedulers\ImportScheduler' ) ) {
throw new \Exception( __( 'Report sync schedulers should be derived from the Automattic\WooCommerce\Internal\Admin\Schedulers\ImportScheduler class.', 'woocommerce-admin' ) ); throw new \Exception( __( 'Report sync schedulers should be derived from the Automattic\WooCommerce\Internal\Admin\Schedulers\ImportScheduler class.', 'woocommerce' ) );
} }
} }
@ -76,7 +76,7 @@ class ReportsSync {
*/ */
public static function regenerate_report_data( $days, $skip_existing ) { public static function regenerate_report_data( $days, $skip_existing ) {
if ( self::is_importing() ) { if ( self::is_importing() ) {
return new \WP_Error( 'wc_admin_import_in_progress', __( 'An import is already in progress. Please allow the previous import to complete before beginning a new one.', 'woocommerce-admin' ) ); return new \WP_Error( 'wc_admin_import_in_progress', __( 'An import is already in progress. Please allow the previous import to complete before beginning a new one.', 'woocommerce' ) );
} }
self::reset_import_stats( $days, $skip_existing ); self::reset_import_stats( $days, $skip_existing );
@ -92,7 +92,7 @@ class ReportsSync {
*/ */
do_action( 'woocommerce_analytics_regenerate_init', $days, $skip_existing ); do_action( 'woocommerce_analytics_regenerate_init', $days, $skip_existing );
return __( 'Report table data is being rebuilt. Please allow some time for data to fully populate.', 'woocommerce-admin' ); return __( 'Report table data is being rebuilt. Please allow some time for data to fully populate.', 'woocommerce' );
} }
/** /**
@ -176,7 +176,7 @@ class ReportsSync {
// Delete import options. // Delete import options.
delete_option( ImportScheduler::IMPORT_STATS_OPTION ); delete_option( ImportScheduler::IMPORT_STATS_OPTION );
return __( 'Report table data is being deleted.', 'woocommerce-admin' ); return __( 'Report table data is being deleted.', 'woocommerce' );
} }
/** /**

View File

@ -65,11 +65,11 @@ class Analytics {
public static function add_feature_toggle( $features ) { public static function add_feature_toggle( $features ) {
$description = __( $description = __(
'Enables WooCommerce Analytics', 'Enables WooCommerce Analytics',
'woocommerce-admin' 'woocommerce'
); );
$features[] = array( $features[] = array(
'title' => __( 'Analytics', 'woocommerce-admin' ), 'title' => __( 'Analytics', 'woocommerce' ),
'desc' => $description, 'desc' => $description,
'id' => self::TOGGLE_OPTION_NAME, 'id' => self::TOGGLE_OPTION_NAME,
'type' => 'checkbox', 'type' => 'checkbox',
@ -151,11 +151,11 @@ class Analytics {
); );
$debug_tools[ self::CACHE_TOOL_ID ] = array( $debug_tools[ self::CACHE_TOOL_ID ] = array(
'name' => __( 'Clear analytics cache', 'woocommerce-admin' ), 'name' => __( 'Clear analytics cache', 'woocommerce' ),
'button' => __( 'Clear', 'woocommerce-admin' ), 'button' => __( 'Clear', 'woocommerce' ),
'desc' => sprintf( 'desc' => sprintf(
/* translators: 1: opening link tag, 2: closing tag */ /* translators: 1: opening link tag, 2: closing tag */
__( 'This tool will reset the cached values used in WooCommerce Analytics. If numbers still look off, try %1$sReimporting Historical Data%2$s.', 'woocommerce-admin' ), __( 'This tool will reset the cached values used in WooCommerce Analytics. If numbers still look off, try %1$sReimporting Historical Data%2$s.', 'woocommerce' ),
'<a href="' . esc_url( $settings_url ) . '">', '<a href="' . esc_url( $settings_url ) . '">',
'</a>' '</a>'
), ),
@ -183,7 +183,7 @@ class Analytics {
public static function get_report_pages() { public static function get_report_pages() {
$overview_page = array( $overview_page = array(
'id' => 'woocommerce-analytics', 'id' => 'woocommerce-analytics',
'title' => __( 'Analytics', 'woocommerce-admin' ), 'title' => __( 'Analytics', 'woocommerce' ),
'path' => '/analytics/overview', 'path' => '/analytics/overview',
'icon' => 'dashicons-chart-bar', 'icon' => 'dashicons-chart-bar',
'position' => 57, // After WooCommerce & Product menu items. 'position' => 57, // After WooCommerce & Product menu items.
@ -193,7 +193,7 @@ class Analytics {
$overview_page, $overview_page,
array( array(
'id' => 'woocommerce-analytics-overview', 'id' => 'woocommerce-analytics-overview',
'title' => __( 'Overview', 'woocommerce-admin' ), 'title' => __( 'Overview', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/overview', 'path' => '/analytics/overview',
'nav_args' => array( 'nav_args' => array(
@ -203,7 +203,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-products', 'id' => 'woocommerce-analytics-products',
'title' => __( 'Products', 'woocommerce-admin' ), 'title' => __( 'Products', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/products', 'path' => '/analytics/products',
'nav_args' => array( 'nav_args' => array(
@ -213,7 +213,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-revenue', 'id' => 'woocommerce-analytics-revenue',
'title' => __( 'Revenue', 'woocommerce-admin' ), 'title' => __( 'Revenue', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/revenue', 'path' => '/analytics/revenue',
'nav_args' => array( 'nav_args' => array(
@ -223,7 +223,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-orders', 'id' => 'woocommerce-analytics-orders',
'title' => __( 'Orders', 'woocommerce-admin' ), 'title' => __( 'Orders', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/orders', 'path' => '/analytics/orders',
'nav_args' => array( 'nav_args' => array(
@ -233,7 +233,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-variations', 'id' => 'woocommerce-analytics-variations',
'title' => __( 'Variations', 'woocommerce-admin' ), 'title' => __( 'Variations', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/variations', 'path' => '/analytics/variations',
'nav_args' => array( 'nav_args' => array(
@ -243,7 +243,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-categories', 'id' => 'woocommerce-analytics-categories',
'title' => __( 'Categories', 'woocommerce-admin' ), 'title' => __( 'Categories', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/categories', 'path' => '/analytics/categories',
'nav_args' => array( 'nav_args' => array(
@ -253,7 +253,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-coupons', 'id' => 'woocommerce-analytics-coupons',
'title' => __( 'Coupons', 'woocommerce-admin' ), 'title' => __( 'Coupons', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/coupons', 'path' => '/analytics/coupons',
'nav_args' => array( 'nav_args' => array(
@ -263,7 +263,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-taxes', 'id' => 'woocommerce-analytics-taxes',
'title' => __( 'Taxes', 'woocommerce-admin' ), 'title' => __( 'Taxes', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/taxes', 'path' => '/analytics/taxes',
'nav_args' => array( 'nav_args' => array(
@ -273,7 +273,7 @@ class Analytics {
), ),
array( array(
'id' => 'woocommerce-analytics-downloads', 'id' => 'woocommerce-analytics-downloads',
'title' => __( 'Downloads', 'woocommerce-admin' ), 'title' => __( 'Downloads', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/downloads', 'path' => '/analytics/downloads',
'nav_args' => array( 'nav_args' => array(
@ -283,7 +283,7 @@ class Analytics {
), ),
'yes' === get_option( 'woocommerce_manage_stock' ) ? array( 'yes' === get_option( 'woocommerce_manage_stock' ) ? array(
'id' => 'woocommerce-analytics-stock', 'id' => 'woocommerce-analytics-stock',
'title' => __( 'Stock', 'woocommerce-admin' ), 'title' => __( 'Stock', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/stock', 'path' => '/analytics/stock',
'nav_args' => array( 'nav_args' => array(
@ -293,17 +293,17 @@ class Analytics {
) : null, ) : null,
array( array(
'id' => 'woocommerce-analytics-customers', 'id' => 'woocommerce-analytics-customers',
'title' => __( 'Customers', 'woocommerce-admin' ), 'title' => __( 'Customers', 'woocommerce' ),
'parent' => 'woocommerce', 'parent' => 'woocommerce',
'path' => '/customers', 'path' => '/customers',
), ),
array( array(
'id' => 'woocommerce-analytics-settings', 'id' => 'woocommerce-analytics-settings',
'title' => __( 'Settings', 'woocommerce-admin' ), 'title' => __( 'Settings', 'woocommerce' ),
'parent' => 'woocommerce-analytics', 'parent' => 'woocommerce-analytics',
'path' => '/analytics/settings', 'path' => '/analytics/settings',
'nav_args' => array( 'nav_args' => array(
'title' => __( 'Analytics', 'woocommerce-admin' ), 'title' => __( 'Analytics', 'woocommerce' ),
'parent' => 'woocommerce-settings', 'parent' => 'woocommerce-settings',
), ),
), ),
@ -318,6 +318,6 @@ class Analytics {
public function run_clear_cache_tool() { public function run_clear_cache_tool() {
Cache::invalidate(); Cache::invalidate();
return __( 'Analytics cache cleared.', 'woocommerce-admin' ); return __( 'Analytics cache cleared.', 'woocommerce' );
} }
} }

View File

@ -71,8 +71,8 @@ class Coupons {
add_submenu_page( add_submenu_page(
'woocommerce', 'woocommerce',
__( 'Coupons', 'woocommerce-admin' ), __( 'Coupons', 'woocommerce' ),
__( 'Coupons', 'woocommerce-admin' ), __( 'Coupons', 'woocommerce' ),
'manage_options', 'manage_options',
'coupons-moved', 'coupons-moved',
[ $this, 'coupon_menu_moved' ] [ $this, 'coupon_menu_moved' ]

View File

@ -129,7 +129,7 @@ class CustomerEffortScoreTracks {
3 3
); );
} }
$this->onsubmit_label = __( 'Thank you for your feedback!', 'woocommerce-admin' ); $this->onsubmit_label = __( 'Thank you for your feedback!', 'woocommerce' );
} }
/** /**
@ -273,7 +273,7 @@ class CustomerEffortScoreTracks {
'action' => self::SEARCH_ACTION_NAME, 'action' => self::SEARCH_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to use search?', 'How easy was it to use search?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => $page_now, 'pagenow' => $page_now,
@ -339,7 +339,7 @@ class CustomerEffortScoreTracks {
'action' => self::PRODUCT_ADD_PUBLISH_ACTION_NAME, 'action' => self::PRODUCT_ADD_PUBLISH_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to add a product?', 'How easy was it to add a product?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'product', 'pagenow' => 'product',
@ -364,7 +364,7 @@ class CustomerEffortScoreTracks {
'action' => self::PRODUCT_UPDATE_ACTION_NAME, 'action' => self::PRODUCT_UPDATE_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to edit your product?', 'How easy was it to edit your product?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'product', 'pagenow' => 'product',
@ -389,7 +389,7 @@ class CustomerEffortScoreTracks {
'action' => self::SHOP_ORDER_UPDATE_ACTION_NAME, 'action' => self::SHOP_ORDER_UPDATE_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to update an order?', 'How easy was it to update an order?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'shop_order', 'pagenow' => 'shop_order',
@ -447,7 +447,7 @@ class CustomerEffortScoreTracks {
wc_enqueue_js( wc_enqueue_js(
$this->get_script_track_edit_php( $this->get_script_track_edit_php(
self::ADD_PRODUCT_CATEGORIES_ACTION_NAME, self::ADD_PRODUCT_CATEGORIES_ACTION_NAME,
__( 'How easy was it to add product category?', 'woocommerce-admin' ) __( 'How easy was it to add product category?', 'woocommerce' )
) )
); );
} }
@ -463,7 +463,7 @@ class CustomerEffortScoreTracks {
wc_enqueue_js( wc_enqueue_js(
$this->get_script_track_edit_php( $this->get_script_track_edit_php(
self::ADD_PRODUCT_TAGS_ACTION_NAME, self::ADD_PRODUCT_TAGS_ACTION_NAME,
__( 'How easy was it to add a product tag?', 'woocommerce-admin' ) __( 'How easy was it to add a product tag?', 'woocommerce' )
) )
); );
} }
@ -486,7 +486,7 @@ class CustomerEffortScoreTracks {
'action' => self::IMPORT_PRODUCTS_ACTION_NAME, 'action' => self::IMPORT_PRODUCTS_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to import products?', 'How easy was it to import products?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'product_page_product_importer', 'pagenow' => 'product_page_product_importer',
@ -521,7 +521,7 @@ class CustomerEffortScoreTracks {
'action' => self::SETTINGS_CHANGE_ACTION_NAME, 'action' => self::SETTINGS_CHANGE_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to update your settings?', 'How easy was it to update your settings?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'woocommerce_page_wc-settings', 'pagenow' => 'woocommerce_page_wc-settings',
@ -544,7 +544,7 @@ class CustomerEffortScoreTracks {
'action' => self::ADD_PRODUCT_ATTRIBUTES_ACTION_NAME, 'action' => self::ADD_PRODUCT_ATTRIBUTES_ACTION_NAME,
'label' => __( 'label' => __(
'How easy was it to add a product attribute?', 'How easy was it to add a product attribute?',
'woocommerce-admin' 'woocommerce'
), ),
'onsubmit_label' => $this->onsubmit_label, 'onsubmit_label' => $this->onsubmit_label,
'pagenow' => 'product_page_product_attributes', 'pagenow' => 'product_page_product_attributes',

View File

@ -245,7 +245,7 @@ class FeaturePlugin {
if ( ! $woocommerce_minimum_met ) { if ( ! $woocommerce_minimum_met ) {
$errors[] = sprintf( $errors[] = sprintf(
/* translators: 1: URL of WooCommerce plugin, 2: The minimum WooCommerce version number */ /* translators: 1: URL of WooCommerce plugin, 2: The minimum WooCommerce version number */
__( 'The WooCommerce Admin feature plugin requires <a href="%1$s">WooCommerce</a> %2$s or greater to be installed and active.', 'woocommerce-admin' ), __( 'The WooCommerce Admin feature plugin requires <a href="%1$s">WooCommerce</a> %2$s or greater to be installed and active.', 'woocommerce' ),
'https://wordpress.org/plugins/woocommerce/', 'https://wordpress.org/plugins/woocommerce/',
$minimum_woocommerce_version $minimum_woocommerce_version
); );
@ -254,7 +254,7 @@ class FeaturePlugin {
if ( ! $wordpress_minimum_met ) { if ( ! $wordpress_minimum_met ) {
$errors[] = sprintf( $errors[] = sprintf(
/* translators: 1: URL of WordPress.org, 2: The minimum WordPress version number */ /* translators: 1: URL of WordPress.org, 2: The minimum WordPress version number */
__( 'The WooCommerce Admin feature plugin requires <a href="%1$s">WordPress</a> %2$s or greater to be installed and active.', 'woocommerce-admin' ), __( 'The WooCommerce Admin feature plugin requires <a href="%1$s">WordPress</a> %2$s or greater to be installed and active.', 'woocommerce' ),
'https://wordpress.org/', 'https://wordpress.org/',
$minimum_wordpress_version $minimum_wordpress_version
); );

View File

@ -81,7 +81,7 @@ class Homescreen {
wc_admin_register_page( wc_admin_register_page(
array( array(
'id' => 'woocommerce-home', 'id' => 'woocommerce-home',
'title' => __( 'WooCommerce', 'woocommerce-admin' ), 'title' => __( 'WooCommerce', 'woocommerce' ),
'path' => self::MENU_SLUG, 'path' => self::MENU_SLUG,
'capability' => 'read', 'capability' => 'read',
) )
@ -92,7 +92,7 @@ class Homescreen {
wc_admin_register_page( wc_admin_register_page(
array( array(
'id' => 'woocommerce-home', 'id' => 'woocommerce-home',
'title' => __( 'Home', 'woocommerce-admin' ), 'title' => __( 'Home', 'woocommerce' ),
'parent' => 'woocommerce', 'parent' => 'woocommerce',
'path' => self::MENU_SLUG, 'path' => self::MENU_SLUG,
'order' => 0, 'order' => 0,

Some files were not shown because too many files have changed in this diff Show More