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( $ ) {
$( '.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() {
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 ),
strength = 1,
fieldValue = field.val();

View File

@ -29,7 +29,7 @@ class WC_Admin_Attributes {
$result = '';
$action = '';
// Action to perform: add, edit, delete or none
// Action to perform: add, edit, delete or none.
if ( ! empty( $_POST['add_new_attribute'] ) ) {
$action = 'add';
} 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>';
}
// Show admin interface
// Show admin interface.
if ( ! empty( $_GET['edit'] ) ) {
self::edit_attribute();
} else {
@ -64,6 +64,7 @@ class WC_Admin_Attributes {
/**
* Get and sanitize posted attribute data.
*
* @return array
*/
private static function get_posted_attribute() {
@ -169,55 +170,52 @@ class WC_Admin_Attributes {
?>
<div class="wrap woocommerce">
<h1><?php _e( 'Edit attribute', 'woocommerce' ) ?></h1>
<h1><?php esc_html_e( 'Edit attribute', 'woocommerce' ) ?></h1>
<?php
if ( ! $attribute_to_edit ) {
echo '<div id="woocommerce_errors" class="error"><p>' . __( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>';
} else {
$att_type = $attribute_to_edit->attribute_type;
$att_label = $attribute_to_edit->attribute_label;
$att_name = $attribute_to_edit->attribute_name;
$att_orderby = $attribute_to_edit->attribute_orderby;
$att_public = $attribute_to_edit->attribute_public;
?>
if ( ! $attribute_to_edit ) {
echo '<div id="woocommerce_errors" class="error"><p>' . esc_html__( 'Error: non-existing attribute ID.', 'woocommerce' ) . '</p></div>';
} else {
$att_type = $attribute_to_edit->attribute_type;
$att_label = $attribute_to_edit->attribute_label;
$att_name = $attribute_to_edit->attribute_name;
$att_orderby = $attribute_to_edit->attribute_orderby;
$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">
<table class="form-table">
<tbody>
<?php do_action( 'woocommerce_before_edit_attribute_fields' ); ?>
<tr class="form-field form-required">
<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>
<td>
<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>
</tr>
<tr class="form-field form-required">
<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>
<td>
<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>
</tr>
<tr class="form-field form-required">
<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>
<td>
<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>
</tr>
<tr class="form-field form-required">
<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>
<td>
<select name="attribute_type" id="attribute_type">
@ -234,27 +232,27 @@ class WC_Admin_Attributes {
do_action( 'woocommerce_admin_attribute_types' );
?>
</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>
</tr>
<tr class="form-field form-required">
<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>
<td>
<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="name" <?php selected( $att_orderby, 'name' ); ?>><?php _e( 'Name', 'woocommerce' ); ?></option>
<option value="name_num" <?php selected( $att_orderby, 'name_num' ); ?>><?php _e( 'Name (numeric)', 'woocommerce' ); ?></option>
<option value="id" <?php selected( $att_orderby, 'id' ); ?>><?php _e( 'Term ID', '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 esc_html_e( 'Name', '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 esc_html_e( 'Term ID', 'woocommerce' ); ?></option>
</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>
</tr>
<?php do_action( 'woocommerce_after_edit_attribute_fields' ) ?>
</tbody>
</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 ); ?>
</form>
<?php } ?>
@ -270,7 +268,7 @@ class WC_Admin_Attributes {
public static function add_attribute() {
?>
<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" />
<div id="col-container">
@ -279,76 +277,79 @@ class WC_Admin_Attributes {
<table class="widefat attributes-table wp-list-table ui-sortable" style="width:100%">
<thead>
<tr>
<th scope="col"><?php _e( 'Name', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Slug', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Type', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Order by', 'woocommerce' ); ?></th>
<th scope="col"><?php _e( 'Terms', 'woocommerce' ); ?></th>
<th scope="col"><?php esc_html_e( 'Name', 'woocommerce' ); ?></th>
<th scope="col"><?php esc_html_e( 'Slug', 'woocommerce' ); ?></th>
<th scope="col"><?php esc_html_e( 'Type', 'woocommerce' ); ?></th>
<th scope="col"><?php esc_html_e( 'Order by', 'woocommerce' ); ?></th>
<th scope="col"><?php esc_html_e( 'Terms', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php
if ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) :
foreach ( $attribute_taxonomies as $tax ) :
?><tr>
if ( $attribute_taxonomies = wc_get_attribute_taxonomies() ) :
foreach ( $attribute_taxonomies as $tax ) :
?><tr>
<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>
<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><?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
switch ( $tax->attribute_orderby ) {
case 'name' :
esc_html_e( 'Name', 'woocommerce' );
break;
case 'name_num' :
esc_html_e( 'Name (numeric)', 'woocommerce' );
break;
case 'id' :
esc_html_e( 'Term ID', 'woocommerce' );
break;
default:
esc_html_e( 'Custom ordering', 'woocommerce' );
break;
}
?>
</td>
<td class="attribute-terms">
<?php
$taxonomy = wc_attribute_taxonomy_name( $tax->attribute_name );
if ( taxonomy_exists( $taxonomy ) ) {
if ( 'menu_order' === wc_attribute_orderby( $taxonomy ) ) {
$terms = get_terms( $taxonomy, 'hide_empty=0&menu_order=ASC' );
} else {
$terms = get_terms( $taxonomy, 'hide_empty=0&menu_order=false' );
}
switch ( $tax->attribute_orderby ) {
case 'name' :
_e( 'Name', 'woocommerce' );
break;
case 'name_num' :
_e( 'Name (numeric)', 'woocommerce' );
usort( $terms, '_wc_get_product_terms_name_num_usort_callback' );
break;
case 'id' :
_e( 'Term ID', 'woocommerce' );
break;
default:
_e( 'Custom ordering', 'woocommerce' );
case 'parent' :
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
break;
}
?></td>
<td class="attribute-terms"><?php
$taxonomy = wc_attribute_taxonomy_name( $tax->attribute_name );
if ( taxonomy_exists( $taxonomy ) ) {
if ( 'menu_order' === wc_attribute_orderby( $taxonomy ) ) {
$terms = get_terms( $taxonomy, 'hide_empty=0&menu_order=ASC' );
} else {
$terms = get_terms( $taxonomy, 'hide_empty=0&menu_order=false' );
}
switch ( $tax->attribute_orderby ) {
case 'name_num' :
usort( $terms, '_wc_get_product_terms_name_num_usort_callback' );
break;
case 'parent' :
usort( $terms, '_wc_get_product_terms_parent_usort_callback' );
break;
}
$terms_string = implode( ', ', wp_list_pluck( $terms, 'name' ) );
if ( $terms_string ) {
echo $terms_string;
} else {
echo '<span class="na">&ndash;</span>';
}
$terms_string = implode( ', ', wp_list_pluck( $terms, 'name' ) );
if ( $terms_string ) {
echo esc_html( $terms_string );
} else {
echo '<span class="na">&ndash;</span>';
}
} else {
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>
</tr><?php
</tr>
<?php
endforeach;
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;
?>
</tbody>
@ -358,31 +359,31 @@ class WC_Admin_Attributes {
<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h2><?php _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>
<h2><?php esc_html_e( 'Add new attribute', 'woocommerce' ); ?></h2>
<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">
<?php do_action( 'woocommerce_before_add_attribute_fields' ) ?>
<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="" />
<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 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" />
<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 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 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">
<?php foreach ( wc_get_attribute_types() as $key => $value ) : ?>
<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' );
?>
</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 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">
<option value="menu_order"><?php _e( 'Custom ordering', 'woocommerce' ); ?></option>
<option value="name"><?php _e( 'Name', 'woocommerce' ); ?></option>
<option value="name_num"><?php _e( 'Name (numeric)', 'woocommerce' ); ?></option>
<option value="id"><?php _e( 'Term ID', 'woocommerce' ); ?></option>
<option value="menu_order"><?php esc_html_e( 'Custom ordering', 'woocommerce' ); ?></option>
<option value="name"><?php esc_html_e( 'Name', 'woocommerce' ); ?></option>
<option value="name_num"><?php esc_html_e( 'Name (numeric)', 'woocommerce' ); ?></option>
<option value="id"><?php esc_html_e( 'Term ID', 'woocommerce' ); ?></option>
</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>
<?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' ); ?>
</form>
</div>
@ -425,7 +426,7 @@ class WC_Admin_Attributes {
/* <![CDATA[ */
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 false;

View File

@ -14,335 +14,338 @@ if ( ! defined( 'ABSPATH' ) ) {
if ( ! class_exists( 'WC_Admin_Menus', false ) ) :
/**
* WC_Admin_Menus Class.
*/
class WC_Admin_Menus {
/**
* Hook in tabs.
* WC_Admin_Menus Class.
*/
public function __construct() {
// Add menus
add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
add_action( 'admin_menu', array( $this, 'reports_menu' ), 20 );
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
class WC_Admin_Menus {
if ( apply_filters( 'woocommerce_show_addons_page', true ) ) {
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
/**
* Hook in tabs.
*/
public function __construct() {
// Add menus.
add_action( 'admin_menu', array( $this, 'admin_menu' ), 9 );
add_action( 'admin_menu', array( $this, 'reports_menu' ), 20 );
add_action( 'admin_menu', array( $this, 'settings_menu' ), 50 );
add_action( 'admin_menu', array( $this, 'status_menu' ), 60 );
if ( apply_filters( 'woocommerce_show_addons_page', true ) ) {
add_action( 'admin_menu', array( $this, 'addons_menu' ), 70 );
}
add_action( 'admin_head', array( $this, 'menu_highlight' ) );
add_action( 'admin_head', array( $this, 'menu_order_count' ) );
add_filter( 'menu_order', array( $this, 'menu_order' ) );
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
// Add endpoints custom URLs in Appearance > Menus > Pages.
add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
// Admin bar menus.
if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) {
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 31 );
}
}
add_action( 'admin_head', array( $this, 'menu_highlight' ) );
add_action( 'admin_head', array( $this, 'menu_order_count' ) );
add_filter( 'menu_order', array( $this, 'menu_order' ) );
add_filter( 'custom_menu_order', array( $this, 'custom_menu_order' ) );
/**
* Add menu items.
*/
public function admin_menu() {
global $menu;
// Add endpoints custom URLs in Appearance > Menus > Pages.
add_action( 'admin_head-nav-menus.php', array( $this, 'add_nav_menu_meta_boxes' ) );
if ( current_user_can( 'manage_woocommerce' ) ) {
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
}
// Admin bar menus
if ( apply_filters( 'woocommerce_show_admin_bar_visit_store', true ) ) {
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 31 );
}
}
add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce', null, null, '55.5' );
/**
* Add menu items.
*/
public function admin_menu() {
global $menu;
if ( current_user_can( 'manage_woocommerce' ) ) {
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
add_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'product_attributes', array( $this, 'attributes_page' ) );
}
add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce', null, null, '55.5' );
add_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'product_attributes', array( $this, 'attributes_page' ) );
}
/**
* Add menu item.
*/
public function reports_menu() {
if ( current_user_can( 'manage_woocommerce' ) ) {
add_submenu_page( 'woocommerce', __( 'Reports', 'woocommerce' ), __( 'Reports', 'woocommerce' ) , 'view_woocommerce_reports', 'wc-reports', array( $this, 'reports_page' ) );
} else {
add_menu_page( __( 'Sales reports', 'woocommerce' ), __( 'Sales reports', 'woocommerce' ) , 'view_woocommerce_reports', 'wc-reports', array( $this, 'reports_page' ), null, '55.6' );
}
}
/**
* Add menu item.
*/
public function settings_menu() {
$settings_page = add_submenu_page( 'woocommerce', __( 'WooCommerce settings', 'woocommerce' ), __( 'Settings', 'woocommerce' ) , 'manage_woocommerce', 'wc-settings', array( $this, 'settings_page' ) );
add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) );
}
/**
* Loads gateways and shipping methods into memory for use within settings.
*/
public function settings_page_init() {
global $current_tab, $current_section;
WC()->payment_gateways();
WC()->shipping();
// Include settings pages
WC_Admin_Settings::get_settings_pages();
// Get current tab/section
$current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( $_GET['tab'] );
$current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( $_REQUEST['section'] );
// Save settings if data has been posted
if ( ! empty( $_POST ) ) {
WC_Admin_Settings::save();
/**
* Add menu item.
*/
public function reports_menu() {
if ( current_user_can( 'manage_woocommerce' ) ) {
add_submenu_page( 'woocommerce', __( 'Reports', 'woocommerce' ), __( 'Reports', 'woocommerce' ) , 'view_woocommerce_reports', 'wc-reports', array( $this, 'reports_page' ) );
} else {
add_menu_page( __( 'Sales reports', 'woocommerce' ), __( 'Sales reports', 'woocommerce' ) , 'view_woocommerce_reports', 'wc-reports', array( $this, 'reports_page' ), null, '55.6' );
}
}
// Add any posted messages
if ( ! empty( $_GET['wc_error'] ) ) {
WC_Admin_Settings::add_error( stripslashes( $_GET['wc_error'] ) );
/**
* Add menu item.
*/
public function settings_menu() {
$settings_page = add_submenu_page( 'woocommerce', __( 'WooCommerce settings', 'woocommerce' ), __( 'Settings', 'woocommerce' ) , 'manage_woocommerce', 'wc-settings', array( $this, 'settings_page' ) );
add_action( 'load-' . $settings_page, array( $this, 'settings_page_init' ) );
}
if ( ! empty( $_GET['wc_message'] ) ) {
WC_Admin_Settings::add_message( stripslashes( $_GET['wc_message'] ) );
/**
* Loads gateways and shipping methods into memory for use within settings.
*/
public function settings_page_init() {
global $current_tab, $current_section;
WC()->payment_gateways();
WC()->shipping();
// Include settings pages.
WC_Admin_Settings::get_settings_pages();
// Get current tab/section.
$current_tab = empty( $_GET['tab'] ) ? 'general' : sanitize_title( wp_unslash( $_GET['tab'] ) );
$current_section = empty( $_REQUEST['section'] ) ? '' : sanitize_title( wp_unslash( $_REQUEST['section'] ) );
// Save settings if data has been posted.
// @codingStandardsIgnoreStart
if ( ! empty( $_POST ) ) {
WC_Admin_Settings::save();
}
// @codingStandardsIgnoreEnd
// Add any posted messages.
if ( ! empty( $_GET['wc_error'] ) ) {
WC_Admin_Settings::add_error( sanitize_title( wp_unslash( $_GET['wc_error'] ) ) );
}
if ( ! empty( $_GET['wc_message'] ) ) {
WC_Admin_Settings::add_message( sanitize_title( wp_unslash( $_GET['wc_message'] ) ) );
}
}
}
/**
* Add menu item.
*/
public function status_menu() {
add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'Status', 'woocommerce' ) , 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) );
}
/**
* Addons menu item.
*/
public function addons_menu() {
$count_html = WC_Helper_Updater::get_updates_count_html();
$menu_title = sprintf( __( 'Extensions %s', 'woocommerce' ), $count_html );
add_submenu_page( 'woocommerce', __( 'WooCommerce extensions', 'woocommerce' ), $menu_title, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
}
/**
* Highlights the correct top level admin menu item for post type add screens.
*/
public function menu_highlight() {
global $parent_file, $submenu_file, $post_type;
switch ( $post_type ) {
case 'shop_order' :
case 'shop_coupon' :
$parent_file = 'woocommerce';
break;
case 'product' :
$screen = get_current_screen();
if ( $screen && taxonomy_is_product_attribute( $screen->taxonomy ) ) {
$submenu_file = 'product_attributes';
$parent_file = 'edit.php?post_type=product';
}
break;
/**
* Add menu item.
*/
public function status_menu() {
add_submenu_page( 'woocommerce', __( 'WooCommerce status', 'woocommerce' ), __( 'Status', 'woocommerce' ) , 'manage_woocommerce', 'wc-status', array( $this, 'status_page' ) );
}
}
/**
* Adds the order processing count to the menu.
*/
public function menu_order_count() {
global $submenu;
/**
* Addons menu item.
*/
public function addons_menu() {
$count_html = WC_Helper_Updater::get_updates_count_html();
$menu_title = sprintf( __( 'Extensions %s', 'woocommerce' ), $count_html );
add_submenu_page( 'woocommerce', __( 'WooCommerce extensions', 'woocommerce' ), $menu_title, 'manage_woocommerce', 'wc-addons', array( $this, 'addons_page' ) );
}
if ( isset( $submenu['woocommerce'] ) ) {
// Remove 'WooCommerce' sub menu item
unset( $submenu['woocommerce'][0] );
/**
* Highlights the correct top level admin menu item for post type add screens.
*/
public function menu_highlight() {
global $parent_file, $submenu_file, $post_type;
// @codingStandardsIgnoreStart
switch ( $post_type ) {
case 'shop_order' :
case 'shop_coupon' :
$parent_file = 'woocommerce';
break;
case 'product' :
$screen = get_current_screen();
if ( $screen && taxonomy_is_product_attribute( $screen->taxonomy ) ) {
$submenu_file = 'product_attributes';
$parent_file = 'edit.php?post_type=product';
}
break;
}
// @codingStandardsIgnoreEnd
}
// 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() ) ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) {
$submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
break;
/**
* Adds the order processing count to the menu.
*/
public function menu_order_count() {
global $submenu;
if ( isset( $submenu['woocommerce'] ) ) {
// Remove 'WooCommerce' sub menu item.
unset( $submenu['woocommerce'][0] );
// 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() ) ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) {
$submenu['woocommerce'][ $key ][0] .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
break;
}
}
}
}
}
}
/**
* Reorder the WC menu items in admin.
*
* @param mixed $menu_order
* @return array
*/
public function menu_order( $menu_order ) {
// Initialize our custom order array
$woocommerce_menu_order = array();
/**
* Reorder the WC menu items in admin.
*
* @param mixed $menu_order Menu Order.
* @return array
*/
public function menu_order( $menu_order ) {
// Initialize our custom order array.
$woocommerce_menu_order = array();
// Get the index of our custom separator
$woocommerce_separator = array_search( 'separator-woocommerce', $menu_order );
// Get the index of our custom separator.
$woocommerce_separator = array_search( 'separator-woocommerce', $menu_order );
// Get index of product menu
$woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order );
// Get index of product menu.
$woocommerce_product = array_search( 'edit.php?post_type=product', $menu_order );
// Loop through menu order and do some rearranging
foreach ( $menu_order as $index => $item ) {
// Loop through menu order and do some rearranging.
foreach ( $menu_order as $index => $item ) {
if ( ( ( 'woocommerce' ) == $item ) ) {
$woocommerce_menu_order[] = 'separator-woocommerce';
$woocommerce_menu_order[] = $item;
$woocommerce_menu_order[] = 'edit.php?post_type=product';
unset( $menu_order[ $woocommerce_separator ] );
unset( $menu_order[ $woocommerce_product ] );
} elseif ( ! in_array( $item, array( 'separator-woocommerce' ) ) ) {
$woocommerce_menu_order[] = $item;
if ( ( ( 'woocommerce' ) == $item ) ) {
$woocommerce_menu_order[] = 'separator-woocommerce';
$woocommerce_menu_order[] = $item;
$woocommerce_menu_order[] = 'edit.php?post_type=product';
unset( $menu_order[ $woocommerce_separator ] );
unset( $menu_order[ $woocommerce_product ] );
} elseif ( ! in_array( $item, array( 'separator-woocommerce' ) ) ) {
$woocommerce_menu_order[] = $item;
}
}
// Return order.
return $woocommerce_menu_order;
}
// Return order
return $woocommerce_menu_order;
}
/**
* Custom menu order.
*
* @return bool
*/
public function custom_menu_order() {
return current_user_can( 'manage_woocommerce' );
}
/**
* Init the reports page.
*/
public function reports_page() {
WC_Admin_Reports::output();
}
/**
* Init the settings page.
*/
public function settings_page() {
WC_Admin_Settings::output();
}
/**
* Init the attributes page.
*/
public function attributes_page() {
WC_Admin_Attributes::output();
}
/**
* Init the status page.
*/
public function status_page() {
WC_Admin_Status::output();
}
/**
* Init the addons page.
*/
public function addons_page() {
WC_Admin_Addons::output();
}
/**
* Add custom nav meta box.
*
* Adapted from http://www.johnmorrisonline.com/how-to-add-a-fully-functional-custom-meta-box-to-wordpress-navigation-menus/.
*/
public function add_nav_menu_meta_boxes() {
add_meta_box( 'woocommerce_endpoints_nav_link', __( 'WooCommerce endpoints', 'woocommerce' ), array( $this, 'nav_menu_links' ), 'nav-menus', 'side', 'low' );
}
/**
* Output menu links.
*/
public function nav_menu_links() {
// Get items from account menu.
$endpoints = wc_get_account_menu_items();
// Remove dashboard item.
if ( isset( $endpoints['dashboard'] ) ) {
unset( $endpoints['dashboard'] );
/**
* Custom menu order.
*
* @return bool
*/
public function custom_menu_order() {
return current_user_can( 'manage_woocommerce' );
}
// Include missing lost password.
$endpoints['lost-password'] = __( 'Lost password', 'woocommerce' );
/**
* Init the reports page.
*/
public function reports_page() {
WC_Admin_Reports::output();
}
$endpoints = apply_filters( 'woocommerce_custom_nav_menu_items', $endpoints );
/**
* Init the settings page.
*/
public function settings_page() {
WC_Admin_Settings::output();
}
?>
<div id="posttype-woocommerce-endpoints" class="posttypediv">
<div id="tabs-panel-woocommerce-endpoints" class="tabs-panel tabs-panel-active">
<ul id="woocommerce-endpoints-checklist" class="categorychecklist form-no-clear">
<?php
$i = -1;
foreach ( $endpoints as $key => $value ) :
?>
<li>
<label class="menu-item-title">
<input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-object-id]" value="<?php echo esc_attr( $i ); ?>" /> <?php echo esc_html( $value ); ?>
</label>
<input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-type]" value="custom" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-title]" value="<?php echo esc_html( $value ); ?>" />
<input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-url]" value="<?php echo esc_url( wc_get_account_endpoint_url( $key ) ); ?>" />
<input type="hidden" class="menu-item-classes" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-classes]" />
</li>
/**
* Init the attributes page.
*/
public function attributes_page() {
WC_Admin_Attributes::output();
}
/**
* Init the status page.
*/
public function status_page() {
WC_Admin_Status::output();
}
/**
* Init the addons page.
*/
public function addons_page() {
WC_Admin_Addons::output();
}
/**
* Add custom nav meta box.
*
* Adapted from http://www.johnmorrisonline.com/how-to-add-a-fully-functional-custom-meta-box-to-wordpress-navigation-menus/.
*/
public function add_nav_menu_meta_boxes() {
add_meta_box( 'woocommerce_endpoints_nav_link', __( 'WooCommerce endpoints', 'woocommerce' ), array( $this, 'nav_menu_links' ), 'nav-menus', 'side', 'low' );
}
/**
* Output menu links.
*/
public function nav_menu_links() {
// Get items from account menu.
$endpoints = wc_get_account_menu_items();
// Remove dashboard item.
if ( isset( $endpoints['dashboard'] ) ) {
unset( $endpoints['dashboard'] );
}
// Include missing lost password.
$endpoints['lost-password'] = __( 'Lost password', 'woocommerce' );
$endpoints = apply_filters( 'woocommerce_custom_nav_menu_items', $endpoints );
?>
<div id="posttype-woocommerce-endpoints" class="posttypediv">
<div id="tabs-panel-woocommerce-endpoints" class="tabs-panel tabs-panel-active">
<ul id="woocommerce-endpoints-checklist" class="categorychecklist form-no-clear">
<?php
$i--;
endforeach;
?>
</ul>
$i = -1;
foreach ( $endpoints as $key => $value ) :
?>
<li>
<label class="menu-item-title">
<input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-object-id]" value="<?php echo esc_attr( $i ); ?>" /> <?php echo esc_html( $value ); ?>
</label>
<input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-type]" value="custom" />
<input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-title]" value="<?php echo esc_html( $value ); ?>" />
<input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-url]" value="<?php echo esc_url( wc_get_account_endpoint_url( $key ) ); ?>" />
<input type="hidden" class="menu-item-classes" name="menu-item[<?php echo esc_attr( $i ); ?>][menu-item-classes]" />
</li>
<?php
$i--;
endforeach;
?>
</ul>
</div>
<p class="button-controls">
<span class="list-controls">
<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 class="add-to-menu">
<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>
</p>
</div>
<p class="button-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>
</span>
<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">
<span class="spinner"></span>
</span>
</p>
</div>
<?php
<?php
}
/**
* Add the "Visit Store" link in admin bar main menu.
*
* @since 2.4.0
* @param WP_Admin_Bar $wp_admin_bar Admin Bar.
*/
public function admin_bar_menus( $wp_admin_bar ) {
if ( ! is_admin() || ! is_user_logged_in() ) {
return;
}
// Show only when the user is a member of this site, or they're a super admin.
if ( ! is_user_member_of_blog() && ! is_super_admin() ) {
return;
}
// Don't display when shop page is the same of the page on front.
if ( get_option( 'page_on_front' ) == wc_get_page_id( 'shop' ) ) {
return;
}
// Add an option to visit the store.
$wp_admin_bar->add_node( array(
'parent' => 'site-name',
'id' => 'view-store',
'title' => __( 'Visit Store', 'woocommerce' ),
'href' => wc_get_page_permalink( 'shop' ),
) );
}
}
/**
* Add the "Visit Store" link in admin bar main menu.
*
* @since 2.4.0
* @param WP_Admin_Bar $wp_admin_bar
*/
public function admin_bar_menus( $wp_admin_bar ) {
if ( ! is_admin() || ! is_user_logged_in() ) {
return;
}
// Show only when the user is a member of this site, or they're a super admin.
if ( ! is_user_member_of_blog() && ! is_super_admin() ) {
return;
}
// Don't display when shop page is the same of the page on front.
if ( get_option( 'page_on_front' ) == wc_get_page_id( 'shop' ) ) {
return;
}
// Add an option to visit the store.
$wp_admin_bar->add_node( array(
'parent' => 'site-name',
'id' => 'view-store',
'title' => __( 'Visit Store', 'woocommerce' ),
'href' => wc_get_page_permalink( 'shop' ),
) );
}
}
endif;
return new WC_Admin_Menus();

View File

@ -9,6 +9,7 @@
* @package WooCommerce/Admin
* @version 2.6.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -18,16 +19,32 @@ if ( ! defined( 'ABSPATH' ) ) {
*/
class WC_Admin_Setup_Wizard {
/** @var string Current Step */
/**
* Current step
*
* @var string
*/
private $step = '';
/** @var array Steps for the setup wizard */
/**
* Steps for the setup wizard
*
* @var 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();
/** @var array Tweets user can optionally send after install */
/**
* Tweets user can optionally send after install
*
* @var array
*/
private $tweets = array(
'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!',
@ -73,7 +90,7 @@ class WC_Admin_Setup_Wizard {
}
$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(
array( 'US', 'CA', 'AU' ),
WC()->countries->get_european_union_countries()
@ -176,9 +193,11 @@ class WC_Admin_Setup_Wizard {
'pending_jetpack_install' => $pending_jetpack ? 'yes' : 'no',
) );
// @codingStandardsIgnoreStart
if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) {
call_user_func( $this->steps[ $this->step ]['handler'], $this );
}
// @codingStandardsIgnoreEnd
ob_start();
$this->setup_wizard_header();
@ -190,7 +209,8 @@ class WC_Admin_Setup_Wizard {
/**
* 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.
* Admin URL if it's the last step.
* Empty string on failure.
@ -230,7 +250,7 @@ class WC_Admin_Setup_Wizard {
<?php do_action( 'admin_head' ); ?>
</head>
<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
}
@ -259,13 +279,15 @@ class WC_Admin_Setup_Wizard {
?>
<ol class="wc-setup-steps">
<?php foreach ( $output_steps as $step_key => $step ) : ?>
<li class="<?php
<li class="
<?php
if ( $step_key === $this->step ) {
echo 'active';
} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
echo 'done';
}
?>"><?php echo esc_html( $step['name'] ); ?></li>
?>
"><?php echo esc_html( $step['name'] ); ?></li>
<?php endforeach; ?>
</ol>
<?php
@ -294,7 +316,7 @@ class WC_Admin_Setup_Wizard {
$country = WC()->countries->get_base_country();
$postcode = WC()->countries->get_base_postcode();
$currency = get_option( 'woocommerce_currency', 'GBP' );
$product_type = get_option( 'woocommerce_product_type' );
$product_type = get_option( 'woocommerce_product_type', 'both' );
if ( empty( $country ) ) {
$user_location = WC_Geolocation::geolocate_ip();
@ -310,7 +332,7 @@ class WC_Admin_Setup_Wizard {
?>
<form method="post" class="address-step">
<?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">
<?php esc_html_e( 'Where is your store based?', 'woocommerce' ); ?>
</label>
@ -390,7 +412,11 @@ class WC_Admin_Setup_Wizard {
<option value=""><?php esc_html_e( 'Choose a currency&hellip;', 'woocommerce' ); ?></option>
<?php foreach ( get_woocommerce_currencies() as $code => $name ) : ?>
<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>
<?php endforeach; ?>
</select>
@ -405,22 +431,20 @@ class WC_Admin_Setup_Wizard {
id="product_type"
name="product_type"
required
data-placeholder="<?php esc_attr_e( 'Please choose one&hellip;', 'woocommerce' ); ?>"
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="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>
<?php if ( 'unknown' === get_option( 'woocommerce_allow_tracking', 'unknown' ) ) : ?>
<div class="allow-tracking">
<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>
<?php endif; ?>
<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>
</form>
<?php
@ -431,7 +455,7 @@ class WC_Admin_Setup_Wizard {
*/
public function wc_setup_store_setup_save() {
check_admin_referer( 'wc-setup' );
// @codingStandardsIgnoreStart
$address = sanitize_text_field( $_POST['store_address'] );
$address_2 = sanitize_text_field( $_POST['store_address_2'] );
$city = sanitize_text_field( $_POST['store_city'] );
@ -440,7 +464,7 @@ class WC_Admin_Setup_Wizard {
$currency_code = sanitize_text_field( $_POST['currency_code'] );
$product_type = sanitize_text_field( $_POST['product_type'] );
$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_2', $address_2 );
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.
* @see https://core.trac.wordpress.org/ticket/41358
*
* @see https://core.trac.wordpress.org/ticket/41358 .
*/
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.
// @codingStandardsIgnoreStart
if ( session_id() ) {
session_write_close();
}
// @codingStandardsIgnoreEnd
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.
*
* @see WC_Admin_Setup_Wizard::install_plugin
* @see WC_Admin_Setup_Wizard::install_theme
*/
@ -543,7 +571,7 @@ class WC_Admin_Setup_Wizard {
array_push( $this->deferred_actions, array(
'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.
@ -562,7 +590,7 @@ class WC_Admin_Setup_Wizard {
}
array_push( $this->deferred_actions, array(
'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.
*
* @param string $country_code
* @param string $currency_code
* @param string $country_code Country Code.
* @param string $currency_code Currecy Code.
* @return bool|string Carrier name if supported, boolean False otherwise.
*/
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.
*
* @param string $country_code
* @param string $currency_code
* @param string $country_code Country code.
* @param string $currency_code Currency code.
* @return array
*/
protected function get_wizard_shipping_methods( $country_code, $currency_code ) {
@ -628,7 +656,7 @@ class WC_Admin_Setup_Wizard {
'settings' => array(
'cost' => array(
'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' ),
'required' => true,
),
@ -642,7 +670,7 @@ class WC_Admin_Setup_Wizard {
$live_rate_carrier = $this->get_wcs_shipping_carrier( $country_code, $currency_code );
if ( false === $live_rate_carrier || ! current_user_can('install_plugins') ) {
if ( false === $live_rate_carrier || ! current_user_can( 'install_plugins' ) ) {
unset( $shipping_methods['live_rates'] );
}
@ -652,9 +680,9 @@ class WC_Admin_Setup_Wizard {
/**
* Render the available shipping methods for a given country code.
*
* @param string $country_code
* @param string $currency_code
* @param string $input_prefix
* @param string $country_code Country code.
* @param string $currency_code Currency code.
* @param string $input_prefix 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 );
@ -673,7 +701,7 @@ class WC_Admin_Setup_Wizard {
</div>
<div class="shipping-method-descriptions">
<?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'] ); ?>
</p>
<?php endforeach; ?>
@ -682,8 +710,8 @@ class WC_Admin_Setup_Wizard {
<div class="shipping-method-settings">
<?php foreach ( $shipping_methods as $method_id => $method ) : ?>
<?php if ( empty( $method['settings'] ) ) continue; ?>
<div class="shipping-method-setting <?php echo esc_attr( $method_id ); ?> <?php if ( $method_id !== $selected ) echo 'hide'; ?>">
<?php if ( empty( $method['settings'] ) ) { continue; } ?>
<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 $method_setting_id = "{$input_prefix}[{$method_id}][{$setting_id}]"; ?>
<input
@ -727,15 +755,15 @@ class WC_Admin_Setup_Wizard {
if ( ! empty( $existing_zones ) ) {
$intro_text = __( 'How would you like units on your store displayed?', 'woocommerce' );
} elseif ( $wcs_carrier ) {
$intro_text = sprintf(
/* 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' ),
$prefixed_country_name,
$wcs_carrier
);
} else {
$intro_text = sprintf(
/* 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' ),
$prefixed_country_name
);
@ -827,7 +855,7 @@ class WC_Admin_Setup_Wizard {
</div>
<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' ); ?>
</p>
</form>
@ -840,18 +868,20 @@ class WC_Admin_Setup_Wizard {
public function wc_setup_shipping_save() {
check_admin_referer( 'wc-setup' );
// If going through this step again, remove the live rates options
// in case the user saved different settings this time
// If going through this step again, remove the live rates options.
// in case the user saved different settings this time.
delete_option( 'woocommerce_setup_domestic_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'] );
$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'] );
$intl_method = sanitize_text_field( $_POST['shipping_zones']['intl']['method'] );
$weight_unit = sanitize_text_field( $_POST['weight_unit'] );
$dimension_unit = sanitize_text_field( $_POST['dimension_unit'] );
$intl_method = sanitize_text_field( wp_unslash( $_POST['shipping_zones']['intl']['method'] ) );
$weight_unit = sanitize_text_field( wp_unslash( $_POST['weight_unit'] ) );
$dimension_unit = sanitize_text_field( wp_unslash( $_POST['dimension_unit'] ) );
$existing_zones = WC_Shipping_Zones::get_zones();
// @codingStandardsIgnoreEnd
update_option( 'woocommerce_ship_to_countries', '' );
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).
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['domestic'][ $domestic_method ] ) ) {
$method_controller = new WC_REST_Shipping_Zone_Methods_Controller();
// @codingStandardsIgnoreStart
$method_controller->update_item( array(
'zone_id' => $zone->get_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).
if ( isset( $instance_id ) && ! empty( $_POST['shipping_zones']['intl'][ $intl_method ] ) ) {
$method_controller = new WC_REST_Shipping_Zone_Methods_Controller();
// @codingStandardsIgnoreStart
$method_controller->update_item( array(
'zone_id' => $zone->get_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 ) {
$stripe_supported_countries = array(
@ -1078,6 +1113,7 @@ class WC_Admin_Setup_Wizard {
/**
* Simple array of "manual" gateways to show in wizard.
*
* @return array
*/
protected function get_wizard_manual_payment_gateways() {
@ -1107,6 +1143,9 @@ class WC_Admin_Setup_Wizard {
/**
* 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 ) {
$item_class = 'wc-wizard-service-item';
@ -1116,8 +1155,8 @@ class WC_Admin_Setup_Wizard {
$previously_saved_settings = get_option( 'woocommerce_' . $item_id . '_settings' );
// Show the user-saved state if it was previously saved
// Otherwise, rely on the item info
// Show the user-saved state if it was previously saved.
// Otherwise, rely on the item info.
if ( is_array( $previously_saved_settings ) ) {
$should_enable_toggle = 'yes' === $previously_saved_settings['enabled'];
} else {
@ -1194,10 +1233,22 @@ class WC_Admin_Setup_Wizard {
<?php
}
/**
* Is it a featured service?
*
* @param array $service Service info array.
* @return boolean
*/
public function is_featured_service( $service ) {
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 ) {
return ! $this->is_featured_service( $service );
}
@ -1213,8 +1264,10 @@ class WC_Admin_Setup_Wizard {
<h1><?php esc_html_e( 'Payment', 'woocommerce' ); ?></h1>
<form method="post" class="wc-wizard-payment-gateway-form">
<p>
<?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' ),
<?php printf(
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' ) )
); ?>
</p>
@ -1250,7 +1303,7 @@ class WC_Admin_Setup_Wizard {
endforeach; ?>
</ul>
<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' ); ?>
</p>
</form>
@ -1283,13 +1336,15 @@ class WC_Admin_Setup_Wizard {
$settings = array_filter( (array) get_option( $settings_key, array() ) );
$settings['enabled'] = ! empty( $_POST[ 'wc-wizard-service-' . $gateway_id . '-enabled' ] ) ? 'yes' : 'no';
// @codingStandardsIgnoreStart
if ( ! empty( $gateway['settings'] ) ) {
foreach ( $gateway['settings'] as $setting_id => $setting ) {
$settings[ $setting_id ] = 'yes' === $settings['enabled']
? wc_clean( $_POST[ $gateway_id . '_' . $setting_id ] )
? wc_clean( wp_unslash( $_POST[ $gateway_id . '_' . $setting_id ] ) )
: false;
}
}
// @codingStandardsIgnoreSEnd
update_option( $settings_key, $settings );
}
@ -1360,7 +1415,7 @@ class WC_Admin_Setup_Wizard {
</ul>
<?php endif; ?>
<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' ); ?>
</p>
</form>
@ -1488,7 +1543,7 @@ class WC_Admin_Setup_Wizard {
</p>
<form method="post" class="activate-jetpack">
<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>
<input type="hidden" name="save_step" value="activate" />
<?php wp_nonce_field( 'wc-setup' ); ?>
@ -1623,13 +1678,13 @@ class WC_Admin_Setup_Wizard {
required
>
<p class="wc-setup-actions step newsletter-form-button-container">
<input
<button
type="submit"
value="<?php esc_html_e( 'Yes please!', 'woocommerce' ); ?>"
name="subscribe"
id="mc-embedded-subscribe"
class="button-primary button newsletter-form-button"
>
><?php esc_html_e( 'Yes please!', 'woocommerce' ); ?></button>
</p>
</div>
</form>

View File

@ -1,4 +1,13 @@
<?php
/**
* Tax importer class file
*
* @version 2.3.0
* @category Admin
* @package WooCommerce/Admin
* @author WooCommerce
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -50,6 +59,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
*/
public function __construct() {
$this->import_page = 'woocommerce_tax_rate_csv';
// @codingStandardsIgnoreLine
$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.
*
* @param mixed $data
* @param string $enc
* @param mixed $data Data.
* @param string $enc Encoding.
* @return string
*/
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.
*
* @param mixed $file
* @param mixed $file File.
*/
public function import( $file ) {
if ( ! is_file( $file ) ) {
@ -129,11 +139,11 @@ class WC_Tax_Rate_Importer extends WP_Importer {
$loop = 0;
if ( ( $handle = fopen( $file, "r" ) ) !== false ) {
if ( ( $handle = fopen( $file, 'r' ) ) !== false ) {
$header = fgetcsv( $handle, 0, $this->delimiter );
if ( 10 === sizeof( $header ) ) {
if ( 10 === count( $header ) ) {
while ( ( $row = fgetcsv( $handle, 0, $this->delimiter ) ) !== false ) {
@ -162,12 +172,12 @@ class WC_Tax_Rate_Importer extends WP_Importer {
fclose( $handle );
}
// Show Result
// Show Result.
echo '<div class="updated settings-error"><p>';
/* translators: %s: tax rates count */
printf(
__( 'Import complete - imported %s tax rates.', 'woocommerce' ),
'<strong>' . $loop . '</strong>'
esc_html__( 'Import complete - imported %s tax rates.', 'woocommerce' ),
'<strong>' . absint( $loop ) . '</strong>'
);
echo '</p></div>';
@ -178,7 +188,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
* Performs post-import cleanup of files and the cache.
*/
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' );
}
@ -190,6 +200,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
* @return bool False if error uploading or invalid file, true otherwise
*/
public function handle_upload() {
// @codingStandardsIgnoreLine
if ( empty( $_POST['file_url'] ) ) {
$file = wp_import_handle_upload();
@ -199,8 +210,9 @@ class WC_Tax_Rate_Importer extends WP_Importer {
}
$this->id = absint( $file['id'] );
// @codingStandardsIgnoreLine
} elseif ( file_exists( ABSPATH . $_POST['file_url'] ) ) {
// @codingStandardsIgnoreLine
$this->file_url = esc_attr( $_POST['file_url'] );
} else {
$this->import_error();
@ -214,7 +226,7 @@ class WC_Tax_Rate_Importer extends WP_Importer {
*/
public function header() {
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() {
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';
@ -240,8 +252,8 @@ class WC_Tax_Rate_Importer extends WP_Importer {
$size = size_format( $bytes );
$upload_dir = wp_upload_dir();
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>
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
?><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 esc_html( $upload_dir['error'] ); ?></strong></p></div><?php
else :
?>
<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>
<tr>
<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>
<td>
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
<small><?php
<input type="hidden" name="max_file_size" value="<?php echo absint( $bytes ); ?>" />
<small>
<?php
/* translators: %s: maximum upload size */
printf(
__( 'Maximum size: %s', 'woocommerce' ),
$size
esc_html__( 'Maximum size: %s', 'woocommerce' ),
esc_attr( $size )
);
?></small>
?>
</small>
</td>
</tr>
<tr>
<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>
<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>
</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>
</tr>
</tbody>
</table>
<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>
</form>
<?php
@ -290,10 +304,11 @@ class WC_Tax_Rate_Importer extends WP_Importer {
/**
* Show import error and quit.
* @param string $message
*
* @param string $message Error messag.
*/
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 ) {
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.
*
* @param int $val
* @param int $val Value.
* @return int 60
*/
public function bump_request_timeout( $val ) {

View File

@ -1,7 +1,10 @@
<?php
/**
* Admin View: Importer - CSV mapping
*
* @package WooCommerce/Admin
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -15,8 +18,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<table class="widefat wc-importer-mapping-table">
<thead>
<tr>
<th><?php _e( 'Column name', 'woocommerce' ); ?></th>
<th><?php _e( 'Map to field', 'woocommerce' ); ?></th>
<th><?php esc_html_e( 'Column name', 'woocommerce' ); ?></th>
<th><?php esc_html_e( 'Map to field', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
@ -26,7 +29,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<td class="wc-importer-mapping-table-name">
<?php echo esc_html( $name ); ?>
<?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; ?>
</td>
<td class="wc-importer-mapping-table-field">
@ -53,7 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</table>
</section>
<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="delimiter" value="<?php echo esc_attr( $this->delimiter ); ?>" />
<input type="hidden" name="update_existing" value="<?php echo (int) $this->update_existing; ?>" />

View File

@ -1,7 +1,10 @@
<?php
/**
* Admin View: Product import form
*
* @package WooCommerce/Admin
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -17,7 +20,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr>
<th scope="row">
<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>
</th>
<td>
@ -32,20 +35,23 @@ if ( ! defined( 'ABSPATH' ) ) {
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo esc_attr( $bytes ); ?>" />
<br><small><?php
<br>
<small>
<?php
/* translators: %s: maximum upload size */
printf(
__( 'Maximum size: %s', 'woocommerce' ),
$size
esc_html__( 'Maximum size: %s', 'woocommerce' ),
absint( $size )
);
?></small>
?>
</small>
<?php
}
?>
</td>
</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>
<input type="hidden" name="update_existing" value="0" />
<input type="checkbox" id="woocommerce-importer-update-existing" name="update_existing" value="1" />
@ -54,7 +60,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr class="woocommerce-importer-advanced hidden">
<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>
<td>
<label for="woocommerce-importer-file-url" class="woocommerce-importer-file-url-field-wrapper">
@ -63,7 +69,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</td>
</tr>
<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>
</tr>
</tbody>
@ -86,7 +92,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</script>
<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>
<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' ); ?>
</div>
</form>

View File

@ -11,7 +11,7 @@
*/
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.
*
* @param WP_Post $post
* @param WP_Post $post Post object.
*/
public static function output( $post ) {
global $theorder;
@ -44,17 +44,17 @@ class WC_Meta_Box_Order_Actions {
<li class="wide" id="actions">
<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 ) { ?>
<option value="<?php echo $action; ?>"><?php echo $title; ?></option>
<option value="<?php echo esc_attr( $action ); ?>"><?php echo esc_html( $title ); ?></option>
<?php } ?>
</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 class="wide">
<div id="delete-action"><?php
<div id="delete-action">
<?php
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( ! EMPTY_TRASH_DAYS ) {
@ -62,11 +62,12 @@ class WC_Meta_Box_Order_Actions {
} else {
$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>
<?php do_action( 'woocommerce_order_actions_end', $post->ID ); ?>
@ -78,17 +79,17 @@ class WC_Meta_Box_Order_Actions {
/**
* Save meta box data.
*
* @param int $post_id
* @param WP_Post $post
* @param int $post_id Post ID.
* @param WP_Post $post Post Object.
*/
public static function save( $post_id, $post ) {
// Order data saved, now get it so we can manipulate status.
$order = wc_get_order( $post_id );
// Handle button actions
if ( ! empty( $_POST['wc_order_action'] ) ) {
// Handle button actions.
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 ) {
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.
*
* @param string $location
*
* @param string $location Location.
* @since 2.3.0
*
* @static
*
* @return string
*/
public static function set_email_sent_message( $location ) {

View File

@ -1,7 +1,12 @@
<?php
/**
* Coupon usage report functionality
*
* @package WooCommerce/Admin/Reports
*/
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() {
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'] ) ) {
$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',
);
$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' ) ) ) {
$current_range = '7day';
@ -171,56 +176,58 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
*/
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">
<form method="GET">
<div>
<?php
$used_coupons = $this->get_order_report_data( array(
'data' => array(
'order_item_name' => array(
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => '',
'distinct' => true,
'name' => 'order_item_name',
),
$used_coupons = $this->get_order_report_data( array(
'data' => array(
'order_item_name' => array(
'type' => 'order_item',
'order_item_type' => 'coupon',
'function' => '',
'distinct' => true,
'name' => 'order_item_name',
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '=',
),
),
'where' => array(
array(
'key' => 'order_item_type',
'value' => 'coupon',
'operator' => '=',
),
'query_type' => 'get_col',
'filter_range' => false,
) );
),
'query_type' => 'get_col',
'filter_range' => false,
) );
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%;">
<option value=""><?php _e( 'All coupons', 'woocommerce' ); ?></option>
<option value=""><?php esc_html_e( 'All coupons', 'woocommerce' ); ?></option>
<?php
foreach ( $used_coupons as $coupon ) {
echo '<option value="' . esc_attr( $coupon ) . '" ' . selected( in_array( $coupon, $this->coupon_codes ), true, false ) . '>' . $coupon . '</option>';
}
?>
foreach ( $used_coupons as $coupon ) {
echo '<option value="' . esc_attr( $coupon ) . '" ' . selected( in_array( $coupon, $this->coupon_codes ), true, false ) . '>' . esc_html( $coupon ) . '</option>';
}
?>
</select>
<input type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>" />
<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="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" />
<input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( $_GET['page'] ) : ''; ?>" />
<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'] ) : ''; ?>" />
<?php // @codingStandardsIgnoreStart ?>
<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( wp_unslash( $_GET['range'] ) ) : ''; ?>" />
<input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( wp_unslash( $_GET['start_date'] ) ) : ''; ?>" />
<input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( wp_unslash( $_GET['end_date'] ) ) : ''; ?>" />
<input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( wp_unslash( $_GET['page'] ) ) : ''; ?>" />
<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 : ?>
<span><?php _e( 'No used coupons found', 'woocommerce' ); ?></span>
<span><?php esc_html_e( 'No used coupons found', 'woocommerce' ); ?></span>
<?php endif; ?>
</div>
</form>
</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">
<table cellspacing="0">
<?php
@ -257,17 +264,17 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
if ( ! empty( $most_popular ) && is_array( $most_popular ) ) {
foreach ( $most_popular as $coupon ) {
echo '<tr class="' . ( in_array( $coupon->coupon_code, $this->coupon_codes ) ? 'active' : '' ) . '">
<td class="count" width="1%">' . $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="count" width="1%">' . esc_html( $coupon->coupon_count ) . '</td>
<td class="name"><a href="' . esc_url( add_query_arg( 'coupon_codes', $coupon->coupon_code ) ) . '">' . esc_html( $coupon->coupon_code ) . '</a></td>
</tr>';
}
} 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>
</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">
<table cellspacing="0">
<?php
@ -303,13 +310,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
if ( ! empty( $most_discount ) && is_array( $most_discount ) ) {
foreach ( $most_discount as $coupon ) {
// @codingStandardsIgnoreStart
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="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>';
// @codingStandardsIgnoreEnd
}
} 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>
@ -342,17 +351,17 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
* Output an export link.
*/
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
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"
data-export="chart"
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>
<?php
}
@ -363,7 +372,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
public function get_main_chart() {
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(
'data' => 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_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_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(
'order_coupon_counts' => array_values( $order_coupon_counts ),
'order_discount_amounts' => array_values( $order_discount_amounts ),
@ -452,15 +461,15 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
var main_chart;
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 series = [
{
label: "<?php echo esc_js( __( 'Number of coupons used', 'woocommerce' ) ) ?>",
data: order_data.order_coupon_counts,
color: '<?php echo $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' },
color: '<?php echo esc_js( $this->chart_colours['coupon_count'] ); ?>',
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,
hoverable: false
},
@ -468,11 +477,11 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
label: "<?php echo esc_js( __( 'Discount amount', 'woocommerce' ) ) ?>",
data: order_data.order_discount_amounts,
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 },
lines: { show: true, lineWidth: 4, fill: false },
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'; ?>",
monthNames: <?php echo json_encode( array_values( $wp_locale->month_abbrev ) ) ?>,
tickLength: 1,
minTickSize: [1, "<?php echo $this->chart_groupby; ?>"],
minTickSize: [1, "<?php echo esc_js( $this->chart_groupby ); ?>"],
font: {
color: "#aaa"
}

View File

@ -1,7 +1,12 @@
<?php
/**
* Sales by category report functionality
*
* @package WooCommerce/Admin/Reporting
*/
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).
*
* @param int $category_id
* @param int $category_id Category ID.
* @return array
*/
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' );
$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' ) ) ) {
$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->calculate_current_range( $current_range );
// Get item sales data
// Get item sales data.
if ( ! empty( $this->show_categories ) ) {
$order_items = $this->get_order_report_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' );
echo wc_walk_category_dropdown_tree( $categories, 0, $r );
echo wc_walk_category_dropdown_tree( $categories, 0, $r ); // @codingStandardsIgnoreLine
?>
</select>
<a href="#" class="select_none"><?php _e( 'None', 'woocommerce' ); ?></a>
<a href="#" class="select_all"><?php _e( 'All', 'woocommerce' ); ?></a>
<input type="submit" class="submit button" value="<?php esc_attr_e( 'Show', 'woocommerce' ); ?>" />
<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="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( $_GET['end_date'] ) : ''; ?>" />
<input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( $_GET['page'] ) : ''; ?>" />
<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'] ) : ''; ?>" />
<?php // @codingStandardsIgnoreStart ?>
<a href="#" class="select_none"><?php esc_html_e( 'None', 'woocommerce' ); ?></a>
<a href="#" class="select_all"><?php esc_html_e( 'All', 'woocommerce' ); ?></a>
<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( wp_unslash( $_GET['range'] ) ) : ''; ?>" />
<input type="hidden" name="start_date" value="<?php echo ( ! empty( $_GET['start_date'] ) ) ? esc_attr( wp_unslash( $_GET['start_date'] ) ) : ''; ?>" />
<input type="hidden" name="end_date" value="<?php echo ( ! empty( $_GET['end_date'] ) ) ? esc_attr( wp_unslash( $_GET['end_date'] ) ) : ''; ?>" />
<input type="hidden" name="page" value="<?php echo ( ! empty( $_GET['page'] ) ) ? esc_attr( wp_unslash( $_GET['page'] ) ) : ''; ?>" />
<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>
<script type="text/javascript">
jQuery(function(){
@ -255,17 +262,17 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
*/
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
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"
data-export="chart"
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>
<?php
}
@ -279,7 +286,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
if ( empty( $this->show_categories ) ) {
?>
<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>
<?php
} else {
@ -325,6 +332,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
<div class="chart-container">
<div class="chart-placeholder main"></div>
</div>
<?php // @codingStandardsIgnoreStart ?>
<script type="text/javascript">
var main_chart;
@ -432,6 +440,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
);
});
</script>
<?php // @codingStandardsIgnoreEnd ?>
<?php
}
}

View File

@ -1,7 +1,12 @@
<?php
/**
* Sales By Product Reporting
*
* @package WooCommerce/Admin/Reporting
*/
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.
*
* @return array
*/
public function get_chart_legend() {
@ -136,7 +142,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'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' ) ) ) {
$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><a class="button" href="' . esc_url( remove_query_arg( 'product_ids' ) ) . '">' . __( 'Reset', 'woocommerce' ) . '</a></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' ) ) . '">' . esc_html__( 'Reset', 'woocommerce' ) . '</a></p>';
}
/**
@ -199,12 +205,13 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
*/
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">
<form method="GET">
<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>
<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="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'] ) : ''; ?>" />
@ -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="report" value="<?php echo ( ! empty( $_GET['report'] ) ) ? esc_attr( $_GET['report'] ) : ''; ?>" />
<?php wp_nonce_field( 'custom_range', 'wc_reports_nonce', false ); ?>
<?php // @codingStandardsIgnoreEnd ?>
</div>
</form>
</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">
<table cellspacing="0">
<?php
@ -242,20 +250,22 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
) );
if ( $top_sellers ) {
// @codingStandardsIgnoreStart
foreach ( $top_sellers as $product ) {
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="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td>
</tr>';
}
// @codingStandardsIgnoreEnd
} 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>
</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">
<table cellspacing="0">
<?php
@ -290,20 +300,22 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
) );
if ( $top_freebies ) {
// @codingStandardsIgnoreStart
foreach ( $top_freebies as $product ) {
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="sparkline">' . $this->sales_sparkline( $product->product_id, 7, 'count' ) . '</td>
</tr>';
}
// @codingStandardsIgnoreEnd
} 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>
</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">
<table cellspacing="0">
<?php
@ -330,6 +342,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
) );
if ( $top_earners ) {
// @codingStandardsIgnoreStart
foreach ( $top_earners as $product ) {
echo '<tr class="' . ( in_array( $product->product_id, $this->product_ids ) ? 'active' : '' ) . '">
<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>
</tr>';
}
// @codingStandardsIgnoreEnd
} 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>
@ -370,17 +384,17 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
*/
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
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"
data-export="chart"
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>
<?php
}
@ -394,11 +408,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
if ( empty( $this->product_ids ) ) {
?>
<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>
<?php
} 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(
'data' => array(
'_qty' => array(
@ -469,11 +483,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'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_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(
'order_item_counts' => array_values( $order_item_counts ),
'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-placeholder main"></div>
</div>
<?php // @codingStandardsIgnoreStart ?>
<script type="text/javascript">
var main_chart;
@ -586,6 +601,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
});
</script>
<?php
// @codingStandardsIgnoreEnd
}
}
}

View File

@ -1,12 +1,18 @@
<?php
/**
* Shipping classes admin
*
* @package WooCommerce/Admin/Shipping
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<h2>
<?php _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 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' ) ); // @codingStandardsIgnoreLine ?>
</h2>
<table class="wc-shipping-classes widefat">
@ -19,8 +25,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</thead>
<tfoot>
<tr>
<td colspan="<?php echo absint( sizeof( $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 />
<td colspan="<?php echo absint( count( $shipping_class_columns ) ); ?>">
<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>
</td>
</tr>
@ -30,55 +36,55 @@ if ( ! defined( 'ABSPATH' ) ) {
<script type="text/html" id="tmpl-wc-shipping-class-row-blank">
<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>
</script>
<script type="text/html" id="tmpl-wc-shipping-class-row">
<tr data-id="{{ data.term_id }}">
<?php
foreach ( $shipping_class_columns as $class => $heading ) {
echo '<td class="' . esc_attr( $class ) . '">';
switch ( $class ) {
case 'wc-shipping-class-name' :
?>
<div class="view">
{{ data.name }}
<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>
</div>
foreach ( $shipping_class_columns as $class => $heading ) {
echo '<td class="' . esc_attr( $class ) . '">';
switch ( $class ) {
case 'wc-shipping-class-name' :
?>
<div class="view">
{{ data.name }}
<div class="row-actions">
<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 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' ); ?>" />
<div class="row-actions">
<a class="wc-shipping-class-cancel-edit" href="#"><?php _e( 'Cancel changes', 'woocommerce' ); ?></a>
</div>
</div>
<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' ); ?>" />
<div class="row-actions">
<a class="wc-shipping-class-cancel-edit" href="#"><?php esc_html_e( 'Cancel changes', 'woocommerce' ); ?></a>
</div>
<?php
break;
case 'wc-shipping-class-slug' :
?>
<div class="view">{{ data.slug }}</div>
<div class="edit"><input type="text" name="slug[{{ data.term_id }}]" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'Slug', 'woocommerce' ); ?>" /></div>
<?php
break;
case 'wc-shipping-class-description' :
?>
<div class="view">{{ data.description }}</div>
<div class="edit"><input type="text" name="description[{{ data.term_id }}]" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'Description for your reference', 'woocommerce' ); ?>" /></div>
<?php
break;
case 'wc-shipping-class-count' :
?>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=product&product_shipping_class=' ) ); ?>{{data.slug}}">{{ data.count }}</a>
<?php
break;
default :
do_action( 'woocommerce_shipping_classes_column_' . $class );
break;
}
echo '</td>';
</div>
<?php
break;
case 'wc-shipping-class-slug' :
?>
<div class="view">{{ data.slug }}</div>
<div class="edit"><input type="text" name="slug[{{ data.term_id }}]" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'Slug', 'woocommerce' ); ?>" /></div>
<?php
break;
case 'wc-shipping-class-description' :
?>
<div class="view">{{ data.description }}</div>
<div class="edit"><input type="text" name="description[{{ data.term_id }}]" data-attribute="description" value="{{ data.description }}" placeholder="<?php esc_attr_e( 'Description for your reference', 'woocommerce' ); ?>" /></div>
<?php
break;
case 'wc-shipping-class-count' :
?>
<a href="<?php echo esc_url( admin_url( 'edit.php?post_type=product&product_shipping_class=' ) ); ?>{{data.slug}}">{{ data.count }}</a>
<?php
break;
default :
do_action( 'woocommerce_shipping_classes_column_' . $class );
break;
}
echo '</td>';
}
?>
</tr>
</script>

View File

@ -1,11 +1,17 @@
<?php
/**
* Shipping zone admin
*
* @package WooCommerce/Admin/Shipping
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<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>
</h2>
@ -17,43 +23,43 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr valign="top" class="">
<th scope="row" class="titledesc">
<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>
<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>
</tr>
<tr valign="top" class="">
<th scope="row" class="titledesc">
<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>
<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
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>';
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>';
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
$countries = array_intersect( array_keys( $allowed_countries ), $continent['countries'] );
foreach ( $countries as $country_code ) {
echo '<option value="country:' . esc_attr( $country_code ) . '" ' . selected( in_array( "country:$country_code", $locations ), true, false ) . ' alt="' . esc_attr( $continent['name'] ) . '">' . esc_html( '&nbsp;&nbsp; ' . $allowed_countries[ $country_code ] ) . '</option>';
foreach ( $countries as $country_code ) {
echo '<option value="country:' . esc_attr( $country_code ) . '" ' . selected( in_array( "country:$country_code", $locations ), true, false ) . ' alt="' . esc_attr( $continent['name'] ) . '">' . esc_html( '&nbsp;&nbsp; ' . $allowed_countries[ $country_code ] ) . '</option>';
if ( $states = WC()->countries->get_states( $country_code ) ) {
foreach ( $states as $state_code => $state_name ) {
echo '<option value="state:' . esc_attr( $country_code . ':' . $state_code ) . '" ' . selected( in_array( "state:$country_code:$state_code", $locations ), true, false ) . ' alt="' . esc_attr( $continent['name'] . ' ' . $allowed_countries[ $country_code ] ) . '">' . esc_html( '&nbsp;&nbsp;&nbsp;&nbsp; ' . $state_name ) . '</option>';
}
if ( $states = WC()->countries->get_states( $country_code ) ) {
foreach ( $states as $state_code => $state_name ) {
echo '<option value="state:' . esc_attr( $country_code . ':' . $state_code ) . '" ' . selected( in_array( "state:$country_code:$state_code", $locations ), true, false ) . ' alt="' . esc_attr( $continent['name'] . ' ' . $allowed_countries[ $country_code ] ) . '">' . esc_html( '&nbsp;&nbsp;&nbsp;&nbsp; ' . $state_name ) . '</option>';
}
}
}
}
?>
</select>
<?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; ?>
<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>
<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>
</td>
<?php endif; ?>
@ -61,7 +67,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr valign="top" class="">
<th scope="row" class="titledesc">
<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>
<td class="">
<table class="wc-shipping-zone-methods widefat">
@ -76,7 +82,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<tfoot>
<tr>
<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>
</tr>
</tfoot>
@ -87,13 +93,13 @@ if ( ! defined( 'ABSPATH' ) ) {
</tbody>
</table>
<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>
<script type="text/html" id="tmpl-wc-shipping-zone-method-row-blank">
<tr>
<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>
</tr>
</script>
@ -104,7 +110,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<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>
<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>
</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>
<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>
</header>
<article class="wc-modal-shipping-method-settings">
@ -139,7 +145,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</article>
<footer>
<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>
</footer>
</section>
@ -153,9 +159,9 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="wc-backbone-modal-content">
<section class="wc-backbone-modal-main" role="main">
<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">
<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>
</header>
<article>
@ -165,12 +171,12 @@ if ( ! defined( 'ABSPATH' ) ) {
<select name="add_method_id">
<?php
foreach ( WC()->shipping->load_shipping_methods() as $method ) {
if ( ! $method->supports( 'shipping-zones' ) ) {
continue;
}
echo '<option data-description="' . esc_attr( wp_kses_post( wpautop( $method->get_method_description() ) ) ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->get_method_title() ) . '</li>';
foreach ( WC()->shipping->load_shipping_methods() as $method ) {
if ( ! $method->supports( 'shipping-zones' ) ) {
continue;
}
echo '<option data-description="' . esc_attr( wp_kses_post( wpautop( $method->get_method_description() ) ) ) . '" value="' . esc_attr( $method->id ) . '">' . esc_attr( $method->get_method_title() ) . '</li>';
}
?>
</select>
</div>
@ -178,7 +184,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</article>
<footer>
<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>
</footer>
</section>

View File

@ -1,4 +1,10 @@
<?php
/**
* Edit Webhooks
*
* @package WooCommerce/Admin/Webhooks
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -7,12 +13,12 @@ if ( ! defined( 'ABSPATH' ) ) {
<input type="hidden" name="webhook_id" value="<?php echo esc_attr( $webhook->id ); ?>" />
<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">
<tbody>
<tr valign="top">
<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
// @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' ) ) ) );
@ -25,16 +31,16 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top">
<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' ) ); ?>
</th>
<td class="forminp">
<select name="webhook_status" id="webhook_status" class="wc-enhanced-select">
<?php
$statuses = wc_get_webhook_statuses();
$current_status = $webhook->get_status();
$statuses = wc_get_webhook_statuses();
$current_status = $webhook->get_status();
foreach ( $statuses as $status_slug => $status_name ) : ?>
foreach ( $statuses as $status_slug => $status_name ) : ?>
<option value="<?php echo esc_attr( $status_slug ); ?>" <?php selected( $current_status, $status_slug, true ); ?>><?php echo esc_html( $status_name ); ?></option>
<?php endforeach; ?>
</select>
@ -42,8 +48,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="webhook_topic"><?php _e( 'Topic', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); ?>
<label for="webhook_topic"><?php esc_html_e( 'Topic', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Select when the webhook will fire.', 'woocommerce' ) ); // @codingStandardsIgnoreLine ?>
</th>
<td class="forminp">
<select name="webhook_topic" id="webhook_topic" class="wc-enhanced-select">
@ -79,8 +85,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top" id="webhook-action-event-wrap">
<th scope="row" class="titledesc">
<label for="webhook_action_event"><?php _e( 'Action event', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Enter the action that will trigger this webhook.', 'woocommerce' ) ); ?>
<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' ) ); // @codingStandardsIgnoreLine ?>
</th>
<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'] ); ?>" />
@ -88,8 +94,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top" id="webhook-custom-topic-wrap">
<th scope="row" class="titledesc">
<label for="webhook_custom_topic"><?php _e( 'Custom topic', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'Enter the custom topic that will trigger this webhook.', 'woocommerce' ) ); ?>
<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' ) ); // @codingStandardsIgnoreLine ?>
</th>
<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() ); ?>" />
@ -97,8 +103,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="webhook_delivery_url"><?php _e( 'Delivery URL', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'URL where the webhook payload is delivered.', 'woocommerce' ) ); ?>
<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' ) ); // @codingStandardsIgnoreLine ?>
</th>
<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() ); ?>" />
@ -106,8 +112,8 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="webhook_secret"><?php _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' ) ); ?>
<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' ) ); // @codingStandardsIgnoreLine ?>
</th>
<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() ); ?>" />
@ -115,14 +121,14 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="webhook_api_version"><?php _e( 'API Version', 'woocommerce' ); ?></label>
<?php echo wc_help_tip( __( 'REST API version used in the webhook deliveries.', 'woocommerce' ) ); ?>
<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' ) ); // @codingStandardsIgnoreLine ?>
</th>
<td class="forminp">
<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_v1" <?php selected( 'wp_api_v1', $webhook->get_api_version(), true ); ?>><?php _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="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 esc_html_e( 'WP REST API Integration v1', '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>
</td>
</tr>
@ -133,34 +139,34 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
<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">
<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_date_gmt ) : ?>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Created at', 'woocommerce' ); ?>
<?php esc_html_e( 'Created at', 'woocommerce' ); ?>
</th>
<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>
</tr>
<?php else : ?>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Created at', 'woocommerce' ); ?>
<?php esc_html_e( 'Created at', 'woocommerce' ); ?>
</th>
<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>
</tr>
<tr valign="top">
<th scope="row" class="titledesc">
<?php _e( 'Updated at', 'woocommerce' ); ?>
<?php esc_html_e( 'Updated at', 'woocommerce' ); ?>
</th>
<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>
</tr>
<?php endif; ?>
@ -168,9 +174,10 @@ if ( ! defined( 'ABSPATH' ) ) {
<tr valign="top">
<td colspan="2" scope="row" style="padding-left: 0;">
<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 ) ) : ?>
<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; ?>
</p>
</td>
@ -180,7 +187,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
<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 ); ?>
</div>

View File

@ -1,7 +1,10 @@
<?php
/**
* Admin View: Product Export
*
* @package WooCommerce/Admin/Export
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -33,9 +36,9 @@ $total_rows = $product_count->publish + $product_count->private + $variatio
<td>
<select id="woocommerce-exporter-columns" class="woocommerce-exporter-columns wc-enhanced-select" style="width:100%;" multiple data-placeholder="<?php esc_attr_e( 'Export all columns', 'woocommerce' ); ?>">
<?php
foreach ( $exporter->get_default_column_names() as $column_id => $column_name ) {
echo '<option value="' . esc_attr( $column_id ) . '">' . esc_html( $column_name ) . '</option>';
}
foreach ( $exporter->get_default_column_names() as $column_id => $column_name ) {
echo '<option value="' . esc_attr( $column_id ) . '">' . esc_html( $column_name ) . '</option>';
}
?>
<option value="downloads"><?php esc_html_e( 'Downloads', 'woocommerce' ); ?></option>
<option value="attributes"><?php esc_html_e( 'Attributes', 'woocommerce' ); ?></option>
@ -49,9 +52,9 @@ $total_rows = $product_count->publish + $product_count->private + $variatio
<td>
<select id="woocommerce-exporter-types" class="woocommerce-exporter-types wc-enhanced-select" style="width:100%;" multiple data-placeholder="<?php esc_attr_e( 'Export all products', 'woocommerce' ); ?>">
<?php
foreach ( wc_get_product_types() as $value => $label ) {
echo '<option value="' . esc_attr( $value ) . '">' . esc_html( $label ) . '</option>';
}
foreach ( wc_get_product_types() as $value => $label ) {
echo '<option value="' . esc_attr( $value ) . '">' . esc_html( $label ) . '</option>';
}
?>
<option value="variation"><?php esc_html_e( 'Product variations', 'woocommerce' ); ?></option>
</select>
@ -71,7 +74,7 @@ $total_rows = $product_count->publish + $product_count->private + $variatio
<progress class="woocommerce-exporter-progress" max="100" value="0"></progress>
</section>
<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>
</form>
</div>

View File

@ -1,6 +1,8 @@
<?php
/**
* Admin View: Page - Status Logs
*
* @package WooCommerce/Admin/Logs
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -19,13 +21,13 @@ if ( ! defined( 'ABSPATH' ) ) {
</h2>
</div>
<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">
<?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; ?>
</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>
</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>
</div>
<?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; ?>

View File

@ -41,7 +41,7 @@ if ( ! $tab_exists ) {
?>
<p class="submit">
<?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 wp_nonce_field( 'woocommerce-settings' ); ?>
</p>

View File

@ -1,10 +1,12 @@
<?php
/**
* Admin View: Report by Date (with date filters)
*
* @package WooCommerce/Admin/Reporting
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
?>
@ -13,14 +15,16 @@ if ( ! defined( 'ABSPATH' ) ) {
<div class="postbox">
<?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 */
printf(
esc_html__( 'From %1$s to %2$s', 'woocommerce' ),
esc_html( wc_clean( $_GET['start_date'] ) ),
esc_html( wc_clean( $_GET['end_date'] ) )
esc_html( wc_clean( wp_unslash( $_GET['start_date'] ) ) ),
esc_html( wc_clean( wp_unslash( $_GET['end_date'] ) ) )
);
?></h3>
?>
</h3>
<?php else : ?>
<h3 class="screen-reader-text"><?php echo esc_html( $ranges[ $current_range ] ); ?></h3>
<?php endif; ?>
@ -29,31 +33,31 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php $this->get_export_button(); ?>
<ul>
<?php
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>';
}
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 ) ) ) . '">' . esc_html( $name ) . '</a></li>';
}
?>
<li class="custom <?php echo ( 'custom' === $current_range ) ? 'active' : ''; ?>">
<?php _e( 'Custom:', 'woocommerce' ); ?>
<?php esc_html_e( 'Custom:', 'woocommerce' ); ?>
<form method="GET">
<div>
<?php
// Maintain query string
foreach ( $_GET as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $v ) {
echo '<input type="hidden" name="' . esc_attr( sanitize_text_field( $key ) ) . '[]" value="' . esc_attr( sanitize_text_field( $v ) ) . '" />';
}
} else {
echo '<input type="hidden" name="' . esc_attr( sanitize_text_field( $key ) ) . '" value="' . esc_attr( sanitize_text_field( $value ) ) . '" />';
// Maintain query string.
foreach ( $_GET as $key => $value ) {
if ( is_array( $value ) ) {
foreach ( $value as $v ) {
echo '<input type="hidden" name="' . esc_attr( sanitize_text_field( $key ) ) . '[]" value="' . esc_attr( sanitize_text_field( $v ) ) . '" />';
}
} else {
echo '<input type="hidden" name="' . esc_attr( sanitize_text_field( $key ) ) . '" value="' . esc_attr( sanitize_text_field( $value ) ) . '" />';
}
}
?>
<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>
<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="submit" class="button" value="<?php esc_attr_e( 'Go', 'woocommerce' ); ?>" />
<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 ?>
<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 ); ?>
</div>
</form>
@ -66,17 +70,18 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( $legends = $this->get_chart_legend() ) : ?>
<ul class="chart-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'] : ''; ?>">
<?php echo $legend['title']; ?>
</li>
<?php // @codingStandardsIgnoreEnd ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<ul class="chart-widgets">
<?php foreach ( $this->get_chart_widgets() as $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'] ); ?>
</li>
<?php endforeach; ?>

View File

@ -234,7 +234,8 @@ function wc_save_order_items( $order_id, $items ) {
if ( isset( $items['meta_key'][ $item_id ], $items['meta_value'][ $item_id ] ) ) {
foreach ( $items['meta_key'][ $item_id ] as $meta_id => $meta_key ) {
$meta_value = isset( $items['meta_value'][ $item_id ][ $meta_id ] ) ? wp_unslash( $items['meta_value'][ $item_id ][ $meta_id ] ) : '';
$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 ] ): '';
if ( '' === $meta_key && '' === $meta_value ) {
if ( ! strstr( $meta_id, 'new-' ) ) {

View File

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

View File

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

View File

@ -482,9 +482,9 @@ class WC_Emails {
return;
}
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 {
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' ),
'BTN' => __( 'Bhutanese ngultrum', 'woocommerce' ),
'BWP' => __( 'Botswana pula', 'woocommerce' ),
'BYR' => __( 'Belarusian ruble', 'woocommerce' ),
'BYR' => __( 'Belarusian ruble (old)', 'woocommerce' ),
'BYN' => __( 'Belarusian ruble', 'woocommerce' ),
'BZD' => __( 'Belize dollar', 'woocommerce' ),
'CAD' => __( 'Canadian dollar', 'woocommerce' ),
'CDF' => __( 'Congolese franc', 'woocommerce' ),
@ -498,6 +499,7 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
'BTN' => 'Nu.',
'BWP' => 'P',
'BYR' => 'Br',
'BYN' => 'Br',
'BZD' => '&#36;',
'CAD' => '&#36;',
'CDF' => 'Fr',

View File

@ -1758,7 +1758,7 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
$args = wp_parse_args( $args, $defaults );
extract( $args );
extract( $args ); // @codingStandardsIgnoreLine
// Main query only.
if ( ! is_main_query() && ! $force_display ) {
@ -2050,7 +2050,7 @@ if ( ! function_exists( 'woocommerce_form_field' ) ) {
$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' );
/**
* 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 ) ) {
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.

View File

@ -1,4 +1,9 @@
<?php
/**
* Layered nav widget
*
* @package WooCommerce/Widgets
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
@ -31,8 +36,8 @@ class WC_Widget_Layered_Nav extends WC_Widget {
*
* @see WP_Widget->update
*
* @param array $new_instance
* @param array $old_instance
* @param array $new_instance New Instance.
* @param array $old_instance Old Instance.
*
* @return array
*/
@ -46,7 +51,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
*
* @see WP_Widget->form
*
* @param array $instance
* @param array $instance Instance.
*/
public function form( $instance ) {
$this->init_settings();
@ -106,8 +111,8 @@ class WC_Widget_Layered_Nav extends WC_Widget {
*
* @see WP_Widget
*
* @param array $args
* @param array $instance
* @param array $args Arguments.
* @param array $instance Instance.
*/
public function widget( $args, $instance ) {
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 );
if ( 0 === sizeof( $terms ) ) {
if ( 0 === count( $terms ) ) {
return;
}
@ -171,7 +176,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$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 ) ) {
$found = true;
}
@ -179,12 +184,13 @@ class WC_Widget_Layered_Nav extends WC_Widget {
if ( ! $found ) {
ob_end_clean();
} else {
echo ob_get_clean();
echo ob_get_clean(); // @codingStandardsIgnoreLine
}
}
/**
* Return the currently viewed taxonomy name.
*
* @return string
*/
protected function get_current_taxonomy() {
@ -193,6 +199,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/**
* Return the currently viewed term ID.
*
* @return int
*/
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 int
*/
protected function get_current_term_slug() {
@ -209,9 +217,10 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/**
* Show dropdown layered nav.
* @param array $terms
* @param string $taxonomy
* @param string $query_type
*
* @param array $terms Terms.
* @param string $taxonomy Taxonomy.
* @param string $query_type Query Type.
* @return bool Will nav display?
*/
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 ) {
// 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() ) {
continue;
}
// Get count based on current view
// Get count based on current view.
$option_is_set = in_array( $term->slug, $current_values );
$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 ) {
$found = true;
} elseif ( 0 === $count && ! $option_is_set ) {
@ -261,7 +270,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
echo '</select>';
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 ) {
@ -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 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>';
wc_enqueue_js( "
@ -310,7 +319,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
/**
* Get current page URL for layered nav items.
*
* @param string $taxonomy
* @param string $taxonomy Taxonomy.
*
* @return string
*/
@ -328,18 +337,18 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$link = get_term_link( $queried_object->slug, $queried_object->taxonomy );
}
// Min/Max
// Min/Max.
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'] ) ) {
$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'] ) ) {
$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 );
}
// Post Type Arg
// Post Type Arg.
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'] ) ) {
$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() ) {
foreach ( $_chosen_attributes as $name => $data ) {
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.
*
* @param array $term_ids
* @param string $taxonomy
* @param string $query_type
* @param array $term_ids Term IDs.
* @param string $taxonomy Taxonomy.
* @param string $query_type Query Type.
* @return array
*/
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' );
$tax_query_sql = $tax_query->get_sql( $wpdb->posts, 'ID' );
// Generate query
// Generate query.
$query = array();
$query['select'] = "SELECT COUNT( DISTINCT {$wpdb->posts}.ID ) as term_count, terms.term_id as term_count_id";
$query['from'] = "FROM {$wpdb->posts}";
@ -420,16 +429,15 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$query['where'] = "
WHERE {$wpdb->posts}.post_type IN ( 'product' )
AND {$wpdb->posts}.post_status = 'publish'
" . $tax_query_sql['where'] . $meta_query_sql['where'] . "
AND terms.term_id IN (" . implode( ',', array_map( 'absint', $term_ids ) ) . ")
";
AND {$wpdb->posts}.post_status = 'publish'"
. $tax_query_sql['where'] . $meta_query_sql['where'] .
'AND terms.term_id IN (' . implode( ',', array_map( 'absint', $term_ids ) ) . ')';
if ( $search = WC_Query::get_main_search_query_sql() ) {
$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 = implode( ' ', $query );
@ -438,7 +446,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$cached_counts = (array) get_transient( 'wc_layered_nav_counts' );
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' ) );
$cached_counts[ $query_hash ] = $counts;
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.
*
* @param array $terms
* @param string $taxonomy
* @param string $query_type
* @param array $terms Terms.
* @param string $taxonomy Taxonomy.
* @param string $query_type Query Type.
* @return bool Will nav display?
*/
protected function layered_nav_list( $terms, $taxonomy, $query_type ) {
// List display
// List display.
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 );
@ -468,12 +476,12 @@ class WC_Widget_Layered_Nav extends WC_Widget {
$option_is_set = in_array( $term->slug, $current_values );
$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 ) {
continue;
}
// Only show options with count > 0
// Only show options with count > 0.
if ( 0 < $count ) {
$found = true;
} 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 ) );
$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 );
if ( ! in_array( $term->slug, $current_filter ) ) {
@ -492,7 +500,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
// Add current filters to URL.
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() ) {
unset( $current_filter[ $key ] );
}
@ -507,8 +515,8 @@ class WC_Widget_Layered_Nav extends WC_Widget {
asort( $current_filter );
$link = add_query_arg( $filter_name, implode( ',', $current_filter ), $link );
// Add Query type Arg to URL
if ( 'or' === $query_type && ! ( 1 === sizeof( $current_filter ) && $option_is_set ) ) {
// Add Query type Arg to URL.
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 = str_replace( '%2C', ',', $link );

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Auth
* @version 2.4.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -24,24 +24,24 @@ if ( ! defined( 'ABSPATH' ) ) {
<?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(); ?>
<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">
<p class="form-row form-row-wide">
<label for="username"><?php _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'] ) : ''; ?>" />
<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'] ) : ''; ?>" /><?php //@codingStandardsIgnoreLine ?>
</p>
<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" />
</p>
<p class="wc-auth-actions">
<?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 ); ?>" />
</p>
</form>

View File

@ -32,10 +32,10 @@ do_action( 'woocommerce_before_cart' ); ?>
<tr>
<th class="product-remove">&nbsp;</th>
<th class="product-thumbnail">&nbsp;</th>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php _e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php _e( 'Total', 'woocommerce' ); ?></th>
<th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php esc_html_e( 'Total', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
@ -53,6 +53,7 @@ do_action( 'woocommerce_before_cart' ); ?>
<td class="product-remove">
<?php
// @codingStandardsIgnoreLine
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>',
esc_url( WC()->cart->get_remove_url( $cart_item_key ) ),
@ -129,12 +130,12 @@ do_action( 'woocommerce_before_cart' ); ?>
<?php if ( wc_coupons_enabled() ) { ?>
<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' ); ?>
</div>
<?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' ); ?>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.2
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
if ( ! wc_coupons_enabled() ) {
@ -37,7 +37,7 @@ if ( empty( WC()->cart->applied_coupons ) ) {
</p>
<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>
<div class="clear"></div>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -26,23 +26,23 @@ if ( ! defined( 'ABSPATH' ) ) {
<table class="shop_table">
<thead>
<tr>
<th class="product-name"><?php _e( 'Product', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php _e( 'Qty', 'woocommerce' ); ?></th>
<th class="product-total"><?php _e( 'Totals', 'woocommerce' ); ?></th>
<th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php esc_html_e( 'Qty', 'woocommerce' ); ?></th>
<th class="product-total"><?php esc_html_e( 'Totals', 'woocommerce' ); ?></th>
</tr>
</thead>
<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
if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
continue;
}
if ( ! apply_filters( 'woocommerce_order_item_visible', true, $item ) ) {
continue;
}
?>
<tr class="<?php echo esc_attr( apply_filters( 'woocommerce_order_item_class', 'order_item', $item, $order ) ); ?>">
<td class="product-name">
<?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 );
@ -51,8 +51,8 @@ if ( ! defined( 'ABSPATH' ) ) {
do_action( 'woocommerce_order_item_meta_end', $item_id, $item, $order );
?>
</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-subtotal"><?php echo $order->get_formatted_line_subtotal( $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><?php // @codingStandardsIgnoreLine ?>
</tr>
<?php endforeach; ?>
<?php endif; ?>
@ -61,8 +61,8 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( $totals = $order->get_order_item_totals() ) : ?>
<?php foreach ( $totals as $total ) : ?>
<tr>
<th scope="row" colspan="2"><?php echo $total['label']; ?></th>
<td class="product-total"><?php echo $total['value']; ?></td>
<th scope="row" colspan="2"><?php echo $total['label']; ?></th><?php // @codingStandardsIgnoreLine ?>
<td class="product-total"><?php echo $total['value']; ?></td><?php // @codingStandardsIgnoreLine ?>
</tr>
<?php endforeach; ?>
<?php endif; ?>
@ -73,13 +73,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( $order->needs_payment() ) : ?>
<ul class="wc_payment_methods payment_methods methods">
<?php
if ( ! empty( $available_gateways ) ) {
foreach ( $available_gateways as $gateway ) {
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
}
} 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>';
if ( ! empty( $available_gateways ) ) {
foreach ( $available_gateways as $gateway ) {
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
}
} 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>'; // @codingStandardsIgnoreLine
}
?>
</ul>
<?php endif; ?>
@ -90,7 +90,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<?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' ); ?>

View File

@ -13,8 +13,9 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
@ -27,27 +28,27 @@ if ( ! is_ajax() ) {
<?php if ( WC()->cart->needs_payment() ) : ?>
<ul class="wc_payment_methods payment_methods methods">
<?php
if ( ! empty( $available_gateways ) ) {
foreach ( $available_gateways as $gateway ) {
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
}
} 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>';
if ( ! empty( $available_gateways ) ) {
foreach ( $available_gateways as $gateway ) {
wc_get_template( 'checkout/payment-method.php', array( 'gateway' => $gateway ) );
}
} else {
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>
<?php endif; ?>
<div class="form-row place-order">
<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' ); ?>
<br/><input type="submit" class="button alt" name="woocommerce_checkout_update_totals" value="<?php esc_attr_e( 'Update totals', '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/><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>
<?php wc_get_template( 'checkout/terms.php' ); ?>
<?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' ); ?>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
if ( is_user_logged_in() ) {
@ -29,14 +29,14 @@ if ( is_user_logged_in() ) {
<?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">
<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" />
</p>
<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" />
</p>
<div class="clear"></div>
@ -45,14 +45,14 @@ if ( is_user_logged_in() ) {
<p class="form-row">
<?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 ) ?>" />
<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>
</p>
<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>
<div class="clear"></div>

View File

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

View File

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

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -32,7 +32,7 @@ if ( $available_gateways = WC()->payment_gateways->get_available_payment_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 ); ?> />
<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
@ -50,7 +50,7 @@ if ( $available_gateways = WC()->payment_gateways->get_available_payment_gateway
<div class="form-row">
<?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" />
</div>
</div>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.6.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -27,33 +27,33 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<?php do_action( 'woocommerce_edit_account_form_start' ); ?>
<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 ); ?>" />
</p>
<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 ); ?>" />
</p>
<div class="clear"></div>
<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 ); ?>" />
</p>
<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">
<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" />
</p>
<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" />
</p>
<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" />
</p>
</fieldset>
@ -63,7 +63,7 @@ do_action( 'woocommerce_before_edit_account_form' ); ?>
<p>
<?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" />
</p>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.9
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -30,26 +30,26 @@ do_action( 'woocommerce_before_edit_account_address_form' ); ?>
<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">
<?php do_action( "woocommerce_before_edit_address_form_{$load_address}" ); ?>
<div class="woocommerce-address-fields__field-wrapper">
<?php
foreach ( $address as $key => $field ) {
if ( isset( $field['country_field'], $address[ $field['country_field'] ] ) ) {
$field['country'] = wc_get_post_data_by_key( $field['country_field'], $address[ $field['country_field'] ]['value'] );
}
woocommerce_form_field( $key, $field, wc_get_post_data_by_key( $key, $field['value'] ) );
foreach ( $address as $key => $field ) {
if ( isset( $field['country_field'], $address[ $field['country_field'] ] ) ) {
$field['country'] = wc_get_post_data_by_key( $field['country_field'], $address[ $field['country_field'] ]['value'] );
}
woocommerce_form_field( $key, $field, wc_get_post_data_by_key( $key, $field['value'] ) );
}
?>
</div>
<?php do_action( "woocommerce_after_edit_address_form_{$load_address}" ); ?>
<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' ); ?>
<input type="hidden" name="action" value="edit_address" />
</p>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.2.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
?>
@ -34,18 +34,18 @@ if ( ! defined( 'ABSPATH' ) ) {
<?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">
<?php do_action( 'woocommerce_login_form_start' ); ?>
<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>
<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'] ) : ''; ?>" />
<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( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p>
<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" />
</p>
@ -53,13 +53,13 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="form-row">
<?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">
<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>
</p>
<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>
<?php do_action( 'woocommerce_login_form_end' ); ?>
@ -72,7 +72,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<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">
@ -81,21 +81,21 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) : ?>
<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>
<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'] ) : ''; ?>" />
<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( wp_unslash( $_POST['username'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p>
<?php endif; ?>
<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>
<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'] ) : ''; ?>" />
<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( wp_unslash( $_POST['email'] ) ) : ''; ?>" /><?php // @codingStandardsIgnoreLine ?>
</p>
<?php if ( 'no' === get_option( 'woocommerce_registration_generate_password' ) ) : ?>
<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" />
</p>
@ -105,7 +105,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="woocommerce-FormRow form-row">
<?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>
<?php do_action( 'woocommerce_register_form_end' ); ?>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -24,10 +24,10 @@ wc_print_notices(); ?>
<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">
<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" />
</p>
@ -37,7 +37,7 @@ wc_print_notices(); ?>
<p class="woocommerce-form-row form-row">
<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>
<?php wp_nonce_field( 'lost_password' ); ?>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -24,14 +24,14 @@ wc_print_notices(); ?>
<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">
<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" />
</p>
<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" />
</p>
@ -44,7 +44,7 @@ wc_print_notices(); ?>
<p class="woocommerce-form-row form-row">
<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>
<?php wp_nonce_field( 'reset_password' ); ?>

View File

@ -13,11 +13,11 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.2.0
* @version 3.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
global $post;
@ -26,13 +26,13 @@ global $post;
<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-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-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 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>
<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' ); ?>
</form>

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.5.0
* @version 3.3.0
*/
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( '/' ) ); ?>">
<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="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" />
</form>

View File

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