Merge branch 'master' into feature/webhook-delivery-logging

This commit is contained in:
Gerhard Potgieter 2017-11-08 14:42:05 +02:00
commit 46a6837a93
45 changed files with 1088 additions and 918 deletions

View File

@ -1,5 +1,5 @@
jQuery( function( $ ) { jQuery( function( $ ) {
$( '.lost_reset_password' ).on( 'submit', function () { $( '.lost_reset_password' ).on( 'submit', function () {
$( 'input[type="submit"]', this ).attr( 'disabled', 'disabled' ); $( 'button[type="submit"]', this ).attr( 'disabled', 'disabled' );
}); });
}); });

View File

@ -20,7 +20,7 @@
*/ */
strengthMeter: function() { strengthMeter: function() {
var wrapper = $( 'form.register, form.checkout, form.edit-account, form.lost_reset_password' ), var wrapper = $( 'form.register, form.checkout, form.edit-account, form.lost_reset_password' ),
submit = $( 'input[type="submit"]', wrapper ), submit = $( 'button[type="submit"]', wrapper ),
field = $( '#reg_password, #account_password, #password_1', wrapper ), field = $( '#reg_password, #account_password, #password_1', wrapper ),
strength = 1, strength = 1,
fieldValue = field.val(); fieldValue = field.val();

View File

@ -29,7 +29,7 @@ class WC_Admin_Attributes {
$result = ''; $result = '';
$action = ''; $action = '';
// Action to perform: add, edit, delete or none // Action to perform: add, edit, delete or none.
if ( ! empty( $_POST['add_new_attribute'] ) ) { if ( ! empty( $_POST['add_new_attribute'] ) ) {
$action = 'add'; $action = 'add';
} elseif ( ! empty( $_POST['save_attribute'] ) && ! empty( $_GET['edit'] ) ) { } elseif ( ! empty( $_POST['save_attribute'] ) && ! empty( $_GET['edit'] ) ) {
@ -54,7 +54,7 @@ class WC_Admin_Attributes {
echo '<div id="woocommerce_errors" class="error"><p>' . wp_kses_post( $result->get_error_message() ) . '</p></div>'; echo '<div id="woocommerce_errors" class="error"><p>' . wp_kses_post( $result->get_error_message() ) . '</p></div>';
} }
// Show admin interface // Show admin interface.
if ( ! empty( $_GET['edit'] ) ) { if ( ! empty( $_GET['edit'] ) ) {
self::edit_attribute(); self::edit_attribute();
} else { } else {
@ -64,6 +64,7 @@ class WC_Admin_Attributes {
/** /**
* Get and sanitize posted attribute data. * Get and sanitize posted attribute data.
*
* @return array * @return array
*/ */
private static function get_posted_attribute() { private static function get_posted_attribute() {
@ -169,55 +170,52 @@ class WC_Admin_Attributes {
?> ?>
<div class="wrap woocommerce"> <div class="wrap woocommerce">
<h1><?php _e( 'Edit attribute', 'woocommerce' ) ?></h1> <h1><?php esc_html_e( 'Edit attribute', 'woocommerce' ) ?></h1>
<?php <?php
if ( ! $attribute_to_edit ) { if ( ! $attribute_to_edit ) {
echo '<div id="woocommerce_errors" class="error"><p>' . __( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>'; echo '<div id="woocommerce_errors" class="error"><p>' . esc_html__( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>';
} else { } else {
$att_type = $attribute_to_edit->attribute_type; $att_type = $attribute_to_edit->attribute_type;
$att_label = $attribute_to_edit->attribute_label; $att_label = $attribute_to_edit->attribute_label;
$att_name = $attribute_to_edit->attribute_name; $att_name = $attribute_to_edit->attribute_name;
$att_orderby = $attribute_to_edit->attribute_orderby; $att_orderby = $attribute_to_edit->attribute_orderby;
$att_public = $attribute_to_edit->attribute_public; $att_public = $attribute_to_edit->attribute_public;
?> ?>
<form action="edit.php?post_type=product&amp;page=product_attributes&amp;edit=<?php echo absint( $edit ); ?>" method="post"> <form action="edit.php?post_type=product&amp;page=product_attributes&amp;edit=<?php echo absint( $edit ); ?>" method="post">
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<?php do_action( 'woocommerce_before_edit_attribute_fields' ); ?> <?php do_action( 'woocommerce_before_edit_attribute_fields' ); ?>
<tr class="form-field form-required"> <tr class="form-field form-required">
<th scope="row" valign="top"> <th scope="row" valign="top">
<label for="attribute_label"><?php _e( 'Name', 'woocommerce' ); ?></label> <label for="attribute_label"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<input name="attribute_label" id="attribute_label" type="text" value="<?php echo esc_attr( $att_label ); ?>" /> <input name="attribute_label" id="attribute_label" type="text" value="<?php echo esc_attr( $att_label ); ?>" />
<p class="description"><?php _e( 'Name for the attribute (shown on the front-end).', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Name for the attribute (shown on the front-end).', 'woocommerce' ); ?></p>
</td> </td>
</tr> </tr>
<tr class="form-field form-required"> <tr class="form-field form-required">
<th scope="row" valign="top"> <th scope="row" valign="top">
<label for="attribute_name"><?php _e( 'Slug', 'woocommerce' ); ?></label> <label for="attribute_name"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<input name="attribute_name" id="attribute_name" type="text" value="<?php echo esc_attr( $att_name ); ?>" maxlength="28" /> <input name="attribute_name" id="attribute_name" type="text" value="<?php echo esc_attr( $att_name ); ?>" maxlength="28" />
<p class="description"><?php _e( 'Unique slug/reference for the attribute; must be no more than 28 characters.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Unique slug/reference for the attribute; must be no more than 28 characters.', 'woocommerce' ); ?></p>
</td> </td>
</tr> </tr>
<tr class="form-field form-required"> <tr class="form-field form-required">
<th scope="row" valign="top"> <th scope="row" valign="top">
<label for="attribute_public"><?php _e( 'Enable archives?', 'woocommerce' ); ?></label> <label for="attribute_public"><?php esc_html_e( 'Enable archives?', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<input name="attribute_public" id="attribute_public" type="checkbox" value="1" <?php checked( $att_public, 1 ); ?> /> <input name="attribute_public" id="attribute_public" type="checkbox" value="1" <?php checked( $att_public, 1 ); ?> />
<p class="description"><?php _e( 'Enable this if you want this attribute to have product archives in your store.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Enable this if you want this attribute to have product archives in your store.', 'woocommerce' ); ?></p>
</td> </td>
</tr> </tr>
<tr class="form-field form-required"> <tr class="form-field form-required">
<th scope="row" valign="top"> <th scope="row" valign="top">
<label for="attribute_type"><?php _e( 'Type', 'woocommerce' ); ?></label> <label for="attribute_type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<select name="attribute_type" id="attribute_type"> <select name="attribute_type" id="attribute_type">
@ -234,27 +232,27 @@ class WC_Admin_Attributes {
do_action( 'woocommerce_admin_attribute_types' ); do_action( 'woocommerce_admin_attribute_types' );
?> ?>
</select> </select>
<p class="description"><?php _e( 'Determines how you select attributes for products. Under admin panel -> products -> product data -> attributes -> values, <strong>Text</strong> allows manual entry whereas <strong>select</strong> allows pre-configured terms in a drop-down list.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Determines how you select attributes for products. Under admin panel -> products -> product data -> attributes -> values, <strong>Text</strong> allows manual entry whereas <strong>select</strong> allows pre-configured terms in a drop-down list.', 'woocommerce' ); ?></p>
</td> </td>
</tr> </tr>
<tr class="form-field form-required"> <tr class="form-field form-required">
<th scope="row" valign="top"> <th scope="row" valign="top">
<label for="attribute_orderby"><?php _e( 'Default sort order', 'woocommerce' ); ?></label> <label for="attribute_orderby"><?php esc_html_e( 'Default sort order', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<select name="attribute_orderby" id="attribute_orderby"> <select name="attribute_orderby" id="attribute_orderby">
<option value="menu_order" <?php selected( $att_orderby, 'menu_order' ); ?>><?php _e( 'Custom ordering', 'woocommerce' ); ?></option> <option value="menu_order" <?php selected( $att_orderby, 'menu_order' ); ?>><?php esc_html_e( 'Custom ordering', 'woocommerce' ); ?></option>
<option value="name" <?php selected( $att_orderby, 'name' ); ?>><?php _e( 'Name', 'woocommerce' ); ?></option> <option value="name" <?php selected( $att_orderby, 'name' ); ?>><?php esc_html_e( 'Name', 'woocommerce' ); ?></option>
<option value="name_num" <?php selected( $att_orderby, 'name_num' ); ?>><?php _e( 'Name (numeric)', 'woocommerce' ); ?></option> <option value="name_num" <?php selected( $att_orderby, 'name_num' ); ?>><?php esc_html_e( 'Name (numeric)', 'woocommerce' ); ?></option>
<option value="id" <?php selected( $att_orderby, 'id' ); ?>><?php _e( 'Term ID', 'woocommerce' ); ?></option> <option value="id" <?php selected( $att_orderby, 'id' ); ?>><?php esc_html_e( 'Term ID', 'woocommerce' ); ?></option>
</select> </select>
<p class="description"><?php _e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
</td> </td>
</tr> </tr>
<?php do_action( 'woocommerce_after_edit_attribute_fields' ) ?> <?php do_action( 'woocommerce_after_edit_attribute_fields' ) ?>
</tbody> </tbody>
</table> </table>
<p class="submit"><input type="submit" name="save_attribute" id="submit" class="button-primary" value="<?php esc_attr_e( 'Update', 'woocommerce' ); ?>"></p> <p class="submit"><button type="submit" name="save_attribute" id="submit" class="button-primary" value="<?php esc_attr_e( 'Update', 'woocommerce' ); ?>"><?php esc_html_e( 'Update', 'woocommerce' ); ?></button></p>
<?php wp_nonce_field( 'woocommerce-save-attribute_' . $edit ); ?> <?php wp_nonce_field( 'woocommerce-save-attribute_' . $edit ); ?>
</form> </form>
<?php } ?> <?php } ?>
@ -270,7 +268,7 @@ class WC_Admin_Attributes {
public static function add_attribute() { public static function add_attribute() {
?> ?>
<div class="wrap woocommerce"> <div class="wrap woocommerce">
<h1><?php echo get_admin_page_title(); ?></h1> <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
<br class="clear" /> <br class="clear" />
<div id="col-container"> <div id="col-container">
@ -279,11 +277,11 @@ class WC_Admin_Attributes {
<table class="widefat attributes-table wp-list-table ui-sortable" style="width:100%"> <table class="widefat attributes-table wp-list-table ui-sortable" style="width:100%">
<thead> <thead>
<tr> <tr>
<th scope="col"><?php _e( 'Name', 'woocommerce' ); ?></th> <th scope="col"><?php esc_html_e( 'Name', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Slug', 'woocommerce' ); ?></th> <th scope="col"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Type', 'woocommerce' ); ?></th> <th scope="col"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Order by', 'woocommerce' ); ?></th> <th scope="col"><?php esc_html_e( 'Order by', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Terms', 'woocommerce' ); ?></th> <th scope="col"><?php esc_html_e( 'Terms', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -294,27 +292,29 @@ class WC_Admin_Attributes {
<td> <td>
<strong><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&amp;post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a></strong> <strong><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&amp;post_type=product"><?php echo esc_html( $tax->attribute_label ); ?></a></strong>
<div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ) ); ?>"><?php _e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php _e( 'Delete', 'woocommerce' ); ?></a></span></div> <div class="row-actions"><span class="edit"><a href="<?php echo esc_url( add_query_arg( 'edit', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ) ); ?>"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'delete', $tax->attribute_id, 'edit.php?post_type=product&amp;page=product_attributes' ), 'woocommerce-delete-attribute_' . $tax->attribute_id ) ); ?>"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></span></div>
</td> </td>
<td><?php echo esc_html( $tax->attribute_name ); ?></td> <td><?php echo esc_html( $tax->attribute_name ); ?></td>
<td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? __( '(Public)', 'woocommerce' ) : ''; ?></td> <td><?php echo esc_html( wc_get_attribute_type_label( $tax->attribute_type ) ); ?> <?php echo $tax->attribute_public ? esc_html__( '(Public)', 'woocommerce' ) : ''; ?></td>
<td><?php <td><?php
switch ( $tax->attribute_orderby ) { switch ( $tax->attribute_orderby ) {
case 'name' : case 'name' :
_e( 'Name', 'woocommerce' ); esc_html_e( 'Name', 'woocommerce' );
break; break;
case 'name_num' : case 'name_num' :
_e( 'Name (numeric)', 'woocommerce' ); esc_html_e( 'Name (numeric)', 'woocommerce' );
break; break;
case 'id' : case 'id' :
_e( 'Term ID', 'woocommerce' ); esc_html_e( 'Term ID', 'woocommerce' );
break; break;
default: default:
_e( 'Custom ordering', 'woocommerce' ); esc_html_e( 'Custom ordering', 'woocommerce' );
break; break;
} }
?></td> ?>
<td class="attribute-terms"><?php </td>
<td class="attribute-terms">
<?php
$taxonomy = wc_attribute_taxonomy_name( $tax->attribute_name ); $taxonomy = wc_attribute_taxonomy_name( $tax->attribute_name );
if ( taxonomy_exists( $taxonomy ) ) { if ( taxonomy_exists( $taxonomy ) ) {
@ -335,7 +335,7 @@ class WC_Admin_Attributes {
$terms_string = implode( ', ', wp_list_pluck( $terms, 'name' ) ); $terms_string = implode( ', ', wp_list_pluck( $terms, 'name' ) );
if ( $terms_string ) { if ( $terms_string ) {
echo $terms_string; echo esc_html( $terms_string );
} else { } else {
echo '<span class="na">&ndash;</span>'; echo '<span class="na">&ndash;</span>';
} }
@ -343,12 +343,13 @@ class WC_Admin_Attributes {
echo '<span class="na">&ndash;</span>'; echo '<span class="na">&ndash;</span>';
} }
?> ?>
<br /><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&amp;post_type=product" class="configure-terms"><?php _e( 'Configure terms', 'woocommerce' ); ?></a> <br /><a href="edit-tags.php?taxonomy=<?php echo esc_html( wc_attribute_taxonomy_name( $tax->attribute_name ) ); ?>&amp;post_type=product" class="configure-terms"><?php esc_html_e( 'Configure terms', 'woocommerce' ); ?></a>
</td> </td>
</tr><?php </tr>
<?php
endforeach; endforeach;
else : else :
?><tr><td colspan="6"><?php _e( 'No attributes currently exist.', 'woocommerce' ) ?></td></tr><?php ?><tr><td colspan="6"><?php esc_html_e( 'No attributes currently exist.', 'woocommerce' ) ?></td></tr><?php
endif; endif;
?> ?>
</tbody> </tbody>
@ -358,31 +359,31 @@ class WC_Admin_Attributes {
<div id="col-left"> <div id="col-left">
<div class="col-wrap"> <div class="col-wrap">
<div class="form-wrap"> <div class="form-wrap">
<h2><?php _e( 'Add new attribute', 'woocommerce' ); ?></h2> <h2><?php esc_html_e( 'Add new attribute', 'woocommerce' ); ?></h2>
<p><?php _e( 'Attributes let you define extra product data, such as size or color. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.', 'woocommerce' ); ?></p> <p><?php esc_html_e( 'Attributes let you define extra product data, such as size or color. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.', 'woocommerce' ); ?></p>
<form action="edit.php?post_type=product&amp;page=product_attributes" method="post"> <form action="edit.php?post_type=product&amp;page=product_attributes" method="post">
<?php do_action( 'woocommerce_before_add_attribute_fields' ) ?> <?php do_action( 'woocommerce_before_add_attribute_fields' ) ?>
<div class="form-field"> <div class="form-field">
<label for="attribute_label"><?php _e( 'Name', 'woocommerce' ); ?></label> <label for="attribute_label"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
<input name="attribute_label" id="attribute_label" type="text" value="" /> <input name="attribute_label" id="attribute_label" type="text" value="" />
<p class="description"><?php _e( 'Name for the attribute (shown on the front-end).', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Name for the attribute (shown on the front-end).', 'woocommerce' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
<label for="attribute_name"><?php _e( 'Slug', 'woocommerce' ); ?></label> <label for="attribute_name"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></label>
<input name="attribute_name" id="attribute_name" type="text" value="" maxlength="28" /> <input name="attribute_name" id="attribute_name" type="text" value="" maxlength="28" />
<p class="description"><?php _e( 'Unique slug/reference for the attribute; must be no more than 28 characters.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Unique slug/reference for the attribute; must be no more than 28 characters.', 'woocommerce' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
<label for="attribute_public"><input name="attribute_public" id="attribute_public" type="checkbox" value="1" /> <?php _e( 'Enable Archives?', 'woocommerce' ); ?></label> <label for="attribute_public"><input name="attribute_public" id="attribute_public" type="checkbox" value="1" /> <?php esc_html_e( 'Enable Archives?', 'woocommerce' ); ?></label>
<p class="description"><?php _e( 'Enable this if you want this attribute to have product archives in your store.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Enable this if you want this attribute to have product archives in your store.', 'woocommerce' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
<label for="attribute_type"><?php _e( 'Type', 'woocommerce' ); ?></label> <label for="attribute_type"><?php esc_html_e( 'Type', 'woocommerce' ); ?></label>
<select name="attribute_type" id="attribute_type"> <select name="attribute_type" id="attribute_type">
<?php foreach ( wc_get_attribute_types() as $key => $value ) : ?> <?php foreach ( wc_get_attribute_types() as $key => $value ) : ?>
<option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_attr( $value ); ?></option> <option value="<?php echo esc_attr( $key ); ?>"><?php echo esc_attr( $value ); ?></option>
@ -398,23 +399,23 @@ class WC_Admin_Attributes {
do_action( 'woocommerce_admin_attribute_types' ); do_action( 'woocommerce_admin_attribute_types' );
?> ?>
</select> </select>
<p class="description"><?php _e( 'Determines how you select attributes for products. Under admin panel -> products -> product data -> attributes -> values, <strong>Text</strong> allows manual entry whereas <strong>select</strong> allows pre-configured terms in a drop-down list.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Determines how you select attributes for products. Under admin panel -> products -> product data -> attributes -> values, <strong>Text</strong> allows manual entry whereas <strong>select</strong> allows pre-configured terms in a drop-down list.', 'woocommerce' ); ?></p>
</div> </div>
<div class="form-field"> <div class="form-field">
<label for="attribute_orderby"><?php _e( 'Default sort order', 'woocommerce' ); ?></label> <label for="attribute_orderby"><?php esc_html_e( 'Default sort order', 'woocommerce' ); ?></label>
<select name="attribute_orderby" id="attribute_orderby"> <select name="attribute_orderby" id="attribute_orderby">
<option value="menu_order"><?php _e( 'Custom ordering', 'woocommerce' ); ?></option> <option value="menu_order"><?php esc_html_e( 'Custom ordering', 'woocommerce' ); ?></option>
<option value="name"><?php _e( 'Name', 'woocommerce' ); ?></option> <option value="name"><?php esc_html_e( 'Name', 'woocommerce' ); ?></option>
<option value="name_num"><?php _e( 'Name (numeric)', 'woocommerce' ); ?></option> <option value="name_num"><?php esc_html_e( 'Name (numeric)', 'woocommerce' ); ?></option>
<option value="id"><?php _e( 'Term ID', 'woocommerce' ); ?></option> <option value="id"><?php esc_html_e( 'Term ID', 'woocommerce' ); ?></option>
</select> </select>
<p class="description"><?php _e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p> <p class="description"><?php esc_html_e( 'Determines the sort order of the terms on the frontend shop product pages. If using custom ordering, you can drag and drop the terms in this attribute.', 'woocommerce' ); ?></p>
</div> </div>
<?php do_action( 'woocommerce_after_add_attribute_fields' ) ?> <?php do_action( 'woocommerce_after_add_attribute_fields' ) ?>
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Add attribute', 'woocommerce' ); ?>"></p> <p class="submit"><button type="submit" name="add_new_attribute" id="submit" class="button button-primary" value="<?php esc_attr_e( 'Add attribute', 'woocommerce' ); ?>"><?php esc_html_e( 'Add attribute', 'woocommerce' ); ?></button></p>
<?php wp_nonce_field( 'woocommerce-add-new_attribute' ); ?> <?php wp_nonce_field( 'woocommerce-add-new_attribute' ); ?>
</form> </form>
</div> </div>
@ -425,7 +426,7 @@ class WC_Admin_Attributes {
/* <![CDATA[ */ /* <![CDATA[ */
jQuery( 'a.delete' ).click( function() { jQuery( 'a.delete' ).click( function() {
if ( window.confirm( '<?php _e( "Are you sure you want to delete this attribute?", "woocommerce" ); ?>' ) ) { if ( window.confirm( '<?php esc_html_e( 'Are you sure you want to delete this attribute?', 'woocommerce' ); ?>' ) ) {
return true; return true;
} }
return false; return false;

View File

@ -23,7 +23,7 @@ class WC_Admin_Menus {
* Hook in tabs. * Hook in tabs.
*/ */
public function __construct() { public function __construct() {
// Add menus // Add menus.
add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 ); add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
add_action( 'admin_menu', array( $this, 'reports_menu' ), 20 ); add_action( 'admin_menu', array( $this, 'reports_menu' ), 20 );
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 ); add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
@ -41,7 +41,7 @@ class WC_Admin_Menus {
// Add endpoints custom URLs in Appearance > Menus > Pages. // Add endpoints custom URLs in Appearance > Menus > Pages.
add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) ); add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
// Admin bar menus // Admin bar menus.
if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) { if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) {
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 31 ); add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 31 );
} }
@ -91,25 +91,27 @@ class WC_Admin_Menus {
WC()->payment_gateways(); WC()->payment_gateways();
WC()->shipping(); WC()->shipping();
// Include settings pages // Include settings pages.
WC_Admin_Settings::get_settings_pages(); WC_Admin_Settings::get_settings_pages();
// Get current tab/section // Get current tab/section.
$current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( $_GET['tab'] ); $current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( wp_unslash( $_GET['tab'] ) );
$current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] ); $current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) );
// Save settings if data has been posted // Save settings if data has been posted.
// @codingStandardsIgnoreStart
if ( ! empty( $_POST ) ) { if ( ! empty( $_POST ) ) {
WC_Admin_Settings::save(); WC_Admin_Settings::save();
} }
// @codingStandardsIgnoreEnd
// Add any posted messages // Add any posted messages.
if ( ! empty( $_GET['wc_error'] ) ) { if ( ! empty( $_GET['wc_error'] ) ) {
WC_Admin_Settings::add_error( stripslashes( $_GET['wc_error'] ) ); WC_Admin_Settings::add_error( sanitize_title( wp_unslash( $_GET['wc_error'] ) ) );
} }
if ( ! empty( $_GET['wc_message'] ) ) { if ( ! empty( $_GET['wc_message'] ) ) {
WC_Admin_Settings::add_message( stripslashes( $_GET['wc_message'] ) ); WC_Admin_Settings::add_message( sanitize_title( wp_unslash( $_GET['wc_message'] ) ) );
} }
} }
@ -134,7 +136,7 @@ class WC_Admin_Menus {
*/ */
public function menu_highlight() { public function menu_highlight() {
global $parent_file, $submenu_file, $post_type; global $parent_file, $submenu_file, $post_type;
// @codingStandardsIgnoreStart
switch ( $post_type ) { switch ( $post_type ) {
case 'shop_order' : case 'shop_order' :
case 'shop_coupon' : case 'shop_coupon' :
@ -148,6 +150,7 @@ class WC_Admin_Menus {
} }
break; break;
} }
// @codingStandardsIgnoreEnd
} }
/** /**
@ -157,10 +160,10 @@ class WC_Admin_Menus {
global $submenu; global $submenu;
if ( isset( $submenu['woocommerce'] ) ) { if ( isset( $submenu['woocommerce'] ) ) {
// Remove 'WooCommerce' sub menu item // Remove 'WooCommerce' sub menu item.
unset( $submenu['woocommerce'][0] ); unset( $submenu['woocommerce'][0] );
// Add count if user has access // Add count if user has access.
if ( apply_filters( 'woocommerce_include_processing_order_count_in_menu', true ) && current_user_can( 'manage_woocommerce' ) && ( $order_count = wc_processing_order_count() ) ) { if ( apply_filters( 'woocommerce_include_processing_order_count_in_menu', true ) && current_user_can( 'manage_woocommerce' ) && ( $order_count = wc_processing_order_count() ) ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) { foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) { if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) {
@ -175,20 +178,20 @@ class WC_Admin_Menus {
/** /**
* Reorder the WC menu items in admin. * Reorder the WC menu items in admin.
* *
* @param mixed $menu_order * @param mixed $menu_order Menu Order.
* @return array * @return array
*/ */
public function menu_order( $menu_order ) { public function menu_order( $menu_order ) {
// Initialize our custom order array // Initialize our custom order array.
$woocommerce_menu_order = array(); $woocommerce_menu_order = array();
// Get the index of our custom separator // Get the index of our custom separator.
$woocommerce_separator = array_search( 'separator-woocommerce', $menu_order ); $woocommerce_separator = array_search( 'separator-woocommerce', $menu_order );
// Get index of product menu // Get index of product menu.
$woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order ); $woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order );
// Loop through menu order and do some rearranging // Loop through menu order and do some rearranging.
foreach ( $menu_order as $index => $item ) { foreach ( $menu_order as $index => $item ) {
if ( ( ( 'woocommerce' ) == $item ) ) { if ( ( ( 'woocommerce' ) == $item ) ) {
@ -202,7 +205,7 @@ class WC_Admin_Menus {
} }
} }
// Return order // Return order.
return $woocommerce_menu_order; return $woocommerce_menu_order;
} }
@ -301,10 +304,10 @@ class WC_Admin_Menus {
</div> </div>
<p class="button-controls"> <p class="button-controls">
<span class="list-controls"> <span class="list-controls">
<a href="<?php echo admin_url( 'nav-menus.php?page-tab=all&selectall=1#posttype-woocommerce-endpoints' ); ?>" class="select-all"><?php _e( 'Select all', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( admin_url( 'nav-menus.php?page-tab=all&selectall=1#posttype-woocommerce-endpoints' ) ); ?>" class="select-all"><?php esc_html_e( 'Select all', 'woocommerce' ); ?></a>
</span> </span>
<span class="add-to-menu"> <span class="add-to-menu">
<input type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'woocommerce' ); ?>" name="add-post-type-menu-item" id="submit-posttype-woocommerce-endpoints"> <button type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to menu', 'woocommerce' ); ?>" name="add-post-type-menu-item" id="submit-posttype-woocommerce-endpoints"><?php esc_html_e( 'Add to menu', 'woocommerce' ); ?></button>
<span class="spinner"></span> <span class="spinner"></span>
</span> </span>
</p> </p>
@ -316,7 +319,7 @@ class WC_Admin_Menus {
* Add the "Visit Store" link in admin bar main menu. * Add the "Visit Store" link in admin bar main menu.
* *
* @since 2.4.0 * @since 2.4.0
* @param WP_Admin_Bar $wp_admin_bar * @param WP_Admin_Bar $wp_admin_bar Admin Bar.
*/ */
public function admin_bar_menus( $wp_admin_bar ) { public function admin_bar_menus( $wp_admin_bar ) {
if ( ! is_admin() || ! is_user_logged_in() ) { if ( ! is_admin() || ! is_user_logged_in() ) {

View File

@ -9,6 +9,7 @@
* @package WooCommerce/Admin * @package WooCommerce/Admin
* @version 2.6.0 * @version 2.6.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -18,16 +19,32 @@ if ( ! defined( 'ABSPATH' ) ) {
*/ */
class WC_Admin_Setup_Wizard { class WC_Admin_Setup_Wizard {
/** @var string Current Step */ /**
* Current step
*
* @var string
*/
private $step = ''; private $step = '';
/** @var array Steps for the setup wizard */ /**
* Steps for the setup wizard
*
* @var array
*/
private $steps = array(); private $steps = array();
/** @var array Actions to be executed after the HTTP response has completed */ /**
* Actions to be executed after the HTTP response has completed
*
* @var array
*/
private $deferred_actions = array(); private $deferred_actions = array();
/** @var array Tweets user can optionally send after install */ /**
* Tweets user can optionally send after install
*
* @var array
*/
private $tweets = array( private $tweets = array(
'Someone give me woo-t, I just set up a new store with #WordPress and @WooCommerce!', 'Someone give me woo-t, I just set up a new store with #WordPress and @WooCommerce!',
'Someone give me high five, I just set up a new store with #WordPress and @WooCommerce!', 'Someone give me high five, I just set up a new store with #WordPress and @WooCommerce!',
@ -73,7 +90,7 @@ class WC_Admin_Setup_Wizard {
} }
$country_code = WC()->countries->get_base_country(); $country_code = WC()->countries->get_base_country();
// https://developers.taxjar.com/api/reference/#countries // https://developers.taxjar.com/api/reference/#countries .
$tax_supported_countries = array_merge( $tax_supported_countries = array_merge(
array( 'US', 'CA', 'AU' ), array( 'US', 'CA', 'AU' ),
WC()->countries->get_european_union_countries() WC()->countries->get_european_union_countries()
@ -176,9 +193,11 @@ class WC_Admin_Setup_Wizard {
'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no', 'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no',
) ); ) );
// @codingStandardsIgnoreStart
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
call_user_func( $this->steps[ $this->step ]['handler'], $this ); call_user_func( $this->steps[ $this->step ]['handler'], $this );
} }
// @codingStandardsIgnoreEnd
ob_start(); ob_start();
$this->setup_wizard_header(); $this->setup_wizard_header();
@ -190,7 +209,8 @@ class WC_Admin_Setup_Wizard {
/** /**
* Get the URL for the next step's screen. * Get the URL for the next step's screen.
* @param string step slug (default: current step) *
* @param string $step slug (default: current step).
* @return string URL for next step if a next step exists. * @return string URL for next step if a next step exists.
* Admin URL if it's the last step. * Admin URL if it's the last step.
* Empty string on failure. * Empty string on failure.
@ -230,7 +250,7 @@ class WC_Admin_Setup_Wizard {
<?php do_action( 'admin_head' ); ?> <?php do_action( 'admin_head' ); ?>
</head> </head>
<body class="wc-setup wp-core-ui"> <body class="wc-setup wp-core-ui">
<h1 id="wc-logo"><a href="https://woocommerce.com/"><img src="<?php echo WC()->plugin_url(); ?>/assets/images/woocommerce_logo.png" alt="WooCommerce" /></a></h1> <h1 id="wc-logo"><a href="https://woocommerce.com/"><img src="<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/woocommerce_logo.png" alt="WooCommerce" /></a></h1>
<?php <?php
} }
@ -259,13 +279,15 @@ class WC_Admin_Setup_Wizard {
?> ?>
<ol class="wc-setup-steps"> <ol class="wc-setup-steps">
<?php foreach ( $output_steps as $step_key => $step ) : ?> <?php foreach ( $output_steps as $step_key => $step ) : ?>
<li class="<?php <li class="
<?php
if ( $step_key === $this->step ) { if ( $step_key === $this->step ) {
echo 'active'; echo 'active';
} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) { } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
echo 'done'; echo 'done';
} }
?>"><?php echo esc_html( $step['name'] ); ?></li> ?>
"><?php echo esc_html( $step['name'] ); ?></li>
<?php endforeach; ?> <?php endforeach; ?>
</ol> </ol>
<?php <?php
@ -294,7 +316,7 @@ class WC_Admin_Setup_Wizard {
$country = WC()->countries->get_base_country(); $country = WC()->countries->get_base_country();
$postcode = WC()->countries->get_base_postcode(); $postcode = WC()->countries->get_base_postcode();
$currency = get_option( 'woocommerce_currency', 'GBP' ); $currency = get_option( 'woocommerce_currency', 'GBP' );
$product_type = get_option( 'woocommerce_product_type' ); $product_type = get_option( 'woocommerce_product_type', 'both' );
if ( empty( $country ) ) { if ( empty( $country ) ) {
$user_location = WC_Geolocation::geolocate_ip(); $user_location = WC_Geolocation::geolocate_ip();
@ -310,7 +332,7 @@ class WC_Admin_Setup_Wizard {
?> ?>
<form method="post" class="address-step"> <form method="post" class="address-step">
<?php wp_nonce_field( 'wc-setup' ); ?> <?php wp_nonce_field( 'wc-setup' ); ?>
<p class="store-setup"><?php esc_html_e( "The following wizard will help you configure your store and get you started quickly.", 'woocommerce' ); ?></p> <p class="store-setup"><?php esc_html_e( 'The following wizard will help you configure your store and get you started quickly.', 'woocommerce' ); ?></p>
<label for="store_country_state" class="location-prompt"> <label for="store_country_state" class="location-prompt">
<?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?> <?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?>
</label> </label>
@ -390,7 +412,11 @@ class WC_Admin_Setup_Wizard {
<option value=""><?php esc_html_e( 'Choose a currency&hellip;', 'woocommerce' ); ?></option> <option value=""><?php esc_html_e( 'Choose a currency&hellip;', 'woocommerce' ); ?></option>
<?php foreach ( get_woocommerce_currencies() as $code => $name ) : ?> <?php foreach ( get_woocommerce_currencies() as $code => $name ) : ?>
<option value="<?php echo esc_attr( $code ); ?>" <?php selected( $currency, $code ); ?>> <option value="<?php echo esc_attr( $code ); ?>" <?php selected( $currency, $code ); ?>>
<?php printf( esc_html__( '%1$s (%2$s)', 'woocommerce' ), $name, get_woocommerce_currency_symbol( $code ) ); ?> <?php
// @codingStandardsIgnoreStart
printf( esc_html__( '%1$s (%2$s)', 'woocommerce' ), $name, get_woocommerce_currency_symbol( $code ) );
// // @codingStandardsIgnoreEnd
?>
</option> </option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
@ -405,22 +431,20 @@ class WC_Admin_Setup_Wizard {
id="product_type" id="product_type"
name="product_type" name="product_type"
required required
data-placeholder="<?php esc_attr_e( 'Please choose one&hellip;', 'woocommerce' ); ?>"
class="location-input wc-enhanced-select dropdown" class="location-input wc-enhanced-select dropdown"
> >
<option value="" <?php selected( $product_type, '' ); ?>><?php esc_html_e( 'Please choose one&hellip;', 'woocommerce' ); ?></option> <option value="both" <?php selected( $product_type, 'both' ); ?>><?php esc_html_e( 'I plan to sell both physical and digital products', 'woocommerce' ); ?></option>
<option value="physical" <?php selected( $product_type, 'physical' ); ?>><?php esc_html_e( 'I plan to sell physical products', 'woocommerce' ); ?></option> <option value="physical" <?php selected( $product_type, 'physical' ); ?>><?php esc_html_e( 'I plan to sell physical products', 'woocommerce' ); ?></option>
<option value="virtual" <?php selected( $product_type, 'virtual' ); ?>><?php esc_html_e( 'I plan to sell digital products', 'woocommerce' ); ?></option> <option value="virtual" <?php selected( $product_type, 'virtual' ); ?>><?php esc_html_e( 'I plan to sell digital products', 'woocommerce' ); ?></option>
<option value="both" <?php selected( $product_type, 'both' ); ?>><?php esc_html_e( 'I plan to sell both physical and digital products', 'woocommerce' ); ?></option>
</select> </select>
<?php if ( 'unknown' === get_option( 'woocommerce_allow_tracking', 'unknown' ) ) : ?> <?php if ( 'unknown' === get_option( 'woocommerce_allow_tracking', 'unknown' ) ) : ?>
<div class="allow-tracking"> <div class="allow-tracking">
<input type="checkbox" id="wc_tracker_optin" name="wc_tracker_optin" value="yes" checked /> <input type="checkbox" id="wc_tracker_optin" name="wc_tracker_optin" value="yes" checked />
<label for="wc_tracker_optin"><?php _e( 'Allow WooCommerce to collect non-sensitive diagnostic data and usage information.', 'woocommerce' ); ?></label> <label for="wc_tracker_optin"><?php esc_html_e( 'Allow WooCommerce to collect non-sensitive diagnostic data and usage information.', 'woocommerce' ); ?></label>
</div> </div>
<?php endif; ?> <?php endif; ?>
<p class="wc-setup-actions step"> <p class="wc-setup-actions step">
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Let's go!", 'woocommerce' ); ?>" name="save_step" /> <button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( "Let's go!", 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( "Let's go!", 'woocommerce' ); ?></button>
</p> </p>
</form> </form>
<?php <?php
@ -431,7 +455,7 @@ class WC_Admin_Setup_Wizard {
*/ */
public function wc_setup_store_setup_save() { public function wc_setup_store_setup_save() {
check_admin_referer( 'wc-setup' ); check_admin_referer( 'wc-setup' );
// @codingStandardsIgnoreStart
$address = sanitize_text_field( $_POST['store_address'] ); $address = sanitize_text_field( $_POST['store_address'] );
$address_2 = sanitize_text_field( $_POST['store_address_2'] ); $address_2 = sanitize_text_field( $_POST['store_address_2'] );
$city = sanitize_text_field( $_POST['store_city'] ); $city = sanitize_text_field( $_POST['store_city'] );
@ -440,7 +464,7 @@ class WC_Admin_Setup_Wizard {
$currency_code = sanitize_text_field( $_POST['currency_code'] ); $currency_code = sanitize_text_field( $_POST['currency_code'] );
$product_type = sanitize_text_field( $_POST['product_type'] ); $product_type = sanitize_text_field( $_POST['product_type'] );
$tracking = isset( $_POST['wc_tracker_optin'] ) && ( 'yes' === sanitize_text_field( $_POST['wc_tracker_optin'] ) ); $tracking = isset( $_POST['wc_tracker_optin'] ) && ( 'yes' === sanitize_text_field( $_POST['wc_tracker_optin'] ) );
// @codingStandardsIgnoreEnd
update_option( 'woocommerce_store_address', $address ); update_option( 'woocommerce_store_address', $address );
update_option( 'woocommerce_store_address_2', $address_2 ); update_option( 'woocommerce_store_address_2', $address_2 );
update_option( 'woocommerce_store_city', $city ); update_option( 'woocommerce_store_city', $city );
@ -477,13 +501,16 @@ class WC_Admin_Setup_Wizard {
/** /**
* Finishes replying to the client, but keeps the process running for further (async) code execution. * Finishes replying to the client, but keeps the process running for further (async) code execution.
* @see https://core.trac.wordpress.org/ticket/41358 *
* @see https://core.trac.wordpress.org/ticket/41358 .
*/ */
protected function close_http_connection() { protected function close_http_connection() {
// Only 1 PHP process can access a session object at a time, close this so the next request isn't kept waiting. // Only 1 PHP process can access a session object at a time, close this so the next request isn't kept waiting.
// @codingStandardsIgnoreStart
if ( session_id() ) { if ( session_id() ) {
session_write_close(); session_write_close();
} }
// @codingStandardsIgnoreEnd
wc_set_time_limit( 0 ); wc_set_time_limit( 0 );
@ -502,6 +529,7 @@ class WC_Admin_Setup_Wizard {
/** /**
* Function called after the HTTP request is finished, so it's executed without the client having to wait for it. * Function called after the HTTP request is finished, so it's executed without the client having to wait for it.
*
* @see WC_Admin_Setup_Wizard::install_plugin * @see WC_Admin_Setup_Wizard::install_plugin
* @see WC_Admin_Setup_Wizard::install_theme * @see WC_Admin_Setup_Wizard::install_theme
*/ */
@ -543,7 +571,7 @@ class WC_Admin_Setup_Wizard {
array_push( $this->deferred_actions, array( array_push( $this->deferred_actions, array(
'func' => array( 'WC_Install', 'background_installer' ), 'func' => array( 'WC_Install', 'background_installer' ),
'args' => array( $plugin_id, $plugin_info ) 'args' => array( $plugin_id, $plugin_info ),
) ); ) );
// Set the background installation flag for this plugin. // Set the background installation flag for this plugin.
@ -562,7 +590,7 @@ class WC_Admin_Setup_Wizard {
} }
array_push( $this->deferred_actions, array( array_push( $this->deferred_actions, array(
'func' => array( 'WC_Install', 'theme_background_installer' ), 'func' => array( 'WC_Install', 'theme_background_installer' ),
'args' => array( $theme_id ) 'args' => array( $theme_id ),
) ); ) );
} }
@ -594,8 +622,8 @@ class WC_Admin_Setup_Wizard {
* *
* Can also be used to determine if WCS supports a given country. * Can also be used to determine if WCS supports a given country.
* *
* @param string $country_code * @param string $country_code Country Code.
* @param string $currency_code * @param string $currency_code Currecy Code.
* @return bool|string Carrier name if supported, boolean False otherwise. * @return bool|string Carrier name if supported, boolean False otherwise.
*/ */
protected function get_wcs_shipping_carrier( $country_code, $currency_code ) { protected function get_wcs_shipping_carrier( $country_code, $currency_code ) {
@ -612,8 +640,8 @@ class WC_Admin_Setup_Wizard {
/** /**
* Get shipping methods based on country code. * Get shipping methods based on country code.
* *
* @param string $country_code * @param string $country_code Country code.
* @param string $currency_code * @param string $currency_code Currency code.
* @return array * @return array
*/ */
protected function get_wizard_shipping_methods( $country_code, $currency_code ) { protected function get_wizard_shipping_methods( $country_code, $currency_code ) {
@ -628,7 +656,7 @@ class WC_Admin_Setup_Wizard {
'settings' => array( 'settings' => array(
'cost' => array( 'cost' => array(
'type' => 'text', 'type' => 'text',
'default_value' => __( 'Cost', 'Short label for entering the cost of an item', 'woocommerce' ), 'default_value' => __( 'Cost', 'woocommerce' ),
'description' => __( 'What would you like to charge for flat rate shipping?', 'woocommerce' ), 'description' => __( 'What would you like to charge for flat rate shipping?', 'woocommerce' ),
'required' => true, 'required' => true,
), ),
@ -652,9 +680,9 @@ class WC_Admin_Setup_Wizard {
/** /**
* Render the available shipping methods for a given country code. * Render the available shipping methods for a given country code.
* *
* @param string $country_code * @param string $country_code Country code.
* @param string $currency_code * @param string $currency_code Currency code.
* @param string $input_prefix * @param string $input_prefix Input prefix.
*/ */
protected function shipping_method_selection_form( $country_code, $currency_code, $input_prefix ) { protected function shipping_method_selection_form( $country_code, $currency_code, $input_prefix ) {
$live_rate_carrier = $this->get_wcs_shipping_carrier( $country_code, $currency_code ); $live_rate_carrier = $this->get_wcs_shipping_carrier( $country_code, $currency_code );
@ -673,7 +701,7 @@ class WC_Admin_Setup_Wizard {
</div> </div>
<div class="shipping-method-descriptions"> <div class="shipping-method-descriptions">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?> <?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>"> <p class="shipping-method-description <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) { echo 'hide'; } ?>">
<?php echo esc_html( $method['description'] ); ?> <?php echo esc_html( $method['description'] ); ?>
</p> </p>
<?php endforeach; ?> <?php endforeach; ?>
@ -682,8 +710,8 @@ class WC_Admin_Setup_Wizard {
<div class="shipping-method-settings"> <div class="shipping-method-settings">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?> <?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<?php if ( empty( $method['settings'] ) ) continue; ?> <?php if ( empty( $method['settings'] ) ) { continue; } ?>
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>"> <div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) { echo 'hide'; } ?>">
<?php foreach ( $method['settings'] as $setting_id => $setting ) : ?> <?php foreach ( $method['settings'] as $setting_id => $setting ) : ?>
<?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?> <?php $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?>
<input <input
@ -727,15 +755,15 @@ class WC_Admin_Setup_Wizard {
if ( ! empty( $existing_zones ) ) { if ( ! empty( $existing_zones ) ) {
$intro_text = __( 'How would you like units on your store displayed?', 'woocommerce' ); $intro_text = __( 'How would you like units on your store displayed?', 'woocommerce' );
} elseif ( $wcs_carrier ) { } elseif ( $wcs_carrier ) {
$intro_text = sprintf(
/* translators: %1$s: country name including the 'the' prefix, %2$s: shipping carrier name */ /* translators: %1$s: country name including the 'the' prefix, %2$s: shipping carrier name */
$intro_text = sprintf(
__( "You're all set up to ship anywhere in %1\$s, and outside of it. We recommend using <strong>live rates</strong> (which are powered by our WooCommerce Services plugin and Jetpack) to get accurate %2\$s shipping prices to cover the cost of order fulfillment.", 'woocommerce' ), __( "You're all set up to ship anywhere in %1\$s, and outside of it. We recommend using <strong>live rates</strong> (which are powered by our WooCommerce Services plugin and Jetpack) to get accurate %2\$s shipping prices to cover the cost of order fulfillment.", 'woocommerce' ),
$prefixed_country_name, $prefixed_country_name,
$wcs_carrier $wcs_carrier
); );
} else { } else {
$intro_text = sprintf(
/* translators: %s: country name including the 'the' prefix if needed */ /* translators: %s: country name including the 'the' prefix if needed */
$intro_text = sprintf(
__( "You can choose which countries you'll be shipping to and with which methods. To get started, we've set you up with shipping inside and outside of %s.", 'woocommerce' ), __( "You can choose which countries you'll be shipping to and with which methods. To get started, we've set you up with shipping inside and outside of %s.", 'woocommerce' ),
$prefixed_country_name $prefixed_country_name
); );
@ -827,7 +855,7 @@ class WC_Admin_Setup_Wizard {
</div> </div>
<p class="wc-setup-actions step"> <p class="wc-setup-actions step">
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" /> <button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?> <?php wp_nonce_field( 'wc-setup' ); ?>
</p> </p>
</form> </form>
@ -840,18 +868,20 @@ class WC_Admin_Setup_Wizard {
public function wc_setup_shipping_save() { public function wc_setup_shipping_save() {
check_admin_referer( 'wc-setup' ); check_admin_referer( 'wc-setup' );
// If going through this step again, remove the live rates options // If going through this step again, remove the live rates options.
// in case the user saved different settings this time // in case the user saved different settings this time.
delete_option( 'woocommerce_setup_domestic_live_rates_zone' ); delete_option( 'woocommerce_setup_domestic_live_rates_zone' );
delete_option( 'woocommerce_setup_intl_live_rates_zone' ); delete_option( 'woocommerce_setup_intl_live_rates_zone' );
// @codingStandardsIgnoreStart
$setup_domestic = isset( $_POST['shipping_zones']['domestic']['enabled'] ) && ( 'yes' === $_POST['shipping_zones']['domestic']['enabled'] ); $setup_domestic = isset( $_POST['shipping_zones']['domestic']['enabled'] ) && ( 'yes' === $_POST['shipping_zones']['domestic']['enabled'] );
$domestic_method = sanitize_text_field( $_POST['shipping_zones']['domestic']['method'] ); $domestic_method = sanitize_text_field( wp_unslash( $_POST['shipping_zones']['domestic']['method'] ) );
$setup_intl = isset( $_POST['shipping_zones']['intl']['enabled'] ) && ( 'yes' === $_POST['shipping_zones']['intl']['enabled'] ); $setup_intl = isset( $_POST['shipping_zones']['intl']['enabled'] ) && ( 'yes' === $_POST['shipping_zones']['intl']['enabled'] );
$intl_method = sanitize_text_field( $_POST['shipping_zones']['intl']['method'] ); $intl_method = sanitize_text_field( wp_unslash( $_POST['shipping_zones']['intl']['method'] ) );
$weight_unit = sanitize_text_field( $_POST['weight_unit'] ); $weight_unit = sanitize_text_field( wp_unslash( $_POST['weight_unit'] ) );
$dimension_unit = sanitize_text_field( $_POST['dimension_unit'] ); $dimension_unit = sanitize_text_field( wp_unslash( $_POST['dimension_unit'] ) );
$existing_zones = WC_Shipping_Zones::get_zones(); $existing_zones = WC_Shipping_Zones::get_zones();
// @codingStandardsIgnoreEnd
update_option( 'woocommerce_ship_to_countries', '' ); update_option( 'woocommerce_ship_to_countries', '' );
update_option( 'woocommerce_weight_unit', $weight_unit ); update_option( 'woocommerce_weight_unit', $weight_unit );
@ -894,12 +924,13 @@ class WC_Admin_Setup_Wizard {
// Save chosen shipping method settings (using REST controller for convenience). // Save chosen shipping method settings (using REST controller for convenience).
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['domestic'][ $domestic_method ] ) ) { if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['domestic'][ $domestic_method ] ) ) {
$method_controller = new WC_REST_Shipping_Zone_Methods_Controller(); $method_controller = new WC_REST_Shipping_Zone_Methods_Controller();
// @codingStandardsIgnoreStart
$method_controller->update_item( array( $method_controller->update_item( array(
'zone_id' => $zone->get_id(), 'zone_id' => $zone->get_id(),
'instance_id' => $instance_id, 'instance_id' => $instance_id,
'settings' => $_POST['shipping_zones']['domestic'][ $domestic_method ], 'settings' => wp_unslash( $_POST['shipping_zones']['domestic'][ $domestic_method ] ),
) ); ) );
// @codingStandardsIgnoreEnd
} }
} }
@ -918,12 +949,13 @@ class WC_Admin_Setup_Wizard {
// Save chosen shipping method settings (using REST controller for convenience). // Save chosen shipping method settings (using REST controller for convenience).
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['intl'][ $intl_method ] ) ) { if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['intl'][ $intl_method ] ) ) {
$method_controller = new WC_REST_Shipping_Zone_Methods_Controller(); $method_controller = new WC_REST_Shipping_Zone_Methods_Controller();
// @codingStandardsIgnoreStart
$method_controller->update_item( array( $method_controller->update_item( array(
'zone_id' => $zone->get_id(), 'zone_id' => $zone->get_id(),
'instance_id' => $instance_id, 'instance_id' => $instance_id,
'settings' => $_POST['shipping_zones']['intl'][ $intl_method ], 'settings' => wp_unslash( $_POST['shipping_zones']['intl'][ $intl_method ] ),
) ); ) );
// @codingStandardsIgnoreEnd
} }
} }
@ -937,7 +969,10 @@ class WC_Admin_Setup_Wizard {
} }
/** /**
* https://stripe.com/global * Is Stripe country supported
* https://stripe.com/global .
*
* @param string $country_code Country code.
*/ */
protected function is_stripe_supported_country( $country_code ) { protected function is_stripe_supported_country( $country_code ) {
$stripe_supported_countries = array( $stripe_supported_countries = array(
@ -1078,6 +1113,7 @@ class WC_Admin_Setup_Wizard {
/** /**
* Simple array of "manual" gateways to show in wizard. * Simple array of "manual" gateways to show in wizard.
*
* @return array * @return array
*/ */
protected function get_wizard_manual_payment_gateways() { protected function get_wizard_manual_payment_gateways() {
@ -1107,6 +1143,9 @@ class WC_Admin_Setup_Wizard {
/** /**
* Display service item in list. * Display service item in list.
*
* @param int $item_id Item ID.
* @param array $item_info Item info array.
*/ */
public function display_service_item( $item_id, $item_info ) { public function display_service_item( $item_id, $item_info ) {
$item_class = 'wc-wizard-service-item'; $item_class = 'wc-wizard-service-item';
@ -1116,8 +1155,8 @@ class WC_Admin_Setup_Wizard {
$previously_saved_settings = get_option( 'woocommerce_' . $item_id . '_settings' ); $previously_saved_settings = get_option( 'woocommerce_' . $item_id . '_settings' );
// Show the user-saved state if it was previously saved // Show the user-saved state if it was previously saved.
// Otherwise, rely on the item info // Otherwise, rely on the item info.
if ( is_array( $previously_saved_settings ) ) { if ( is_array( $previously_saved_settings ) ) {
$should_enable_toggle = 'yes' === $previously_saved_settings['enabled']; $should_enable_toggle = 'yes' === $previously_saved_settings['enabled'];
} else { } else {
@ -1194,10 +1233,22 @@ class WC_Admin_Setup_Wizard {
<?php <?php
} }
/**
* Is it a featured service?
*
* @param array $service Service info array.
* @return boolean
*/
public function is_featured_service( $service ) { public function is_featured_service( $service ) {
return ! empty( $service['featured'] ); return ! empty( $service['featured'] );
} }
/**
* Is this a non featured service?
*
* @param array $service Service info array.
* @return boolean
*/
public function is_not_featured_service( $service ) { public function is_not_featured_service( $service ) {
return ! $this->is_featured_service( $service ); return ! $this->is_featured_service( $service );
} }
@ -1213,8 +1264,10 @@ class WC_Admin_Setup_Wizard {
<h1><?php esc_html_e( 'Payment', 'woocommerce' ); ?></h1> <h1><?php esc_html_e( 'Payment', 'woocommerce' ); ?></h1>
<form method="post" class="wc-wizard-payment-gateway-form"> <form method="post" class="wc-wizard-payment-gateway-form">
<p> <p>
<?php printf( __( <?php printf(
'WooCommerce can accept both online and offline payments. <a href="%1$s" target="_blank">Additional payment methods</a> can be installed later.', 'woocommerce' ), esc_html__(
'WooCommerce can accept both online and offline payments. <a href="%1$s" target="_blank">Additional payment methods</a> can be installed later.', 'woocommerce'
),
esc_url( admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) ) esc_url( admin_url( 'admin.php?page=wc-addons&view=payment-gateways' ) )
); ?> ); ?>
</p> </p>
@ -1250,7 +1303,7 @@ class WC_Admin_Setup_Wizard {
endforeach; ?> endforeach; ?>
</ul> </ul>
<p class="wc-setup-actions step"> <p class="wc-setup-actions step">
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" /> <button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?> <?php wp_nonce_field( 'wc-setup' ); ?>
</p> </p>
</form> </form>
@ -1283,13 +1336,15 @@ class WC_Admin_Setup_Wizard {
$settings = array_filter( (array) get_option( $settings_key, array() ) ); $settings = array_filter( (array) get_option( $settings_key, array() ) );
$settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no'; $settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no';
// @codingStandardsIgnoreStart
if ( ! empty( $gateway['settings'] ) ) { if ( ! empty( $gateway['settings'] ) ) {
foreach ( $gateway['settings'] as $setting_id => $setting ) { foreach ( $gateway['settings'] as $setting_id => $setting ) {
$settings[ $setting_id ] = 'yes' === $settings['enabled'] $settings[ $setting_id ] = 'yes' === $settings['enabled']
? wc_clean( $_POST[ $gateway_id . '_' . $setting_id ] ) ? wc_clean( wp_unslash( $_POST[ $gateway_id . '_' . $setting_id ] ) )
: false; : false;
} }
} }
// @codingStandardsIgnoreSEnd
update_option( $settings_key, $settings ); update_option( $settings_key, $settings );
} }
@ -1360,7 +1415,7 @@ class WC_Admin_Setup_Wizard {
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<p class="wc-setup-actions step"> <p class="wc-setup-actions step">
<input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" /> <button type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'wc-setup' ); ?> <?php wp_nonce_field( 'wc-setup' ); ?>
</p> </p>
</form> </form>
@ -1488,7 +1543,7 @@ class WC_Admin_Setup_Wizard {
</p> </p>
<form method="post" class="activate-jetpack"> <form method="post" class="activate-jetpack">
<p class="wc-setup-actions step"> <p class="wc-setup-actions step">
<input type="submit" class="button-primary button button-large" value="<?php esc_attr_e( 'Connect with Jetpack', 'woocommerce' ); ?>" /> <button type="submit" class="button-primary button button-large" value="<?php esc_attr_e( 'Connect with Jetpack', 'woocommerce' ); ?>"><?php esc_html_e( 'Continue with Jetpack', 'woocommerce' ); ?></button>
</p> </p>
<input type="hidden" name="save_step" value="activate" /> <input type="hidden" name="save_step" value="activate" />
<?php wp_nonce_field( 'wc-setup' ); ?> <?php wp_nonce_field( 'wc-setup' ); ?>
@ -1623,13 +1678,13 @@ class WC_Admin_Setup_Wizard {
required required
> >
<p class="wc-setup-actions step newsletter-form-button-container"> <p class="wc-setup-actions step newsletter-form-button-container">
<input <button
type="submit" type="submit"
value="<?php esc_html_e( 'Yes please!', 'woocommerce' ); ?>" value="<?php esc_html_e( 'Yes please!', 'woocommerce' ); ?>"
name="subscribe" name="subscribe"
id="mc-embedded-subscribe" id="mc-embedded-subscribe"
class="button-primary button newsletter-form-button" class="button-primary button newsletter-form-button"
> ><?php esc_html_e( 'Yes please!', 'woocommerce' ); ?></button>
</p> </p>
</div> </div>
</form> </form>

View File

@ -1,4 +1,13 @@
<?php <?php
/**
* Tax importer class file
*
* @version 2.3.0
* @category Admin
* @package WooCommerce/Admin
* @author WooCommerce
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -50,6 +59,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
*/ */
public function __construct() { public function __construct() {
$this->import_page = 'woocommerce_tax_rate_csv'; $this->import_page = 'woocommerce_tax_rate_csv';
// @codingStandardsIgnoreLine
$this->delimiter = empty( $_POST['delimiter'] ) ? ',' : (string) wc_clean( $_POST['delimiter'] ); $this->delimiter = empty( $_POST['delimiter'] ) ? ',' : (string) wc_clean( $_POST['delimiter'] );
} }
@ -107,8 +117,8 @@ class WC_Tax_Rate_Importer extends WP_Importer {
/** /**
* UTF-8 encode the data if `$enc` value isn't UTF-8. * UTF-8 encode the data if `$enc` value isn't UTF-8.
* *
* @param mixed $data * @param mixed $data Data.
* @param string $enc * @param string $enc Encoding.
* @return string * @return string
*/ */
public function format_data_from_csv( $data, $enc ) { public function format_data_from_csv( $data, $enc ) {
@ -118,7 +128,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
/** /**
* Import the file if it exists and is valid. * Import the file if it exists and is valid.
* *
* @param mixed $file * @param mixed $file File.
*/ */
public function import( $file ) { public function import( $file ) {
if ( ! is_file( $file ) ) { if ( ! is_file( $file ) ) {
@ -129,11 +139,11 @@ class WC_Tax_Rate_Importer extends WP_Importer {
$loop = 0; $loop = 0;
if ( ( $handle = fopen( $file, "r" ) ) !== false ) { if ( ( $handle = fopen( $file, 'r' ) ) !== false ) {
$header = fgetcsv( $handle, 0, $this->delimiter ); $header = fgetcsv( $handle, 0, $this->delimiter );
if ( 10 === sizeof( $header ) ) { if ( 10 === count( $header ) ) {
while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== false ) { while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== false ) {
@ -162,12 +172,12 @@ class WC_Tax_Rate_Importer extends WP_Importer {
fclose( $handle ); fclose( $handle );
} }
// Show Result // Show Result.
echo '<div class="updated settings-error"><p>'; echo '<div class="updated settings-error"><p>';
/* translators: %s: tax rates count */ /* translators: %s: tax rates count */
printf( printf(
__( 'Import complete - imported %s tax rates.', 'woocommerce' ), esc_html__( 'Import complete - imported %s tax rates.', 'woocommerce' ),
'<strong>' . $loop . '</strong>' '<strong>' . absint( $loop ) . '</strong>'
); );
echo '</p></div>'; echo '</p></div>';
@ -178,7 +188,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
* Performs post-import cleanup of files and the cache. * Performs post-import cleanup of files and the cache.
*/ */
public function import_end() { public function import_end() {
echo '<p>' . __( 'All done!', 'woocommerce' ) . ' <a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '">' . __( 'View tax rates', 'woocommerce' ) . '</a>' . '</p>'; echo '<p>' . esc_html__( 'All done!', 'woocommerce' ) . ' <a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=tax' ) ) . '">' . esc_html__( 'View tax rates', 'woocommerce' ) . '</a></p>';
do_action( 'import_end' ); do_action( 'import_end' );
} }
@ -190,6 +200,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
* @return bool False if error uploading or invalid file, true otherwise * @return bool False if error uploading or invalid file, true otherwise
*/ */
public function handle_upload() { public function handle_upload() {
// @codingStandardsIgnoreLine
if ( empty( $_POST['file_url'] ) ) { if ( empty( $_POST['file_url'] ) ) {
$file = wp_import_handle_upload(); $file = wp_import_handle_upload();
@ -199,8 +210,9 @@ class WC_Tax_Rate_Importer extends WP_Importer {
} }
$this->id = absint( $file['id'] ); $this->id = absint( $file['id'] );
// @codingStandardsIgnoreLine
} elseif ( file_exists( ABSPATH . $_POST['file_url'] ) ) { } elseif ( file_exists( ABSPATH . $_POST['file_url'] ) ) {
// @codingStandardsIgnoreLine
$this->file_url = esc_attr( $_POST['file_url'] ); $this->file_url = esc_attr( $_POST['file_url'] );
} else { } else {
$this->import_error(); $this->import_error();
@ -214,7 +226,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
*/ */
public function header() { public function header() {
echo '<div class="wrap">'; echo '<div class="wrap">';
echo '<h1>' . __( 'Import tax rates', 'woocommerce' ) . '</h1>'; echo '<h1>' . esc_html__( 'Import tax rates', 'woocommerce' ) . '</h1>';
} }
/** /**
@ -230,9 +242,9 @@ class WC_Tax_Rate_Importer extends WP_Importer {
public function greet() { public function greet() {
echo '<div class="narrow">'; echo '<div class="narrow">';
echo '<p>' . __( 'Hi there! Upload a CSV file containing tax rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce' ) . '</p>'; echo '<p>' . esc_html__( 'Hi there! Upload a CSV file containing tax rates to import the contents into your shop. Choose a .csv file to upload, then click "Upload file and import".', 'woocommerce' ) . '</p>';
echo '<p>' . sprintf( __( 'Tax rates need to be defined with columns in a specific order (10 columns). <a href="%s">Click here to download a sample</a>.', 'woocommerce' ), WC()->plugin_url() . '/dummy-data/sample_tax_rates.csv' ) . '</p>'; echo '<p>' . sprintf( esc_html__( 'Tax rates need to be defined with columns in a specific order (10 columns). <a href="%s">Click here to download a sample</a>.', 'woocommerce' ), esc_url( WC()->plugin_url() ) . '/dummy-data/sample_tax_rates.csv' ) . '</p>';
$action = 'admin.php?import=woocommerce_tax_rate_csv&step=1'; $action = 'admin.php?import=woocommerce_tax_rate_csv&step=1';
@ -240,8 +252,8 @@ class WC_Tax_Rate_Importer extends WP_Importer {
$size = size_format( $bytes ); $size = size_format( $bytes );
$upload_dir = wp_upload_dir(); $upload_dir = wp_upload_dir();
if ( ! empty( $upload_dir['error'] ) ) : if ( ! empty( $upload_dir['error'] ) ) :
?><div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:', 'woocommerce' ); ?></p> ?><div class="error"><p><?php esc_html_e( 'Before you can upload your import file, you will need to fix the following error:', 'woocommerce' ); ?></p>
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php <p><strong><?php echo esc_html( $upload_dir['error'] ); ?></strong></p></div><?php
else : else :
?> ?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr( wp_nonce_url( $action, 'import-upload' ) ); ?>"> <form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo esc_attr( wp_nonce_url( $action, 'import-upload' ) ); ?>">
@ -249,37 +261,39 @@ class WC_Tax_Rate_Importer extends WP_Importer {
<tbody> <tbody>
<tr> <tr>
<th> <th>
<label for="upload"><?php _e( 'Choose a file from your computer:', 'woocommerce' ); ?></label> <label for="upload"><?php esc_html_e( 'Choose a file from your computer:', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<input type="file" id="upload" name="import" size="25" /> <input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" /> <input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" /> <input type="hidden" name="max_file_size" value="<?php echo absint( $bytes ); ?>" />
<small><?php <small>
<?php
/* translators: %s: maximum upload size */ /* translators: %s: maximum upload size */
printf( printf(
__( 'Maximum size: %s', 'woocommerce' ), esc_html__( 'Maximum size: %s', 'woocommerce' ),
$size esc_attr( $size )
); );
?></small> ?>
</small>
</td> </td>
</tr> </tr>
<tr> <tr>
<th> <th>
<label for="file_url"><?php _e( 'OR enter path to file:', 'woocommerce' ); ?></label> <label for="file_url"><?php esc_html_e( 'OR enter path to file:', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<?php echo ' ' . ABSPATH . ' '; ?><input type="text" id="file_url" name="file_url" size="25" /> <?php echo ' ' . esc_html( ABSPATH ) . ' '; ?><input type="text" id="file_url" name="file_url" size="25" />
</td> </td>
</tr> </tr>
<tr> <tr>
<th><label><?php _e( 'Delimiter', 'woocommerce' ); ?></label><br/></th> <th><label><?php esc_html_e( 'Delimiter', 'woocommerce' ); ?></label><br/></th>
<td><input type="text" name="delimiter" placeholder="," size="2" /></td> <td><input type="text" name="delimiter" placeholder="," size="2" /></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p class="submit"> <p class="submit">
<input type="submit" class="button" value="<?php esc_attr_e( 'Upload file and import', 'woocommerce' ); ?>" /> <button type="submit" class="button" value="<?php esc_attr_e( 'Upload file and import', 'woocommerce' ); ?>"><?php esc_html_e( 'Upload file and import', 'woocommerce' ); ?></button>
</p> </p>
</form> </form>
<?php <?php
@ -290,10 +304,11 @@ class WC_Tax_Rate_Importer extends WP_Importer {
/** /**
* Show import error and quit. * Show import error and quit.
* @param string $message *
* @param string $message Error messag.
*/ */
private function import_error( $message = '' ) { private function import_error( $message = '' ) {
echo '<p><strong>' . __( 'Sorry, there has been an error.', 'woocommerce' ) . '</strong><br />'; echo '<p><strong>' . esc_html__( 'Sorry, there has been an error.', 'woocommerce' ) . '</strong><br />';
if ( $message ) { if ( $message ) {
echo esc_html( $message ); echo esc_html( $message );
} }
@ -305,7 +320,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
/** /**
* Added to http_request_timeout filter to force timeout at 60 seconds during import. * Added to http_request_timeout filter to force timeout at 60 seconds during import.
* *
* @param int $val * @param int $val Value.
* @return int 60 * @return int 60
*/ */
public function bump_request_timeout( $val ) { public function bump_request_timeout( $val ) {

View File

@ -1,7 +1,10 @@
<?php <?php
/** /**
* Admin View: Importer - CSV mapping * Admin View: Importer - CSV mapping
*
* @package WooCommerce/Admin
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -15,8 +18,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<table class="widefat wc-importer-mapping-table"> <table class="widefat wc-importer-mapping-table">
<thead> <thead>
<tr> <tr>
<th><?php _e( 'Column name', 'woocommerce' ); ?></th> <th><?php esc_html_e( 'Column name', 'woocommerce' ); ?></th>
<th><?php _e( 'Map to field', 'woocommerce' ); ?></th> <th><?php esc_html_e( 'Map to field', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -26,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<td class="wc-importer-mapping-table-name"> <td class="wc-importer-mapping-table-name">
<?php echo esc_html( $name ); ?> <?php echo esc_html( $name ); ?>
<?php if ( ! empty( $sample[ $index ] ) ) : ?> <?php if ( ! empty( $sample[ $index ] ) ) : ?>
<span class="description"><?php _e( 'Sample:', 'woocommerce' ); ?> <code><?php echo esc_html( $sample[ $index ] ); ?></code></span> <span class="description"><?php esc_html_e( 'Sample:', 'woocommerce' ); ?> <code><?php echo esc_html( $sample[ $index ] ); ?></code></span>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td class="wc-importer-mapping-table-field"> <td class="wc-importer-mapping-table-field">
@ -53,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</table> </table>
</section> </section>
<div class="wc-actions"> <div class="wc-actions">
<input type="submit" class="button button-primary button-next" value="<?php esc_attr_e( 'Run the importer', 'woocommerce' ); ?>" name="save_step" /> <button type="submit" class="button button-primary button-next" value="<?php esc_attr_e( 'Run the importer', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Run the importer', 'woocommerce' ); ?></button>
<input type="hidden" name="file" value="<?php echo esc_attr( $this->file ); ?>" /> <input type="hidden" name="file" value="<?php echo esc_attr( $this->file ); ?>" />
<input type="hidden" name="delimiter" value="<?php echo esc_attr( $this->delimiter ); ?>" /> <input type="hidden" name="delimiter" value="<?php echo esc_attr( $this->delimiter ); ?>" />
<input type="hidden" name="update_existing" value="<?php echo (int) $this->update_existing; ?>" /> <input type="hidden" name="update_existing" value="<?php echo (int) $this->update_existing; ?>" />

View File

@ -1,7 +1,10 @@
<?php <?php
/** /**
* Admin View: Product import form * Admin View: Product import form
*
* @package WooCommerce/Admin
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -17,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="upload"> <label for="upload">
<?php _e( 'Choose a CSV file from your computer:', 'woocommerce' ); ?> <?php esc_html_e( 'Choose a CSV file from your computer:', 'woocommerce' ); ?>
</label> </label>
</th> </th>
<td> <td>
@ -32,20 +35,23 @@ if ( ! defined( 'ABSPATH' ) ) {
<input type="file" id="upload" name="import" size="25" /> <input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" /> <input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo esc_attr( $bytes ); ?>" /> <input type="hidden" name="max_file_size" value="<?php echo esc_attr( $bytes ); ?>" />
<br><small><?php <br>
<small>
<?php
/* translators: %s: maximum upload size */ /* translators: %s: maximum upload size */
printf( printf(
__( 'Maximum size: %s', 'woocommerce' ), esc_html__( 'Maximum size: %s', 'woocommerce' ),
$size absint( $size )
); );
?></small> ?>
</small>
<?php <?php
} }
?> ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<th><label for="woocommerce-importer-update-existing"><?php _e( 'Update existing products', 'woocommerce' ); ?></label><br/></th> <th><label for="woocommerce-importer-update-existing"><?php esc_html_e( 'Update existing products', 'woocommerce' ); ?></label><br/></th>
<td> <td>
<input type="hidden" name="update_existing" value="0" /> <input type="hidden" name="update_existing" value="0" />
<input type="checkbox" id="woocommerce-importer-update-existing" name="update_existing" value="1" /> <input type="checkbox" id="woocommerce-importer-update-existing" name="update_existing" value="1" />
@ -54,7 +60,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr class="woocommerce-importer-advanced hidden"> <tr class="woocommerce-importer-advanced hidden">
<th> <th>
<label for="woocommerce-importer-file-url"><?php _e( '<em>or</em> enter the path to a CSV file on your server:', 'woocommerce' ); ?></label> <label for="woocommerce-importer-file-url"><?php esc_html_e( '<em>or</em> enter the path to a CSV file on your server:', 'woocommerce' ); ?></label>
</th> </th>
<td> <td>
<label for="woocommerce-importer-file-url" class="woocommerce-importer-file-url-field-wrapper"> <label for="woocommerce-importer-file-url" class="woocommerce-importer-file-url-field-wrapper">
@ -63,7 +69,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</td> </td>
</tr> </tr>
<tr class="woocommerce-importer-advanced hidden"> <tr class="woocommerce-importer-advanced hidden">
<th><label><?php _e( 'CSV Delimiter', 'woocommerce' ); ?></label><br/></th> <th><label><?php esc_html_e( 'CSV Delimiter', 'woocommerce' ); ?></label><br/></th>
<td><input type="text" name="delimiter" placeholder="," size="2" /></td> <td><input type="text" name="delimiter" placeholder="," size="2" /></td>
</tr> </tr>
</tbody> </tbody>
@ -86,7 +92,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</script> </script>
<div class="wc-actions"> <div class="wc-actions">
<a href="#" class="woocommerce-importer-toggle-advanced-options" data-hidetext="<?php esc_html_e( 'Hide advanced options', 'woocommerce' ); ?>" data-showtext="<?php esc_html_e( 'Hide advanced options', 'woocommerce' ); ?>"><?php esc_html_e( 'Show advanced options', 'woocommerce' ); ?></a> <a href="#" class="woocommerce-importer-toggle-advanced-options" data-hidetext="<?php esc_html_e( 'Hide advanced options', 'woocommerce' ); ?>" data-showtext="<?php esc_html_e( 'Hide advanced options', 'woocommerce' ); ?>"><?php esc_html_e( 'Show advanced options', 'woocommerce' ); ?></a>
<input type="submit" class="button button-primary button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step" /> <button type="submit" class="button button-primary button-next" value="<?php esc_attr_e( 'Continue', 'woocommerce' ); ?>" name="save_step"><?php esc_html_e( 'Continue', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'woocommerce-csv-importer' ); ?> <?php wp_nonce_field( 'woocommerce-csv-importer' ); ?>
</div> </div>
</form> </form>

View File

@ -11,7 +11,7 @@
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
/** /**
@ -22,7 +22,7 @@ class WC_Meta_Box_Order_Actions {
/** /**
* Output the metabox. * Output the metabox.
* *
* @param WP_Post $post * @param WP_Post $post Post object.
*/ */
public static function output( $post ) { public static function output( $post ) {
global $theorder; global $theorder;
@ -44,17 +44,17 @@ class WC_Meta_Box_Order_Actions {
<li class="wide" id="actions"> <li class="wide" id="actions">
<select name="wc_order_action"> <select name="wc_order_action">
<option value=""><?php _e( 'Choose an action...', 'woocommerce' ); ?></option> <option value=""><?php esc_html_e( 'Choose an action...', 'woocommerce' ); ?></option>
<?php foreach ( $order_actions as $action => $title ) { ?> <?php foreach ( $order_actions as $action => $title ) { ?>
<option value="<?php echo $action; ?>"><?php echo $title; ?></option> <option value="<?php echo esc_attr( $action ); ?>"><?php echo esc_html( $title ); ?></option>
<?php } ?> <?php } ?>
</select> </select>
<button class="button wc-reload"><span><?php _e( 'Apply', 'woocommerce' ); ?></span></button> <button class="button wc-reload"><span><?php esc_html_e( 'Apply', 'woocommerce' ); ?></span></button>
</li> </li>
<li class="wide"> <li class="wide">
<div id="delete-action"><?php <div id="delete-action">
<?php
if ( current_user_can( 'delete_post', $post->ID ) ) { if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( ! EMPTY_TRASH_DAYS ) { if ( ! EMPTY_TRASH_DAYS ) {
@ -62,11 +62,12 @@ class WC_Meta_Box_Order_Actions {
} else { } else {
$delete_text = __( 'Move to trash', 'woocommerce' ); $delete_text = __( 'Move to trash', 'woocommerce' );
} }
?><a class="submitdelete deletion" href="<?php echo esc_url( get_delete_post_link( $post->ID ) ); ?>"><?php echo $delete_text; ?></a><?php ?><a class="submitdelete deletion" href="<?php echo esc_url( get_delete_post_link( $post->ID ) ); ?>"><?php echo esc_html( $delete_text ); ?></a><?php
} }
?></div> ?>
</div>
<input type="submit" class="button save_order button-primary" name="save" value="<?php echo 'auto-draft' === $post->post_status ? esc_attr__( 'Create', 'woocommerce' ) : esc_attr__( 'Update', 'woocommerce' ); ?>" /> <button type="submit" class="button save_order button-primary" name="save" value="<?php echo 'auto-draft' === $post->post_status ? esc_attr__( 'Create', 'woocommerce' ) : esc_attr__( 'Update', 'woocommerce' ); ?>"><?php echo 'auto-draft' === $post->post_status ? esc_html__( 'Create', 'woocommerce' ) : esc_html__( 'Update', 'woocommerce' ); ?></button>
</li> </li>
<?php do_action( 'woocommerce_order_actions_end', $post->ID ); ?> <?php do_action( 'woocommerce_order_actions_end', $post->ID ); ?>
@ -78,17 +79,17 @@ class WC_Meta_Box_Order_Actions {
/** /**
* Save meta box data. * Save meta box data.
* *
* @param int $post_id * @param int $post_id Post ID.
* @param WP_Post $post * @param WP_Post $post Post Object.
*/ */
public static function save( $post_id, $post ) { public static function save( $post_id, $post ) {
// Order data saved, now get it so we can manipulate status. // Order data saved, now get it so we can manipulate status.
$order = wc_get_order( $post_id ); $order = wc_get_order( $post_id );
// Handle button actions // Handle button actions.
if ( ! empty( $_POST['wc_order_action'] ) ) { if ( ! empty( $_POST['wc_order_action'] ) ) { // @codingStandardsIgnoreLine
$action = wc_clean( $_POST['wc_order_action'] ); $action = wc_clean( wp_unslash( $_POST['wc_order_action'] ) ); // @codingStandardsIgnoreLine
if ( 'send_order_details' === $action ) { if ( 'send_order_details' === $action ) {
do_action( 'woocommerce_before_resend_order_emails', $order, 'customer_invoice' ); do_action( 'woocommerce_before_resend_order_emails', $order, 'customer_invoice' );
@ -137,12 +138,9 @@ class WC_Meta_Box_Order_Actions {
/** /**
* Set the correct message ID. * Set the correct message ID.
* *
* @param string $location * @param string $location Location.
*
* @since 2.3.0 * @since 2.3.0
*
* @static * @static
*
* @return string * @return string
*/ */
public static function set_email_sent_message( $location ) { public static function set_email_sent_message( $location ) {

View File

@ -1,7 +1,12 @@
<?php <?php
/**
* Coupon usage report functionality
*
* @package WooCommerce/Admin/Reports
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
/** /**
@ -33,9 +38,9 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
*/ */
public function __construct() { public function __construct() {
if ( isset( $_GET['coupon_codes'] ) && is_array( $_GET['coupon_codes'] ) ) { if ( isset( $_GET['coupon_codes'] ) && is_array( $_GET['coupon_codes'] ) ) {
$this->coupon_codes = array_filter( array_map( 'sanitize_text_field', $_GET['coupon_codes'] ) ); $this->coupon_codes = array_filter( array_map( 'sanitize_text_field', wp_unslash( $_GET['coupon_codes'] ) ) );
} elseif ( isset( $_GET['coupon_codes'] ) ) { } elseif ( isset( $_GET['coupon_codes'] ) ) {
$this->coupon_codes = array_filter( array( sanitize_text_field( $_GET['coupon_codes'] ) ) ); $this->coupon_codes = array_filter( array( sanitize_text_field( wp_unslash( $_GET['coupon_codes'] ) ) ) );
} }
} }
@ -138,7 +143,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'coupon_count' => '#d4d9dc', 'coupon_count' => '#d4d9dc',
); );
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day'; $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) { if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day'; $current_range = '7day';
@ -171,7 +176,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
*/ */
public function coupons_widget() { public function coupons_widget() {
?> ?>
<h4 class="section_title"><span><?php _e( 'Filter by coupon', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Filter by coupon', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<form method="GET"> <form method="GET">
<div> <div>
@ -200,27 +205,29 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
if ( ! empty( $used_coupons ) && is_array( $used_coupons ) ) : if ( ! empty( $used_coupons ) && is_array( $used_coupons ) ) :
?> ?>
<select id="coupon_codes" name="coupon_codes" class="wc-enhanced-select" data-placeholder="<?php esc_attr_e( 'Choose coupons&hellip;', 'woocommerce' ); ?>" style="width:100%;"> <select id="coupon_codes" name="coupon_codes" class="wc-enhanced-select" data-placeholder="<?php esc_attr_e( 'Choose coupons&hellip;', 'woocommerce' ); ?>" style="width:100%;">
<option value=""><?php _e( 'All coupons', 'woocommerce' ); ?></option> <option value=""><?php esc_html_e( 'All coupons', 'woocommerce' ); ?></option>
<?php <?php
foreach ( $used_coupons as $coupon ) { foreach ( $used_coupons as $coupon ) {
echo '<option value="' . esc_attr( $coupon ) . '" ' . selected( in_array( $coupon, $this->coupon_codes ), true, false ) . '>' . $coupon . '</option>'; echo '<option value="' . esc_attr( $coupon ) . '" ' . selected( in_array( $coupon, $this->coupon_codes ), true, false ) . '>' . esc_html( $coupon ) . '</option>';
} }
?> ?>
</select> </select>
<input type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>" /> <?php // @codingStandardsIgnoreStart ?>
<input type="hidden" name="range" value="<?php echo ( ! empty( $_GET['range'] ) ) ? esc_attr( $_GET['range'] ) : ''; ?>" /> <button type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>"><?php esc_html_e( 'Show', 'woocommerce' ); ?></button>
<input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( $_GET['start_date'] ) : ''; ?>" /> <input type="hidden" name="range" value="<?php echo ( ! empty( $_GET['range'] ) ) ? esc_attr( wp_unslash( $_GET['range'] ) ) : ''; ?>" />
<input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" /> <input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( wp_unslash( $_GET['start_date'] ) ) : ''; ?>" />
<input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( $_GET['page'] ) : ''; ?>" /> <input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( wp_unslash( $_GET['end_date'] ) ) : ''; ?>" />
<input type="hidden" name="tab" value="<?php echo ( ! empty( $_GET['tab'] ) ) ? esc_attr( $_GET['tab'] ) : ''; ?>" /> <input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( wp_unslash( $_GET['page'] ) ) : ''; ?>" />
<input type="hidden" name="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( $_GET['report'] ) : ''; ?>" /> <input type="hidden" name="tab" value="<?php echo ( ! empty( $_GET['tab'] ) ) ? esc_attr( wp_unslash( $_GET['tab'] ) ) : ''; ?>" />
<input type="hidden" name="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( wp_unslash( $_GET['report'] ) ) : ''; ?>" />
<?php // @codingStandardsIgnoreEnd ?>
<?php else : ?> <?php else : ?>
<span><?php _e( 'No used coupons found', 'woocommerce' ); ?></span> <span><?php esc_html_e( 'No used coupons found', 'woocommerce' ); ?></span>
<?php endif; ?> <?php endif; ?>
</div> </div>
</form> </form>
</div> </div>
<h4 class="section_title"><span><?php _e( 'Most popular', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Most popular', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<table cellspacing="0"> <table cellspacing="0">
<?php <?php
@ -257,17 +264,17 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
if ( ! empty( $most_popular ) && is_array( $most_popular ) ) { if ( ! empty( $most_popular ) && is_array( $most_popular ) ) {
foreach ( $most_popular as $coupon ) { foreach ( $most_popular as $coupon ) {
echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '"> echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '">
<td class="count" width="1%">' . $coupon->coupon_count . '</td> <td class="count" width="1%">' . esc_html( $coupon->coupon_count ) . '</td>
<td class="name"><a href="' . esc_url( add_query_arg( 'coupon_codes', $coupon->coupon_code ) ) . '">' . $coupon->coupon_code . '</a></td> <td class="name"><a href="' . esc_url( add_query_arg( 'coupon_codes', $coupon->coupon_code ) ) . '">' . esc_html( $coupon->coupon_code ) . '</a></td>
</tr>'; </tr>';
} }
} else { } else {
echo '<tr><td colspan="2">' . __( 'No coupons found in range', 'woocommerce' ) . '</td></tr>'; echo '<tr><td colspan="2">' . esc_html__( 'No coupons found in range', 'woocommerce' ) . '</td></tr>';
} }
?> ?>
</table> </table>
</div> </div>
<h4 class="section_title"><span><?php _e( 'Most discount', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Most discount', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<table cellspacing="0"> <table cellspacing="0">
<?php <?php
@ -303,13 +310,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
if ( ! empty( $most_discount ) && is_array( $most_discount ) ) { if ( ! empty( $most_discount ) && is_array( $most_discount ) ) {
foreach ( $most_discount as $coupon ) { foreach ( $most_discount as $coupon ) {
// @codingStandardsIgnoreStart
echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '"> echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '">
<td class="count" width="1%">' . wc_price( $coupon->discount_amount ) . '</td> <td class="count" width="1%">' . wc_price( $coupon->discount_amount ) . '</td>
<td class="name"><a href="' . esc_url( add_query_arg( 'coupon_codes', $coupon->coupon_code ) ) . '">' . $coupon->coupon_code . '</a></td> <td class="name"><a href="' . esc_url( add_query_arg( 'coupon_codes', $coupon->coupon_code ) ) . '">' . esc_html( $coupon->coupon_code ) . '</a></td>
</tr>'; </tr>';
// @codingStandardsIgnoreEnd
} }
} else { } else {
echo '<tr><td colspan="3">' . __( 'No coupons found in range', 'woocommerce' ) . '</td></tr>'; echo '<tr><td colspan="3">' . esc_html__( 'No coupons found in range', 'woocommerce' ) . '</td></tr>';
} }
?> ?>
</table> </table>
@ -342,17 +351,17 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
* Output an export link. * Output an export link.
*/ */
public function get_export_button() { public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day'; $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
?> ?>
<a <a
href="#" href="#"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); ?>.csv" download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo esc_attr( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) ); ?>.csv"
class="export_csv" class="export_csv"
data-export="chart" data-export="chart"
data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>" data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>"
data-groupby="<?php echo $this->chart_groupby; ?>" data-groupby="<?php echo esc_attr( $this->chart_groupby ); ?>"
> >
<?php _e( 'Export CSV', 'woocommerce' ); ?> <?php esc_html_e( 'Export CSV', 'woocommerce' ); ?>
</a> </a>
<?php <?php
} }
@ -363,7 +372,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
public function get_main_chart() { public function get_main_chart() {
global $wp_locale; global $wp_locale;
// Get orders and dates in range - we want the SUM of order totals, COUNT of order items, COUNT of orders, and the date // Get orders and dates in range - we want the SUM of order totals, COUNT of order items, COUNT of orders, and the date.
$order_coupon_counts_query = array( $order_coupon_counts_query = array(
'data' => array( 'data' => array(
'order_item_name' => array( 'order_item_name' => array(
@ -435,11 +444,11 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
$order_coupon_counts = $this->get_order_report_data( $order_coupon_counts_query ); $order_coupon_counts = $this->get_order_report_data( $order_coupon_counts_query );
$order_discount_amounts = $this->get_order_report_data( $order_discount_amounts_query ); $order_discount_amounts = $this->get_order_report_data( $order_discount_amounts_query );
// Prepare data for report // Prepare data for report.
$order_coupon_counts = $this->prepare_chart_data( $order_coupon_counts, 'post_date', 'order_coupon_count' , $this->chart_interval, $this->start_date, $this->chart_groupby ); $order_coupon_counts = $this->prepare_chart_data( $order_coupon_counts, 'post_date', 'order_coupon_count' , $this->chart_interval, $this->start_date, $this->chart_groupby );
$order_discount_amounts = $this->prepare_chart_data( $order_discount_amounts, 'post_date', 'discount_amount', $this->chart_interval, $this->start_date, $this->chart_groupby ); $order_discount_amounts = $this->prepare_chart_data( $order_discount_amounts, 'post_date', 'discount_amount', $this->chart_interval, $this->start_date, $this->chart_groupby );
// Encode in json format // Encode in json format.
$chart_data = json_encode( array( $chart_data = json_encode( array(
'order_coupon_counts' => array_values( $order_coupon_counts ), 'order_coupon_counts' => array_values( $order_coupon_counts ),
'order_discount_amounts' => array_values( $order_discount_amounts ), 'order_discount_amounts' => array_values( $order_discount_amounts ),
@ -452,15 +461,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
var main_chart; var main_chart;
jQuery(function(){ jQuery(function(){
var order_data = jQuery.parseJSON( '<?php echo $chart_data; ?>' ); var order_data = jQuery.parseJSON( '<?php echo $chart_data; ?>' );<?php // @codingStandardsIgnoreLine ?>
var drawGraph = function( highlight ) { var drawGraph = function( highlight ) {
var series = [ var series = [
{ {
label: "<?php echo esc_js( __( 'Number of coupons used', 'woocommerce' ) ) ?>", label: "<?php echo esc_js( __( 'Number of coupons used', 'woocommerce' ) ) ?>",
data: order_data.order_coupon_counts, data: order_data.order_coupon_counts,
color: '<?php echo $this->chart_colours['coupon_count']; ?>', color: '<?php echo esc_js( $this->chart_colours['coupon_count'] ); ?>',
bars: { fillColor: '<?php echo $this->chart_colours['coupon_count']; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' }, bars: { fillColor: '<?php echo esc_js( $this->chart_colours['coupon_count'] ); ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo esc_js( $this->barwidth ); ?> * 0.5, align: 'center' },
shadowSize: 0, shadowSize: 0,
hoverable: false hoverable: false
}, },
@ -468,11 +477,11 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
label: "<?php echo esc_js( __( 'Discount amount', 'woocommerce' ) ) ?>", label: "<?php echo esc_js( __( 'Discount amount', 'woocommerce' ) ) ?>",
data: order_data.order_discount_amounts, data: order_data.order_discount_amounts,
yaxis: 2, yaxis: 2,
color: '<?php echo $this->chart_colours['discount_amount']; ?>', color: '<?php echo esc_js( $this->chart_colours['discount_amount'] ); ?>',
points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true }, points: { show: true, radius: 5, lineWidth: 3, fillColor: '#fff', fill: true },
lines: { show: true, lineWidth: 4, fill: false }, lines: { show: true, lineWidth: 4, fill: false },
shadowSize: 0, shadowSize: 0,
<?php echo $this->get_currency_tooltip(); ?> <?php echo $this->get_currency_tooltip(); ?><?php // @codingStandardsIgnoreLine ?>
} }
]; ];
@ -510,7 +519,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
timeformat: "<?php echo ( 'day' === $this->chart_groupby ) ? '%d %b' : '%b'; ?>", timeformat: "<?php echo ( 'day' === $this->chart_groupby ) ? '%d %b' : '%b'; ?>",
monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ) ?>, monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ) ?>,
tickLength: 1, tickLength: 1,
minTickSize: [1, "<?php echo $this->chart_groupby; ?>"], minTickSize: [1, "<?php echo esc_js( $this->chart_groupby ); ?>"],
font: { font: {
color: "#aaa" color: "#aaa"
} }

View File

@ -1,7 +1,12 @@
<?php <?php
/**
* Sales by category report functionality
*
* @package WooCommerce/Admin/Reporting
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
/** /**
@ -54,7 +59,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
/** /**
* Get all product ids in a category (and its children). * Get all product ids in a category (and its children).
* *
* @param int $category_id * @param int $category_id Category ID.
* @return array * @return array
*/ */
public function get_products_in_category( $category_id ) { public function get_products_in_category( $category_id ) {
@ -119,7 +124,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
$this->chart_colours = array( '#3498db', '#34495e', '#1abc9c', '#2ecc71', '#f1c40f', '#e67e22', '#e74c3c', '#2980b9', '#8e44ad', '#2c3e50', '#16a085', '#27ae60', '#f39c12', '#d35400', '#c0392b' ); $this->chart_colours = array( '#3498db', '#34495e', '#1abc9c', '#2ecc71', '#f1c40f', '#e67e22', '#e74c3c', '#2980b9', '#8e44ad', '#2c3e50', '#16a085', '#27ae60', '#f39c12', '#d35400', '#c0392b' );
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day'; $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) { if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day'; $current_range = '7day';
@ -128,7 +133,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
$this->check_current_range_nonce( $current_range ); $this->check_current_range_nonce( $current_range );
$this->calculate_current_range( $current_range ); $this->calculate_current_range( $current_range );
// Get item sales data // Get item sales data.
if ( ! empty( $this->show_categories ) ) { if ( ! empty( $this->show_categories ) ) {
$order_items = $this->get_order_report_data( array( $order_items = $this->get_order_report_data( array(
'data' => array( 'data' => array(
@ -217,18 +222,20 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
include_once( WC()->plugin_path() . '/includes/walkers/class-product-cat-dropdown-walker.php' ); include_once( WC()->plugin_path() . '/includes/walkers/class-product-cat-dropdown-walker.php' );
echo wc_walk_category_dropdown_tree( $categories, 0, $r ); echo wc_walk_category_dropdown_tree( $categories, 0, $r ); // @codingStandardsIgnoreLine
?> ?>
</select> </select>
<a href="#" class="select_none"><?php _e( 'None', 'woocommerce' ); ?></a> <?php // @codingStandardsIgnoreStart ?>
<a href="#" class="select_all"><?php _e( 'All', 'woocommerce' ); ?></a> <a href="#" class="select_none"><?php esc_html_e( 'None', 'woocommerce' ); ?></a>
<input type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>" /> <a href="#" class="select_all"><?php esc_html_e( 'All', 'woocommerce' ); ?></a>
<input type="hidden" name="range" value="<?php echo ( ! empty( $_GET['range'] ) ) ? esc_attr( $_GET['range'] ) : ''; ?>" /> <button type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>"><?php esc_html_e( 'Show', 'woocommerce' ); ?></button>
<input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( $_GET['start_date'] ) : ''; ?>" /> <input type="hidden" name="range" value="<?php echo ( ! empty( $_GET['range'] ) ) ? esc_attr( wp_unslash( $_GET['range'] ) ) : ''; ?>" />
<input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" /> <input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( wp_unslash( $_GET['start_date'] ) ) : ''; ?>" />
<input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( $_GET['page'] ) : ''; ?>" /> <input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( wp_unslash( $_GET['end_date'] ) ) : ''; ?>" />
<input type="hidden" name="tab" value="<?php echo ( ! empty( $_GET['tab'] ) ) ? esc_attr( $_GET['tab'] ) : ''; ?>" /> <input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( wp_unslash( $_GET['page'] ) ) : ''; ?>" />
<input type="hidden" name="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( $_GET['report'] ) : ''; ?>" /> <input type="hidden" name="tab" value="<?php echo ( ! empty( $_GET['tab'] ) ) ? esc_attr( wp_unslash( $_GET['tab'] ) ) : ''; ?>" />
<input type="hidden" name="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( wp_unslash( $_GET['report'] ) ) : ''; ?>" />
<?php // @codingStandardsIgnoreEnd ?>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
jQuery(function(){ jQuery(function(){
@ -255,17 +262,17 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
*/ */
public function get_export_button() { public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day'; $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
?> ?>
<a <a
href="#" href="#"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); ?>.csv" download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo esc_attr( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) ); ?>.csv"
class="export_csv" class="export_csv"
data-export="chart" data-export="chart"
data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>" data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>"
data-groupby="<?php echo $this->chart_groupby; ?>" data-groupby="<?php echo esc_attr( $this->chart_groupby ); ?>"
> >
<?php _e( 'Export CSV', 'woocommerce' ); ?> <?php esc_html_e( 'Export CSV', 'woocommerce' ); ?>
</a> </a>
<?php <?php
} }
@ -279,7 +286,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
if ( empty( $this->show_categories ) ) { if ( empty( $this->show_categories ) ) {
?> ?>
<div class="chart-container"> <div class="chart-container">
<p class="chart-prompt"><?php _e( 'Choose a category to view stats', 'woocommerce' ); ?></p> <p class="chart-prompt"><?php esc_html_e( 'Choose a category to view stats', 'woocommerce' ); ?></p>
</div> </div>
<?php <?php
} else { } else {
@ -325,6 +332,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
<div class="chart-container"> <div class="chart-container">
<div class="chart-placeholder main"></div> <div class="chart-placeholder main"></div>
</div> </div>
<?php // @codingStandardsIgnoreStart ?>
<script type="text/javascript"> <script type="text/javascript">
var main_chart; var main_chart;
@ -432,6 +440,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
); );
}); });
</script> </script>
<?php // @codingStandardsIgnoreEnd ?>
<?php <?php
} }
} }

View File

@ -1,7 +1,12 @@
<?php <?php
/**
* Sales By Product Reporting
*
* @package WooCommerce/Admin/Reporting
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
/** /**
@ -48,6 +53,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
/** /**
* Get the legend for the main chart sidebar. * Get the legend for the main chart sidebar.
*
* @return array * @return array
*/ */
public function get_chart_legend() { public function get_chart_legend() {
@ -136,7 +142,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'item_count' => '#d4d9dc', 'item_count' => '#d4d9dc',
); );
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day'; $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) { if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day'; $current_range = '7day';
@ -190,8 +196,8 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
} }
} }
echo '<p>' . ' <strong>' . esc_html( implode( ', ', $this->product_ids_titles ) ) . '</strong></p>'; echo '<p><strong>' . esc_html( implode( ', ', $this->product_ids_titles ) ) . '</strong></p>';
echo '<p><a class="button" href="' . esc_url( remove_query_arg( 'product_ids' ) ) . '">' . __( 'Reset', 'woocommerce' ) . '</a></p>'; echo '<p><a class="button" href="' . esc_url( remove_query_arg( 'product_ids' ) ) . '">' . esc_html__( 'Reset', 'woocommerce' ) . '</a></p>';
} }
/** /**
@ -199,12 +205,13 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
*/ */
public function products_widget() { public function products_widget() {
?> ?>
<h4 class="section_title"><span><?php _e( 'Product search', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Product search', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<form method="GET"> <form method="GET">
<div> <div>
<?php // @codingStandardsIgnoreStart ?>
<select class="wc-product-search" style="width:203px;" multiple="multiple" id="product_ids" name="product_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations"></select> <select class="wc-product-search" style="width:203px;" multiple="multiple" id="product_ids" name="product_ids[]" data-placeholder="<?php esc_attr_e( 'Search for a product&hellip;', 'woocommerce' ); ?>" data-action="woocommerce_json_search_products_and_variations"></select>
<input type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>" /> <button type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>"><?php esc_html_e( 'Show', 'woocommerce' ); ?></button>
<input type="hidden" name="range" value="<?php echo ( ! empty( $_GET['range'] ) ) ? esc_attr( $_GET['range'] ) : ''; ?>" /> <input type="hidden" name="range" value="<?php echo ( ! empty( $_GET['range'] ) ) ? esc_attr( $_GET['range'] ) : ''; ?>" />
<input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( $_GET['start_date'] ) : ''; ?>" /> <input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( $_GET['start_date'] ) : ''; ?>" />
<input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" /> <input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" />
@ -212,10 +219,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
<input type="hidden" name="tab" value="<?php echo ( ! empty( $_GET['tab'] ) ) ? esc_attr( $_GET['tab'] ) : ''; ?>" /> <input type="hidden" name="tab" value="<?php echo ( ! empty( $_GET['tab'] ) ) ? esc_attr( $_GET['tab'] ) : ''; ?>" />
<input type="hidden" name="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( $_GET['report'] ) : ''; ?>" /> <input type="hidden" name="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( $_GET['report'] ) : ''; ?>" />
<?php wp_nonce_field( 'custom_range', 'wc_reports_nonce', false ); ?> <?php wp_nonce_field( 'custom_range', 'wc_reports_nonce', false ); ?>
<?php // @codingStandardsIgnoreEnd ?>
</div> </div>
</form> </form>
</div> </div>
<h4 class="section_title"><span><?php _e( 'Top sellers', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Top sellers', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<table cellspacing="0"> <table cellspacing="0">
<?php <?php
@ -242,20 +250,22 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
) ); ) );
if ( $top_sellers ) { if ( $top_sellers ) {
// @codingStandardsIgnoreStart
foreach ( $top_sellers as $product ) { foreach ( $top_sellers as $product ) {
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '"> echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
<td class="count">' . $product->order_item_qty . '</td> <td class="count">' . esc_html( $product->order_item_qty ) . '</td>
<td class="name"><a href="' . esc_url( add_query_arg( 'product_ids', $product->product_id ) ) . '">' . esc_html( get_the_title( $product->product_id ) ) . '</a></td> <td class="name"><a href="' . esc_url( add_query_arg( 'product_ids', $product->product_id ) ) . '">' . esc_html( get_the_title( $product->product_id ) ) . '</a></td>
<td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td> <td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td>
</tr>'; </tr>';
} }
// @codingStandardsIgnoreEnd
} else { } else {
echo '<tr><td colspan="3">' . __( 'No products found in range', 'woocommerce' ) . '</td></tr>'; echo '<tr><td colspan="3">' . esc_html__( 'No products found in range', 'woocommerce' ) . '</td></tr>';
} }
?> ?>
</table> </table>
</div> </div>
<h4 class="section_title"><span><?php _e( 'Top freebies', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Top freebies', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<table cellspacing="0"> <table cellspacing="0">
<?php <?php
@ -290,20 +300,22 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
) ); ) );
if ( $top_freebies ) { if ( $top_freebies ) {
// @codingStandardsIgnoreStart
foreach ( $top_freebies as $product ) { foreach ( $top_freebies as $product ) {
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '"> echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
<td class="count">' . $product->order_item_qty . '</td> <td class="count">' . esc_html( $product->order_item_qty ) . '</td>
<td class="name"><a href="' . esc_url( add_query_arg( 'product_ids', $product->product_id ) ) . '">' . esc_html( get_the_title( $product->product_id ) ) . '</a></td> <td class="name"><a href="' . esc_url( add_query_arg( 'product_ids', $product->product_id ) ) . '">' . esc_html( get_the_title( $product->product_id ) ) . '</a></td>
<td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td> <td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td>
</tr>'; </tr>';
} }
// @codingStandardsIgnoreEnd
} else { } else {
echo '<tr><td colspan="3">' . __( 'No products found in range', 'woocommerce' ) . '</td></tr>'; echo '<tr><td colspan="3">' . esc_html__( 'No products found in range', 'woocommerce' ) . '</td></tr>';
} }
?> ?>
</table> </table>
</div> </div>
<h4 class="section_title"><span><?php _e( 'Top earners', 'woocommerce' ); ?></span></h4> <h4 class="section_title"><span><?php esc_html_e( 'Top earners', 'woocommerce' ); ?></span></h4>
<div class="section"> <div class="section">
<table cellspacing="0"> <table cellspacing="0">
<?php <?php
@ -330,6 +342,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
) ); ) );
if ( $top_earners ) { if ( $top_earners ) {
// @codingStandardsIgnoreStart
foreach ( $top_earners as $product ) { foreach ( $top_earners as $product ) {
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '"> echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
<td class="count">' . wc_price( $product->order_item_total ) . '</td> <td class="count">' . wc_price( $product->order_item_total ) . '</td>
@ -337,8 +350,9 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
<td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'sales' ) . '</td> <td class="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'sales' ) . '</td>
</tr>'; </tr>';
} }
// @codingStandardsIgnoreEnd
} else { } else {
echo '<tr><td colspan="3">' . __( 'No products found in range', 'woocommerce' ) . '</td></tr>'; echo '<tr><td colspan="3">' . esc_html__( 'No products found in range', 'woocommerce' ) . '</td></tr>';
} }
?> ?>
</table> </table>
@ -370,17 +384,17 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
*/ */
public function get_export_button() { public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day'; $current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day';
?> ?>
<a <a
href="#" href="#"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time( 'timestamp' ) ); ?>.csv" download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo esc_html( date_i18n( 'Y-m-d', current_time( 'timestamp' ) ) ); ?>.csv"
class="export_csv" class="export_csv"
data-export="chart" data-export="chart"
data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>" data-xaxes="<?php esc_attr_e( 'Date', 'woocommerce' ); ?>"
data-groupby="<?php echo $this->chart_groupby; ?>" data-groupby="<?php echo $this->chart_groupby; ?>"<?php // @codingStandardsIgnoreLine ?>
> >
<?php _e( 'Export CSV', 'woocommerce' ); ?> <?php esc_html_e( 'Export CSV', 'woocommerce' ); ?>
</a> </a>
<?php <?php
} }
@ -394,11 +408,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
if ( empty( $this->product_ids ) ) { if ( empty( $this->product_ids ) ) {
?> ?>
<div class="chart-container"> <div class="chart-container">
<p class="chart-prompt"><?php _e( 'Choose a product to view stats', 'woocommerce' ); ?></p> <p class="chart-prompt"><?php esc_html_e( 'Choose a product to view stats', 'woocommerce' ); ?></p>
</div> </div>
<?php <?php
} else { } else {
// Get orders and dates in range - we want the SUM of order totals, COUNT of order items, COUNT of orders, and the date // Get orders and dates in range - we want the SUM of order totals, COUNT of order items, COUNT of orders, and the date.
$order_item_counts = $this->get_order_report_data( array( $order_item_counts = $this->get_order_report_data( array(
'data' => array( 'data' => array(
'_qty' => array( '_qty' => array(
@ -469,11 +483,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'filter_range' => true, 'filter_range' => true,
) ); ) );
// Prepare data for report // Prepare data for report.
$order_item_counts = $this->prepare_chart_data( $order_item_counts, 'post_date', 'order_item_count', $this->chart_interval, $this->start_date, $this->chart_groupby ); $order_item_counts = $this->prepare_chart_data( $order_item_counts, 'post_date', 'order_item_count', $this->chart_interval, $this->start_date, $this->chart_groupby );
$order_item_amounts = $this->prepare_chart_data( $order_item_amounts, 'post_date', 'order_item_amount', $this->chart_interval, $this->start_date, $this->chart_groupby ); $order_item_amounts = $this->prepare_chart_data( $order_item_amounts, 'post_date', 'order_item_amount', $this->chart_interval, $this->start_date, $this->chart_groupby );
// Encode in json format // Encode in json format.
$chart_data = json_encode( array( $chart_data = json_encode( array(
'order_item_counts' => array_values( $order_item_counts ), 'order_item_counts' => array_values( $order_item_counts ),
'order_item_amounts' => array_values( $order_item_amounts ), 'order_item_amounts' => array_values( $order_item_amounts ),
@ -482,6 +496,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
<div class="chart-container"> <div class="chart-container">
<div class="chart-placeholder main"></div> <div class="chart-placeholder main"></div>
</div> </div>
<?php // @codingStandardsIgnoreStart ?>
<script type="text/javascript"> <script type="text/javascript">
var main_chart; var main_chart;
@ -586,6 +601,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
}); });
</script> </script>
<?php <?php
// @codingStandardsIgnoreEnd
} }
} }
} }

View File

@ -1,12 +1,18 @@
<?php <?php
/**
* Shipping classes admin
*
* @package WooCommerce/Admin/Shipping
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
?> ?>
<h2> <h2>
<?php _e( 'Shipping classes', 'woocommerce' ); ?> <?php esc_html_e( 'Shipping classes', 'woocommerce' ); ?>
<?php echo wc_help_tip( __( 'Shipping classes can be used to group products of similar type and can be used by some Shipping Methods (such as "Flat rate shipping") to provide different rates to different classes of product.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'Shipping classes can be used to group products of similar type and can be used by some Shipping Methods (such as "Flat rate shipping") to provide different rates to different classes of product.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</h2> </h2>
<table class="wc-shipping-classes widefat"> <table class="wc-shipping-classes widefat">
@ -19,8 +25,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</thead> </thead>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="<?php echo absint( sizeof( $shipping_class_columns ) ); ?>"> <td colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>">
<input type="submit" name="save" class="button button-primary wc-shipping-class-save" value="<?php esc_attr_e( 'Save shipping classes', 'woocommerce' ); ?>" disabled /> <button type="submit" name="save" class="button button-primary wc-shipping-class-save" value="<?php esc_attr_e( 'Save shipping classes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save shipping classes', 'woocommerce' ); ?></button>
<a class="button button-secondary wc-shipping-class-add" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a> <a class="button button-secondary wc-shipping-class-add" href="#"><?php esc_html_e( 'Add shipping class', 'woocommerce' ); ?></a>
</td> </td>
</tr> </tr>
@ -30,7 +36,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<script type="text/html" id="tmpl-wc-shipping-class-row-blank"> <script type="text/html" id="tmpl-wc-shipping-class-row-blank">
<tr> <tr>
<td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( sizeof( $shipping_class_columns ) ); ?>"><p><?php _e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td> <td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>"><p><?php esc_html_e( 'No shipping classes have been created.', 'woocommerce' ); ?></p></td>
</tr> </tr>
</script> </script>
@ -45,13 +51,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="view"> <div class="view">
{{ data.name }} {{ data.name }}
<div class="row-actions"> <div class="row-actions">
<a class="wc-shipping-class-edit" href="#"><?php _e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete"><?php _e( 'Remove', 'woocommerce' ); ?></a> <a class="wc-shipping-class-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-class-delete"><?php esc_html_e( 'Remove', 'woocommerce' ); ?></a>
</div> </div>
</div> </div>
<div class="edit"> <div class="edit">
<input type="text" name="name[{{ data.term_id }}]" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'Shipping class name', 'woocommerce' ); ?>" /> <input type="text" name="name[{{ data.term_id }}]" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'Shipping class name', 'woocommerce' ); ?>" />
<div class="row-actions"> <div class="row-actions">
<a class="wc-shipping-class-cancel-edit" href="#"><?php _e( 'Cancel changes', 'woocommerce' ); ?></a> <a class="wc-shipping-class-cancel-edit" href="#"><?php esc_html_e( 'Cancel changes', 'woocommerce' ); ?></a>
</div> </div>
</div> </div>
<?php <?php

View File

@ -1,11 +1,17 @@
<?php <?php
/**
* Shipping zone admin
*
* @package WooCommerce/Admin/Shipping
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
?> ?>
<h2> <h2>
<a href="<?php echo admin_url( 'admin.php?page=wc-settings&tab=shipping' ); ?>"><?php _e( 'Shipping zones', 'woocommerce' ); ?></a> &gt; <a href="<?php echo esc_url( admin_url( 'admin.php?page=wc-settings&tab=shipping' ) ); ?>"><?php esc_html_e( 'Shipping zones', 'woocommerce' ); ?></a> &gt;
<span class="wc-shipping-zone-name"><?php echo esc_html( $zone->get_zone_name() ? $zone->get_zone_name() : __( 'Zone', 'woocommerce' ) ); ?></span> <span class="wc-shipping-zone-name"><?php echo esc_html( $zone->get_zone_name() ? $zone->get_zone_name() : __( 'Zone', 'woocommerce' ) ); ?></span>
</h2> </h2>
@ -17,19 +23,19 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr valign="top" class=""> <tr valign="top" class="">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="zone_name"><?php esc_html_e( 'Zone name', 'woocommerce' ); ?></label> <label for="zone_name"><?php esc_html_e( 'Zone name', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'This is the name of the zone for your reference.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'This is the name of the zone for your reference.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<input type="text" data-attribute="zone_name" name="zone_name" id="zone_name" value="<?php echo esc_attr( $zone->get_zone_name( 'edit' ) ); ?>" placeholder="<?php _e( 'Zone name', 'woocommerce' ); ?>"> <input type="text" data-attribute="zone_name" name="zone_name" id="zone_name" value="<?php echo esc_attr( $zone->get_zone_name( 'edit' ) ); ?>" placeholder="<?php esc_attr_e( 'Zone name', 'woocommerce' ); ?>">
</td> </td>
</tr> </tr>
<tr valign="top" class=""> <tr valign="top" class="">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="zone_locations"><?php esc_html_e( 'Zone regions', 'woocommerce' ); ?></label> <label for="zone_locations"><?php esc_html_e( 'Zone regions', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'These are regions inside this zone. Customers will be matched against these regions.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'These are regions inside this zone. Customers will be matched against these regions.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<select multiple="multiple" data-attribute="zone_locations" id="zone_locations" name="zone_locations" data-placeholder="<?php _e( 'Select regions within this zone', 'woocommerce' ); ?>" class="wc-shipping-zone-region-select chosen_select"> <select multiple="multiple" data-attribute="zone_locations" id="zone_locations" name="zone_locations" data-placeholder="<?php esc_html_e( 'Select regions within this zone', 'woocommerce' ); ?>" class="wc-shipping-zone-region-select chosen_select">
<?php <?php
foreach ( $continents as $continent_code => $continent ) { foreach ( $continents as $continent_code => $continent ) {
echo '<option value="continent:' . esc_attr( $continent_code ) . '" ' . selected( in_array( "continent:$continent_code", $locations ), true, false ) . ' alt="">' . esc_html( $continent['name'] ) . '</option>'; echo '<option value="continent:' . esc_attr( $continent_code ) . '" ' . selected( in_array( "continent:$continent_code", $locations ), true, false ) . ' alt="">' . esc_html( $continent['name'] ) . '</option>';
@ -49,11 +55,11 @@ if ( ! defined( 'ABSPATH' ) ) {
?> ?>
</select> </select>
<?php if ( empty( $postcodes ) ) : ?> <?php if ( empty( $postcodes ) ) : ?>
<a class="wc-shipping-zone-postcodes-toggle" href="#"><?php _e( 'Limit to specific ZIP/postcodes', 'woocommerce' ); ?></a> <a class="wc-shipping-zone-postcodes-toggle" href="#"><?php esc_html_e( 'Limit to specific ZIP/postcodes', 'woocommerce' ); ?></a>
<?php endif; ?> <?php endif; ?>
<div class="wc-shipping-zone-postcodes"> <div class="wc-shipping-zone-postcodes">
<textarea name="zone_postcodes" data-attribute="zone_postcodes" id="zone_postcodes" placeholder="<?php esc_attr_e( 'List 1 postcode per line', 'woocommerce' ); ?>" class="input-text large-text" cols="25" rows="5"><?php echo esc_textarea( implode( "\n", $postcodes ) ); ?></textarea> <textarea name="zone_postcodes" data-attribute="zone_postcodes" id="zone_postcodes" placeholder="<?php esc_attr_e( 'List 1 postcode per line', 'woocommerce' ); ?>" class="input-text large-text" cols="25" rows="5"><?php echo esc_textarea( implode( "\n", $postcodes ) ); ?></textarea>
<span class="description"><?php _e( 'Postcodes containing wildcards (e.g. CB23*) and fully numeric ranges (e.g. <code>90210...99000</code>) are also supported.', 'woocommerce' ) ?></span> <span class="description"><?php esc_html_e( 'Postcodes containing wildcards (e.g. CB23*) and fully numeric ranges (e.g. <code>90210...99000</code>) are also supported.', 'woocommerce' ) ?></span>
</div> </div>
</td> </td>
<?php endif; ?> <?php endif; ?>
@ -61,7 +67,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr valign="top" class=""> <tr valign="top" class="">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label><?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?></label> <label><?php esc_html_e( 'Shipping methods', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'The following shipping methods apply to customers with shipping addresses within this zone.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class=""> <td class="">
<table class="wc-shipping-zone-methods widefat"> <table class="wc-shipping-zone-methods widefat">
@ -76,7 +82,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tfoot> <tfoot>
<tr> <tr>
<td colspan="4"> <td colspan="4">
<input type="submit" class="button wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>" /> <button type="submit" class="button wc-shipping-zone-add-method" value="<?php esc_attr_e( 'Add shipping method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
@ -87,13 +93,13 @@ if ( ! defined( 'ABSPATH' ) ) {
</tbody> </tbody>
</table> </table>
<p class="submit"> <p class="submit">
<input type="submit" name="submit" id="submit" class="button button-primary button-large wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" disabled /> <button type="submit" name="submit" id="submit" class="button button-primary button-large wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
</p> </p>
<script type="text/html" id="tmpl-wc-shipping-zone-method-row-blank"> <script type="text/html" id="tmpl-wc-shipping-zone-method-row-blank">
<tr> <tr>
<td class="wc-shipping-zone-method-blank-state" colspan="4"> <td class="wc-shipping-zone-method-blank-state" colspan="4">
<p><?php _e( 'You can add multiple shipping methods within this zone. Only customers within the zone will see them.', 'woocommerce' ); ?></p> <p><?php esc_html_e( 'You can add multiple shipping methods within this zone. Only customers within the zone will see them.', 'woocommerce' ); ?></p>
</td> </td>
</tr> </tr>
</script> </script>
@ -104,7 +110,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<td class="wc-shipping-zone-method-title"> <td class="wc-shipping-zone-method-title">
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&amp;tab=shipping&amp;instance_id={{ data.instance_id }}">{{{ data.title }}}</a> <a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&amp;tab=shipping&amp;instance_id={{ data.instance_id }}">{{{ data.title }}}</a>
<div class="row-actions"> <div class="row-actions">
<a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&amp;tab=shipping&amp;instance_id={{ data.instance_id }}"><?php _e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-method-delete"><?php _e( 'Delete', 'woocommerce' ); ?></a> <a class="wc-shipping-zone-method-settings" href="admin.php?page=wc-settings&amp;tab=shipping&amp;instance_id={{ data.instance_id }}"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-zone-method-delete"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a>
</div> </div>
</td> </td>
<td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td> <td width="1%" class="wc-shipping-zone-method-enabled"><a href="#">{{{ data.enabled_icon }}}</a></td>
@ -128,7 +134,7 @@ if ( ! defined( 'ABSPATH' ) ) {
); );
?></h1> ?></h1>
<button class="modal-close modal-close-link dashicons dashicons-no-alt"> <button class="modal-close modal-close-link dashicons dashicons-no-alt">
<span class="screen-reader-text"><?php _e( 'Close modal panel', 'woocommerce' ); ?></span> <span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
</button> </button>
</header> </header>
<article class="wc-modal-shipping-method-settings"> <article class="wc-modal-shipping-method-settings">
@ -139,7 +145,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</article> </article>
<footer> <footer>
<div class="inner"> <div class="inner">
<button id="btn-ok" class="button button-primary button-large"><?php _e( 'Save changes', 'woocommerce' ); ?></button> <button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
</div> </div>
</footer> </footer>
</section> </section>
@ -153,9 +159,9 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="wc-backbone-modal-content"> <div class="wc-backbone-modal-content">
<section class="wc-backbone-modal-main" role="main"> <section class="wc-backbone-modal-main" role="main">
<header class="wc-backbone-modal-header"> <header class="wc-backbone-modal-header">
<h1><?php _e( 'Add shipping method', 'woocommerce' ); ?></h1> <h1><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></h1>
<button class="modal-close modal-close-link dashicons dashicons-no-alt"> <button class="modal-close modal-close-link dashicons dashicons-no-alt">
<span class="screen-reader-text"><?php _e( 'Close modal panel', 'woocommerce' ); ?></span> <span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span>
</button> </button>
</header> </header>
<article> <article>
@ -178,7 +184,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</article> </article>
<footer> <footer>
<div class="inner"> <div class="inner">
<button id="btn-ok" class="button button-primary button-large"><?php _e( 'Add shipping method', 'woocommerce' ); ?></button> <button id="btn-ok" class="button button-primary button-large"><?php esc_html_e( 'Add shipping method', 'woocommerce' ); ?></button>
</div> </div>
</footer> </footer>
</section> </section>

View File

@ -1,4 +1,10 @@
<?php <?php
/**
* Edit Webhooks
*
* @package WooCommerce/Admin/Webhooks
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -7,12 +13,12 @@ if ( ! defined( 'ABSPATH' ) ) {
<input type="hidden" name="webhook_id" value="<?php echo esc_attr( $webhook->id ); ?>" /> <input type="hidden" name="webhook_id" value="<?php echo esc_attr( $webhook->id ); ?>" />
<div id="webhook-options" class="settings-panel"> <div id="webhook-options" class="settings-panel">
<h2><?php _e( 'Webhook data', 'woocommerce' ); ?></h2> <h2><?php esc_html_e( 'Webhook data', 'woocommerce' ); ?></h2>
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_name"><?php _e( 'Name', 'woocommerce' ); ?></label> <label for="webhook_name"><?php esc_html_e( 'Name', 'woocommerce' ); ?></label>
<?php <?php
// @codingStandardsIgnoreStart // @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' ) ) ) ); 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' ) ) ) );
@ -25,7 +31,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_status"><?php _e( 'Status', 'woocommerce' ); ?></label> <label for="webhook_status"><?php esc_html_e( 'Status', 'woocommerce' ); ?></label>
<?php wc_help_tip( __( 'The options are &quot;Active&quot; (delivers payload), &quot;Paused&quot; (does not deliver), or &quot;Disabled&quot; (does not deliver due delivery failures).', 'woocommerce' ) ); ?> <?php wc_help_tip( __( 'The options are &quot;Active&quot; (delivers payload), &quot;Paused&quot; (does not deliver), or &quot;Disabled&quot; (does not deliver due delivery failures).', 'woocommerce' ) ); ?>
</th> </th>
<td class="forminp"> <td class="forminp">
@ -42,8 +48,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_topic"><?php _e( 'Topic', 'woocommerce' ); ?></label> <label for="webhook_topic"><?php esc_html_e( 'Topic', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select"> <select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select">
@ -79,8 +85,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top" id="webhook-action-event-wrap"> <tr valign="top" id="webhook-action-event-wrap">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_action_event"><?php _e( 'Action event', 'woocommerce' ); ?></label> <label for="webhook_action_event"><?php esc_html_e( 'Action event', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Enter the action that will trigger this webhook.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'Enter the action that will trigger this webhook.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<input name="webhook_action_event" id="webhook_action_event" type="text" class="input-text regular-input" value="<?php echo esc_attr( $topic_data['event'] ); ?>" /> <input name="webhook_action_event" id="webhook_action_event" type="text" class="input-text regular-input" value="<?php echo esc_attr( $topic_data['event'] ); ?>" />
@ -88,8 +94,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top" id="webhook-custom-topic-wrap"> <tr valign="top" id="webhook-custom-topic-wrap">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_custom_topic"><?php _e( 'Custom topic', 'woocommerce' ); ?></label> <label for="webhook_custom_topic"><?php esc_html_e( 'Custom topic', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Enter the custom topic that will trigger this webhook.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'Enter the custom topic that will trigger this webhook.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<input name="webhook_custom_topic" id="webhook_custom_topic" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_topic() ); ?>" /> <input name="webhook_custom_topic" id="webhook_custom_topic" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_topic() ); ?>" />
@ -97,8 +103,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_delivery_url"><?php _e( 'Delivery URL', 'woocommerce' ); ?></label> <label for="webhook_delivery_url"><?php esc_html_e( 'Delivery URL', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'URL where the webhook payload is delivered.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'URL where the webhook payload is delivered.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<input name="webhook_delivery_url" id="webhook_delivery_url" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_delivery_url() ); ?>" /> <input name="webhook_delivery_url" id="webhook_delivery_url" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_delivery_url() ); ?>" />
@ -106,8 +112,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_secret"><?php _e( 'Secret', 'woocommerce' ); ?></label> <label for="webhook_secret"><?php esc_html_e( 'Secret', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'The secret key is used to generate a hash of the delivered webhook and provided in the request headers.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'The secret key is used to generate a hash of the delivered webhook and provided in the request headers.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<input name="webhook_secret" id="webhook_secret" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_secret() ); ?>" /> <input name="webhook_secret" id="webhook_secret" type="text" class="input-text regular-input" value="<?php echo esc_attr( $webhook->get_secret() ); ?>" />
@ -115,14 +121,14 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<label for="webhook_api_version"><?php _e( 'API Version', 'woocommerce' ); ?></label> <label for="webhook_api_version"><?php esc_html_e( 'API Version', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'REST API version used in the webhook deliveries.', 'woocommerce' ) ); ?> <?php echo wc_help_tip( __( 'REST API version used in the webhook deliveries.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<select name="webhook_api_version" id="webhook_api_version"> <select name="webhook_api_version" id="webhook_api_version">
<option value="wp_api_v2" <?php selected( 'wp_api_v2', $webhook->get_api_version(), true ); ?>><?php _e( 'WP REST API Integration v2', 'woocommerce' ); ?></option> <option value="wp_api_v2" <?php selected( 'wp_api_v2', $webhook->get_api_version(), true ); ?>><?php esc_html_e( 'WP REST API Integration v2', 'woocommerce' ); ?></option>
<option value="wp_api_v1" <?php selected( 'wp_api_v1', $webhook->get_api_version(), true ); ?>><?php _e( 'WP REST API Integration v1', 'woocommerce' ); ?></option> <option value="wp_api_v1" <?php selected( 'wp_api_v1', $webhook->get_api_version(), true ); ?>><?php esc_html_e( 'WP REST API Integration v1', 'woocommerce' ); ?></option>
<option value="legacy_v3" <?php selected( 'legacy_v3', $webhook->get_api_version(), true ); ?>><?php _e( 'Legacy API v3 (deprecated)', 'woocommerce' ); ?></option> <option value="legacy_v3" <?php selected( 'legacy_v3', $webhook->get_api_version(), true ); ?>><?php esc_html_e( 'Legacy API v3 (deprecated)', 'woocommerce' ); ?></option>
</select> </select>
</td> </td>
</tr> </tr>
@ -133,34 +139,34 @@ if ( ! defined( 'ABSPATH' ) ) {
</div> </div>
<div id="webhook-actions" class="settings-panel"> <div id="webhook-actions" class="settings-panel">
<h2><?php _e( 'Webhook actions', 'woocommerce' ); ?></h2> <h2><?php esc_html_e( 'Webhook actions', 'woocommerce' ); ?></h2>
<table class="form-table"> <table class="form-table">
<tbody> <tbody>
<?php if ( '0000-00-00 00:00:00' != $webhook->post_data->post_modified_gmt ) : ?> <?php if ( '0000-00-00 00:00:00' != $webhook->post_data->post_modified_gmt ) : ?>
<?php if ( '0000-00-00 00:00:00' == $webhook->post_data->post_date_gmt ) : ?> <?php if ( '0000-00-00 00:00:00' == $webhook->post_data->post_date_gmt ) : ?>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<?php _e( 'Created at', 'woocommerce' ); ?> <?php esc_html_e( 'Created at', 'woocommerce' ); ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<?php echo date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->post_data->post_modified_gmt ) ); ?> <?php echo esc_html( date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->post_data->post_modified_gmt ) ) ); ?>
</td> </td>
</tr> </tr>
<?php else : ?> <?php else : ?>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<?php _e( 'Created at', 'woocommerce' ); ?> <?php esc_html_e( 'Created at', 'woocommerce' ); ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<?php echo date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->post_data->post_date_gmt ) ); ?> <?php echo esc_html( date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->post_data->post_date_gmt ) ) ); ?>
</td> </td>
</tr> </tr>
<tr valign="top"> <tr valign="top">
<th scope="row" class="titledesc"> <th scope="row" class="titledesc">
<?php _e( 'Updated at', 'woocommerce' ); ?> <?php esc_html_e( 'Updated at', 'woocommerce' ); ?>
</th> </th>
<td class="forminp"> <td class="forminp">
<?php echo date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->post_data->post_modified_gmt ) ); ?> <?php echo esc_html( date_i18n( __( 'M j, Y @ G:i', 'woocommerce' ), strtotime( $webhook->post_data->post_modified_gmt ) ) ); ?>
</td> </td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
@ -168,9 +174,10 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr valign="top"> <tr valign="top">
<td colspan="2" scope="row" style="padding-left: 0;"> <td colspan="2" scope="row" style="padding-left: 0;">
<p class="submit"> <p class="submit">
<input type="submit" class="button button-primary button-large" name="save" id="publish" accesskey="p" value="<?php esc_attr_e( 'Save webhook', 'woocommerce' ); ?>" /> <button type="submit" class="button button-primary button-large" name="save" id="publish" accesskey="p" value="<?php esc_attr_e( 'Save webhook', 'woocommerce' ); ?>"><?php esc_html_e( 'Save webhook', 'woocommerce' ); ?></button>
<?php if ( current_user_can( 'delete_post', $webhook->id ) ) : ?> <?php if ( current_user_can( 'delete_post', $webhook->id ) ) : ?>
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( get_delete_post_link( $webhook->id ) ); ?>"><?php echo ( ! EMPTY_TRASH_DAYS ) ? __( 'Delete permanently', 'woocommerce' ) : __( 'Move to trash', 'woocommerce' ); ?></a> <?php //@codingStandardsIgnoreLine ?>
<a style="color: #a00; text-decoration: none; margin-left: 10px;" href="<?php echo esc_url( get_delete_post_link( $webhook->id ) ); ?>"><?php echo ( ! EMPTY_TRASH_DAYS ) ? esc_html__( 'Delete permanently', 'woocommerce' ) : esc_html__( 'Move to trash', 'woocommerce' ); ?></a>
<?php endif; ?> <?php endif; ?>
</p> </p>
</td> </td>
@ -180,7 +187,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</div> </div>
<div id="webhook-logs" class="settings-panel"> <div id="webhook-logs" class="settings-panel">
<h2><?php _e( 'Webhook logs', 'woocommerce' ); ?></h2> <h2><?php esc_html_e( 'Webhook logs', 'woocommerce' ); ?></h2>
<?php WC_Admin_Webhooks::logs_output( $webhook ); ?> <?php WC_Admin_Webhooks::logs_output( $webhook ); ?>
</div> </div>

View File

@ -1,7 +1,10 @@
<?php <?php
/** /**
* Admin View: Product Export * Admin View: Product Export
*
* @package WooCommerce/Admin/Export
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -71,7 +74,7 @@ $total_rows = $product_count->publish + $product_count->private + $variatio
<progress class="woocommerce-exporter-progress" max="100" value="0"></progress> <progress class="woocommerce-exporter-progress" max="100" value="0"></progress>
</section> </section>
<div class="wc-actions"> <div class="wc-actions">
<input type="submit" class="woocommerce-exporter-button button button-primary" value="<?php esc_attr_e( 'Generate CSV', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-exporter-button button button-primary" value="<?php esc_attr_e( 'Generate CSV', 'woocommerce' ); ?>"><?php esc_html_e( 'Generate CSV', 'woocommerce' ); ?></button>
</div> </div>
</form> </form>
</div> </div>

View File

@ -1,6 +1,8 @@
<?php <?php
/** /**
* Admin View: Page - Status Logs * Admin View: Page - Status Logs
*
* @package WooCommerce/Admin/Logs
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -19,13 +21,13 @@ if ( ! defined( 'ABSPATH' ) ) {
</h2> </h2>
</div> </div>
<div class="alignright"> <div class="alignright">
<form action="<?php echo admin_url( 'admin.php?page=wc-status&tab=logs' ); ?>" method="post"> <form action="<?php echo esc_url( admin_url( 'admin.php?page=wc-status&tab=logs' ) ); ?>" method="post">
<select name="log_file"> <select name="log_file">
<?php foreach ( $logs as $log_key => $log_file ) : ?> <?php foreach ( $logs as $log_key => $log_file ) : ?>
<option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), filemtime( WC_LOG_DIR . $log_file ) ); ?>)</option> <option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo esc_html( date_i18n( get_option( 'date_format' ) ) . ' ' . get_option( 'time_format' ), filemtime( WC_LOG_DIR . $log_file ) ); ?>)</option>
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
<input type="submit" class="button" value="<?php esc_attr_e( 'View', 'woocommerce' ); ?>" /> <button type="submit" class="button" value="<?php esc_attr_e( 'View', 'woocommerce' ); ?>"><?php esc_html_e( 'View', 'woocommerce' ); ?></button>
</form> </form>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
@ -34,5 +36,5 @@ if ( ! defined( 'ABSPATH' ) ) {
<pre><?php echo esc_html( file_get_contents( WC_LOG_DIR . $viewed_log ) ); ?></pre> <pre><?php echo esc_html( file_get_contents( WC_LOG_DIR . $viewed_log ) ); ?></pre>
</div> </div>
<?php else : ?> <?php else : ?>
<div class="updated woocommerce-message inline"><p><?php _e( 'There are currently no logs to view.', 'woocommerce' ); ?></p></div> <div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'woocommerce' ); ?></p></div>
<?php endif; ?> <?php endif; ?>

View File

@ -41,7 +41,7 @@ if ( ! $tab_exists ) {
?> ?>
<p class="submit"> <p class="submit">
<?php if ( empty( $GLOBALS['hide_save_button'] ) ) : ?> <?php if ( empty( $GLOBALS['hide_save_button'] ) ) : ?>
<input name="save" class="button-primary woocommerce-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" /> <button name="save" class="button-primary woocommerce-save-button" type="submit" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
<?php endif; ?> <?php endif; ?>
<?php wp_nonce_field( 'woocommerce-settings' ); ?> <?php wp_nonce_field( 'woocommerce-settings' ); ?>
</p> </p>

View File

@ -1,10 +1,12 @@
<?php <?php
/** /**
* Admin View: Report by Date (with date filters) * Admin View: Report by Date (with date filters)
*
* @package WooCommerce/Admin/Reporting
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
?> ?>
@ -13,14 +15,16 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="postbox"> <div class="postbox">
<?php if ( 'custom' === $current_range && isset( $_GET['start_date'], $_GET['end_date'] ) ) : ?> <?php if ( 'custom' === $current_range && isset( $_GET['start_date'], $_GET['end_date'] ) ) : ?>
<h3 class="screen-reader-text"><?php <h3 class="screen-reader-text">
<?php
/* translators: 1: start date 2: end date */ /* translators: 1: start date 2: end date */
printf( printf(
esc_html__( 'From %1$s to %2$s', 'woocommerce' ), esc_html__( 'From %1$s to %2$s', 'woocommerce' ),
esc_html( wc_clean( $_GET['start_date'] ) ), esc_html( wc_clean( wp_unslash( $_GET['start_date'] ) ) ),
esc_html( wc_clean( $_GET['end_date'] ) ) esc_html( wc_clean( wp_unslash( $_GET['end_date'] ) ) )
); );
?></h3> ?>
</h3>
<?php else : ?> <?php else : ?>
<h3 class="screen-reader-text"><?php echo esc_html( $ranges[ $current_range ] ); ?></h3> <h3 class="screen-reader-text"><?php echo esc_html( $ranges[ $current_range ] ); ?></h3>
<?php endif; ?> <?php endif; ?>
@ -30,15 +34,15 @@ if ( ! defined( 'ABSPATH' ) ) {
<ul> <ul>
<?php <?php
foreach ( $ranges as $range => $name ) { foreach ( $ranges as $range => $name ) {
echo '<li class="' . ( $current_range == $range ? 'active' : '' ) . '"><a href="' . esc_url( remove_query_arg( array( 'start_date', 'end_date' ), add_query_arg( 'range', $range ) ) ) . '">' . $name . '</a></li>'; echo '<li class="' . ( $current_range == $range ? 'active' : '' ) . '"><a href="' . esc_url( remove_query_arg( array( 'start_date', 'end_date' ), add_query_arg( 'range', $range ) ) ) . '">' . esc_html( $name ) . '</a></li>';
} }
?> ?>
<li class="custom <?php echo ( 'custom' === $current_range ) ? 'active' : ''; ?>"> <li class="custom <?php echo ( 'custom' === $current_range ) ? 'active' : ''; ?>">
<?php _e( 'Custom:', 'woocommerce' ); ?> <?php esc_html_e( 'Custom:', 'woocommerce' ); ?>
<form method="GET"> <form method="GET">
<div> <div>
<?php <?php
// Maintain query string // Maintain query string.
foreach ( $_GET as $key => $value ) { foreach ( $_GET as $key => $value ) {
if ( is_array( $value ) ) { if ( is_array( $value ) ) {
foreach ( $value as $v ) { foreach ( $value as $v ) {
@ -50,10 +54,10 @@ if ( ! defined( 'ABSPATH' ) ) {
} }
?> ?>
<input type="hidden" name="range" value="custom" /> <input type="hidden" name="range" value="custom" />
<input type="text" size="11" placeholder="yyyy-mm-dd" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( $_GET['start_date'] ) : ''; ?>" name="start_date" class="range_datepicker from" /> <input type="text" size="11" placeholder="yyyy-mm-dd" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( wp_unslash( $_GET['start_date'] ) ) : ''; ?>" name="start_date" class="range_datepicker from" /><?php //@codingStandardsIgnoreLine ?>
<span>&ndash;</span> <span>&ndash;</span>
<input type="text" size="11" placeholder="yyyy-mm-dd" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" name="end_date" class="range_datepicker to" /> <input type="text" size="11" placeholder="yyyy-mm-dd" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( wp_unslash( $_GET['end_date'] ) ) : ''; ?>" name="end_date" class="range_datepicker to" /><?php //@codingStandardsIgnoreLine ?>
<input type="submit" class="button" value="<?php esc_attr_e( 'Go', 'woocommerce' ); ?>" /> <button type="submit" class="button" value="<?php esc_attr_e( 'Go', 'woocommerce' ); ?>"><?php esc_html_e( 'Go', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'custom_range', 'wc_reports_nonce', false ); ?> <?php wp_nonce_field( 'custom_range', 'wc_reports_nonce', false ); ?>
</div> </div>
</form> </form>
@ -66,17 +70,18 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( $legends = $this->get_chart_legend() ) : ?> <?php if ( $legends = $this->get_chart_legend() ) : ?>
<ul class="chart-legend"> <ul class="chart-legend">
<?php foreach ( $legends as $legend ) : ?> <?php foreach ( $legends as $legend ) : ?>
<?php // @codingStandardsIgnoreLine ?> <?php // @codingStandardsIgnoreStart ?>
<li style="border-color: <?php echo $legend['color']; ?>" <?php if ( isset( $legend['highlight_series'] ) ) echo 'class="highlight_series ' . ( isset( $legend['placeholder'] ) ? 'tips' : '' ) . '" data-series="' . esc_attr( $legend['highlight_series'] ) . '"'; ?> data-tip="<?php echo isset( $legend['placeholder'] ) ? $legend['placeholder'] : ''; ?>"> <li style="border-color: <?php echo $legend['color']; ?>" <?php if ( isset( $legend['highlight_series'] ) ) echo 'class="highlight_series ' . ( isset( $legend['placeholder'] ) ? 'tips' : '' ) . '" data-series="' . esc_attr( $legend['highlight_series'] ) . '"'; ?> data-tip="<?php echo isset( $legend['placeholder'] ) ? $legend['placeholder'] : ''; ?>">
<?php echo $legend['title']; ?> <?php echo $legend['title']; ?>
</li> </li>
<?php // @codingStandardsIgnoreEnd ?>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<ul class="chart-widgets"> <ul class="chart-widgets">
<?php foreach ( $this->get_chart_widgets() as $widget ) : ?> <?php foreach ( $this->get_chart_widgets() as $widget ) : ?>
<li class="chart-widget"> <li class="chart-widget">
<?php if ( $widget['title'] ) : ?><h4><?php echo $widget['title']; ?></h4><?php endif; ?> <?php if ( $widget['title'] ) : ?><h4><?php echo esc_html( $widget['title'] ); ?></h4><?php endif; ?>
<?php call_user_func( $widget['callback'] ); ?> <?php call_user_func( $widget['callback'] ); ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -234,6 +234,7 @@ function wc_save_order_items( $order_id, $items ) {
if ( isset( $items['meta_key'][ $item_id ], $items['meta_value'][ $item_id ] ) ) { if ( isset( $items['meta_key'][ $item_id ], $items['meta_value'][ $item_id ] ) ) {
foreach ( $items['meta_key'][ $item_id ] as $meta_id => $meta_key ) { foreach ( $items['meta_key'][ $item_id ] as $meta_id => $meta_key ) {
$meta_key = wp_unslash( $meta_key );
$meta_value = isset( $items['meta_value'][ $item_id ][ $meta_id ] ) ? wp_unslash( $items['meta_value'][ $item_id ][ $meta_id ] ): ''; $meta_value = isset( $items['meta_value'][ $item_id ][ $meta_id ] ) ? wp_unslash( $items['meta_value'][ $item_id ][ $meta_id ] ): '';
if ( '' === $meta_key && '' === $meta_value ) { if ( '' === $meta_key && '' === $meta_value ) {

View File

@ -2029,7 +2029,7 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller {
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',
); );
$params['sku'] = array( $params['sku'] = array(
'description' => __( 'Limit result set to products with a specific SKU.', 'woocommerce' ), 'description' => __( 'Limit result set to products with specific SKU(s). Use commas to separate.', 'woocommerce' ),
'type' => 'string', 'type' => 'string',
'sanitize_callback' => 'sanitize_text_field', 'sanitize_callback' => 'sanitize_text_field',
'validate_callback' => 'rest_validate_request_arg', 'validate_callback' => 'rest_validate_request_arg',

View File

@ -104,7 +104,7 @@ final class WC_Cart_Session {
do_action( 'woocommerce_cart_loaded_from_session', $this->cart ); do_action( 'woocommerce_cart_loaded_from_session', $this->cart );
if ( $update_cart_session || is_null( $totals ) ) { if ( $update_cart_session || is_null( WC()->session->get( 'cart_totals', null ) ) ) {
WC()->session->set( 'cart', $this->get_cart_for_session() ); WC()->session->set( 'cart', $this->get_cart_for_session() );
$this->cart->calculate_totals(); $this->cart->calculate_totals();
} }

View File

@ -1688,10 +1688,6 @@ class WC_Cart extends WC_Legacy_Cart {
* @return bool * @return bool
*/ */
public function remove_coupon( $coupon_code ) { public function remove_coupon( $coupon_code ) {
if ( ! wc_coupons_enabled() ) {
return false;
}
$coupon_code = wc_format_coupon_code( $coupon_code ); $coupon_code = wc_format_coupon_code( $coupon_code );
$position = array_search( $coupon_code, $this->get_applied_coupons(), true ); $position = array_search( $coupon_code, $this->get_applied_coupons(), true );

View File

@ -482,9 +482,9 @@ class WC_Emails {
return; return;
} }
if ( $plain_text ) { if ( $plain_text ) {
wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order ) ); wc_get_template( 'emails/plain/email-addresses.php', array( 'order' => $order, 'sent_to_admin' => $sent_to_admin ) );
} else { } else {
wc_get_template( 'emails/email-addresses.php', array( 'order' => $order ) ); wc_get_template( 'emails/email-addresses.php', array( 'order' => $order, 'sent_to_admin' => $sent_to_admin ) );
} }
} }

View File

@ -315,7 +315,8 @@ function get_woocommerce_currencies() {
'BTC' => __( 'Bitcoin', 'woocommerce' ), 'BTC' => __( 'Bitcoin', 'woocommerce' ),
'BTN' => __( 'Bhutanese ngultrum', 'woocommerce' ), 'BTN' => __( 'Bhutanese ngultrum', 'woocommerce' ),
'BWP' => __( 'Botswana pula', 'woocommerce' ), 'BWP' => __( 'Botswana pula', 'woocommerce' ),
'BYR' => __( 'Belarusian ruble', 'woocommerce' ), 'BYR' => __( 'Belarusian ruble (old)', 'woocommerce' ),
'BYN' => __( 'Belarusian ruble', 'woocommerce' ),
'BZD' => __( 'Belize dollar', 'woocommerce' ), 'BZD' => __( 'Belize dollar', 'woocommerce' ),
'CAD' => __( 'Canadian dollar', 'woocommerce' ), 'CAD' => __( 'Canadian dollar', 'woocommerce' ),
'CDF' => __( 'Congolese franc', 'woocommerce' ), 'CDF' => __( 'Congolese franc', 'woocommerce' ),
@ -498,6 +499,7 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
'BTN' => 'Nu.', 'BTN' => 'Nu.',
'BWP' => 'P', 'BWP' => 'P',
'BYR' => 'Br', 'BYR' => 'Br',
'BYN' => 'Br',
'BZD' => '&#36;', 'BZD' => '&#36;',
'CAD' => '&#36;', 'CAD' => '&#36;',
'CDF' => 'Fr', 'CDF' => 'Fr',

View File

@ -1758,7 +1758,7 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
$args = wp_parse_args( $args, $defaults ); $args = wp_parse_args( $args, $defaults );
extract( $args ); extract( $args ); // @codingStandardsIgnoreLine
// Main query only. // Main query only.
if ( ! is_main_query() && ! $force_display ) { if ( ! is_main_query() && ! $force_display ) {
@ -2050,7 +2050,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$field .= '</select>'; $field .= '</select>';
$field .= '<noscript><input type="submit" name="woocommerce_checkout_update_totals" value="' . esc_attr__( 'Update country', 'woocommerce' ) . '" /></noscript>'; $field .= '<noscript><button type="submit" name="woocommerce_checkout_update_totals" value="' . esc_attr__( 'Update country', 'woocommerce' ) . '">' . esc_html__( 'Update country', 'woocommerce' ) . '</button></noscript>';
} }
@ -2728,3 +2728,13 @@ function wc_page_noindex() {
} }
} }
add_action( 'wp_head', 'wc_page_noindex' ); add_action( 'wp_head', 'wc_page_noindex' );
/**
* Get a slug identifying the current theme.
*
* @since 3.3.0
* @return string
*/
function wc_get_theme_slug_for_templates() {
return apply_filters( 'woocommerce_theme_slug_for_templates', get_option( 'template' ) );
}

View File

@ -50,7 +50,7 @@ if ( ! function_exists( 'wc_create_new_customer' ) ) {
} }
if ( email_exists( $email ) ) { if ( email_exists( $email ) ) {
return new WP_Error( 'registration-error-email-exists', __( 'An account is already registered with your email address. Please log in.', 'woocommerce' ) ); return new WP_Error( 'registration-error-email-exists', apply_filters( 'woocommerce_registration_error_email_exists', __( 'An account is already registered with your email address. Please log in.', 'woocommerce' ), $email ) );
} }
// Handle username creation. // Handle username creation.

View File

@ -1,4 +1,9 @@
<?php <?php
/**
* Layered nav widget
*
* @package WooCommerce/Widgets
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
@ -31,8 +36,8 @@ class WC_Widget_Layered_Nav extends WC_Widget {
* *
* @see WP_Widget->update * @see WP_Widget->update
* *
* @param array $new_instance * @param array $new_instance New Instance.
* @param array $old_instance * @param array $old_instance Old Instance.
* *
* @return array * @return array
*/ */
@ -46,7 +51,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
* *
* @see WP_Widget->form * @see WP_Widget->form
* *
* @param array $instance * @param array $instance Instance.
*/ */
public function form( $instance ) { public function form( $instance ) {
$this->init_settings(); $this->init_settings();
@ -106,8 +111,8 @@ class WC_Widget_Layered_Nav extends WC_Widget {
* *
* @see WP_Widget * @see WP_Widget
* *
* @param array $args * @param array $args Arguments.
* @param array $instance * @param array $instance Instance.
*/ */
public function widget( $args, $instance ) { public function widget( $args, $instance ) {
if ( ! is_post_type_archive( 'product' ) && ! is_tax( get_object_taxonomies( 'product' ) ) ) { if ( ! is_post_type_archive( 'product' ) && ! is_tax( get_object_taxonomies( 'product' ) ) ) {
@ -144,7 +149,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$terms = get_terms( $taxonomy, $get_terms_args ); $terms = get_terms( $taxonomy, $get_terms_args );
if ( 0 === sizeof( $terms ) ) { if ( 0 === count( $terms ) ) {
return; return;
} }
@ -171,7 +176,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$this->widget_end( $args ); $this->widget_end( $args );
// Force found when option is selected - do not force found on taxonomy attributes // Force found when option is selected - do not force found on taxonomy attributes.
if ( ! is_tax() && is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) { if ( ! is_tax() && is_array( $_chosen_attributes ) && array_key_exists( $taxonomy, $_chosen_attributes ) ) {
$found = true; $found = true;
} }
@ -179,12 +184,13 @@ class WC_Widget_Layered_Nav extends WC_Widget {
if ( ! $found ) { if ( ! $found ) {
ob_end_clean(); ob_end_clean();
} else { } else {
echo ob_get_clean(); echo ob_get_clean(); // @codingStandardsIgnoreLine
} }
} }
/** /**
* Return the currently viewed taxonomy name. * Return the currently viewed taxonomy name.
*
* @return string * @return string
*/ */
protected function get_current_taxonomy() { protected function get_current_taxonomy() {
@ -193,6 +199,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/** /**
* Return the currently viewed term ID. * Return the currently viewed term ID.
*
* @return int * @return int
*/ */
protected function get_current_term_id() { protected function get_current_term_id() {
@ -201,6 +208,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/** /**
* Return the currently viewed term slug. * Return the currently viewed term slug.
*
* @return int * @return int
*/ */
protected function get_current_term_slug() { protected function get_current_term_slug() {
@ -209,9 +217,10 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/** /**
* Show dropdown layered nav. * Show dropdown layered nav.
* @param array $terms *
* @param string $taxonomy * @param array $terms Terms.
* @param string $query_type * @param string $taxonomy Taxonomy.
* @param string $query_type Query Type.
* @return bool Will nav display? * @return bool Will nav display?
*/ */
protected function layered_nav_dropdown( $terms, $taxonomy, $query_type ) { protected function layered_nav_dropdown( $terms, $taxonomy, $query_type ) {
@ -239,16 +248,16 @@ class WC_Widget_Layered_Nav extends WC_Widget {
foreach ( $terms as $term ) { foreach ( $terms as $term ) {
// If on a term page, skip that term in widget list // If on a term page, skip that term in widget list.
if ( $term->term_id === $this->get_current_term_id() ) { if ( $term->term_id === $this->get_current_term_id() ) {
continue; continue;
} }
// Get count based on current view // Get count based on current view.
$option_is_set = in_array( $term->slug, $current_values ); $option_is_set = in_array( $term->slug, $current_values );
$count = isset( $term_counts[ $term->term_id ] ) ? $term_counts[ $term->term_id ] : 0; $count = isset( $term_counts[ $term->term_id ] ) ? $term_counts[ $term->term_id ] : 0;
// Only show options with count > 0 // Only show options with count > 0.
if ( 0 < $count ) { if ( 0 < $count ) {
$found = true; $found = true;
} elseif ( 0 === $count && ! $option_is_set ) { } elseif ( 0 === $count && ! $option_is_set ) {
@ -261,7 +270,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
echo '</select>'; echo '</select>';
if ( $multiple ) { if ( $multiple ) {
echo '<input class="woocommerce-widget-layered-nav-dropdown__submit" type="submit" value="' . esc_attr__( 'Apply', 'woocommerce' ) . '" />'; echo '<button class="woocommerce-widget-layered-nav-dropdown__submit" type="submit" value="' . esc_attr__( 'Apply', 'woocommerce' ) . '">' . esc_html__( 'Apply', 'woocommerce' ) . '</button>';
} }
if ( 'or' === $query_type ) { if ( 'or' === $query_type ) {
@ -269,7 +278,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
} }
echo '<input type="hidden" name="filter_' . esc_attr( $taxonomy_filter_name ) . '" value="' . esc_attr( implode( ',', $current_values ) ) . '" />'; echo '<input type="hidden" name="filter_' . esc_attr( $taxonomy_filter_name ) . '" value="' . esc_attr( implode( ',', $current_values ) ) . '" />';
echo wc_query_string_form_fields( null, array( 'filter_' . $taxonomy_filter_name, 'query_type_' . $taxonomy_filter_name ), '', true ); echo wc_query_string_form_fields( null, array( 'filter_' . $taxonomy_filter_name, 'query_type_' . $taxonomy_filter_name ), '', true ); // @codingStandardsIgnoreLine
echo '</form>'; echo '</form>';
wc_enqueue_js( " wc_enqueue_js( "
@ -310,7 +319,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/** /**
* Get current page URL for layered nav items. * Get current page URL for layered nav items.
* *
* @param string $taxonomy * @param string $taxonomy Taxonomy.
* *
* @return string * @return string
*/ */
@ -328,18 +337,18 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$link = get_term_link( $queried_object->slug, $queried_object->taxonomy ); $link = get_term_link( $queried_object->slug, $queried_object->taxonomy );
} }
// Min/Max // Min/Max.
if ( isset( $_GET['min_price'] ) ) { if ( isset( $_GET['min_price'] ) ) {
$link = add_query_arg( 'min_price', wc_clean( $_GET['min_price'] ), $link ); $link = add_query_arg( 'min_price', wc_clean( wp_unslash( $_GET['min_price'] ) ), $link );
} }
if ( isset( $_GET['max_price'] ) ) { if ( isset( $_GET['max_price'] ) ) {
$link = add_query_arg( 'max_price', wc_clean( $_GET['max_price'] ), $link ); $link = add_query_arg( 'max_price', wc_clean( wp_unslash( $_GET['max_price'] ) ), $link );
} }
// Order by // Order by.
if ( isset( $_GET['orderby'] ) ) { if ( isset( $_GET['orderby'] ) ) {
$link = add_query_arg( 'orderby', wc_clean( $_GET['orderby'] ), $link ); $link = add_query_arg( 'orderby', wc_clean( wp_unslash( $_GET['orderby'] ) ), $link );
} }
/** /**
@ -350,17 +359,17 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$link = add_query_arg( 's', rawurlencode( htmlspecialchars_decode( get_search_query() ) ), $link ); $link = add_query_arg( 's', rawurlencode( htmlspecialchars_decode( get_search_query() ) ), $link );
} }
// Post Type Arg // Post Type Arg.
if ( isset( $_GET['post_type'] ) ) { if ( isset( $_GET['post_type'] ) ) {
$link = add_query_arg( 'post_type', wc_clean( $_GET['post_type'] ), $link ); $link = add_query_arg( 'post_type', wc_clean( wp_unslash( $_GET['post_type'] ) ), $link );
} }
// Min Rating Arg // Min Rating Arg.
if ( isset( $_GET['rating_filter'] ) ) { if ( isset( $_GET['rating_filter'] ) ) {
$link = add_query_arg( 'rating_filter', wc_clean( $_GET['rating_filter'] ), $link ); $link = add_query_arg( 'rating_filter', wc_clean( wp_unslash( $_GET['rating_filter'] ) ), $link );
} }
// All current filters // All current filters.
if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) { if ( $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes() ) {
foreach ( $_chosen_attributes as $name => $data ) { foreach ( $_chosen_attributes as $name => $data ) {
if ( $name === $taxonomy ) { if ( $name === $taxonomy ) {
@ -384,9 +393,9 @@ class WC_Widget_Layered_Nav extends WC_Widget {
* *
* This query allows counts to be generated based on the viewed products, not all products. * This query allows counts to be generated based on the viewed products, not all products.
* *
* @param array $term_ids * @param array $term_ids Term IDs.
* @param string $taxonomy * @param string $taxonomy Taxonomy.
* @param string $query_type * @param string $query_type Query Type.
* @return array * @return array
*/ */
protected function get_filtered_term_product_counts( $term_ids, $taxonomy, $query_type ) { protected function get_filtered_term_product_counts( $term_ids, $taxonomy, $query_type ) {
@ -408,7 +417,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' ); $meta_query_sql = $meta_query->get_sql( 'post', $wpdb->posts, 'ID' );
$tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' ); $tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' );
// Generate query // Generate query.
$query = array(); $query = array();
$query['select'] = "SELECT COUNT( DISTINCT {$wpdb->posts}.ID ) as term_count, terms.term_id as term_count_id"; $query['select'] = "SELECT COUNT( DISTINCT {$wpdb->posts}.ID ) as term_count, terms.term_id as term_count_id";
$query['from'] = "FROM {$wpdb->posts}"; $query['from'] = "FROM {$wpdb->posts}";
@ -420,16 +429,15 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$query['where'] = " $query['where'] = "
WHERE {$wpdb->posts}.post_type IN ( 'product' ) WHERE {$wpdb->posts}.post_type IN ( 'product' )
AND {$wpdb->posts}.post_status = 'publish' AND {$wpdb->posts}.post_status = 'publish'"
" . $tax_query_sql['where'] . $meta_query_sql['where'] . " . $tax_query_sql['where'] . $meta_query_sql['where'] .
AND terms.term_id IN (" . implode( ',', array_map( 'absint', $term_ids ) ) . ") 'AND terms.term_id IN (' . implode( ',', array_map( 'absint', $term_ids ) ) . ')';
";
if ( $search = WC_Query::get_main_search_query_sql() ) { if ( $search = WC_Query::get_main_search_query_sql() ) {
$query['where'] .= ' AND ' . $search; $query['where'] .= ' AND ' . $search;
} }
$query['group_by'] = "GROUP BY terms.term_id"; $query['group_by'] = 'GROUP BY terms.term_id';
$query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query ); $query = apply_filters( 'woocommerce_get_filtered_term_product_counts_query', $query );
$query = implode( ' ', $query ); $query = implode( ' ', $query );
@ -438,7 +446,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$cached_counts = (array) get_transient( 'wc_layered_nav_counts' ); $cached_counts = (array) get_transient( 'wc_layered_nav_counts' );
if ( ! isset( $cached_counts[ $query_hash ] ) ) { if ( ! isset( $cached_counts[ $query_hash ] ) ) {
$results = $wpdb->get_results( $query, ARRAY_A ); $results = $wpdb->get_results( $query, ARRAY_A ); // @codingStandardsIgnoreLine
$counts = array_map( 'absint', wp_list_pluck( $results, 'term_count', 'term_count_id' ) ); $counts = array_map( 'absint', wp_list_pluck( $results, 'term_count', 'term_count_id' ) );
$cached_counts[ $query_hash ] = $counts; $cached_counts[ $query_hash ] = $counts;
set_transient( 'wc_layered_nav_counts', $cached_counts, DAY_IN_SECONDS ); set_transient( 'wc_layered_nav_counts', $cached_counts, DAY_IN_SECONDS );
@ -450,13 +458,13 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/** /**
* Show list based layered nav. * Show list based layered nav.
* *
* @param array $terms * @param array $terms Terms.
* @param string $taxonomy * @param string $taxonomy Taxonomy.
* @param string $query_type * @param string $query_type Query Type.
* @return bool Will nav display? * @return bool Will nav display?
*/ */
protected function layered_nav_list( $terms, $taxonomy, $query_type ) { protected function layered_nav_list( $terms, $taxonomy, $query_type ) {
// List display // List display.
echo '<ul class="woocommerce-widget-layered-nav-list">'; echo '<ul class="woocommerce-widget-layered-nav-list">';
$term_counts = $this->get_filtered_term_product_counts( wp_list_pluck( $terms, 'term_id' ), $taxonomy, $query_type ); $term_counts = $this->get_filtered_term_product_counts( wp_list_pluck( $terms, 'term_id' ), $taxonomy, $query_type );
@ -468,12 +476,12 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$option_is_set = in_array( $term->slug, $current_values ); $option_is_set = in_array( $term->slug, $current_values );
$count = isset( $term_counts[ $term->term_id ] ) ? $term_counts[ $term->term_id ] : 0; $count = isset( $term_counts[ $term->term_id ] ) ? $term_counts[ $term->term_id ] : 0;
// Skip the term for the current archive // Skip the term for the current archive.
if ( $this->get_current_term_id() === $term->term_id ) { if ( $this->get_current_term_id() === $term->term_id ) {
continue; continue;
} }
// Only show options with count > 0 // Only show options with count > 0.
if ( 0 < $count ) { if ( 0 < $count ) {
$found = true; $found = true;
} elseif ( 0 === $count && ! $option_is_set ) { } elseif ( 0 === $count && ! $option_is_set ) {
@ -481,7 +489,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
} }
$filter_name = 'filter_' . sanitize_title( str_replace( 'pa_', '', $taxonomy ) ); $filter_name = 'filter_' . sanitize_title( str_replace( 'pa_', '', $taxonomy ) );
$current_filter = isset( $_GET[ $filter_name ] ) ? explode( ',', wc_clean( $_GET[ $filter_name ] ) ) : array(); $current_filter = isset( $_GET[ $filter_name ] ) ? explode( ',', wc_clean( wp_unslash( $_GET[ $filter_name ] ) ) ) : array();
$current_filter = array_map( 'sanitize_title', $current_filter ); $current_filter = array_map( 'sanitize_title', $current_filter );
if ( ! in_array( $term->slug, $current_filter ) ) { if ( ! in_array( $term->slug, $current_filter ) ) {
@ -492,7 +500,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
// Add current filters to URL. // Add current filters to URL.
foreach ( $current_filter as $key => $value ) { foreach ( $current_filter as $key => $value ) {
// Exclude query arg for current term archive term // Exclude query arg for current term archive term.
if ( $value === $this->get_current_term_slug() ) { if ( $value === $this->get_current_term_slug() ) {
unset( $current_filter[ $key ] ); unset( $current_filter[ $key ] );
} }
@ -507,8 +515,8 @@ class WC_Widget_Layered_Nav extends WC_Widget {
asort( $current_filter ); asort( $current_filter );
$link = add_query_arg( $filter_name, implode( ',', $current_filter ), $link ); $link = add_query_arg( $filter_name, implode( ',', $current_filter ), $link );
// Add Query type Arg to URL // Add Query type Arg to URL.
if ( 'or' === $query_type && ! ( 1 === sizeof( $current_filter ) && $option_is_set ) ) { if ( 'or' === $query_type && ! ( 1 === count( $current_filter ) && $option_is_set ) ) {
$link = add_query_arg( 'query_type_' . sanitize_title( str_replace( 'pa_', '', $taxonomy ) ), 'or', $link ); $link = add_query_arg( 'query_type_' . sanitize_title( str_replace( 'pa_', '', $taxonomy ) ), 'or', $link );
} }
$link = str_replace( '%2C', ',', $link ); $link = str_replace( '%2C', ',', $link );

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates/Auth * @package WooCommerce/Templates/Auth
* @version 2.4.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -24,24 +24,24 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_auth_page_header' ); ?> <?php do_action( 'woocommerce_auth_page_header' ); ?>
<h1><?php printf( __( '%s would like to connect to your store' , 'woocommerce' ), esc_html( $app_name ) ); ?></h1> <h1><?php printf( esc_html__( '%s would like to connect to your store' , 'woocommerce' ), esc_html( $app_name ) ); ?></h1>
<?php wc_print_notices(); ?> <?php wc_print_notices(); ?>
<p><?php printf( __( 'To connect to %1$s you need to be logged in. Log in to your store below, or <a href="%2$s">cancel and return to %1$s</a>', 'woocommerce' ), wc_clean( $app_name ), esc_url( $return_url ) ); ?></p> <p><?php printf( esc_html__( 'To connect to %1$s you need to be logged in. Log in to your store below, or <a href="%2$s">cancel and return to %1$s</a>', 'woocommerce' ), esc_html( wc_clean( $app_name ) ), esc_url( $return_url ) ); ?></p>
<form method="post" class="wc-auth-login"> <form method="post" class="wc-auth-login">
<p class="form-row form-row-wide"> <p class="form-row form-row-wide">
<label for="username"><?php _e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="username"><?php esc_html_e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="username" id="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" /> <input type="text" class="input-text" name="username" id="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" /><?php //@codingStandardsIgnoreLine ?>
</p> </p>
<p class="form-row form-row-wide"> <p class="form-row form-row-wide">
<label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="password"><?php esc_html_e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input class="input-text" type="password" name="password" id="password" /> <input class="input-text" type="password" name="password" id="password" />
</p> </p>
<p class="wc-auth-actions"> <p class="wc-auth-actions">
<?php wp_nonce_field( 'woocommerce-login' ); ?> <?php wp_nonce_field( 'woocommerce-login' ); ?>
<input type="submit" class="button button-large button-primary wc-auth-login-button" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>" /> <button type="submit" class="button button-large button-primary wc-auth-login-button" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>"><?php esc_html_e( 'Login', 'woocommerce' ); ?></button>
<input type="hidden" name="redirect" value="<?php echo esc_url( $redirect_url ); ?>" /> <input type="hidden" name="redirect" value="<?php echo esc_url( $redirect_url ); ?>" />
</p> </p>
</form> </form>

View File

@ -32,10 +32,10 @@ do_action( 'woocommerce_before_cart' ); ?>
<tr> <tr>
<th class="product-remove">&nbsp;</th> <th class="product-remove">&nbsp;</th>
<th class="product-thumbnail">&nbsp;</th> <th class="product-thumbnail">&nbsp;</th>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th> <th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th> <th class="product-price"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th> <th class="product-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th> <th class="product-subtotal"><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -53,6 +53,7 @@ do_action( 'woocommerce_before_cart' ); ?>
<td class="product-remove"> <td class="product-remove">
<?php <?php
// @codingStandardsIgnoreLine
echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf( echo apply_filters( 'woocommerce_cart_item_remove_link', sprintf(
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>', '<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">&times;</a>',
esc_url( WC()->cart->get_remove_url( $cart_item_key ) ), esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
@ -129,12 +130,12 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php if ( wc_coupons_enabled() ) { ?> <?php if ( wc_coupons_enabled() ) { ?>
<div class="coupon"> <div class="coupon">
<label for="coupon_code"><?php _e( 'Coupon:', 'woocommerce' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" /> <label for="coupon_code"><?php esc_html_e( 'Coupon:', 'woocommerce' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" />
<?php do_action( 'woocommerce_cart_coupon' ); ?> <?php do_action( 'woocommerce_cart_coupon' ); ?>
</div> </div>
<?php } ?> <?php } ?>
<input type="submit" class="button" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>" /> <button type="submit" class="button" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>"><?php esc_html_e( 'Update cart', 'woocommerce' ); ?></button>
<?php do_action( 'woocommerce_cart_actions' ); ?> <?php do_action( 'woocommerce_cart_actions' ); ?>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.2 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
if ( ! wc_coupons_enabled() ) { if ( ! wc_coupons_enabled() ) {
@ -37,7 +37,7 @@ if ( empty( WC()->cart->applied_coupons ) ) {
</p> </p>
<p class="form-row form-row-last"> <p class="form-row form-row-last">
<input type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>" /> <button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_html_e( 'Apply coupon', 'woocommerce' ); ?></button>
</p> </p>
<div class="clear"></div> <div class="clear"></div>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.5.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -26,13 +26,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<table class="shop_table"> <table class="shop_table">
<thead> <thead>
<tr> <tr>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th> <th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Qty', 'woocommerce' ); ?></th> <th class="product-quantity"><?php esc_html_e( 'Qty', 'woocommerce' ); ?></th>
<th class="product-total"><?php _e( 'Totals', 'woocommerce' ); ?></th> <th class="product-total"><?php esc_html_e( 'Totals', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php if ( sizeof( $order->get_items() ) > 0 ) : ?> <?php if ( count( $order->get_items() ) > 0 ) : ?>
<?php foreach ( $order->get_items() as $item_id => $item ) : ?> <?php foreach ( $order->get_items() as $item_id => $item ) : ?>
<?php <?php
if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) { if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>"> <tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
<td class="product-name"> <td class="product-name">
<?php <?php
echo apply_filters( 'woocommerce_order_item_name', esc_html( $item->get_name() ), $item, false ); echo apply_filters( 'woocommerce_order_item_name', esc_html( $item->get_name() ), $item, false ); // @codingStandardsIgnoreLine
do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order ); do_action( 'woocommerce_order_item_meta_start', $item_id, $item, $order );
@ -51,8 +51,8 @@ if ( ! defined( 'ABSPATH' ) ) {
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order ); do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
?> ?>
</td> </td>
<td class="product-quantity"><?php echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '&times; %s', esc_html( $item->get_quantity() ) ) . '</strong>', $item ); ?></td> <td class="product-quantity"><?php echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '&times; %s', esc_html( $item->get_quantity() ) ) . '</strong>', $item ); ?></td><?php // @codingStandardsIgnoreLine ?>
<td class="product-subtotal"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td> <td class="product-subtotal"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td><?php // @codingStandardsIgnoreLine ?>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
@ -61,8 +61,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( $totals = $order->get_order_item_totals() ) : ?> <?php if ( $totals = $order->get_order_item_totals() ) : ?>
<?php foreach ( $totals as $total ) : ?> <?php foreach ( $totals as $total ) : ?>
<tr> <tr>
<th scope="row" colspan="2"><?php echo $total['label']; ?></th> <th scope="row" colspan="2"><?php echo $total['label']; ?></th><?php // @codingStandardsIgnoreLine ?>
<td class="product-total"><?php echo $total['value']; ?></td> <td class="product-total"><?php echo $total['value']; ?></td><?php // @codingStandardsIgnoreLine ?>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
@ -78,7 +78,7 @@ if ( ! defined( 'ABSPATH' ) ) {
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) ); wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
} }
} else { } else {
echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', __( 'Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) ) . '</li>'; echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', __( 'Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) ) . '</li>'; // @codingStandardsIgnoreLine
} }
?> ?>
</ul> </ul>
@ -90,7 +90,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php do_action( 'woocommerce_pay_order_before_submit' ); ?> <?php do_action( 'woocommerce_pay_order_before_submit' ); ?>
<?php echo apply_filters( 'woocommerce_pay_order_button_html', '<input type="submit" class="button alt" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?> <?php echo apply_filters( 'woocommerce_pay_order_button_html', '<button type="submit" class="button alt" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine ?>
<?php do_action( 'woocommerce_pay_order_after_submit' ); ?> <?php do_action( 'woocommerce_pay_order_after_submit' ); ?>

View File

@ -13,8 +13,9 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.5.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit;
} }
@ -32,22 +33,22 @@ if ( ! is_ajax() ) {
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) ); wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
} }
} else { } else {
echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', WC()->customer->get_billing_country() ? __( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) : __( 'Please fill in your details above to see available payment methods.', 'woocommerce' ) ) . '</li>'; echo '<li class="woocommerce-notice woocommerce-notice--info woocommerce-info">' . apply_filters( 'woocommerce_no_available_payment_methods_message', WC()->customer->get_billing_country() ? esc_html__( 'Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'woocommerce' ) : esc_html__( 'Please fill in your details above to see available payment methods.', 'woocommerce' ) ) . '</li>'; // @codingStandardsIgnoreLine
} }
?> ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
<div class="form-row place-order"> <div class="form-row place-order">
<noscript> <noscript>
<?php _e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?> <?php esc_html_e( 'Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'woocommerce' ); ?>
<br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce' ); ?>" /> <br/><button type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', 'woocommerce' ); ?>"><?php esc_html_e( 'Update totals', 'woocommerce' ); ?></button>
</noscript> </noscript>
<?php wc_get_template( 'checkout/terms.php' ); ?> <?php wc_get_template( 'checkout/terms.php' ); ?>
<?php do_action( 'woocommerce_review_order_before_submit' ); ?> <?php do_action( 'woocommerce_review_order_before_submit' ); ?>
<?php echo apply_filters( 'woocommerce_order_button_html', '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '" />' ); ?> <?php echo apply_filters( 'woocommerce_order_button_html', '<button type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="' . esc_attr( $order_button_text ) . '" data-value="' . esc_attr( $order_button_text ) . '">' . esc_html( $order_button_text ) . '</button>' ); // @codingStandardsIgnoreLine ?>
<?php do_action( 'woocommerce_review_order_after_submit' ); ?> <?php do_action( 'woocommerce_review_order_after_submit' ); ?>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.1.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
if ( is_user_logged_in() ) { if ( is_user_logged_in() ) {
@ -29,14 +29,14 @@ if ( is_user_logged_in() ) {
<?php do_action( 'woocommerce_login_form_start' ); ?> <?php do_action( 'woocommerce_login_form_start' ); ?>
<?php echo ( $message ) ? wpautop( wptexturize( $message ) ) : ''; ?> <?php echo ( $message ) ? wpautop( wptexturize( $message ) ) : ''; // @codingStandardsIgnoreLine ?>
<p class="form-row form-row-first"> <p class="form-row form-row-first">
<label for="username"><?php _e( 'Username or email', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="username"><?php esc_html_e( 'Username or email', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="username" id="username" /> <input type="text" class="input-text" name="username" id="username" />
</p> </p>
<p class="form-row form-row-last"> <p class="form-row form-row-last">
<label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="password"><?php esc_html_e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input class="input-text" type="password" name="password" id="password" /> <input class="input-text" type="password" name="password" id="password" />
</p> </p>
<div class="clear"></div> <div class="clear"></div>
@ -45,14 +45,14 @@ if ( is_user_logged_in() ) {
<p class="form-row"> <p class="form-row">
<?php wp_nonce_field( 'woocommerce-login' ); ?> <?php wp_nonce_field( 'woocommerce-login' ); ?>
<input type="submit" class="button" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>" /> <button type="submit" class="button" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>"><?php esc_html_e( 'Login', 'woocommerce' ); ?></button>
<input type="hidden" name="redirect" value="<?php echo esc_url( $redirect ) ?>" /> <input type="hidden" name="redirect" value="<?php echo esc_url( $redirect ) ?>" />
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline"> <label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline">
<input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php _e( 'Remember me', 'woocommerce' ); ?></span> <input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php esc_html_e( 'Remember me', 'woocommerce' ); ?></span>
</label> </label>
</p> </p>
<p class="lost_password"> <p class="lost_password">
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Lost your password?', 'woocommerce' ); ?></a>
</p> </p>
<div class="clear"></div> <div class="clear"></div>

View File

@ -13,16 +13,19 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 1.6.4 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
$template = get_option( 'template' ); $template = wc_get_theme_slug_for_templates();
switch ( $template ) { switch ( $template ) {
case 'twentyten' :
echo '</div></div>';
break;
case 'twentyeleven' : case 'twentyeleven' :
echo '</div>'; echo '</div>';
get_sidebar( 'shop' ); get_sidebar( 'shop' );
@ -45,6 +48,6 @@ switch ( $template ) {
echo '</main></div>'; echo '</main></div>';
break; break;
default : default :
echo '</div></div>'; echo '</div></main>';
break; break;
} }

View File

@ -13,16 +13,19 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 1.6.4 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly
} }
$template = get_option( 'template' ); $template = wc_get_theme_slug_for_templates();
switch ( $template ) { switch ( $template ) {
case 'twentyten' :
echo '<div id="container"><div id="content" role="main">';
break;
case 'twentyeleven' : case 'twentyeleven' :
echo '<div id="primary"><div id="content" role="main" class="twentyeleven">'; echo '<div id="primary"><div id="content" role="main" class="twentyeleven">';
break; break;
@ -42,6 +45,6 @@ switch ( $template ) {
echo '<div id="primary" class="content-area twentysixteen"><main id="main" class="site-main" role="main">'; echo '<div id="primary" class="content-area twentysixteen"><main id="main" class="site-main" role="main">';
break; break;
default : default :
echo '<div id="container"><div id="content" role="main">'; echo '<div id="primary" class="content-area"><main id="main" class="site-main" role="main">';
break; break;
} }

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -32,7 +32,7 @@ if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateway
foreach ( $available_gateways as $gateway ) { foreach ( $available_gateways as $gateway ) {
?> ?>
<li class="woocommerce-PaymentMethod woocommerce-PaymentMethod--<?php echo $gateway->id; ?> payment_method_<?php echo $gateway->id; ?>"> <li class="woocommerce-PaymentMethod woocommerce-PaymentMethod--<?php echo esc_attr( $gateway->id ); ?> payment_method_<?php echo esc_attr( $gateway->id ); ?>">
<input id="payment_method_<?php echo esc_attr( $gateway->id ); ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> /> <input id="payment_method_<?php echo esc_attr( $gateway->id ); ?>" type="radio" class="input-radio" name="payment_method" value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> />
<label for="payment_method_<?php echo esc_attr( $gateway->id ); ?>"><?php echo wp_kses_post( $gateway->get_title() ); ?> <?php echo wp_kses_post( $gateway->get_icon() ); ?></label> <label for="payment_method_<?php echo esc_attr( $gateway->id ); ?>"><?php echo wp_kses_post( $gateway->get_title() ); ?> <?php echo wp_kses_post( $gateway->get_icon() ); ?></label>
<?php <?php
@ -50,7 +50,7 @@ if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateway
<div class="form-row"> <div class="form-row">
<?php wp_nonce_field( 'woocommerce-add-payment-method' ); ?> <?php wp_nonce_field( 'woocommerce-add-payment-method' ); ?>
<input type="submit" class="woocommerce-Button woocommerce-Button--alt button alt" id="place_order" value="<?php esc_attr_e( 'Add payment method', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-Button woocommerce-Button--alt button alt" id="place_order" value="<?php esc_attr_e( 'Add payment method', 'woocommerce' ); ?>"><?php esc_html_e( 'Add payment method', 'woocommerce' ); ?></button>
<input type="hidden" name="woocommerce_add_payment_method" id="woocommerce_add_payment_method" value="1" /> <input type="hidden" name="woocommerce_add_payment_method" id="woocommerce_add_payment_method" value="1" />
</div> </div>
</div> </div>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.6.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -27,33 +27,33 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<?php do_action( 'woocommerce_edit_account_form_start' ); ?> <?php do_action( 'woocommerce_edit_account_form_start' ); ?>
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <p class="woocommerce-form-row woocommerce-form-row--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 esc_html_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 ); ?>" /> <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>
<p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last"> <p class="woocommerce-form-row woocommerce-form-row--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 esc_html_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 ); ?>" /> <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> </p>
<div class="clear"></div> <div class="clear"></div>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--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 esc_html_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 ); ?>" /> <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> </p>
<fieldset> <fieldset>
<legend><?php _e( 'Password change', 'woocommerce' ); ?></legend> <legend><?php esc_html_e( 'Password change', 'woocommerce' ); ?></legend>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password_current"><?php _e( 'Current password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> <label for="password_current"><?php esc_html_e( 'Current password (leave blank to leave unchanged)', 'woocommerce' ); ?></label>
<input type="password" class="woocommerce-Input woocommerce-Input--password input-text" name="password_current" id="password_current" /> <input type="password" class="woocommerce-Input woocommerce-Input--password input-text" name="password_current" id="password_current" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password_1"><?php _e( 'New password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> <label for="password_1"><?php esc_html_e( 'New password (leave blank to leave unchanged)', 'woocommerce' ); ?></label>
<input type="password" class="woocommerce-Input woocommerce-Input--password input-text" name="password_1" id="password_1" /> <input type="password" class="woocommerce-Input woocommerce-Input--password input-text" name="password_1" id="password_1" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password_2"><?php _e( 'Confirm new password', 'woocommerce' ); ?></label> <label for="password_2"><?php esc_html_e( 'Confirm new password', 'woocommerce' ); ?></label>
<input type="password" class="woocommerce-Input woocommerce-Input--password input-text" name="password_2" id="password_2" /> <input type="password" class="woocommerce-Input woocommerce-Input--password input-text" name="password_2" id="password_2" />
</p> </p>
</fieldset> </fieldset>
@ -63,7 +63,7 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<p> <p>
<?php wp_nonce_field( 'save_account_details' ); ?> <?php wp_nonce_field( 'save_account_details' ); ?>
<input type="submit" class="woocommerce-Button button" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-Button button" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
<input type="hidden" name="action" value="save_account_details" /> <input type="hidden" name="action" value="save_account_details" />
</p> </p>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.9 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -30,7 +30,7 @@ do_action( 'woocommerce_before_edit_account_address_form' ); ?>
<form method="post"> <form method="post">
<h3><?php echo apply_filters( 'woocommerce_my_account_edit_address_title', $page_title, $load_address ); ?></h3> <h3><?php echo apply_filters( 'woocommerce_my_account_edit_address_title', $page_title, $load_address ); ?></h3><?php // @codingStandardsIgnoreLine ?>
<div class="woocommerce-address-fields"> <div class="woocommerce-address-fields">
<?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?> <?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?>
@ -49,7 +49,7 @@ do_action( 'woocommerce_before_edit_account_address_form' ); ?>
<?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?> <?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?>
<p> <p>
<input type="submit" class="button" name="save_address" value="<?php esc_attr_e( 'Save address', 'woocommerce' ); ?>" /> <button type="submit" class="button" name="save_address" value="<?php esc_attr_e( 'Save address', 'woocommerce' ); ?>"><?php esc_html_e( 'Save address', 'woocommerce' ); ?></button>
<?php wp_nonce_field( 'woocommerce-edit_address' ); ?> <?php wp_nonce_field( 'woocommerce-edit_address' ); ?>
<input type="hidden" name="action" value="edit_address" /> <input type="hidden" name="action" value="edit_address" />
</p> </p>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.2.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
?> ?>
@ -34,18 +34,18 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php endif; ?> <?php endif; ?>
<h2><?php _e( 'Login', 'woocommerce' ); ?></h2> <h2><?php esc_html_e( 'Login', 'woocommerce' ); ?></h2>
<form class="woocommerce-form woocommerce-form-login login" method="post"> <form class="woocommerce-form woocommerce-form-login login" method="post">
<?php do_action( 'woocommerce_login_form_start' ); ?> <?php do_action( 'woocommerce_login_form_start' ); ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="username"><?php _e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="username"><?php esc_html_e( 'Username or email address', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" /> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="password"><?php esc_html_e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input class="woocommerce-Input woocommerce-Input--text input-text" type="password" name="password" id="password" /> <input class="woocommerce-Input woocommerce-Input--text input-text" type="password" name="password" id="password" />
</p> </p>
@ -53,13 +53,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="form-row"> <p class="form-row">
<?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?> <?php wp_nonce_field( 'woocommerce-login', 'woocommerce-login-nonce' ); ?>
<input type="submit" class="woocommerce-Button button" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-Button button" name="login" value="<?php esc_attr_e( 'Login', 'woocommerce' ); ?>"><?php esc_html_e( 'Login', 'woocommerce' ); ?></button>
<label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline"> <label class="woocommerce-form__label woocommerce-form__label-for-checkbox inline">
<input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php _e( 'Remember me', 'woocommerce' ); ?></span> <input class="woocommerce-form__input woocommerce-form__input-checkbox" name="rememberme" type="checkbox" id="rememberme" value="forever" /> <span><?php esc_html_e( 'Remember me', 'woocommerce' ); ?></span>
</label> </label>
</p> </p>
<p class="woocommerce-LostPassword lost_password"> <p class="woocommerce-LostPassword lost_password">
<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Lost your password?', 'woocommerce' ); ?></a>
</p> </p>
<?php do_action( 'woocommerce_login_form_end' ); ?> <?php do_action( 'woocommerce_login_form_end' ); ?>
@ -72,7 +72,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="u-column2 col-2"> <div class="u-column2 col-2">
<h2><?php _e( 'Register', 'woocommerce' ); ?></h2> <h2><?php esc_html_e( 'Register', 'woocommerce' ); ?></h2>
<form method="post" class="register"> <form method="post" class="register">
@ -81,21 +81,21 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?> <?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_username"><?php _e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="reg_username"><?php esc_html_e( 'Username', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( $_POST['username'] ) : ''; ?>" /> <input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" value="<?php echo ( ! empty( $_POST['username'] ) ) ? esc_attr( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--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 esc_html_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 echo ( ! empty( $_POST['email'] ) ) ? esc_attr( $_POST['email'] ) : ''; ?>" /> <input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" value="<?php echo ( ! empty( $_POST['email'] ) ) ? esc_attr( wp_unslash( $_POST['email'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p> </p>
<?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?> <?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_password"><?php _e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="reg_password"><?php esc_html_e( 'Password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" /> <input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" />
</p> </p>
@ -105,7 +105,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="woocommerce-FormRow form-row"> <p class="woocommerce-FormRow form-row">
<?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?> <?php wp_nonce_field( 'woocommerce-register', 'woocommerce-register-nonce' ); ?>
<input type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-Button button" name="register" value="<?php esc_attr_e( 'Register', 'woocommerce' ); ?>"><?php esc_html_e( 'Register', 'woocommerce' ); ?></button>
</p> </p>
<?php do_action( 'woocommerce_register_form_end' ); ?> <?php do_action( 'woocommerce_register_form_end' ); ?>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -24,10 +24,10 @@ wc_print_notices(); ?>
<form method="post" class="woocommerce-ResetPassword lost_reset_password"> <form method="post" class="woocommerce-ResetPassword lost_reset_password">
<p><?php echo apply_filters( 'woocommerce_lost_password_message', __( 'Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.', 'woocommerce' ) ); ?></p> <p><?php echo apply_filters( 'woocommerce_lost_password_message', esc_html__( 'Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.', 'woocommerce' ) ); ?></p><?php // @codingStandardsIgnoreLine ?>
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first">
<label for="user_login"><?php _e( 'Username or email', 'woocommerce' ); ?></label> <label for="user_login"><?php esc_html_e( 'Username or email', 'woocommerce' ); ?></label>
<input class="woocommerce-Input woocommerce-Input--text input-text" type="text" name="user_login" id="user_login" /> <input class="woocommerce-Input woocommerce-Input--text input-text" type="text" name="user_login" id="user_login" />
</p> </p>
@ -37,7 +37,7 @@ wc_print_notices(); ?>
<p class="woocommerce-form-row form-row"> <p class="woocommerce-form-row form-row">
<input type="hidden" name="wc_reset_password" value="true" /> <input type="hidden" name="wc_reset_password" value="true" />
<input type="submit" class="woocommerce-Button button" value="<?php esc_attr_e( 'Reset password', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-Button button" value="<?php esc_attr_e( 'Reset password', 'woocommerce' ); ?>"><?php esc_html_e( 'Reset password', 'woocommerce' ); ?></button>
</p> </p>
<?php wp_nonce_field( 'lost_password' ); ?> <?php wp_nonce_field( 'lost_password' ); ?>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.0.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -24,14 +24,14 @@ wc_print_notices(); ?>
<form method="post" class="woocommerce-ResetPassword lost_reset_password"> <form method="post" class="woocommerce-ResetPassword lost_reset_password">
<p><?php echo apply_filters( 'woocommerce_reset_password_message', __( 'Enter a new password below.', 'woocommerce' ) ); ?></p> <p><?php echo apply_filters( 'woocommerce_reset_password_message', esc_html__( 'Enter a new password below.', 'woocommerce' ) ); ?></p><?php // @codingStandardsIgnoreLine ?>
<p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first"> <p class="woocommerce-form-row woocommerce-form-row--first form-row form-row-first">
<label for="password_1"><?php _e( 'New password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="password_1"><?php esc_html_e( 'New password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password_1" id="password_1" /> <input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password_1" id="password_1" />
</p> </p>
<p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last"> <p class="woocommerce-form-row woocommerce-form-row--last form-row form-row-last">
<label for="password_2"><?php _e( 'Re-enter new password', 'woocommerce' ); ?> <span class="required">*</span></label> <label for="password_2"><?php esc_html_e( 'Re-enter new password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password_2" id="password_2" /> <input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password_2" id="password_2" />
</p> </p>
@ -44,7 +44,7 @@ wc_print_notices(); ?>
<p class="woocommerce-form-row form-row"> <p class="woocommerce-form-row form-row">
<input type="hidden" name="wc_reset_password" value="true" /> <input type="hidden" name="wc_reset_password" value="true" />
<input type="submit" class="woocommerce-Button button" value="<?php esc_attr_e( 'Save', 'woocommerce' ); ?>" /> <button type="submit" class="woocommerce-Button button" value="<?php esc_attr_e( 'Save', 'woocommerce' ); ?>"><?php esc_html_e( 'Save', 'woocommerce' ); ?></button>
</p> </p>
<?php wp_nonce_field( 'reset_password' ); ?> <?php wp_nonce_field( 'reset_password' ); ?>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 3.2.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit; // Exit if accessed directly.
} }
global $post; global $post;
@ -26,13 +26,13 @@ global $post;
<form action="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" method="post" class="track_order"> <form action="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" method="post" class="track_order">
<p><?php _e( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'woocommerce' ); ?></p> <p><?php esc_html_e( 'To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received.', 'woocommerce' ); ?></p>
<p class="form-row form-row-first"><label for="orderid"><?php _e( 'Order ID', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" value="<?php echo isset( $_REQUEST['orderid'] ) ? esc_attr( $_REQUEST['orderid'] ) : ''; ?>" placeholder="<?php esc_attr_e( 'Found in your order confirmation email.', 'woocommerce' ); ?>" /></p> <p class="form-row form-row-first"><label for="orderid"><?php esc_html_e( 'Order ID', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" value="<?php echo isset( $_REQUEST['orderid'] ) ? esc_attr( wp_unslash( $_REQUEST['orderid'] ) ) : ''; ?>" placeholder="<?php esc_attr_e( 'Found in your order confirmation email.', 'woocommerce' ); ?>" /></p><?php // @codingStandardsIgnoreLine ?>
<p class="form-row form-row-last"><label for="order_email"><?php _e( 'Billing email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" value="<?php echo isset( $_REQUEST['order_email'] ) ? esc_attr( $_REQUEST['order_email'] ) : ''; ?>" placeholder="<?php esc_attr_e( 'Email you used during checkout.', 'woocommerce' ); ?>" /></p> <p class="form-row form-row-last"><label for="order_email"><?php esc_html_e( 'Billing email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" value="<?php echo isset( $_REQUEST['order_email'] ) ? esc_attr( wp_unslash( $_REQUEST['order_email'] ) ) : ''; ?>" placeholder="<?php esc_attr_e( 'Email you used during checkout.', 'woocommerce' ); ?>" /></p><?php // @codingStandardsIgnoreLine ?>
<div class="clear"></div> <div class="clear"></div>
<p class="form-row"><input type="submit" class="button" name="track" value="<?php esc_attr_e( 'Track', 'woocommerce' ); ?>" /></p> <p class="form-row"><button type="submit" class="button" name="track" value="<?php esc_attr_e( 'Track', 'woocommerce' ); ?>"><?php esc_html_e( 'Track', 'woocommerce' ); ?></button></p>
<?php wp_nonce_field( 'woocommerce-order_tracking' ); ?> <?php wp_nonce_field( 'woocommerce-order_tracking' ); ?>
</form> </form>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/ * @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes * @author WooThemes
* @package WooCommerce/Templates * @package WooCommerce/Templates
* @version 2.5.0 * @version 3.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
@ -22,8 +22,8 @@ if ( ! defined( 'ABSPATH' ) ) {
?> ?>
<form role="search" method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/' ) ); ?>"> <form role="search" method="get" class="woocommerce-product-search" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<label class="screen-reader-text" for="woocommerce-product-search-field-<?php echo isset( $index ) ? absint( $index ) : 0; ?>"><?php _e( 'Search for:', 'woocommerce' ); ?></label> <label class="screen-reader-text" for="woocommerce-product-search-field-<?php echo isset( $index ) ? absint( $index ) : 0; ?>"><?php esc_html_e( 'Search for:', 'woocommerce' ); ?></label>
<input type="search" id="woocommerce-product-search-field-<?php echo isset( $index ) ? absint( $index ) : 0; ?>" class="search-field" placeholder="<?php echo esc_attr__( 'Search products&hellip;', 'woocommerce' ); ?>" value="<?php echo get_search_query(); ?>" name="s" /> <input type="search" id="woocommerce-product-search-field-<?php echo isset( $index ) ? absint( $index ) : 0; ?>" class="search-field" placeholder="<?php echo esc_attr__( 'Search products&hellip;', 'woocommerce' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
<input type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'woocommerce' ); ?>" /> <button type="submit" value="<?php echo esc_attr_x( 'Search', 'submit button', 'woocommerce' ); ?>"><?php echo esc_html_x( 'Search', 'submit button', 'woocommerce' ); ?></button>
<input type="hidden" name="post_type" value="product" /> <input type="hidden" name="post_type" value="product" />
</form> </form>

View File

@ -49,7 +49,8 @@ class WC_Tests_Core_Functions extends WC_Unit_Test_Case {
'BTC' => 'Bitcoin', 'BTC' => 'Bitcoin',
'BTN' => 'Bhutanese ngultrum', 'BTN' => 'Bhutanese ngultrum',
'BWP' => 'Botswana pula', 'BWP' => 'Botswana pula',
'BYR' => 'Belarusian ruble', 'BYR' => 'Belarusian ruble (old)',
'BYN' => 'Belarusian ruble',
'BZD' => 'Belize dollar', 'BZD' => 'Belize dollar',
'CAD' => 'Canadian dollar', 'CAD' => 'Canadian dollar',
'CDF' => 'Congolese franc', 'CDF' => 'Congolese franc',