Skip to content

Commit

Permalink
Additional coding-standards fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Sep 2, 2016
1 parent c823236 commit e075115
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion includes/admin/meta-boxes/views/html-order-item.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</td>
<td class="name" data-sort-value="<?php echo esc_attr( $item->get_name() ); ?>">
<?php
echo $product_link ? '<a href="' . esc_url( $product_link ) . '" class="wc-order-item-name">' . esc_html( $item->get_name() ) . '</a>' : '<div class="class="wc-order-item-name"">' . esc_html( $item->get_name() ) . '</div>';
echo $product_link ? '<a href="' . esc_url( $product_link ) . '" class="wc-order-item-name">' . esc_html( $item->get_name() ) . '</a>' : '<div class="class="wc-order-item-name"">' . esc_html( $item->get_name() ) . '</div>';

if ( $product && $product->get_sku() ) {
echo '<div class="wc-order-item-sku"><strong>' . __( 'SKU:', 'woocommerce' ) . '</strong> ' . esc_html( $product->get_sku() ) . '</div>';
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/meta-boxes/views/html-order-items.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_title = %s AND post_type = 'shop_coupon' AND post_status = 'publish' LIMIT 1;", $item->get_code() ) );
$link = $post_id ? add_query_arg( array( 'post' => $post_id, 'action' => 'edit' ), admin_url( 'post.php' ) ) : add_query_arg( array( 's' => $item->get_code(), 'post_status' => 'all', 'post_type' => 'shop_coupon' ), admin_url( 'edit.php' ) );

echo '<li class="code"><a href="' . esc_url( $link ) . '" class="tips" data-tip="' . esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ) . '"><span>' . esc_html( $item->get_code() ). '</span></a></li>';
echo '<li class="code"><a href="' . esc_url( $link ) . '" class="tips" data-tip="' . esc_attr( wc_price( $item->get_discount(), array( 'currency' => $order->get_currency() ) ) ) . '"><span>' . esc_html( $item->get_code() ) . '</span></a></li>';
}
?></ul>
</div>
Expand Down Expand Up @@ -271,7 +271,7 @@
$gateway_supports_refunds = false !== $payment_gateway && $payment_gateway->supports( 'refunds' );
$gateway_name = false !== $payment_gateway ? ( ! empty( $payment_gateway->method_title ) ? $payment_gateway->method_title : $payment_gateway->get_title() ) : __( 'Payment Gateway', 'woocommerce' );
?>
<button type="button" class="button <?php echo $gateway_supports_refunds ? 'button-primary do-api-refund' : 'tips disabled'; ?>" <?php echo $gateway_supports_refunds ? '' : 'data-tip="' . esc_attr__( 'The payment gateway used to place this order does not support automatic refunds.', 'woocommerce' ) . '"'; ?>><?php printf( _x( 'Refund %s via %s', 'Refund $amount', 'woocommerce' ), $refund_amount, $gateway_name ); ?></button>
<button type="button" class="button <?php echo $gateway_supports_refunds ? 'button-primary do-api-refund' : 'tips disabled'; ?>" <?php echo $gateway_supports_refunds ? '' : 'data-tip="' . esc_attr__( 'The payment gateway used to place this order does not support automatic refunds.', 'woocommerce' ) . '"'; ?>><?php printf( _x( 'Refund %1$s via %2$s', 'Refund $amount', 'woocommerce' ), $refund_amount, $gateway_name ); ?></button>
<button type="button" class="button button-primary do-manual-refund tips" data-tip="<?php esc_attr_e( 'You will need to manually issue a refund through your payment gateway after using this.', 'woocommerce' ); ?>"><?php printf( _x( 'Refund %s manually', 'Refund $amount manually', 'woocommerce' ), $refund_amount ); ?></button>
<button type="button" class="button cancel-action"><?php _e( 'Cancel', 'woocommerce' ); ?></button>
<div class="clear"></div>
Expand Down
6 changes: 5 additions & 1 deletion includes/admin/settings/views/html-webhooks-edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
<tr valign="top">
<th scope="row" class="titledesc">
<label for="webhook_name"><?php _e( 'Name', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( sprintf( __( 'Friendly name for identifying this webhook, defaults to Webhook created on %s.', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ) ); ?>
<?php
// @codingStandardsIgnoreStart
echo wc_help_tip( sprintf( __( 'Friendly name for identifying this webhook, defaults to Webhook created on %s.', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ) );
// @codingStandardsIgnoreEnd
?>
</th>
<td class="forminp">
<input name="webhook_name" id="webhook_name" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_name() ); ?>" />
Expand Down
6 changes: 3 additions & 3 deletions includes/api/legacy/v2/class-wc-api-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ protected function save_variations( $id, $data ) {
$variation_id = isset( $variation['id'] ) ? absint( $variation['id'] ) : 0;

// Generate a useful post title
$variation_post_title = sprintf( __( 'Variation #%s of %s', 'woocommerce' ), $variation_id, esc_html( get_the_title( $id ) ) );
$variation_post_title = sprintf( __( 'Variation #%1$s of %2$s', 'woocommerce' ), $variation_id, esc_html( get_the_title( $id ) ) );

// Update or Add post
if ( ! $variation_id ) {
Expand Down Expand Up @@ -2089,9 +2089,9 @@ protected function validate_attribute_data( $name, $slug, $type, $order_by, $new

if ( strlen( $slug ) >= 28 ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max). Shorten it, please.', 'woocommerce' ), $slug ), 400 );
} else if ( wc_check_if_attribute_name_is_reserved( $slug ) ) {
} elseif ( wc_check_if_attribute_name_is_reserved( $slug ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), $slug ), 400 );
} else if ( $new_data && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) {
} elseif ( $new_data && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) {
throw new WC_API_Exception( 'woocommerce_api_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce' ), $slug ), 400 );
}

Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v2/class-wc-api-resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function validate_request( $id, $type, $context ) {
$post = get_post( $id );

if ( null === $post ) {
return new WP_Error( "woocommerce_api_no_{$resource_name}_found", sprintf( __( 'No %s found with the ID equal to %s', 'woocommerce' ), $resource_name, $id ), array( 'status' => 404 ) );
return new WP_Error( "woocommerce_api_no_{$resource_name}_found", sprintf( __( 'No %1$s found with the ID equal to %2$s', 'woocommerce' ), $resource_name, $id ), array( 'status' => 404 ) );
}

// For checking permissions, product variations are the same as the product post type
Expand Down
2 changes: 2 additions & 0 deletions includes/api/legacy/v2/class-wc-api-webhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ public function create_webhook( $data ) {
'ping_status' => 'closed',
'post_author' => get_current_user_id(),
'post_password' => strlen( ( $password = uniqid( 'webhook_' ) ) ) > 20 ? substr( $password, 0, 20 ) : $password,
// @codingStandardsIgnoreStart
'post_title' => ! empty( $data['name'] ) ? $data['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ),
// @codingStandardsIgnoreEnd
), $data, $this );

$webhook_id = wp_insert_post( $webhook_data );
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v3/class-wc-api-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ protected function save_variations( $id, $data ) {
}

// Generate a useful post title
$variation_post_title = sprintf( __( 'Variation #%s of %s', 'woocommerce' ), $variation_id, esc_html( get_the_title( $id ) ) );
$variation_post_title = sprintf( __( 'Variation #%1$s of %2$s', 'woocommerce' ), $variation_id, esc_html( get_the_title( $id ) ) );

// Update or Add post
if ( ! $variation_id ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v3/class-wc-api-resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected function validate_request( $id, $type, $context ) {
$post = get_post( $id );

if ( null === $post ) {
return new WP_Error( "woocommerce_api_no_{$resource_name}_found", sprintf( __( 'No %s found with the ID equal to %s', 'woocommerce' ), $resource_name, $id ), array( 'status' => 404 ) );
return new WP_Error( "woocommerce_api_no_{$resource_name}_found", sprintf( __( 'No %1$s found with the ID equal to %2$s', 'woocommerce' ), $resource_name, $id ), array( 'status' => 404 ) );
}

// For checking permissions, product variations are the same as the product post type
Expand Down
2 changes: 2 additions & 0 deletions includes/api/legacy/v3/class-wc-api-webhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ public function create_webhook( $data ) {
'ping_status' => 'closed',
'post_author' => get_current_user_id(),
'post_password' => strlen( ( $password = uniqid( 'webhook_' ) ) ) > 20 ? substr( $password, 0, 20 ) : $password,
// @codingStandardsIgnoreStart
'post_title' => ! empty( $data['name'] ) ? $data['name'] : sprintf( __( 'Webhook created on %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Webhook created on date parsed by strftime', 'woocommerce' ) ) ),
// @codingStandardsIgnoreEnd
), $data, $this );

$webhook_id = wp_insert_post( $webhook_data );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public function check_response() {
if ( ! empty( $_POST ) && $this->validate_ipn() ) {
$posted = wp_unslash( $_POST );

// @codingStandardsIgnoreStart
do_action( 'valid-paypal-standard-ipn-request', $posted );
// @codingStandardsIgnoreEnd
exit;
}

Expand Down Expand Up @@ -258,7 +260,7 @@ protected function payment_status_refunded( $order, $posted ) {

$this->send_ipn_email_notification(
sprintf( __( 'Payment for order %s refunded', 'woocommerce' ), '<a class="link" href="' . esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) . '">' . $order->get_order_number() . '</a>' ),
sprintf( __( 'Order #%s has been marked as refunded - PayPal reason code: %s', 'woocommerce' ), $order->get_order_number(), $posted['reason_code'] )
sprintf( __( 'Order #%1$s has been marked as refunded - PayPal reason code: %2$s', 'woocommerce' ), $order->get_order_number(), $posted['reason_code'] )
);
}
}
Expand All @@ -273,7 +275,7 @@ protected function payment_status_reversed( $order, $posted ) {

$this->send_ipn_email_notification(
sprintf( __( 'Payment for order %s reversed', 'woocommerce' ), '<a class="link" href="' . esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) . '">' . $order->get_order_number() . '</a>' ),
sprintf( __( 'Order #%s has been marked on-hold due to a reversal - PayPal reason code: %s', 'woocommerce' ), $order->get_order_number(), wc_clean( $posted['reason_code'] ) )
sprintf( __( 'Order #%1$s has been marked on-hold due to a reversal - PayPal reason code: %2$s', 'woocommerce' ), $order->get_order_number(), wc_clean( $posted['reason_code'] ) )
);
}

