Merge branch 'master' of github.com:woothemes/woocommerce
This commit is contained in:
commit
153664d1f1
|
@ -330,7 +330,9 @@ class WC_Checkout {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function process_checkout() {
|
public function process_checkout() {
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-process_checkout' );
|
if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-process_checkout' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) )
|
if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) )
|
||||||
define( 'WOOCOMMERCE_CHECKOUT', true );
|
define( 'WOOCOMMERCE_CHECKOUT', true );
|
||||||
|
|
|
@ -48,7 +48,9 @@ class WC_Form_Handler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-edit_address' );
|
if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-edit_address' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$user_id = get_current_user_id();
|
$user_id = get_current_user_id();
|
||||||
|
|
||||||
|
@ -143,12 +145,10 @@ class WC_Form_Handler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $_POST[ 'action' ] ) || ( 'save_account_details' !== $_POST[ 'action' ] ) || empty( $_POST['_wpnonce'] ) ) {
|
if ( empty( $_POST[ 'action' ] ) || ( 'save_account_details' !== $_POST[ 'action' ] ) || empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'save_account_details' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-save_account_details' );
|
|
||||||
|
|
||||||
$update = true;
|
$update = true;
|
||||||
$errors = new WP_Error();
|
$errors = new WP_Error();
|
||||||
$user = new stdClass();
|
$user = new stdClass();
|
||||||
|
@ -733,9 +733,7 @@ class WC_Form_Handler {
|
||||||
* Process the login form.
|
* Process the login form.
|
||||||
*/
|
*/
|
||||||
public static function process_login() {
|
public static function process_login() {
|
||||||
if ( ! empty( $_POST['login'] ) && ! empty( $_POST['_wpnonce'] ) ) {
|
if ( ! empty( $_POST['login'] ) && ! empty( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-login' ) ) {
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-login' );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$creds = array();
|
$creds = array();
|
||||||
|
@ -809,14 +807,13 @@ class WC_Form_Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// process lost password form
|
// process lost password form
|
||||||
if ( isset( $_POST['user_login'] ) && isset( $_POST['_wpnonce'] ) ) {
|
if ( isset( $_POST['user_login'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'lost_password' ) ) {
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-lost_password' );
|
|
||||||
|
|
||||||
WC_Shortcode_My_Account::retrieve_password();
|
WC_Shortcode_My_Account::retrieve_password();
|
||||||
}
|
}
|
||||||
|
|
||||||
// process reset password form
|
// process reset password form
|
||||||
if ( isset( $_POST['password_1'] ) && isset( $_POST['password_2'] ) && isset( $_POST['reset_key'] ) && isset( $_POST['reset_login'] ) && isset( $_POST['_wpnonce'] ) ) {
|
if ( isset( $_POST['password_1'] ) && isset( $_POST['password_2'] ) && isset( $_POST['reset_key'] ) && isset( $_POST['reset_login'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'reset_password' ) ) {
|
||||||
|
|
||||||
// verify reset key again
|
// verify reset key again
|
||||||
$user = WC_Shortcode_My_Account::check_password_reset_key( $_POST['reset_key'], $_POST['reset_login'] );
|
$user = WC_Shortcode_My_Account::check_password_reset_key( $_POST['reset_key'], $_POST['reset_login'] );
|
||||||
|
@ -827,8 +824,6 @@ class WC_Form_Handler {
|
||||||
$args['key'] = wc_clean( $_POST['reset_key'] );
|
$args['key'] = wc_clean( $_POST['reset_key'] );
|
||||||
$args['login'] = wc_clean( $_POST['reset_login'] );
|
$args['login'] = wc_clean( $_POST['reset_login'] );
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-reset_password' );
|
|
||||||
|
|
||||||
if ( empty( $_POST['password_1'] ) || empty( $_POST['password_2'] ) ) {
|
if ( empty( $_POST['password_1'] ) || empty( $_POST['password_2'] ) ) {
|
||||||
wc_add_notice( __( 'Please enter your password.', 'woocommerce' ), 'error' );
|
wc_add_notice( __( 'Please enter your password.', 'woocommerce' ), 'error' );
|
||||||
$args['form'] = 'reset_password';
|
$args['form'] = 'reset_password';
|
||||||
|
@ -865,9 +860,7 @@ class WC_Form_Handler {
|
||||||
* Process the registration form.
|
* Process the registration form.
|
||||||
*/
|
*/
|
||||||
public static function process_registration() {
|
public static function process_registration() {
|
||||||
if ( ! empty( $_POST['register'] ) ) {
|
if ( ! empty( $_POST['register'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-register' ) ) {
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['register'], 'woocommerce-register' );
|
|
||||||
|
|
||||||
if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) {
|
if ( 'no' === get_option( 'woocommerce_registration_generate_username' ) ) {
|
||||||
$_username = $_POST['username'];
|
$_username = $_POST['username'];
|
||||||
|
|
|
@ -276,6 +276,27 @@ class WC_Product_Variation extends WC_Product {
|
||||||
return $this->variation_data;
|
return $this->variation_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if all variation's attributes are set
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function has_all_attributes_set() {
|
||||||
|
|
||||||
|
$set = true;
|
||||||
|
|
||||||
|
// undefined attributes have null strings as array values
|
||||||
|
foreach( $this->get_variation_attributes() as $att ){
|
||||||
|
if( ! $att ){
|
||||||
|
$set = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $set;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get variation price HTML. Prices are not inherited from parents.
|
* Get variation price HTML. Prices are not inherited from parents.
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,18 +9,18 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
*
|
*
|
||||||
* Provides a Bank Transfer Payment Gateway. Based on code by Mike Pepper.
|
* Provides a Bank Transfer Payment Gateway. Based on code by Mike Pepper.
|
||||||
*
|
*
|
||||||
* @class WC_Gateway_BACS
|
* @class WC_Gateway_BACS
|
||||||
* @extends WC_Payment_Gateway
|
* @extends WC_Payment_Gateway
|
||||||
* @version 2.1.0
|
* @version 2.1.0
|
||||||
* @package WooCommerce/Classes/Payment
|
* @package WooCommerce/Classes/Payment
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
*/
|
*/
|
||||||
class WC_Gateway_BACS extends WC_Payment_Gateway {
|
class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the gateway.
|
* Constructor for the gateway.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->id = 'bacs';
|
$this->id = 'bacs';
|
||||||
$this->icon = apply_filters('woocommerce_bacs_icon', '');
|
$this->icon = apply_filters('woocommerce_bacs_icon', '');
|
||||||
$this->has_fields = false;
|
$this->has_fields = false;
|
||||||
|
@ -31,7 +31,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
$this->init_form_fields();
|
$this->init_form_fields();
|
||||||
$this->init_settings();
|
$this->init_settings();
|
||||||
|
|
||||||
// Define user set variables
|
// Define user set variables
|
||||||
$this->title = $this->get_option( 'title' );
|
$this->title = $this->get_option( 'title' );
|
||||||
$this->description = $this->get_option( 'description' );
|
$this->description = $this->get_option( 'description' );
|
||||||
$this->instructions = $this->get_option( 'instructions', $this->description );
|
$this->instructions = $this->get_option( 'instructions', $this->description );
|
||||||
|
@ -53,17 +53,17 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
// Actions
|
// Actions
|
||||||
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
|
||||||
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'save_account_details' ) );
|
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'save_account_details' ) );
|
||||||
add_action( 'woocommerce_thankyou_bacs', array( $this, 'thankyou_page' ) );
|
add_action( 'woocommerce_thankyou_bacs', array( $this, 'thankyou_page' ) );
|
||||||
|
|
||||||
// Customer Emails
|
// Customer Emails
|
||||||
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise Gateway Settings Form Fields
|
* Initialise Gateway Settings Form Fields
|
||||||
*/
|
*/
|
||||||
public function init_form_fields() {
|
public function init_form_fields() {
|
||||||
$this->form_fields = array(
|
$this->form_fields = array(
|
||||||
'enabled' => array(
|
'enabled' => array(
|
||||||
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
'title' => __( 'Enable/Disable', 'woocommerce' ),
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
|
@ -95,88 +95,88 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
'type' => 'account_details'
|
'type' => 'account_details'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate_account_details_html function.
|
* generate_account_details_html function.
|
||||||
*/
|
*/
|
||||||
public function generate_account_details_html() {
|
public function generate_account_details_html() {
|
||||||
ob_start();
|
ob_start();
|
||||||
?>
|
?>
|
||||||
<tr valign="top">
|
<tr valign="top">
|
||||||
<th scope="row" class="titledesc"><?php _e( 'Account Details', 'woocommerce' ); ?>:</th>
|
<th scope="row" class="titledesc"><?php _e( 'Account Details', 'woocommerce' ); ?>:</th>
|
||||||
<td class="forminp" id="bacs_accounts">
|
<td class="forminp" id="bacs_accounts">
|
||||||
<table class="widefat wc_input_table sortable" cellspacing="0">
|
<table class="widefat wc_input_table sortable" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="sort"> </th>
|
<th class="sort"> </th>
|
||||||
<th><?php _e( 'Account Name', 'woocommerce' ); ?></th>
|
<th><?php _e( 'Account Name', 'woocommerce' ); ?></th>
|
||||||
<th><?php _e( 'Account Number', 'woocommerce' ); ?></th>
|
<th><?php _e( 'Account Number', 'woocommerce' ); ?></th>
|
||||||
<th><?php _e( 'Bank Name', 'woocommerce' ); ?></th>
|
<th><?php _e( 'Bank Name', 'woocommerce' ); ?></th>
|
||||||
<th><?php _e( 'Sort Code', 'woocommerce' ); ?></th>
|
<th><?php _e( 'Sort Code', 'woocommerce' ); ?></th>
|
||||||
<th><?php _e( 'IBAN', 'woocommerce' ); ?></th>
|
<th><?php _e( 'IBAN', 'woocommerce' ); ?></th>
|
||||||
<th><?php _e( 'BIC / Swift', 'woocommerce' ); ?></th>
|
<th><?php _e( 'BIC / Swift', 'woocommerce' ); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="accounts">
|
<tbody class="accounts">
|
||||||
<?php
|
<?php
|
||||||
$i = -1;
|
$i = -1;
|
||||||
if ( $this->account_details ) {
|
if ( $this->account_details ) {
|
||||||
foreach ( $this->account_details as $account ) {
|
foreach ( $this->account_details as $account ) {
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
echo '<tr class="account">
|
echo '<tr class="account">
|
||||||
<td class="sort"></td>
|
<td class="sort"></td>
|
||||||
<td><input type="text" value="' . esc_attr( $account['account_name'] ) . '" name="bacs_account_name[' . $i . ']" /></td>
|
<td><input type="text" value="' . esc_attr( wp_unslash( $account['account_name'] ) ) . '" name="bacs_account_name[' . $i . ']" /></td>
|
||||||
<td><input type="text" value="' . esc_attr( $account['account_number'] ) . '" name="bacs_account_number[' . $i . ']" /></td>
|
<td><input type="text" value="' . esc_attr( $account['account_number'] ) . '" name="bacs_account_number[' . $i . ']" /></td>
|
||||||
<td><input type="text" value="' . esc_attr( $account['bank_name'] ) . '" name="bacs_bank_name[' . $i . ']" /></td>
|
<td><input type="text" value="' . esc_attr( wp_unslash( $account['bank_name'] ) ) . '" name="bacs_bank_name[' . $i . ']" /></td>
|
||||||
<td><input type="text" value="' . esc_attr( $account['sort_code'] ) . '" name="bacs_sort_code[' . $i . ']" /></td>
|
<td><input type="text" value="' . esc_attr( $account['sort_code'] ) . '" name="bacs_sort_code[' . $i . ']" /></td>
|
||||||
<td><input type="text" value="' . esc_attr( $account['iban'] ) . '" name="bacs_iban[' . $i . ']" /></td>
|
<td><input type="text" value="' . esc_attr( $account['iban'] ) . '" name="bacs_iban[' . $i . ']" /></td>
|
||||||
<td><input type="text" value="' . esc_attr( $account['bic'] ) . '" name="bacs_bic[' . $i . ']" /></td>
|
<td><input type="text" value="' . esc_attr( $account['bic'] ) . '" name="bacs_bic[' . $i . ']" /></td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="7"><a href="#" class="add button"><?php _e( '+ Add Account', 'woocommerce' ); ?></a> <a href="#" class="remove_rows button"><?php _e( 'Remove selected account(s)', 'woocommerce' ); ?></a></th>
|
<th colspan="7"><a href="#" class="add button"><?php _e( '+ Add Account', 'woocommerce' ); ?></a> <a href="#" class="remove_rows button"><?php _e( 'Remove selected account(s)', 'woocommerce' ); ?></a></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(function() {
|
jQuery(function() {
|
||||||
jQuery('#bacs_accounts').on( 'click', 'a.add', function(){
|
jQuery('#bacs_accounts').on( 'click', 'a.add', function(){
|
||||||
|
|
||||||
var size = jQuery('#bacs_accounts tbody .account').size();
|
var size = jQuery('#bacs_accounts tbody .account').size();
|
||||||
|
|
||||||
jQuery('<tr class="account">\
|
jQuery('<tr class="account">\
|
||||||
<td class="sort"></td>\
|
<td class="sort"></td>\
|
||||||
<td><input type="text" name="bacs_account_name[' + size + ']" /></td>\
|
<td><input type="text" name="bacs_account_name[' + size + ']" /></td>\
|
||||||
<td><input type="text" name="bacs_account_number[' + size + ']" /></td>\
|
<td><input type="text" name="bacs_account_number[' + size + ']" /></td>\
|
||||||
<td><input type="text" name="bacs_bank_name[' + size + ']" /></td>\
|
<td><input type="text" name="bacs_bank_name[' + size + ']" /></td>\
|
||||||
<td><input type="text" name="bacs_sort_code[' + size + ']" /></td>\
|
<td><input type="text" name="bacs_sort_code[' + size + ']" /></td>\
|
||||||
<td><input type="text" name="bacs_iban[' + size + ']" /></td>\
|
<td><input type="text" name="bacs_iban[' + size + ']" /></td>\
|
||||||
<td><input type="text" name="bacs_bic[' + size + ']" /></td>\
|
<td><input type="text" name="bacs_bic[' + size + ']" /></td>\
|
||||||
</tr>').appendTo('#bacs_accounts table tbody');
|
</tr>').appendTo('#bacs_accounts table tbody');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save account details table
|
* Save account details table
|
||||||
*/
|
*/
|
||||||
public function save_account_details() {
|
public function save_account_details() {
|
||||||
$accounts = array();
|
$accounts = array();
|
||||||
|
|
||||||
if ( isset( $_POST['bacs_account_name'] ) ) {
|
if ( isset( $_POST['bacs_account_name'] ) ) {
|
||||||
|
|
||||||
$account_names = array_map( 'wc_clean', $_POST['bacs_account_name'] );
|
$account_names = array_map( 'wc_clean', $_POST['bacs_account_name'] );
|
||||||
$account_numbers = array_map( 'wc_clean', $_POST['bacs_account_number'] );
|
$account_numbers = array_map( 'wc_clean', $_POST['bacs_account_number'] );
|
||||||
|
@ -190,108 +190,108 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$accounts[] = array(
|
$accounts[] = array(
|
||||||
'account_name' => $account_names[ $i ],
|
'account_name' => $account_names[ $i ],
|
||||||
'account_number' => $account_numbers[ $i ],
|
'account_number' => $account_numbers[ $i ],
|
||||||
'bank_name' => $bank_names[ $i ],
|
'bank_name' => $bank_names[ $i ],
|
||||||
'sort_code' => $sort_codes[ $i ],
|
'sort_code' => $sort_codes[ $i ],
|
||||||
'iban' => $ibans[ $i ],
|
'iban' => $ibans[ $i ],
|
||||||
'bic' => $bics[ $i ]
|
'bic' => $bics[ $i ]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update_option( 'woocommerce_bacs_accounts', $accounts );
|
update_option( 'woocommerce_bacs_accounts', $accounts );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output for the order received page.
|
* Output for the order received page.
|
||||||
*/
|
*/
|
||||||
public function thankyou_page( $order_id ) {
|
public function thankyou_page( $order_id ) {
|
||||||
if ( $this->instructions ) {
|
if ( $this->instructions ) {
|
||||||
echo wpautop( wptexturize( wp_kses_post( $this->instructions ) ) );
|
echo wpautop( wptexturize( wp_kses_post( $this->instructions ) ) );
|
||||||
}
|
}
|
||||||
$this->bank_details( $order_id );
|
$this->bank_details( $order_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add content to the WC emails.
|
* Add content to the WC emails.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param WC_Order $order
|
* @param WC_Order $order
|
||||||
* @param bool $sent_to_admin
|
* @param bool $sent_to_admin
|
||||||
* @param bool $plain_text
|
* @param bool $plain_text
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
public function email_instructions( $order, $sent_to_admin, $plain_text = false ) {
|
||||||
if ( ! $sent_to_admin && 'bacs' === $order->payment_method && $order->has_status( 'on-hold' ) ) {
|
if ( ! $sent_to_admin && 'bacs' === $order->payment_method && $order->has_status( 'on-hold' ) ) {
|
||||||
if ( $this->instructions ) {
|
if ( $this->instructions ) {
|
||||||
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
|
echo wpautop( wptexturize( $this->instructions ) ) . PHP_EOL;
|
||||||
}
|
}
|
||||||
$this->bank_details( $order->id );
|
$this->bank_details( $order->id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get bank details and place into a list format
|
* Get bank details and place into a list format
|
||||||
*/
|
*/
|
||||||
private function bank_details( $order_id = '' ) {
|
private function bank_details( $order_id = '' ) {
|
||||||
if ( empty( $this->account_details ) ) {
|
if ( empty( $this->account_details ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<h2>' . __( 'Our Bank Details', 'woocommerce' ) . '</h2>' . PHP_EOL;
|
echo '<h2>' . __( 'Our Bank Details', 'woocommerce' ) . '</h2>' . PHP_EOL;
|
||||||
|
|
||||||
$bacs_accounts = apply_filters( 'woocommerce_bacs_accounts', $this->account_details );
|
$bacs_accounts = apply_filters( 'woocommerce_bacs_accounts', $this->account_details );
|
||||||
|
|
||||||
if ( ! empty( $bacs_accounts ) ) {
|
if ( ! empty( $bacs_accounts ) ) {
|
||||||
foreach ( $bacs_accounts as $bacs_account ) {
|
foreach ( $bacs_accounts as $bacs_account ) {
|
||||||
$bacs_account = (object) $bacs_account;
|
$bacs_account = (object) $bacs_account;
|
||||||
|
|
||||||
if ( $bacs_account->account_name || $bacs_account->bank_name ) {
|
if ( $bacs_account->account_name || $bacs_account->bank_name ) {
|
||||||
echo '<h3>' . implode( ' - ', array_filter( array( $bacs_account->account_name, $bacs_account->bank_name ) ) ) . '</h3>' . PHP_EOL;
|
echo '<h3>' . wp_unslash( implode( ' - ', array_filter( array( $bacs_account->account_name, $bacs_account->bank_name ) ) ) ) . '</h3>' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<ul class="order_details bacs_details">' . PHP_EOL;
|
echo '<ul class="order_details bacs_details">' . PHP_EOL;
|
||||||
|
|
||||||
// BACS account fields shown on the thanks page and in emails
|
// BACS account fields shown on the thanks page and in emails
|
||||||
$account_fields = apply_filters( 'woocommerce_bacs_account_fields', array(
|
$account_fields = apply_filters( 'woocommerce_bacs_account_fields', array(
|
||||||
'account_number'=> array(
|
'account_number'=> array(
|
||||||
'label' => __( 'Account Number', 'woocommerce' ),
|
'label' => __( 'Account Number', 'woocommerce' ),
|
||||||
'value' => $bacs_account->account_number
|
'value' => $bacs_account->account_number
|
||||||
),
|
),
|
||||||
'sort_code' => array(
|
'sort_code' => array(
|
||||||
'label' => __( 'Sort Code', 'woocommerce' ),
|
'label' => __( 'Sort Code', 'woocommerce' ),
|
||||||
'value' => $bacs_account->sort_code
|
'value' => $bacs_account->sort_code
|
||||||
),
|
),
|
||||||
'iban' => array(
|
'iban' => array(
|
||||||
'label' => __( 'IBAN', 'woocommerce' ),
|
'label' => __( 'IBAN', 'woocommerce' ),
|
||||||
'value' => $bacs_account->iban
|
'value' => $bacs_account->iban
|
||||||
),
|
),
|
||||||
'bic' => array(
|
'bic' => array(
|
||||||
'label' => __( 'BIC', 'woocommerce' ),
|
'label' => __( 'BIC', 'woocommerce' ),
|
||||||
'value' => $bacs_account->bic
|
'value' => $bacs_account->bic
|
||||||
)
|
)
|
||||||
), $order_id );
|
), $order_id );
|
||||||
|
|
||||||
foreach ( $account_fields as $field_key => $field ) {
|
foreach ( $account_fields as $field_key => $field ) {
|
||||||
if ( ! empty( $field['value'] ) ) {
|
if ( ! empty( $field['value'] ) ) {
|
||||||
echo '<li class="' . esc_attr( $field_key ) . '">' . esc_attr( $field['label'] ) . ': <strong>' . wptexturize( $field['value'] ) . '</strong></li>' . PHP_EOL;
|
echo '<li class="' . esc_attr( $field_key ) . '">' . esc_attr( $field['label'] ) . ': <strong>' . wptexturize( $field['value'] ) . '</strong></li>' . PHP_EOL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process the payment and return the result
|
* Process the payment and return the result
|
||||||
*
|
*
|
||||||
* @param int $order_id
|
* @param int $order_id
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function process_payment( $order_id ) {
|
public function process_payment( $order_id ) {
|
||||||
|
|
||||||
$order = wc_get_order( $order_id );
|
$order = wc_get_order( $order_id );
|
||||||
|
|
||||||
|
@ -306,8 +306,8 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
||||||
|
|
||||||
// Return thankyou redirect
|
// Return thankyou redirect
|
||||||
return array(
|
return array(
|
||||||
'result' => 'success',
|
'result' => 'success',
|
||||||
'redirect' => $this->get_return_url( $order )
|
'redirect' => $this->get_return_url( $order )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,7 @@ class WC_Shortcode_Order_Tracking {
|
||||||
|
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
if ( ! empty( $_REQUEST['orderid'] ) ) {
|
if ( ! empty( $_REQUEST['orderid'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-order_tracking' ) ) {
|
||||||
|
|
||||||
wp_verify_nonce( $_POST['_wpnonce'], 'woocommerce-order_tracking' );
|
|
||||||
|
|
||||||
$order_id = empty( $_REQUEST['orderid'] ) ? 0 : esc_attr( $_REQUEST['orderid'] );
|
$order_id = empty( $_REQUEST['orderid'] ) ? 0 : esc_attr( $_REQUEST['orderid'] );
|
||||||
$order_email = empty( $_REQUEST['order_email'] ) ? '' : esc_attr( $_REQUEST['order_email']) ;
|
$order_email = empty( $_REQUEST['order_email'] ) ? '' : esc_attr( $_REQUEST['order_email']) ;
|
||||||
|
|
|
@ -589,3 +589,15 @@ function wc_format_phone_number( $tel ) {
|
||||||
$tel = str_replace( '.', '-', $tel );
|
$tel = str_replace( '.', '-', $tel );
|
||||||
return $tel;
|
return $tel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a string lowercase.
|
||||||
|
* Try to use mb_strtolower() when available.
|
||||||
|
*
|
||||||
|
* @since 2.3
|
||||||
|
* @param string $string
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function wc_strtolower( $string ) {
|
||||||
|
return function_exists( 'mb_strtolower' ) ? mb_strtolower( $string ) : strtolower( $string );
|
||||||
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ function wc_get_order_status_name( $status ) {
|
||||||
$status = 'wc-' === substr( $status, 0, 3 ) ? substr( $status, 3 ) : $status;
|
$status = 'wc-' === substr( $status, 0, 3 ) ? substr( $status, 3 ) : $status;
|
||||||
$status = isset( $statuses[ 'wc-' . $status ] ) ? $statuses[ 'wc-' . $status ] : $status;
|
$status = isset( $statuses[ 'wc-' . $status ] ) ? $statuses[ 'wc-' . $status ] : $status;
|
||||||
|
|
||||||
return function_exists( 'mb_strtolower' ) ? mb_strtolower( $status ) : strtolower( $status );
|
return wc_strtolower( $status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,6 +67,15 @@ if ( 0 == $woocommerce_loop['loop'] % $woocommerce_loop['columns'] )
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* woocommerce_after_shop_loop_item hook
|
||||||
|
*
|
||||||
|
* @hooked woocommerce_template_loop_add_to_cart - 10
|
||||||
|
*/
|
||||||
|
do_action( 'woocommerce_after_shop_loop_item' );
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @package WooCommerce/Templates
|
* @package WooCommerce/Templates
|
||||||
* @version 2.1.0
|
* @version 2.2.6
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -99,7 +99,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
<?php do_action( 'register_form' ); ?>
|
<?php do_action( 'register_form' ); ?>
|
||||||
|
|
||||||
<p class="form-row">
|
<p class="form-row">
|
||||||
<?php wp_nonce_field( 'woocommerce-register', 'register' ); ?>
|
<?php wp_nonce_field( 'woocommerce-register' ); ?>
|
||||||
<input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" />
|
<input type="submit" class="button" name="register" value="<?php _e( 'Register', 'woocommerce' ); ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,7 @@ final class WooCommerce {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Email Actions
|
// Email Actions
|
||||||
$email_actions = array(
|
$email_actions = apply_filters( 'woocommerce_email_actions', array(
|
||||||
'woocommerce_low_stock',
|
'woocommerce_low_stock',
|
||||||
'woocommerce_no_stock',
|
'woocommerce_no_stock',
|
||||||
'woocommerce_product_on_backorder',
|
'woocommerce_product_on_backorder',
|
||||||
|
@ -398,7 +398,7 @@ final class WooCommerce {
|
||||||
'woocommerce_order_status_completed',
|
'woocommerce_order_status_completed',
|
||||||
'woocommerce_new_customer_note',
|
'woocommerce_new_customer_note',
|
||||||
'woocommerce_created_customer'
|
'woocommerce_created_customer'
|
||||||
);
|
) );
|
||||||
|
|
||||||
foreach ( $email_actions as $action ) {
|
foreach ( $email_actions as $action ) {
|
||||||
add_action( $action, array( $this, 'send_transactional_email' ), 10, 10 );
|
add_action( $action, array( $this, 'send_transactional_email' ), 10, 10 );
|
||||||
|
|
Loading…
Reference in New Issue