Merge branch 'ramiy-i18n/similar-strings'

This commit is contained in:
Claudio Sanches 2016-10-11 15:57:21 -03:00
commit dc87a07baa
56 changed files with 232 additions and 232 deletions

View File

@ -732,7 +732,7 @@ abstract class WC_Settings_API {
</select>
<?php echo $this->get_description_html( $data ); ?>
<?php if ( $data['select_buttons'] ) : ?>
<br/><a class="select_all button" href="#"><?php _e( 'Select all', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select none', 'woocommerce' ); ?></a>
<br/><a class="select_all button" href="#"><?php _e( 'Select All', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select None', 'woocommerce' ); ?></a>
<?php endif; ?>
</fieldset>
</td>

View File

@ -359,7 +359,7 @@ class WC_Admin_Post_Types {
if ( 'grouped' == $the_product->product_type ) {
echo '<span class="product-type tips grouped" data-tip="' . esc_attr__( 'Grouped', 'woocommerce' ) . '"></span>';
} elseif ( 'external' == $the_product->product_type ) {
echo '<span class="product-type tips external" data-tip="' . esc_attr__( 'External/Affiliate', 'woocommerce' ) . '"></span>';
echo '<span class="product-type tips external" data-tip="' . esc_attr__( 'External/Affiliate product', 'woocommerce' ) . '"></span>';
} elseif ( 'simple' == $the_product->product_type ) {
if ( $the_product->is_virtual() ) {
@ -682,7 +682,7 @@ class WC_Admin_Post_Types {
}
if ( $the_order->get_billing_phone() ) {
echo '<small class="meta">' . __( 'Tel:', 'woocommerce' ) . ' ' . esc_html( $the_order->get_billing_phone() ) . '</small>';
echo '<small class="meta">' . __( 'Phone:', 'woocommerce' ) . ' ' . esc_html( $the_order->get_billing_phone() ) . '</small>';
}
break;

View File

@ -41,11 +41,11 @@ class WC_Admin_Profile {
'title' => __( 'Customer Billing Address', 'woocommerce' ),
'fields' => array(
'billing_first_name' => array(
'label' => __( 'First name', 'woocommerce' ),
'label' => __( 'First Name', 'woocommerce' ),
'description' => '',
),
'billing_last_name' => array(
'label' => __( 'Last name', 'woocommerce' ),
'label' => __( 'Last Name', 'woocommerce' ),
'description' => '',
),
'billing_company' => array(
@ -65,7 +65,7 @@ class WC_Admin_Profile {
'description' => '',
),
'billing_postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'label' => __( 'Postcode / ZIP', 'woocommerce' ),
'description' => '',
),
'billing_country' => array(
@ -76,16 +76,16 @@ class WC_Admin_Profile {
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'billing_state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'description' => __( 'State/County or state code', 'woocommerce' ),
'label' => __( 'State / County', 'woocommerce' ),
'description' => __( 'State / County or state code', 'woocommerce' ),
'class' => 'js_field-state',
),
'billing_phone' => array(
'label' => __( 'Telephone', 'woocommerce' ),
'label' => __( 'Phone', 'woocommerce' ),
'description' => '',
),
'billing_email' => array(
'label' => __( 'Email', 'woocommerce' ),
'label' => __( 'Email Address', 'woocommerce' ),
'description' => '',
),
),
@ -94,11 +94,11 @@ class WC_Admin_Profile {
'title' => __( 'Customer Shipping Address', 'woocommerce' ),
'fields' => array(
'shipping_first_name' => array(
'label' => __( 'First name', 'woocommerce' ),
'label' => __( 'First Name', 'woocommerce' ),
'description' => '',
),
'shipping_last_name' => array(
'label' => __( 'Last name', 'woocommerce' ),
'label' => __( 'Last Name', 'woocommerce' ),
'description' => '',
),
'shipping_company' => array(
@ -118,7 +118,7 @@ class WC_Admin_Profile {
'description' => '',
),
'shipping_postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'label' => __( 'Postcode / ZIP', 'woocommerce' ),
'description' => '',
),
'shipping_country' => array(
@ -129,8 +129,8 @@ class WC_Admin_Profile {
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'shipping_state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'description' => __( 'State/County or state code', 'woocommerce' ),
'label' => __( 'State / County', 'woocommerce' ),
'description' => __( 'State / County or state code', 'woocommerce' ),
'class' => 'js_field-state',
),
),

View File

@ -602,7 +602,7 @@ class WC_Admin_Settings {
}
}
?>
</select> <?php echo ( $description ) ? $description : ''; ?> <br /><a class="select_all button" href="#"><?php _e( 'Select all', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select none', 'woocommerce' ); ?></a>
</select> <?php echo ( $description ) ? $description : ''; ?> <br /><a class="select_all button" href="#"><?php _e( 'Select All', 'woocommerce' ); ?></a> <a class="select_none button" href="#"><?php _e( 'Select None', 'woocommerce' ); ?></a>
</td>
</tr><?php
break;

View File

@ -64,7 +64,7 @@ class WC_Meta_Box_Order_Data {
'show' => false,
),
'postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'label' => __( 'Postcode / ZIP', 'woocommerce' ),
'show' => false,
),
'country' => array(
@ -75,12 +75,12 @@ class WC_Meta_Box_Order_Data {
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_allowed_countries(),
),
'state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'label' => __( 'State / County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false,
),
'email' => array(
'label' => __( 'Email', 'woocommerce' ),
'label' => __( 'Email Address', 'woocommerce' ),
),
'phone' => array(
'label' => __( 'Phone', 'woocommerce' ),
@ -113,7 +113,7 @@ class WC_Meta_Box_Order_Data {
'show' => false,
),
'postcode' => array(
'label' => __( 'Postcode', 'woocommerce' ),
'label' => __( 'Postcode / ZIP', 'woocommerce' ),
'show' => false,
),
'country' => array(
@ -124,7 +124,7 @@ class WC_Meta_Box_Order_Data {
'options' => array( '' => __( 'Select a country&hellip;', 'woocommerce' ) ) + WC()->countries->get_shipping_countries(),
),
'state' => array(
'label' => __( 'State/County', 'woocommerce' ),
'label' => __( 'State / County', 'woocommerce' ),
'class' => 'js_field-state select short',
'show' => false,
),

View File

@ -653,7 +653,7 @@ class WC_Meta_Box_Product_Data {
<div id="message" class="inline notice woocommerce-message">
<p><?php _e( 'Before you can add a variation you need to add some variation attributes on the <strong>Attributes</strong> tab.', 'woocommerce' ); ?></p>
<p>
<a class="button-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations' ) ); ?>" target="_blank"><?php _e( 'Learn more', 'woocommerce' ); ?></a>
<a class="button-primary" href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'https://docs.woocommerce.com/document/variable-product/', 'product-variations' ) ); ?>" target="_blank"><?php _e( 'Learn More', 'woocommerce' ); ?></a>
</p>
</div>

View File

@ -16,7 +16,7 @@ $who_refunded = new WP_User( $refund->get_refunded_by() );
echo esc_attr__( 'Refund', 'woocommerce' ) . ' #' . $refund->get_id() . ' - ' . esc_attr( date_i18n( get_option( 'date_format' ) . ', ' . get_option( 'time_format' ), $refund->get_date_created() ) );
if ( $who_refunded->exists() ) {
echo ' ' . esc_attr_x( 'by', 'Ex: Refund - $date >by< $username', 'woocommerce' ) . ' ' . '<abbr class="refund_by" title="' . esc_attr__( 'ID: ', 'woocommerce' ) . absint( $who_refunded->ID ) . '">' . esc_attr( $who_refunded->display_name ) . '</abbr>' ;
echo ' ' . esc_attr_x( 'by', 'Ex: Refund - $date >by< $username', 'woocommerce' ) . ' ' . '<abbr class="refund_by" title="' . sprintf( esc_attr__( 'ID: %d', 'woocommerce' ), absint( $who_refunded->ID ) ) . '">' . esc_attr( $who_refunded->display_name ) . '</abbr>' ;
}
?>
<?php if ( $refund->get_reason() ) : ?>

View File

@ -41,9 +41,9 @@
}
?>
</select>
<button class="button plus select_all_attributes"><?php _e( 'Select all', 'woocommerce' ); ?></button>
<button class="button minus select_no_attributes"><?php _e( 'Select none', 'woocommerce' ); ?></button>
<button class="button fr plus add_new_attribute"><?php _e( 'Add new', 'woocommerce' ); ?></button>
<button class="button plus select_all_attributes"><?php _e( 'Select All', 'woocommerce' ); ?></button>
<button class="button minus select_no_attributes"><?php _e( 'Select None', 'woocommerce' ); ?></button>
<button class="button fr plus add_new_attribute"><?php _e( 'Add New', 'woocommerce' ); ?></button>
<?php elseif ( 'text' == $attribute_taxonomy->attribute_type ) : ?>

View File

@ -230,7 +230,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
</div>
<script type="text/javascript">
jQuery(function(){
// Select all/none
// Select All/None
jQuery( '.chart-widget' ).on( 'click', '.select_all', function() {
jQuery(this).closest( 'div' ).find( 'select option' ).attr( 'selected', 'selected' );
jQuery(this).closest( 'div' ).find('select').change();

View File

@ -91,7 +91,7 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
),
array(
'title' => _x( 'Checkout Process', 'Settings group label', 'woocommerce' ),
'title' => __( 'Checkout Process', 'woocommerce' ),
'desc' => __( 'Enable guest checkout', 'woocommerce' ),
'desc_tip' => __( 'Allows customers to checkout without creating an account.', 'woocommerce' ),
'id' => 'woocommerce_enable_guest_checkout',

View File

@ -176,7 +176,7 @@ class WC_Settings_Tax extends WC_Settings_Page {
'csv_data_cols' => array(
__( 'Country Code', 'woocommerce' ),
__( 'State Code', 'woocommerce' ),
__( 'ZIP/Postcode', 'woocommerce' ),
__( 'Postcode / ZIP', 'woocommerce' ),
__( 'City', 'woocommerce' ),
__( 'Rate %', 'woocommerce' ),
__( 'Tax Name', 'woocommerce' ),

View File

@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr>
<th width="8%"><a href="https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes" target="_blank"><?php _e( 'Country&nbsp;Code', 'woocommerce' ); ?></a>&nbsp;<?php echo wc_help_tip( __( 'A 2 digit country code, e.g. US. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
<th width="8%"><?php _e( 'State&nbsp;Code', 'woocommerce' ); ?>&nbsp;<?php echo wc_help_tip( __( 'A 2 digit state code, e.g. AL. Leave blank to apply to all.', 'woocommerce' ) ); ?></th>
<th><?php _e( 'ZIP/Postcode', 'woocommerce' ); ?>&nbsp;<?php echo wc_help_tip( __( 'Postcode for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all areas. Wildcards (*) and ranges for numeric postcodes (e.g. 12345...12350) can also be used.', 'woocommerce' ) ); ?></th>
<th><?php _e( 'Postcode / ZIP', 'woocommerce' ); ?>&nbsp;<?php echo wc_help_tip( __( 'Postcode for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all areas. Wildcards (*) and ranges for numeric postcodes (e.g. 12345...12350) can also be used.', 'woocommerce' ) ); ?></th>
<th><?php _e( 'City', 'woocommerce' ); ?>&nbsp;<?php echo wc_help_tip( __( 'Cities for this rule. Semi-colon (;) separate multiple values. Leave blank to apply to all cities.', 'woocommerce' ) ); ?></th>
<th width="8%"><?php _e( 'Rate&nbsp;%', 'woocommerce' ); ?>&nbsp;<?php echo wc_help_tip( __( 'Enter a tax rate (percentage) to 4 decimal places.', 'woocommerce' ) ); ?></th>
<th width="8%"><?php _e( 'Tax&nbsp;Name', 'woocommerce' ); ?>&nbsp;<?php echo wc_help_tip( __( 'Enter a name for this tax rate.', 'woocommerce' ) ); ?></th>

View File

@ -538,7 +538,7 @@ class WC_REST_Authentication {
global $wc_rest_authentication_error;
if ( is_wp_error( $wc_rest_authentication_error ) && is_ssl() ) {
$auth_message = __( 'WooCommerce API - Use a consumer key in the username field and a consumer secret in the password field.', 'woocommerce' );
$auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field.', 'woocommerce' );
$response->header( 'WWW-Authenticate', 'Basic realm="' . $auth_message . '"', true );
}

View File

@ -716,12 +716,12 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
'context' => array( 'view', 'edit' ),
),
'address_1' => array(
'description' => __( 'Address line 1.', 'woocommerce' ),
'description' => __( 'Address 1', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'address_2' => array(
'description' => __( 'Address line 2.', 'woocommerce' ),
'description' => __( 'Address 2', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
@ -779,12 +779,12 @@ class WC_REST_Customers_Controller extends WC_REST_Controller {
'context' => array( 'view', 'edit' ),
),
'address_1' => array(
'description' => __( 'Address line 1.', 'woocommerce' ),
'description' => __( 'Address 1', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'address_2' => array(
'description' => __( 'Address line 2.', 'woocommerce' ),
'description' => __( 'Address 2', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),

View File

@ -903,12 +903,12 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
'context' => array( 'view', 'edit' ),
),
'address_1' => array(
'description' => __( 'Address line 1.', 'woocommerce' ),
'description' => __( 'Address 1', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'address_2' => array(
'description' => __( 'Address line 2.', 'woocommerce' ),
'description' => __( 'Address 2', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
@ -966,12 +966,12 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
'context' => array( 'view', 'edit' ),
),
'address_1' => array(
'description' => __( 'Address line 1.', 'woocommerce' ),
'description' => __( 'Address 1', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),
'address_2' => array(
'description' => __( 'Address line 2.', 'woocommerce' ),
'description' => __( 'Address 2', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),

View File

@ -634,11 +634,11 @@ class WC_REST_Product_Attributes_Controller extends WC_REST_Controller {
*/
protected function validate_attribute_slug( $slug, $new_data = true ) {
if ( strlen( $slug ) >= 28 ) {
return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max).', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max). Shorten it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
} elseif ( wc_check_if_attribute_name_is_reserved( $slug ) ) {
return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
} elseif ( $new_data && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) {
return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
}
return true;

View File

@ -581,7 +581,7 @@ class WC_REST_Taxes_Controller extends WC_REST_Controller {
'context' => array( 'view', 'edit' ),
),
'postcode' => array(
'description' => __( 'Postcode/ZIP.', 'woocommerce' ),
'description' => __( 'Postcode / ZIP.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
),

View File

@ -90,7 +90,7 @@ class WC_API_Authentication {
} else {
throw new Exception( __( 'Consumer Key is missing', 'woocommerce' ), 404 );
throw new Exception( __( 'Consumer Key is missing.', 'woocommerce' ), 404 );
}
// Get consumer secret
@ -106,13 +106,13 @@ class WC_API_Authentication {
} else {
throw new Exception( __( 'Consumer Secret is missing', 'woocommerce' ), 404 );
throw new Exception( __( 'Consumer Secret is missing.', 'woocommerce' ), 404 );
}
$keys = $this->get_keys_by_consumer_key( $consumer_key );
if ( ! $this->is_consumer_secret_valid( $keys['consumer_secret'], $consumer_secret ) ) {
throw new Exception( __( 'Consumer Secret is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Secret is invalid.', 'woocommerce' ), 401 );
}
return $keys;
@ -180,7 +180,7 @@ class WC_API_Authentication {
", $consumer_key ), ARRAY_A );
if ( empty( $keys ) ) {
throw new Exception( __( 'Consumer Key is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Key is invalid.', 'woocommerce' ), 401 );
}
return $keys;
@ -248,7 +248,7 @@ class WC_API_Authentication {
// Sort parameters
if ( ! uksort( $params, 'strcmp' ) ) {
throw new Exception( __( 'Invalid Signature - failed to sort parameters', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - failed to sort parameters.', 'woocommerce' ), 401 );
}
// Form query string
@ -262,7 +262,7 @@ class WC_API_Authentication {
$string_to_sign = $http_method . '&' . $base_request_uri . '&' . $query_string;
if ( 'HMAC-SHA1' !== $params['oauth_signature_method'] && 'HMAC-SHA256' !== $params['oauth_signature_method'] ) {
throw new Exception( __( 'Invalid Signature - signature method is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - signature method is invalid.', 'woocommerce' ), 401 );
}
$hash_algorithm = strtolower( str_replace( 'HMAC-', '', $params['oauth_signature_method'] ) );
@ -270,7 +270,7 @@ class WC_API_Authentication {
$signature = base64_encode( hash_hmac( $hash_algorithm, $string_to_sign, $keys['consumer_secret'], true ) );
if ( ! hash_equals( $signature, $consumer_signature ) ) {
throw new Exception( __( 'Invalid Signature - provided signature does not match', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - provided signature does not match.', 'woocommerce' ), 401 );
}
}
@ -328,7 +328,7 @@ class WC_API_Authentication {
$valid_window = 15 * 60; // 15 minute window
if ( ( $timestamp < time() - $valid_window ) || ( $timestamp > time() + $valid_window ) ) {
throw new Exception( __( 'Invalid timestamp', 'woocommerce' ) );
throw new Exception( __( 'Invalid timestamp.', 'woocommerce' ) );
}
$used_nonces = maybe_unserialize( $keys['nonces'] );
@ -338,7 +338,7 @@ class WC_API_Authentication {
}
if ( in_array( $nonce, $used_nonces ) ) {
throw new Exception( __( 'Invalid nonce - nonce has already been used', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid nonce - nonce has already been used.', 'woocommerce' ), 401 );
}
$used_nonces[ $timestamp ] = $nonce;
@ -373,7 +373,7 @@ class WC_API_Authentication {
case 'HEAD':
case 'GET':
if ( 'read' !== $key_permissions && 'read_write' !== $key_permissions ) {
throw new Exception( __( 'The API key provided does not have read permissions', 'woocommerce' ), 401 );
throw new Exception( __( 'The API key provided does not have read permissions.', 'woocommerce' ), 401 );
}
break;
@ -382,7 +382,7 @@ class WC_API_Authentication {
case 'PATCH':
case 'DELETE':
if ( 'write' !== $key_permissions && 'read_write' !== $key_permissions ) {
throw new Exception( __( 'The API key provided does not have write permissions', 'woocommerce' ), 401 );
throw new Exception( __( 'The API key provided does not have write permissions.', 'woocommerce' ), 401 );
}
break;
}

View File

@ -90,7 +90,7 @@ class WC_API_Authentication {
} else {
throw new Exception( __( 'Consumer Key is missing', 'woocommerce' ), 404 );
throw new Exception( __( 'Consumer Key is missing.', 'woocommerce' ), 404 );
}
// Get consumer secret
@ -106,13 +106,13 @@ class WC_API_Authentication {
} else {
throw new Exception( __( 'Consumer Secret is missing', 'woocommerce' ), 404 );
throw new Exception( __( 'Consumer Secret is missing.', 'woocommerce' ), 404 );
}
$keys = $this->get_keys_by_consumer_key( $consumer_key );
if ( ! $this->is_consumer_secret_valid( $keys['consumer_secret'], $consumer_secret ) ) {
throw new Exception( __( 'Consumer Secret is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Secret is invalid.', 'woocommerce' ), 401 );
}
return $keys;
@ -180,7 +180,7 @@ class WC_API_Authentication {
", $consumer_key ), ARRAY_A );
if ( empty( $keys ) ) {
throw new Exception( __( 'Consumer Key is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Key is invalid.', 'woocommerce' ), 401 );
}
return $keys;
@ -248,7 +248,7 @@ class WC_API_Authentication {
// Sort parameters
if ( ! uksort( $params, 'strcmp' ) ) {
throw new Exception( __( 'Invalid Signature - failed to sort parameters', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - failed to sort parameters.', 'woocommerce' ), 401 );
}
// Form query string
@ -262,7 +262,7 @@ class WC_API_Authentication {
$string_to_sign = $http_method . '&' . $base_request_uri . '&' . $query_string;
if ( 'HMAC-SHA1' !== $params['oauth_signature_method'] && 'HMAC-SHA256' !== $params['oauth_signature_method'] ) {
throw new Exception( __( 'Invalid Signature - signature method is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - signature method is invalid.', 'woocommerce' ), 401 );
}
$hash_algorithm = strtolower( str_replace( 'HMAC-', '', $params['oauth_signature_method'] ) );
@ -270,7 +270,7 @@ class WC_API_Authentication {
$signature = base64_encode( hash_hmac( $hash_algorithm, $string_to_sign, $keys['consumer_secret'], true ) );
if ( ! hash_equals( $signature, $consumer_signature ) ) {
throw new Exception( __( 'Invalid Signature - provided signature does not match', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - provided signature does not match.', 'woocommerce' ), 401 );
}
}
@ -328,7 +328,7 @@ class WC_API_Authentication {
$valid_window = 15 * 60; // 15 minute window
if ( ( $timestamp < time() - $valid_window ) || ( $timestamp > time() + $valid_window ) ) {
throw new Exception( __( 'Invalid timestamp', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid timestamp.', 'woocommerce' ), 401 );
}
$used_nonces = maybe_unserialize( $keys['nonces'] );
@ -338,7 +338,7 @@ class WC_API_Authentication {
}
if ( in_array( $nonce, $used_nonces ) ) {
throw new Exception( __( 'Invalid nonce - nonce has already been used', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid nonce - nonce has already been used.', 'woocommerce' ), 401 );
}
$used_nonces[ $timestamp ] = $nonce;
@ -373,7 +373,7 @@ class WC_API_Authentication {
case 'HEAD':
case 'GET':
if ( 'read' !== $key_permissions && 'read_write' !== $key_permissions ) {
throw new Exception( __( 'The API key provided does not have read permissions', 'woocommerce' ), 401 );
throw new Exception( __( 'The API key provided does not have read permissions.', 'woocommerce' ), 401 );
}
break;
@ -382,7 +382,7 @@ class WC_API_Authentication {
case 'PATCH':
case 'DELETE':
if ( 'write' !== $key_permissions && 'read_write' !== $key_permissions ) {
throw new Exception( __( 'The API key provided does not have write permissions', 'woocommerce' ), 401 );
throw new Exception( __( 'The API key provided does not have write permissions.', 'woocommerce' ), 401 );
}
break;
}

View File

@ -512,7 +512,7 @@ class WC_API_Coupons extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_coupons_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_coupons_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$coupons = array();

View File

@ -796,7 +796,7 @@ class WC_API_Customers extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_customers_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_customers_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$customers = array();

View File

@ -385,7 +385,7 @@ class WC_API_Orders extends WC_API_Resource {
// make sure customer exists
if ( false === get_user_by( 'id', $data['customer_id'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 );
}
$default_order_args['customer_id'] = $data['customer_id'];
@ -445,7 +445,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( isset( $data['currency'] ) ) {
if ( ! array_key_exists( $data['currency'], get_woocommerce_currencies() ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid.', 'woocommerce' ), 400 );
}
update_post_meta( $order->get_id(), '_order_currency', $data['currency'] );
@ -531,7 +531,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( isset( $data['customer_id'] ) && $data['customer_id'] != $order->get_user_id() ) {
// Make sure customer exists.
if ( false === get_user_by( 'id', $data['customer_id'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 );
}
update_post_meta( $order->get_id(), '_customer_user', $data['customer_id'] );
@ -596,7 +596,7 @@ class WC_API_Orders extends WC_API_Resource {
// Set order currency.
if ( isset( $data['currency'] ) ) {
if ( ! array_key_exists( $data['currency'], get_woocommerce_currencies() ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid.', 'woocommerce' ), 400 );
}
update_post_meta( $order->get_id(), '_order_currency', $data['currency'] );
@ -837,7 +837,7 @@ class WC_API_Orders extends WC_API_Resource {
) );
if ( is_null( $result ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID provided is not associated with order', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce' ), 400 );
}
}
@ -893,17 +893,17 @@ class WC_API_Orders extends WC_API_Resource {
// must be a valid WC_Product
if ( ! is_object( $product ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product', __( 'Product is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product', __( 'Product is invalid.', 'woocommerce' ), 400 );
}
// quantity must be positive float
if ( isset( $item['quantity'] ) && floatval( $item['quantity'] ) <= 0 ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity must be a positive float', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity must be a positive float.', 'woocommerce' ), 400 );
}
// quantity is required when creating
if ( $creating && ! isset( $item['quantity'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity is required.', 'woocommerce' ), 400 );
}
if ( $creating ) {
@ -938,7 +938,7 @@ class WC_API_Orders extends WC_API_Resource {
$item_id = $item->save();
if ( ! $item_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again.', 'woocommerce' ), 500 );
}
}
@ -1005,14 +1005,14 @@ class WC_API_Orders extends WC_API_Resource {
// total must be a positive float
if ( isset( $shipping['total'] ) && floatval( $shipping['total'] ) < 0 ) {
throw new WC_API_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount.', 'woocommerce' ), 400 );
}
if ( 'create' === $action ) {
// method ID is required
if ( ! isset( $shipping['method_id'] ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_shipping_item', __( 'Shipping method ID is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce' ), 400 );
}
$rate = new WC_Shipping_Rate( $shipping['method_id'], isset( $shipping['method_title'] ) ? $shipping['method_title'] : '', isset( $shipping['total'] ) ? floatval( $shipping['total'] ) : 0, array(), $shipping['method_id'] );
@ -1021,7 +1021,7 @@ class WC_API_Orders extends WC_API_Resource {
$shipping_id = $item->save();
if ( ! $shipping_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_shipping', __( 'Cannot create shipping method, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_shipping', __( 'Cannot create shipping method, try again.', 'woocommerce' ), 500 );
}
} else {
@ -1042,7 +1042,7 @@ class WC_API_Orders extends WC_API_Resource {
$shipping_id = $item->save();
if ( ! $shipping_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_update_shipping', __( 'Cannot update shipping method, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_update_shipping', __( 'Cannot update shipping method, try again.', 'woocommerce' ), 500 );
}
}
}
@ -1072,7 +1072,7 @@ class WC_API_Orders extends WC_API_Resource {
// if taxable, tax class and total are required
if ( ! empty( $fee['taxable'] ) ) {
if ( ! isset( $fee['tax_class'] ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable.', 'woocommerce' ), 400 );
}
$item->set_tax_status( 'taxable' );
@ -1091,7 +1091,7 @@ class WC_API_Orders extends WC_API_Resource {
$fee_id = $item->save();
if ( ! $fee_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again.', 'woocommerce' ), 500 );
}
} else {
@ -1116,7 +1116,7 @@ class WC_API_Orders extends WC_API_Resource {
$fee_id = $item->save();
if ( ! $fee_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again.', 'woocommerce' ), 500 );
}
}
}
@ -1134,14 +1134,14 @@ class WC_API_Orders extends WC_API_Resource {
// coupon amount must be positive float
if ( isset( $coupon['amount'] ) && floatval( $coupon['amount'] ) < 0 ) {
throw new WC_API_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount.', 'woocommerce' ), 400 );
}
if ( 'create' === $action ) {
// coupon code is required
if ( empty( $coupon['code'] ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_coupon_coupon', __( 'Coupon code is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce' ), 400 );
}
$item = new WC_Order_Item_Coupon( array(
@ -1153,7 +1153,7 @@ class WC_API_Orders extends WC_API_Resource {
$coupon_id = $item->save();
if ( ! $coupon_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_order_coupon', __( 'Cannot create coupon, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_order_coupon', __( 'Cannot create coupon, try again.', 'woocommerce' ), 500 );
}
} else {
@ -1170,7 +1170,7 @@ class WC_API_Orders extends WC_API_Resource {
$coupon_id = $item->save();
if ( ! $coupon_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_update_order_coupon', __( 'Cannot update coupon, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_update_order_coupon', __( 'Cannot update coupon, try again.', 'woocommerce' ), 500 );
}
}
}
@ -1299,7 +1299,7 @@ class WC_API_Orders extends WC_API_Resource {
$note_id = $order->add_order_note( $data['note'], $is_customer_note );
if ( ! $note_id ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce' ), 500 );
}
// HTTP 201 Created
@ -1491,14 +1491,14 @@ class WC_API_Orders extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 400 );
}
$order = wc_get_order( $order_id );
$refund = wc_get_order( $id );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found.', 'woocommerce' ), 404 );
}
$line_items = array();
@ -1578,9 +1578,9 @@ class WC_API_Orders extends WC_API_Resource {
// Refund amount is required
if ( ! isset( $data['amount'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount is required.', 'woocommerce' ), 400 );
} elseif ( 0 > $data['amount'] ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount must be positive', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount must be positive.', 'woocommerce' ), 400 );
}
$data['order_id'] = $order_id;
@ -1590,7 +1590,7 @@ class WC_API_Orders extends WC_API_Resource {
$refund = wc_create_refund( $data );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_refund', __( 'Cannot create order refund, please try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 );
}
// Refund via API
@ -1607,7 +1607,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( is_wp_error( $result ) ) {
return $result;
} elseif ( ! $result ) {
throw new WC_API_Exception( 'woocommerce_api_create_order_refund_api_failed', __( 'An error occurred while attempting to create the refund using the payment gateway API', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_api_create_order_refund_api_failed', __( 'An error occurred while attempting to create the refund using the payment gateway API.', 'woocommerce' ), 500 );
}
}
}
@ -1653,19 +1653,19 @@ class WC_API_Orders extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 400 );
}
// Ensure order ID is valid
$refund = get_post( $id );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found.', 'woocommerce' ), 404 );
}
// Ensure refund ID is associated with given order
if ( $refund->post_parent != $order_id ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order.', 'woocommerce' ), 400 );
}
$data = apply_filters( 'woocommerce_api_edit_order_refund_data', $data, $refund->ID, $order_id, $this );
@ -1714,19 +1714,19 @@ class WC_API_Orders extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 400 );
}
// Ensure refund ID is valid
$refund = get_post( $id );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found.', 'woocommerce' ), 404 );
}
// Ensure refund ID is associated with given order
if ( $refund->post_parent != $order_id ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order.', 'woocommerce' ), 400 );
}
wc_delete_shop_order_transients( $order_id );
@ -1760,7 +1760,7 @@ class WC_API_Orders extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_orders_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_orders_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$orders = array();

View File

@ -878,7 +878,7 @@ class WC_API_Products extends WC_API_Resource {
if ( ! empty( $new_sku ) ) {
$unique_sku = wc_product_has_unique_sku( $product_id, $new_sku );
if ( ! $unique_sku ) {
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product.', 'woocommerce' ), 400 );
} else {
update_post_meta( $product_id, '_sku', $new_sku );
}
@ -1305,7 +1305,7 @@ class WC_API_Products extends WC_API_Resource {
if ( ! empty( $new_sku ) ) {
$unique_sku = wc_product_has_unique_sku( $variation_id, $new_sku );
if ( ! $unique_sku ) {
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product.', 'woocommerce' ), 400 );
} else {
update_post_meta( $variation_id, '_sku', $new_sku );
}
@ -1806,7 +1806,7 @@ class WC_API_Products extends WC_API_Resource {
// Check parsed URL
if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_image', sprintf( __( 'Invalid URL %s', 'woocommerce' ), $image_url ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product_image', sprintf( __( 'Invalid URL %s.', 'woocommerce' ), $image_url ), 400 );
}
// Ensure url is valid
@ -1858,7 +1858,7 @@ class WC_API_Products extends WC_API_Resource {
if ( 0 == $filesize ) {
@unlink( $upload['file'] );
unset( $upload );
throw new WC_API_Exception( 'woocommerce_api_product_image_upload_file_error', __( 'Zero size file downloaded', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_product_image_upload_file_error', __( 'Zero size file downloaded.', 'woocommerce' ), 400 );
}
unset( $response );
@ -2396,7 +2396,7 @@ class WC_API_Products extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_products_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_products_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$products = array();

View File

@ -173,14 +173,14 @@ class WC_API_Webhooks extends WC_API_Resource {
// permission check
if ( ! current_user_can( 'publish_shop_webhooks' ) ) {
throw new WC_API_Exception( 'woocommerce_api_user_cannot_create_webhooks', __( 'You do not have permission to create webhooks', 'woocommerce' ), 401 );
throw new WC_API_Exception( 'woocommerce_api_user_cannot_create_webhooks', __( 'You do not have permission to create webhooks.', 'woocommerce' ), 401 );
}
$data = apply_filters( 'woocommerce_api_create_webhook_data', $data, $this );
// validate topic
if ( empty( $data['topic'] ) || ! wc_is_webhook_valid_topic( strtolower( $data['topic'] ) ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic is required and must be valid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic is required and must be valid.', 'woocommerce' ), 400 );
}
// validate delivery URL
@ -267,7 +267,7 @@ class WC_API_Webhooks extends WC_API_Resource {
$webhook->set_topic( $data['topic'] );
} else {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic must be valid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic must be valid.', 'woocommerce' ), 400 );
}
}
@ -436,7 +436,7 @@ class WC_API_Webhooks extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery ID', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery ID.', 'woocommerce' ), 404 );
}
$webhook = new WC_Webhook( $webhook_id );
@ -444,7 +444,7 @@ class WC_API_Webhooks extends WC_API_Resource {
$log = $webhook->get_delivery_log( $id );
if ( ! $log ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery.', 'woocommerce' ), 400 );
}
$delivery_log = $log;

View File

@ -80,7 +80,7 @@ class WC_API_Authentication {
$keys = $this->get_keys_by_consumer_key( $params['consumer_key'] );
if ( ! $this->is_consumer_secret_valid( $keys['consumer_secret'], $params['consumer_secret'] ) ) {
throw new Exception( __( 'Consumer Secret is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Secret is invalid.', 'woocommerce' ), 401 );
}
return $keys;
@ -108,10 +108,10 @@ class WC_API_Authentication {
* @since 2.4
*/
private function exit_with_unauthorized_headers() {
$auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field', 'woocommerce' );
$auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field.', 'woocommerce' );
header( 'WWW-Authenticate: Basic realm="' . $auth_message . '"' );
header( 'HTTP/1.0 401 Unauthorized' );
throw new Exception( __( 'Consumer Secret is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Secret is invalid.', 'woocommerce' ), 401 );
}
/**
@ -176,7 +176,7 @@ class WC_API_Authentication {
", $consumer_key ), ARRAY_A );
if ( empty( $keys ) ) {
throw new Exception( __( 'Consumer Key is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Consumer Key is invalid.', 'woocommerce' ), 401 );
}
return $keys;
@ -238,7 +238,7 @@ class WC_API_Authentication {
// Sort parameters
if ( ! uksort( $params, 'strcmp' ) ) {
throw new Exception( __( 'Invalid Signature - failed to sort parameters', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - failed to sort parameters.', 'woocommerce' ), 401 );
}
// Normalize parameter key/values
@ -258,7 +258,7 @@ class WC_API_Authentication {
$string_to_sign = $http_method . '&' . $base_request_uri . '&' . $query_string;
if ( 'HMAC-SHA1' !== $params['oauth_signature_method'] && 'HMAC-SHA256' !== $params['oauth_signature_method'] ) {
throw new Exception( __( 'Invalid Signature - signature method is invalid', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - signature method is invalid.', 'woocommerce' ), 401 );
}
$hash_algorithm = strtolower( str_replace( 'HMAC-', '', $params['oauth_signature_method'] ) );
@ -267,7 +267,7 @@ class WC_API_Authentication {
$signature = base64_encode( hash_hmac( $hash_algorithm, $string_to_sign, $secret, true ) );
if ( ! hash_equals( $signature, $consumer_signature ) ) {
throw new Exception( __( 'Invalid Signature - provided signature does not match', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid Signature - provided signature does not match.', 'woocommerce' ), 401 );
}
}
@ -332,7 +332,7 @@ class WC_API_Authentication {
$valid_window = 15 * 60; // 15 minute window
if ( ( $timestamp < time() - $valid_window ) || ( $timestamp > time() + $valid_window ) ) {
throw new Exception( __( 'Invalid timestamp', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid timestamp.', 'woocommerce' ), 401 );
}
$used_nonces = maybe_unserialize( $keys['nonces'] );
@ -342,7 +342,7 @@ class WC_API_Authentication {
}
if ( in_array( $nonce, $used_nonces ) ) {
throw new Exception( __( 'Invalid nonce - nonce has already been used', 'woocommerce' ), 401 );
throw new Exception( __( 'Invalid nonce - nonce has already been used.', 'woocommerce' ), 401 );
}
$used_nonces[ $timestamp ] = $nonce;
@ -377,7 +377,7 @@ class WC_API_Authentication {
case 'HEAD':
case 'GET':
if ( 'read' !== $key_permissions && 'read_write' !== $key_permissions ) {
throw new Exception( __( 'The API key provided does not have read permissions', 'woocommerce' ), 401 );
throw new Exception( __( 'The API key provided does not have read permissions.', 'woocommerce' ), 401 );
}
break;
@ -386,7 +386,7 @@ class WC_API_Authentication {
case 'PATCH':
case 'DELETE':
if ( 'write' !== $key_permissions && 'read_write' !== $key_permissions ) {
throw new Exception( __( 'The API key provided does not have write permissions', 'woocommerce' ), 401 );
throw new Exception( __( 'The API key provided does not have write permissions.', 'woocommerce' ), 401 );
}
break;
}

View File

@ -512,7 +512,7 @@ class WC_API_Coupons extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_coupons_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_coupons_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$coupons = array();

View File

@ -785,7 +785,7 @@ class WC_API_Customers extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_customers_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_customers_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$customers = array();

View File

@ -421,7 +421,7 @@ class WC_API_Orders extends WC_API_Resource {
// make sure customer exists
if ( false === get_user_by( 'id', $data['customer_id'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 );
}
$default_order_args['customer_id'] = $data['customer_id'];
@ -486,7 +486,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( isset( $data['currency'] ) ) {
if ( ! array_key_exists( $data['currency'], get_woocommerce_currencies() ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid.', 'woocommerce' ), 400 );
}
update_post_meta( $order->get_id(), '_order_currency', $data['currency'] );
@ -572,7 +572,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( isset( $data['customer_id'] ) && $data['customer_id'] != $order->get_user_id() ) {
// Make sure customer exists.
if ( false === get_user_by( 'id', $data['customer_id'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ), 400 );
}
update_post_meta( $order->get_id(), '_customer_user', $data['customer_id'] );
@ -636,7 +636,7 @@ class WC_API_Orders extends WC_API_Resource {
// Set order currency.
if ( isset( $data['currency'] ) ) {
if ( ! array_key_exists( $data['currency'], get_woocommerce_currencies() ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid.', 'woocommerce' ), 400 );
}
update_post_meta( $order->get_id(), '_order_currency', $data['currency'] );
@ -884,7 +884,7 @@ class WC_API_Orders extends WC_API_Resource {
) );
if ( is_null( $result ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID provided is not associated with order', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce' ), 400 );
}
}
@ -940,17 +940,17 @@ class WC_API_Orders extends WC_API_Resource {
// must be a valid WC_Product
if ( ! is_object( $product ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product', __( 'Product is invalid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product', __( 'Product is invalid.', 'woocommerce' ), 400 );
}
// quantity must be positive float
if ( isset( $item['quantity'] ) && floatval( $item['quantity'] ) <= 0 ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity must be a positive float', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity must be a positive float.', 'woocommerce' ), 400 );
}
// quantity is required when creating
if ( $creating && ! isset( $item['quantity'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_product_quantity', __( 'Product quantity is required.', 'woocommerce' ), 400 );
}
// quantity
@ -1050,14 +1050,14 @@ class WC_API_Orders extends WC_API_Resource {
// total must be a positive float
if ( isset( $shipping['total'] ) && floatval( $shipping['total'] ) < 0 ) {
throw new WC_API_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount.', 'woocommerce' ), 400 );
}
if ( 'create' === $action ) {
// method ID is required
if ( ! isset( $shipping['method_id'] ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_shipping_item', __( 'Shipping method ID is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce' ), 400 );
}
$rate = new WC_Shipping_Rate( $shipping['method_id'], isset( $shipping['method_title'] ) ? $shipping['method_title'] : '', isset( $shipping['total'] ) ? floatval( $shipping['total'] ) : 0, array(), $shipping['method_id'] );
@ -1066,7 +1066,7 @@ class WC_API_Orders extends WC_API_Resource {
$shipping_id = $item->save();
if ( ! $shipping_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_shipping', __( 'Cannot create shipping method, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_shipping', __( 'Cannot create shipping method, try again.', 'woocommerce' ), 500 );
}
} else {
@ -1087,7 +1087,7 @@ class WC_API_Orders extends WC_API_Resource {
$shipping_id = $item->save();
if ( ! $shipping_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_update_shipping', __( 'Cannot update shipping method, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_update_shipping', __( 'Cannot update shipping method, try again.', 'woocommerce' ), 500 );
}
}
}
@ -1117,7 +1117,7 @@ class WC_API_Orders extends WC_API_Resource {
// if taxable, tax class and total are required
if ( ! empty( $fee['taxable'] ) ) {
if ( ! isset( $fee['tax_class'] ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable.', 'woocommerce' ), 400 );
}
$item->set_tax_status( 'taxable' );
@ -1136,7 +1136,7 @@ class WC_API_Orders extends WC_API_Resource {
$fee_id = $item->save();
if ( ! $fee_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again.', 'woocommerce' ), 500 );
}
} else {
@ -1161,7 +1161,7 @@ class WC_API_Orders extends WC_API_Resource {
$fee_id = $item->save();
if ( ! $fee_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again.', 'woocommerce' ), 500 );
}
}
}
@ -1179,14 +1179,14 @@ class WC_API_Orders extends WC_API_Resource {
// coupon amount must be positive float
if ( isset( $coupon['amount'] ) && floatval( $coupon['amount'] ) < 0 ) {
throw new WC_API_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount.', 'woocommerce' ), 400 );
}
if ( 'create' === $action ) {
// coupon code is required
if ( empty( $coupon['code'] ) ) {
throw new WC_API_Exception( 'woocommerce_invalid_coupon_coupon', __( 'Coupon code is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce' ), 400 );
}
$item = new WC_Order_Item_Coupon( array(
@ -1198,7 +1198,7 @@ class WC_API_Orders extends WC_API_Resource {
$coupon_id = $item->save();
if ( ! $coupon_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_create_order_coupon', __( 'Cannot create coupon, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_create_order_coupon', __( 'Cannot create coupon, try again.', 'woocommerce' ), 500 );
}
} else {
@ -1215,7 +1215,7 @@ class WC_API_Orders extends WC_API_Resource {
$coupon_id = $item->save();
if ( ! $coupon_id ) {
throw new WC_API_Exception( 'woocommerce_cannot_update_order_coupon', __( 'Cannot update coupon, try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_cannot_update_order_coupon', __( 'Cannot update coupon, try again.', 'woocommerce' ), 500 );
}
}
}
@ -1344,7 +1344,7 @@ class WC_API_Orders extends WC_API_Resource {
$note_id = $order->add_order_note( $data['note'], $is_customer_note );
if ( ! $note_id ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_note', __( 'Cannot create order note, please try again.', 'woocommerce' ), 500 );
}
// HTTP 201 Created
@ -1536,14 +1536,14 @@ class WC_API_Orders extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 400 );
}
$order = wc_get_order( $order_id );
$refund = wc_get_order( $id );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found.', 'woocommerce' ), 404 );
}
$line_items = array();
@ -1623,9 +1623,9 @@ class WC_API_Orders extends WC_API_Resource {
// Refund amount is required
if ( ! isset( $data['amount'] ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount is required', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount is required.', 'woocommerce' ), 400 );
} elseif ( 0 > $data['amount'] ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount must be positive', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund', __( 'Refund amount must be positive.', 'woocommerce' ), 400 );
}
$data['order_id'] = $order_id;
@ -1635,7 +1635,7 @@ class WC_API_Orders extends WC_API_Resource {
$refund = wc_create_refund( $data );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_refund', __( 'Cannot create order refund, please try again', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_api_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 );
}
// Refund via API
@ -1652,7 +1652,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( is_wp_error( $result ) ) {
return $result;
} elseif ( ! $result ) {
throw new WC_API_Exception( 'woocommerce_api_create_order_refund_api_failed', __( 'An error occurred while attempting to create the refund using the payment gateway API', 'woocommerce' ), 500 );
throw new WC_API_Exception( 'woocommerce_api_create_order_refund_api_failed', __( 'An error occurred while attempting to create the refund using the payment gateway API.', 'woocommerce' ), 500 );
}
}
}
@ -1698,19 +1698,19 @@ class WC_API_Orders extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 400 );
}
// Ensure order ID is valid
$refund = get_post( $id );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found.', 'woocommerce' ), 404 );
}
// Ensure refund ID is associated with given order
if ( $refund->post_parent != $order_id ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order.', 'woocommerce' ), 400 );
}
$data = apply_filters( 'woocommerce_api_edit_order_refund_data', $data, $refund->ID, $order_id, $this );
@ -1759,19 +1759,19 @@ class WC_API_Orders extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'Invalid order refund ID.', 'woocommerce' ), 400 );
}
// Ensure refund ID is valid
$refund = get_post( $id );
if ( ! $refund ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'An order refund with the provided ID could not be found.', 'woocommerce' ), 404 );
}
// Ensure refund ID is associated with given order
if ( $refund->post_parent != $order_id ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_order_refund_id', __( 'The order refund ID provided is not associated with the order.', 'woocommerce' ), 400 );
}
wc_delete_shop_order_transients( $order_id );
@ -1805,7 +1805,7 @@ class WC_API_Orders extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_orders_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_orders_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$orders = array();

View File

@ -1363,7 +1363,7 @@ class WC_API_Products extends WC_API_Resource {
if ( ! empty( $new_sku ) ) {
$unique_sku = wc_product_has_unique_sku( $product_id, $new_sku );
if ( ! $unique_sku ) {
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product.', 'woocommerce' ), 400 );
} else {
update_post_meta( $product_id, '_sku', $new_sku );
}
@ -1800,7 +1800,7 @@ class WC_API_Products extends WC_API_Resource {
if ( ! empty( $new_sku ) ) {
$unique_sku = wc_product_has_unique_sku( $variation_id, $new_sku );
if ( ! $unique_sku ) {
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_product_sku_already_exists', __( 'The SKU already exists on another product.', 'woocommerce' ), 400 );
} else {
update_post_meta( $variation_id, '_sku', $new_sku );
}
@ -2362,7 +2362,7 @@ class WC_API_Products extends WC_API_Resource {
// Check parsed URL.
if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_' . $upload_for, sprintf( __( 'Invalid URL %s', 'woocommerce' ), $image_url ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_' . $upload_for, sprintf( __( 'Invalid URL %s.', 'woocommerce' ), $image_url ), 400 );
}
// Ensure url is valid.
@ -2414,7 +2414,7 @@ class WC_API_Products extends WC_API_Resource {
if ( 0 == $filesize ) {
@unlink( $upload['file'] );
unset( $upload );
throw new WC_API_Exception( 'woocommerce_api_' . $upload_for . '_upload_file_error', __( 'Zero size file downloaded', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_' . $upload_for . '_upload_file_error', __( 'Zero size file downloaded.', 'woocommerce' ), 400 );
}
unset( $response );
@ -3224,7 +3224,7 @@ class WC_API_Products extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_products_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_products_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$products = array();

View File

@ -462,7 +462,7 @@ class WC_API_Taxes extends WC_API_Resource {
// Limit bulk operation
if ( count( $data ) > $limit ) {
throw new WC_API_Exception( 'woocommerce_api_taxes_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request', 'woocommerce' ), $limit ), 413 );
throw new WC_API_Exception( 'woocommerce_api_taxes_request_entity_too_large', sprintf( __( 'Unable to accept more than %s items for this request.', 'woocommerce' ), $limit ), 413 );
}
$taxes = array();

View File

@ -173,14 +173,14 @@ class WC_API_Webhooks extends WC_API_Resource {
// permission check
if ( ! current_user_can( 'publish_shop_webhooks' ) ) {
throw new WC_API_Exception( 'woocommerce_api_user_cannot_create_webhooks', __( 'You do not have permission to create webhooks', 'woocommerce' ), 401 );
throw new WC_API_Exception( 'woocommerce_api_user_cannot_create_webhooks', __( 'You do not have permission to create webhooks.', 'woocommerce' ), 401 );
}
$data = apply_filters( 'woocommerce_api_create_webhook_data', $data, $this );
// validate topic
if ( empty( $data['topic'] ) || ! wc_is_webhook_valid_topic( strtolower( $data['topic'] ) ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic is required and must be valid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic is required and must be valid.', 'woocommerce' ), 400 );
}
// validate delivery URL
@ -267,7 +267,7 @@ class WC_API_Webhooks extends WC_API_Resource {
$webhook->set_topic( $data['topic'] );
} else {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic must be valid', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_topic', __( 'Webhook topic must be valid.', 'woocommerce' ), 400 );
}
}
@ -439,7 +439,7 @@ class WC_API_Webhooks extends WC_API_Resource {
$id = absint( $id );
if ( empty( $id ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery ID', 'woocommerce' ), 404 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery ID.', 'woocommerce' ), 404 );
}
$webhook = new WC_Webhook( $webhook_id );
@ -447,7 +447,7 @@ class WC_API_Webhooks extends WC_API_Resource {
$log = $webhook->get_delivery_log( $id );
if ( ! $log ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery', 'woocommerce' ), 400 );
throw new WC_API_Exception( 'woocommerce_api_invalid_webhook_delivery_id', __( 'Invalid webhook delivery.', 'woocommerce' ), 400 );
}
$delivery_log = $log;

View File

@ -372,7 +372,7 @@ class WC_Auth {
} catch ( Exception $e ) {
$this->maybe_delete_key( $consumer_data );
wp_die( sprintf( __( 'Error: %s', 'woocommerce' ), $e->getMessage() ), __( 'Access Denied', 'woocommerce' ), array( 'response' => 401 ) );
wp_die( sprintf( __( 'Error: %s.', 'woocommerce' ), $e->getMessage() ), __( 'Access Denied', 'woocommerce' ), array( 'response' => 401 ) );
}
}

View File

@ -490,7 +490,7 @@ class WC_Checkout {
$this->posted[ $key ] = strtoupper( str_replace( ' ', '', $this->posted[ $key ] ) );
if ( ! WC_Validation::is_postcode( $this->posted[ $key ], $_POST[ $fieldset_key . '_country' ] ) ) {
wc_add_notice( __( 'Please enter a valid postcode/ZIP.', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Please enter a valid postcode / ZIP.', 'woocommerce' ), 'error' );
} else {
$this->posted[ $key ] = wc_format_postcode( $this->posted[ $key ], $_POST[ $fieldset_key . '_country' ] );
}

View File

@ -459,14 +459,14 @@ class WC_Emails {
if ( $order->get_billing_email() ) {
$fields['billing_email'] = array(
'label' => __( 'Email', 'woocommerce' ),
'label' => __( 'Email Address', 'woocommerce' ),
'value' => wptexturize( $order->get_billing_email() ),
);
}
if ( $order->get_billing_phone() ) {
$fields['billing_phone'] = array(
'label' => __( 'Tel', 'woocommerce' ),
'label' => __( 'Phone', 'woocommerce' ),
'value' => wptexturize( $order->get_billing_phone() ),
);
}

View File

@ -111,7 +111,7 @@ class WC_Form_Handler {
$_POST[ $key ] = strtoupper( str_replace( ' ', '', $_POST[ $key ] ) );
if ( ! WC_Validation::is_postcode( $_POST[ $key ], $_POST[ $load_address . '_country' ] ) ) {
wc_add_notice( __( 'Please enter a valid postcode/ZIP.', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Please enter a valid postcode / ZIP.', 'woocommerce' ), 'error' );
} else {
$_POST[ $key ] = wc_format_postcode( $_POST[ $key ], $_POST[ $load_address . '_country' ] );
}
@ -194,7 +194,7 @@ class WC_Form_Handler {
$required_fields = apply_filters( 'woocommerce_save_account_details_required_fields', array(
'account_first_name' => __( 'First Name', 'woocommerce' ),
'account_last_name' => __( 'Last Name', 'woocommerce' ),
'account_email' => __( 'Email address', 'woocommerce' ),
'account_email' => __( 'Email Address', 'woocommerce' ),
) );
foreach ( $required_fields as $field_key => $field_name ) {
@ -397,17 +397,17 @@ class WC_Form_Handler {
$delete = true;
if ( is_null( $token ) ) {
wc_add_notice( __( 'Invalid payment method', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Invalid payment method.', 'woocommerce' ), 'error' );
$delete = false;
}
if ( get_current_user_id() !== $token->get_user_id() ) {
wc_add_notice( __( 'Invalid payment method', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Invalid payment method.', 'woocommerce' ), 'error' );
$delete = false;
}
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'delete-payment-method-' . $token_id ) ) {
wc_add_notice( __( 'Invalid payment method', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Invalid payment method.', 'woocommerce' ), 'error' );
$delete = false;
}
@ -435,17 +435,17 @@ class WC_Form_Handler {
$delete = true;
if ( is_null( $token ) ) {
wc_add_notice( __( 'Invalid payment method', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Invalid payment method.', 'woocommerce' ), 'error' );
$delete = false;
}
if ( get_current_user_id() !== $token->get_user_id() ) {
wc_add_notice( __( 'Invalid payment method', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Invalid payment method.', 'woocommerce' ), 'error' );
$delete = false;
}
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'set-default-payment-method-' . $token_id ) ) {
wc_add_notice( __( 'Invalid payment method', 'woocommerce' ), 'error' );
wc_add_notice( __( 'Invalid payment method.', 'woocommerce' ), 'error' );
$delete = false;
}

View File

@ -111,7 +111,7 @@ class WC_CLI_Order extends WC_CLI_Command {
// make sure customer exists
if ( false === get_user_by( 'id', $data['customer_id'] ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ) );
}
$default_order_args['customer_id'] = $data['customer_id'];
@ -163,7 +163,7 @@ class WC_CLI_Order extends WC_CLI_Command {
// Set order currency.
if ( isset( $data['currency'] ) ) {
if ( ! array_key_exists( $data['currency'], get_woocommerce_currencies() ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid.', 'woocommerce' ) );
}
update_post_meta( $order->get_id(), '_order_currency', $data['currency'] );
@ -447,7 +447,7 @@ class WC_CLI_Order extends WC_CLI_Command {
// make sure customer exists
if ( false === get_user_by( 'id', $data['customer_id'] ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_customer_id', __( 'Customer ID is invalid', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_customer_id', __( 'Customer ID is invalid.', 'woocommerce' ) );
}
update_post_meta( $order->get_id(), '_customer_user', $data['customer_id'] );
@ -518,7 +518,7 @@ class WC_CLI_Order extends WC_CLI_Command {
if ( isset( $data['currency'] ) ) {
if ( ! array_key_exists( $data['currency'], get_woocommerce_currencies() ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_order_currency', __( 'Provided order currency is invalid.', 'woocommerce' ) );
}
update_post_meta( $order->get_id(), '_order_currency', $data['currency'] );
@ -888,7 +888,7 @@ class WC_CLI_Order extends WC_CLI_Command {
) );
if ( is_null( $result ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID provided is not associated with order', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_item_id', __( 'Order item ID provided is not associated with order.', 'woocommerce' ) );
}
}
@ -946,17 +946,17 @@ class WC_CLI_Order extends WC_CLI_Command {
// must be a valid WC_Product
if ( ! is_object( $product ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product', __( 'Product is invalid', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product', __( 'Product is invalid.', 'woocommerce' ) );
}
// quantity must be positive float
if ( isset( $item['quantity'] ) && floatval( $item['quantity'] ) <= 0 ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_quantity', __( 'Product quantity must be a positive float', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_quantity', __( 'Product quantity must be a positive float.', 'woocommerce' ) );
}
// quantity is required when creating
if ( $creating && ! isset( $item['quantity'] ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_quantity', __( 'Product quantity is required', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_quantity', __( 'Product quantity is required.', 'woocommerce' ) );
}
$item_args = array();
@ -993,14 +993,14 @@ class WC_CLI_Order extends WC_CLI_Command {
$item_id = $order->add_product( $product, $item_args['qty'], $item_args );
if ( ! $item_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_create_line_item', __( 'Cannot create line item, try again.', 'woocommerce' ) );
}
} else {
$item_id = $order->update_product( $item['id'], $product, $item_args );
if ( ! $item_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_update_line_item', __( 'Cannot update line item, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_update_line_item', __( 'Cannot update line item, try again.', 'woocommerce' ) );
}
}
}
@ -1074,14 +1074,14 @@ class WC_CLI_Order extends WC_CLI_Command {
// total must be a positive float
if ( isset( $shipping['total'] ) && floatval( $shipping['total'] ) < 0 ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount.', 'woocommerce' ) );
}
if ( 'create' === $action ) {
// method ID is required
if ( ! isset( $shipping['method_id'] ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_shipping_item', __( 'Shipping method ID is required', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_shipping_item', __( 'Shipping method ID is required.', 'woocommerce' ) );
}
$rate = new WC_Shipping_Rate( $shipping['method_id'], isset( $shipping['method_title'] ) ? $shipping['method_title'] : '', isset( $shipping['total'] ) ? floatval( $shipping['total'] ) : 0, array(), $shipping['method_id'] );
@ -1089,7 +1089,7 @@ class WC_CLI_Order extends WC_CLI_Command {
$shipping_id = $order->add_shipping( $rate );
if ( ! $shipping_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_create_shipping', __( 'Cannot create shipping method, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_create_shipping', __( 'Cannot create shipping method, try again.', 'woocommerce' ) );
}
} else {
@ -1110,7 +1110,7 @@ class WC_CLI_Order extends WC_CLI_Command {
$shipping_id = $order->update_shipping( $shipping['id'], $shipping_args );
if ( ! $shipping_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_update_shipping', __( 'Cannot update shipping method, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_update_shipping', __( 'Cannot update shipping method, try again.', 'woocommerce' ) );
}
}
}
@ -1146,7 +1146,7 @@ class WC_CLI_Order extends WC_CLI_Command {
if ( isset( $fee['taxable'] ) && $fee['taxable'] ) {
if ( ! isset( $fee['tax_class'] ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable.', 'woocommerce' ) );
}
$order_fee->taxable = true;
@ -1165,7 +1165,7 @@ class WC_CLI_Order extends WC_CLI_Command {
$fee_id = $order->add_fee( $order_fee );
if ( ! $fee_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again.', 'woocommerce' ) );
}
} else {
@ -1190,7 +1190,7 @@ class WC_CLI_Order extends WC_CLI_Command {
$fee_id = $order->update_fee( $fee['id'], $fee_args );
if ( ! $fee_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again.', 'woocommerce' ) );
}
}
}
@ -1208,20 +1208,20 @@ class WC_CLI_Order extends WC_CLI_Command {
// coupon amount must be positive float.
if ( isset( $coupon['amount'] ) && floatval( $coupon['amount'] ) < 0 ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount.', 'woocommerce' ) );
}
if ( 'create' === $action ) {
// coupon code is required
if ( empty( $coupon['code'] ) ) {
throw new WC_CLI_Exception( 'woocommerce_invalid_coupon_coupon', __( 'Coupon code is required', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_invalid_coupon_coupon', __( 'Coupon code is required.', 'woocommerce' ) );
}
$coupon_id = $order->add_coupon( $coupon['code'], isset( $coupon['amount'] ) ? floatval( $coupon['amount'] ) : 0 );
if ( ! $coupon_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_create_order_coupon', __( 'Cannot create coupon, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_create_order_coupon', __( 'Cannot create coupon, try again.', 'woocommerce' ) );
}
} else {
@ -1238,7 +1238,7 @@ class WC_CLI_Order extends WC_CLI_Command {
$coupon_id = $order->update_coupon( $coupon['id'], $coupon_args );
if ( ! $coupon_id ) {
throw new WC_CLI_Exception( 'woocommerce_cannot_update_order_coupon', __( 'Cannot update coupon, try again', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cannot_update_order_coupon', __( 'Cannot update coupon, try again.', 'woocommerce' ) );
}
}
}

View File

@ -1128,7 +1128,7 @@ class WC_CLI_Product extends WC_CLI_Command {
if ( ! empty( $new_sku ) ) {
$unique_sku = wc_product_has_unique_sku( $product_id, $new_sku );
if ( ! $unique_sku ) {
throw new WC_CLI_Exception( 'woocommerce_cli_product_sku_already_exists', __( 'The SKU already exists on another product', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_product_sku_already_exists', __( 'The SKU already exists on another product.', 'woocommerce' ) );
} else {
update_post_meta( $product_id, '_sku', $new_sku );
}
@ -1576,7 +1576,7 @@ class WC_CLI_Product extends WC_CLI_Command {
if ( ! empty( $new_sku ) ) {
$unique_sku = wc_product_has_unique_sku( $variation_id, $new_sku );
if ( ! $unique_sku ) {
throw new WC_CLI_Exception( 'woocommerce_cli_product_sku_already_exists', __( 'The SKU already exists on another product', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_product_sku_already_exists', __( 'The SKU already exists on another product.', 'woocommerce' ) );
} else {
update_post_meta( $variation_id, '_sku', $new_sku );
}
@ -2018,7 +2018,7 @@ class WC_CLI_Product extends WC_CLI_Command {
// Check parsed URL
if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_image', sprintf( __( 'Invalid URL %s', 'woocommerce' ), $image_url ) );
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_image', sprintf( __( 'Invalid URL %s.', 'woocommerce' ), $image_url ) );
}
// Ensure url is valid
@ -2070,7 +2070,7 @@ class WC_CLI_Product extends WC_CLI_Command {
if ( 0 == $filesize ) {
@unlink( $upload['file'] );
unset( $upload );
throw new WC_CLI_Exception( 'woocommerce_cli_product_image_upload_file_error', __( 'Zero size file downloaded', 'woocommerce' ) );
throw new WC_CLI_Exception( 'woocommerce_cli_product_image_upload_file_error', __( 'Zero size file downloaded.', 'woocommerce' ) );
}
unset( $response );

View File

@ -130,7 +130,7 @@ class WC_Email_Cancelled_Order extends WC_Email {
'desc_tip' => true,
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'title' => __( 'Email Type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',

View File

@ -174,7 +174,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
'desc_tip' => true,
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'title' => __( 'Email Type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',

View File

@ -232,7 +232,7 @@ class WC_Email_Customer_Refunded_Order extends WC_Email {
'desc_tip' => true,
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'title' => __( 'Email Type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',

View File

@ -46,7 +46,7 @@ class WC_Email_Customer_Reset_Password extends WC_Email {
public function __construct() {
$this->id = 'customer_reset_password';
$this->title = __( 'Reset password', 'woocommerce' );
$this->title = __( 'Reset Password', 'woocommerce' );
$this->description = __( 'Customer "reset password" emails are sent when customers reset their passwords.', 'woocommerce' );
$this->customer_email = true;

View File

@ -130,7 +130,7 @@ class WC_Email_Failed_Order extends WC_Email {
'desc_tip' => true,
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'title' => __( 'Email Type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',

View File

@ -135,7 +135,7 @@ class WC_Email_New_Order extends WC_Email {
'desc_tip' => true,
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'title' => __( 'Email Type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',

View File

@ -505,7 +505,7 @@ class WC_Email extends WC_Settings_API {
'desc_tip' => true,
),
'email_type' => array(
'title' => __( 'Email type', 'woocommerce' ),
'title' => __( 'Email Type', 'woocommerce' ),
'type' => 'select',
'description' => __( 'Choose which format of email to send.', 'woocommerce' ),
'default' => 'html',

View File

@ -57,7 +57,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable COD', 'woocommerce' ),
'title' => __( 'Enable/Disable', 'woocommerce' ),
'label' => __( 'Enable Cash on Delivery', 'woocommerce' ),
'type' => 'checkbox',
'description' => '',

View File

@ -11,7 +11,7 @@ return array(
'enabled' => array(
'title' => __( 'Enable/Disable', 'woocommerce' ),
'type' => 'checkbox',
'label' => __( 'Enable PayPal standard', 'woocommerce' ),
'label' => __( 'Enable PayPal Standard', 'woocommerce' ),
'default' => 'yes',
),
'title' => array(

View File

@ -294,7 +294,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
$customer_id = get_post_meta( $order->get_id(), '_simplify_customer_id', true );
if ( ! $customer_id ) {
return new WP_Error( 'simplify_error', __( 'Customer not found', 'woocommerce' ) );
return new WP_Error( 'simplify_error', __( 'Customer not found.', 'woocommerce' ) );
}
try {
@ -318,7 +318,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
}
}
$order->add_order_note( sprintf( __( 'Simplify payment error: %s', 'woocommerce' ), $error_message ) );
$order->add_order_note( sprintf( __( 'Simplify payment error: %s.', 'woocommerce' ), $error_message ) );
return new WP_Error( 'simplify_payment_declined', $e->getMessage(), array( 'status' => $e->getCode() ) );
}
@ -431,7 +431,7 @@ class WC_Addons_Gateway_Simplify_Commerce extends WC_Gateway_Simplify_Commerce {
$customer_id = get_post_meta( $order->get_id(), '_simplify_customer_id', true );
if ( ! $customer_id ) {
return new WP_Error( 'simplify_error', __( 'Customer not found', 'woocommerce' ) );
return new WP_Error( 'simplify_error', __( 'Customer not found.', 'woocommerce' ) );
}
// Charge the customer

View File

@ -95,7 +95,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC {
<p class="main"><strong><?php _e( 'Getting started', 'woocommerce' ); ?></strong></p>
<p><?php _e( 'Simplify Commerce is your merchant account and payment gateway all rolled into one. Choose Simplify Commerce as your WooCommerce payment gateway to get access to your money quickly with a powerful, secure payment engine backed by MasterCard.', 'woocommerce' ); ?></p>
<p><a href="https://www.simplify.com/commerce/partners/woocommerce#/signup" target="_blank" class="button button-primary"><?php _e( 'Sign up for Simplify Commerce', 'woocommerce' ); ?></a> <a href="https://www.simplify.com/commerce/partners/woocommerce#/" target="_blank" class="button"><?php _e( 'Learn more', 'woocommerce' ); ?></a></p>
<p><a href="https://www.simplify.com/commerce/partners/woocommerce#/signup" target="_blank" class="button button-primary"><?php _e( 'Sign up for Simplify Commerce', 'woocommerce' ); ?></a> <a href="https://www.simplify.com/commerce/partners/woocommerce#/" target="_blank" class="button"><?php _e( 'Learn More', 'woocommerce' ); ?></a></p>
</div>
<?php else : ?>
@ -197,7 +197,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC {
'title' => __( 'Title', 'woocommerce' ),
'type' => 'text',
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
'default' => __( 'Credit card', 'woocommerce' ),
'default' => __( 'Credit Card', 'woocommerce' ),
'desc_tip' => true,
),
'description' => array(
@ -517,7 +517,7 @@ class WC_Gateway_Simplify_Commerce extends WC_Payment_Gateway_CC {
}
}
$order->add_order_note( sprintf( __( 'Simplify payment error: %s', 'woocommerce' ), $error_message ) );
$order->add_order_note( sprintf( __( 'Simplify payment error: %s.', 'woocommerce' ), $error_message ) );
return new WP_Error( 'simplify_payment_declined', $e->getMessage(), array( 'status' => $e->getCode() ) );
}

View File

@ -121,7 +121,7 @@ class WC_Shipping_Legacy_Free_Shipping extends WC_Shipping_Method {
'options' => array(
'' => __( 'N/A', 'woocommerce' ),
'coupon' => __( 'A valid free shipping coupon', 'woocommerce' ),
'min_amount' => __( 'A minimum order amount (defined below)', 'woocommerce' ),
'min_amount' => __( 'A minimum order amount', 'woocommerce' ),
'either' => __( 'A minimum order amount OR a coupon', 'woocommerce' ),
'both' => __( 'A minimum order amount AND a coupon', 'woocommerce' ),
),

View File

@ -24,7 +24,7 @@ class WC_Shortcode_Cart {
$city = apply_filters( 'woocommerce_shipping_calculator_enable_city', false ) ? wc_clean( $_POST['calc_shipping_city'] ) : '';
if ( $postcode && ! WC_Validation::is_postcode( $postcode, $country ) ) {
throw new Exception( __( 'Please enter a valid postcode/ZIP.', 'woocommerce' ) );
throw new Exception( __( 'Please enter a valid postcode / ZIP.', 'woocommerce' ) );
} elseif ( $postcode ) {
$postcode = wc_format_postcode( $postcode, $country );
}

View File

@ -117,7 +117,7 @@ function wc_create_order( $args = array() ) {
*/
function wc_update_order( $args ) {
if ( ! $args['order_id'] ) {
return new WP_Error( __( 'Invalid order ID', 'woocommerce' ) );
return new WP_Error( __( 'Invalid order ID.', 'woocommerce' ) );
}
return wc_create_order( $args );
}

View File

@ -53,13 +53,13 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->
// Hidden Input
if ( is_array( $states ) && empty( $states ) ) {
?><input type="hidden" name="calc_shipping_state" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / county', 'woocommerce' ); ?>" /><?php
?><input type="hidden" name="calc_shipping_state" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / County', 'woocommerce' ); ?>" /><?php
// Dropdown Input
} elseif ( is_array( $states ) ) {
?><span>
<select name="calc_shipping_state" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / county', 'woocommerce' ); ?>">
<select name="calc_shipping_state" id="calc_shipping_state" placeholder="<?php esc_attr_e( 'State / County', 'woocommerce' ); ?>">
<option value=""><?php _e( 'Select a state&hellip;', 'woocommerce' ); ?></option>
<?php
foreach ( $states as $ckey => $cvalue )
@ -71,7 +71,7 @@ if ( 'no' === get_option( 'woocommerce_enable_shipping_calc' ) || ! WC()->cart->
// Standard Input
} else {
?><input type="text" class="input-text" value="<?php echo esc_attr( $current_r ); ?>" placeholder="<?php esc_attr_e( 'State / county', 'woocommerce' ); ?>" name="calc_shipping_state" id="calc_shipping_state" /><?php
?><input type="text" class="input-text" value="<?php echo esc_attr( $current_r ); ?>" placeholder="<?php esc_attr_e( 'State / County', 'woocommerce' ); ?>" name="calc_shipping_state" id="calc_shipping_state" /><?php
}
?>

View File

@ -27,17 +27,17 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<?php do_action( 'woocommerce_edit_account_form_start' ); ?>
<p class="woocommerce-FormRow woocommerce-FormRow--first form-row form-row-first">
<label for="account_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<label for="account_first_name"><?php _e( 'First Name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_first_name" id="account_first_name" value="<?php echo esc_attr( $user->first_name ); ?>" />
</p>
<p class="woocommerce-FormRow woocommerce-FormRow--last form-row form-row-last">
<label for="account_last_name"><?php _e( 'Last name', 'woocommerce' ); ?> <span class="required">*</span></label>
<label for="account_last_name"><?php _e( 'Last Name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="account_last_name" id="account_last_name" value="<?php echo esc_attr( $user->last_name ); ?>" />
</p>
<div class="clear"></div>
<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
<label for="account_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label>
<label for="account_email"><?php _e( 'Email Address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="email" class="woocommerce-Input woocommerce-Input--email input-text" name="account_email" id="account_email" value="<?php echo esc_attr( $user->user_email ); ?>" />
</p>

View File

@ -88,7 +88,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php endif; ?>
<p class="woocommerce-FormRow woocommerce-FormRow--wide form-row form-row-wide">
<label for="reg_email"><?php _e( 'Email address', 'woocommerce' ); ?> <span class="required">*</span></label>
<label for="reg_email"><?php _e( 'Email Address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php if ( ! empty( $_POST['email'] ) ) echo esc_attr( $_POST['email'] ); ?>" />
</p>

View File

@ -43,7 +43,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( $order->get_billing_phone() ) : ?>
<tr>
<th><?php _e( 'Telephone:', 'woocommerce' ); ?></th>
<th><?php _e( 'Phone:', 'woocommerce' ); ?></th>
<td><?php echo esc_html( $order->get_billing_phone() ); ?></td>
</tr>
<?php endif; ?>

View File

@ -25,7 +25,7 @@ $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
if ( $rating && get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { ?>
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf( esc_attr__( 'Rated %d out of 5', 'woocommerce' ), esc_attr( $rating ) ) ?>">
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf( esc_attr__( 'Rated %s out of 5', 'woocommerce' ), esc_attr( $rating ) ) ?>">
<span style="width:<?php echo ( esc_attr( $rating ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo esc_attr( $rating ); ?></strong> <?php esc_attr_e( 'out of 5', 'woocommerce' ); ?></span>
</div>