Expand All @@ -285,7 +287,7 @@ protected function payment_status_reversed( $order, $posted ) {
protected function payment_status_canceled_reversal( $order, $posted ) {
$this->send_ipn_email_notification(
sprintf( __( 'Reversal cancelled for order #%s', 'woocommerce' ), $order->get_order_number() ),
sprintf( __( 'Order #%s has had a reversal cancelled. Please check the status of payment and update the order status accordingly here: %s', 'woocommerce' ), $order->get_order_number(), esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) )
sprintf( __( 'Order #%1$s has had a reversal cancelled. Please check the status of payment and update the order status accordingly here: %2$s', 'woocommerce' ), $order->get_order_number(), esc_url( admin_url( 'post.php?post=' . $order->get_id() . '&action=edit' ) ) )
);
}

Expand Down
2 changes: 1 addition & 1 deletion includes/gateways/paypal/includes/settings-paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
'api_details' => array(
'title' => __( 'API Credentials', 'woocommerce' ),
'type' => 'title',
'description' => sprintf( __( 'Enter your PayPal API credentials to process refunds via PayPal. Learn how to access your PayPal API Credentials %shere%s.', 'woocommerce' ), '<a href="https://developer.paypal.com/webapps/developer/docs/classic/api/apiCredentials/#creating-an-api-signature">', '</a>' ),
'description' => sprintf( __( 'Enter your PayPal API credentials to process refunds via PayPal. Learn how to access your PayPal API Credentials %1$shere%2$s.', 'woocommerce' ), '<a href="https://developer.paypal.com/webapps/developer/docs/classic/api/apiCredentials/#creating-an-api-signature">', '</a>' ),
),
'api_username' => array(
'title' => __( 'API Username', 'woocommerce' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'title' => __( 'Shipping Class Costs', 'woocommerce' ),
'type' => 'title',
'default' => '',
'description' => sprintf( __( 'These costs can optionally be added based on the %sproduct shipping class%s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section=classes' ) . '">', '</a>' ),
'description' => sprintf( __( 'These costs can optionally be added based on the %1$sproduct shipping class%2$s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section=classes' ) . '">', '</a>' ),
);
foreach ( $shipping_classes as $shipping_class ) {
if ( ! isset( $shipping_class->term_id ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
'title' => __( 'Shipping Class Costs', 'woocommerce' ),
'type' => 'title',
'default' => '',
'description' => sprintf( __( 'These costs can optionally be added based on the %sproduct shipping class%s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section=classes' ) . '">', '</a>' ),
'description' => sprintf( __( 'These costs can optionally be added based on the %1$sproduct shipping class%2$s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=shipping&section=classes' ) . '">', '</a>' ),
);
foreach ( $shipping_classes as $shipping_class ) {
if ( ! isset( $shipping_class->term_id ) ) {
Expand Down

0 comments on commit e075115

Please sign in to comment.