Better filter. Closes #3249
This commit is contained in:
parent
48edab0837
commit
304f006566
|
@ -159,16 +159,17 @@ function woocommerce_create_page( $slug, $option, $page_title = '', $page_conten
|
|||
|
||||
if ( $option_value > 0 && get_post( $option_value ) )
|
||||
return;
|
||||
|
||||
|
||||
$page_found = null;
|
||||
if ( strlen($page_content) > 0 ) {
|
||||
|
||||
if ( strlen( $page_content ) > 0 ) {
|
||||
// Search for an existing page with the specified page content (typically a shortcode)
|
||||
$page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_type='page' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) );
|
||||
} else {
|
||||
// Search for an existing page with the specified page slug
|
||||
$page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_type='page' AND post_name = %s LIMIT 1;", $slug ) );
|
||||
}
|
||||
|
||||
|
||||
if ( $page_found ) {
|
||||
if ( ! $option_value )
|
||||
update_option( $option, $page_found );
|
||||
|
|
|
@ -31,24 +31,32 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
$this->init_form_fields();
|
||||
$this->init_settings();
|
||||
|
||||
// Define user set variables
|
||||
$this->title = $this->get_option( 'title' );
|
||||
$this->description = $this->get_option( 'description' );
|
||||
$this->account_name = $this->get_option( 'account_name' );
|
||||
$this->account_number = $this->get_option( 'account_number' );
|
||||
$this->sort_code = $this->get_option( 'sort_code' );
|
||||
$this->bank_name = $this->get_option( 'bank_name' );
|
||||
$this->iban = $this->get_option( 'iban' );
|
||||
$this->bic = $this->get_option( 'bic' );
|
||||
|
||||
// BACS account fields shown on the thanks page and in emails
|
||||
$this->account_fields = array(
|
||||
'account_name' => __( 'Account Name', 'woocommerce' ),
|
||||
'account_number'=> __( 'Account Number', 'woocommerce' ),
|
||||
'sort_code' => __( 'Sort Code', 'woocommerce' ),
|
||||
'bank_name' => __( 'Bank Name', 'woocommerce' ),
|
||||
'iban' => __( 'IBAN', 'woocommerce' ),
|
||||
'bic' => __( 'BIC', 'woocommerce' )
|
||||
'account_name' => array(
|
||||
'label' => __( 'Account Name', 'woocommerce' ),
|
||||
'value' => $this->get_option( 'account_name' )
|
||||
),
|
||||
'account_number'=> array(
|
||||
'label' => __( 'Account Number', 'woocommerce' ),
|
||||
'value' => $this->get_option( 'account_number' )
|
||||
),
|
||||
'sort_code' => array(
|
||||
'label' => __( 'Sort Code', 'woocommerce' ),
|
||||
'value' => $this->get_option( 'sort_code' )
|
||||
),
|
||||
'bank_name' => array(
|
||||
'label' => __( 'Bank Name', 'woocommerce' ),
|
||||
'value' => $this->get_option( 'bank_name' )
|
||||
),
|
||||
'iban' => array(
|
||||
'label' => __( 'IBAN', 'woocommerce' ),
|
||||
'value' => $this->get_option( 'iban' )
|
||||
),
|
||||
'bic' => array(
|
||||
'label' => __( 'BIC', 'woocommerce' ),
|
||||
'value' => $this->get_option( 'bic' )
|
||||
)
|
||||
);
|
||||
|
||||
// Actions
|
||||
|
@ -171,9 +179,9 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
|
||||
$fields = apply_filters( 'woocommerce_bacs_fields', $this->account_fields, $order_id );
|
||||
|
||||
foreach ( $fields as $key=>$value ) {
|
||||
if ( ! empty( $this->$key ) ) {
|
||||
echo '<li class="' . esc_attr( $key ) . '">' . esc_attr( $value ) . ': <strong>' . wptexturize( $this->$key ) . '</strong></li>';
|
||||
foreach ( $fields as $field_key => $field ) {
|
||||
if ( ! empty( $field['value'] ) ) {
|
||||
echo '<li class="' . esc_attr( $field_key ) . '">' . esc_attr( $field['label'] ) . ': <strong>' . wptexturize( $field['value'] ) . '</strong></li>';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,11 +212,11 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
|
|||
|
||||
$fields = apply_filters( 'woocommerce_bacs_fields', $this->account_fields, $order->id );
|
||||
|
||||
foreach ($fields as $key=>$value) :
|
||||
if(!empty($this->$key)) :
|
||||
echo '<li class="'.$key.'">'.$value.': <strong>'.wptexturize($this->$key).'</strong></li>';
|
||||
endif;
|
||||
endforeach;
|
||||
foreach ( $fields as $field_key => $field ) {
|
||||
if ( ! empty( $field['value'] ) ) {
|
||||
echo '<li class="' . esc_attr( $field_key ) . '">' . esc_attr( $field['label'] ) . ': <strong>' . wptexturize( $field['value'] ) . '</strong></li>';
|
||||
}
|
||||
}
|
||||
|
||||
?></ul><?php
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Refactor - Removed pay and thanks pages. Endpoints are used instead.
|
||||
* Localization - Portugese locale by jpBenfica
|
||||
* Localization - Swedish translation by Björn Sennbrink
|
||||
* Localization - Spanish, Romanian, Danish updates.
|
||||
* Localization - Spanish, Romanian, Danish, Korean updates.
|
||||
|
||||
= 2.0.10 - 15/05/2013 =
|
||||
* Tweak - Searching for SKU in admin panel can also be done via lowercase 'sku:' instead of just 'SKU:'
|
||||
|
|
Loading…
Reference in New Issue