Merge branch 'master' of github.com:woothemes/woocommerce

This commit is contained in:
Barry Kooij 2014-10-22 00:26:14 +02:00
commit b0923bb0b8
16 changed files with 72 additions and 9935 deletions

View File

@ -627,8 +627,11 @@ class WC_Product {
public function is_visible() { public function is_visible() {
$visible = true; $visible = true;
if ( ! $this->post ) {
$visible = false;
// Published/private // Published/private
if ( $this->post->post_status !== 'publish' && ! current_user_can( 'edit_post', $this->id ) ) { } elseif ( $this->post->post_status !== 'publish' && ! current_user_can( 'edit_post', $this->id ) ) {
$visible = false; $visible = false;
// Out of stock visibility // Out of stock visibility

View File

@ -44,14 +44,10 @@ class WC_Report_Low_In_Stock extends WC_Report_Stock {
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
WHERE 1=1 WHERE 1=1
AND posts.post_type IN ('product', 'product_variation') AND posts.post_type IN ( 'product', 'product_variation' )
AND posts.post_status = 'publish' AND posts.post_status = 'publish'
AND ( AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}' AND CAST(postmeta.meta_value AS SIGNED) > '{$nostock}' AND postmeta.meta_value != '' AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}'
)
AND (
( postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes' ) OR ( posts.post_type = 'product_variation' )
)
"; ";
$this->items = $wpdb->get_results( $wpdb->prepare( "SELECT posts.ID as id, posts.post_parent as parent {$query_from} GROUP BY posts.ID ORDER BY posts.post_title DESC LIMIT %d, %d;", ( $current_page - 1 ) * $per_page, $per_page ) ); $this->items = $wpdb->get_results( $wpdb->prepare( "SELECT posts.ID as id, posts.post_parent as parent {$query_from} GROUP BY posts.ID ORDER BY posts.post_title DESC LIMIT %d, %d;", ( $current_page - 1 ) * $per_page, $per_page ) );

View File

@ -36,14 +36,10 @@ class WC_Report_Most_Stocked extends WC_Report_Stock {
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
WHERE 1=1 WHERE 1=1
AND posts.post_type IN ('product', 'product_variation') AND posts.post_type IN ( 'product', 'product_variation' )
AND posts.post_status = 'publish' AND posts.post_status = 'publish'
AND ( AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$stock}' AND postmeta.meta_value != '' AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) > '{$stock}'
)
AND (
( postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes' ) OR ( posts.post_type = 'product_variation' )
)
"; ";
$this->items = $wpdb->get_results( $wpdb->prepare( "SELECT posts.ID as id, posts.post_parent as parent {$query_from} GROUP BY posts.ID ORDER BY CAST(postmeta.meta_value AS SIGNED) DESC LIMIT %d, %d;", ( $current_page - 1 ) * $per_page, $per_page ) ); $this->items = $wpdb->get_results( $wpdb->prepare( "SELECT posts.ID as id, posts.post_parent as parent {$query_from} GROUP BY posts.ID ORDER BY CAST(postmeta.meta_value AS SIGNED) DESC LIMIT %d, %d;", ( $current_page - 1 ) * $per_page, $per_page ) );

View File

@ -43,14 +43,10 @@ class WC_Report_Out_Of_Stock extends WC_Report_Stock {
INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id INNER JOIN {$wpdb->postmeta} AS postmeta ON posts.ID = postmeta.post_id
INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id INNER JOIN {$wpdb->postmeta} AS postmeta2 ON posts.ID = postmeta2.post_id
WHERE 1=1 WHERE 1=1
AND posts.post_type IN ('product', 'product_variation') AND posts.post_type IN ( 'product', 'product_variation' )
AND posts.post_status = 'publish' AND posts.post_status = 'publish'
AND ( AND postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes'
postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}' AND postmeta.meta_value != '' AND postmeta.meta_key = '_stock' AND CAST(postmeta.meta_value AS SIGNED) <= '{$stock}'
)
AND (
( postmeta2.meta_key = '_manage_stock' AND postmeta2.meta_value = 'yes' ) OR ( posts.post_type = 'product_variation' )
)
"; ";
$this->items = $wpdb->get_results( $wpdb->prepare( "SELECT posts.ID as id, posts.post_parent as parent {$query_from} GROUP BY posts.ID ORDER BY posts.post_title DESC LIMIT %d, %d;", ( $current_page - 1 ) * $per_page, $per_page ) ); $this->items = $wpdb->get_results( $wpdb->prepare( "SELECT posts.ID as id, posts.post_parent as parent {$query_from} GROUP BY posts.ID ORDER BY posts.post_title DESC LIMIT %d, %d;", ( $current_page - 1 ) * $per_page, $per_page ) );

View File

@ -30,10 +30,6 @@ class WC_Settings_General extends WC_Settings_Page {
add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); add_filter( 'woocommerce_settings_tabs_array', array( $this, 'add_settings_page' ), 20 );
add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) ); add_action( 'woocommerce_settings_' . $this->id, array( $this, 'output' ) );
add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) ); add_action( 'woocommerce_settings_save_' . $this->id, array( $this, 'save' ) );
if ( ( $styles = WC_Frontend_Scripts::get_styles() ) && array_key_exists( 'woocommerce-general', $styles ) ) {
add_action( 'woocommerce_admin_field_frontend_styles', array( $this, 'frontend_styles_setting' ) );
}
} }
/** /**
@ -213,57 +209,6 @@ class WC_Settings_General extends WC_Settings_Page {
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings ); return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
} }
/**
* Output the frontend styles settings.
*/
public function frontend_styles_setting() {
?><tr valign="top" class="woocommerce_frontend_css_colors">
<th scope="row" class="titledesc">
<?php _e( 'Frontend Styles', 'woocommerce' ); ?>
</th>
<td class="forminp"><?php
$base_file = WC()->plugin_path() . '/assets/css/_woocommerce-base.scss';
$css_file = WC()->plugin_path() . '/assets/css/woocommerce.css';
if ( is_writable( $base_file ) && is_writable( $css_file ) ) {
// Get settings
$colors = array_map( 'esc_attr', (array) get_option( 'woocommerce_frontend_css_colors' ) );
// Defaults
if ( empty( $colors['primary'] ) ) {
$colors['primary'] = '#ad74a2';
}
if ( empty( $colors['secondary'] ) ) {
$colors['secondary'] = '#f7f6f7';
}
if ( empty( $colors['highlight'] ) ) {
$colors['highlight'] = '#85ad74';
}
if ( empty( $colors['content_bg'] ) ) {
$colors['content_bg'] = '#ffffff';
}
if ( empty( $colors['subtext'] ) ) {
$colors['subtext'] = '#777777';
}
// Show inputs
$this->color_picker( __( 'Primary', 'woocommerce' ), 'woocommerce_frontend_css_primary', $colors['primary'], __( 'Call to action buttons/price slider/layered nav UI', 'woocommerce' ) );
$this->color_picker( __( 'Secondary', 'woocommerce' ), 'woocommerce_frontend_css_secondary', $colors['secondary'], __( 'Buttons and tabs', 'woocommerce' ) );
$this->color_picker( __( 'Highlight', 'woocommerce' ), 'woocommerce_frontend_css_highlight', $colors['highlight'], __( 'Price labels and Sale Flashes', 'woocommerce' ) );
$this->color_picker( __( 'Content', 'woocommerce' ), 'woocommerce_frontend_css_content_bg', $colors['content_bg'], __( 'Your themes page background - used for tab active states', 'woocommerce' ) );
$this->color_picker( __( 'Subtext', 'woocommerce' ), 'woocommerce_frontend_css_subtext', $colors['subtext'], __( 'Used for certain text and asides - breadcrumbs, small text etc.', 'woocommerce' ) );
} else {
echo '<span class="description">' . __( 'To edit colours <code>woocommerce/assets/css/_woocommerce-base.scss</code> and <code>woocommerce.css</code> need to be writable. See <a href="http://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.', 'woocommerce' ) . '</span>';
}
?></td>
</tr><?php
}
/** /**
* Output a colour picker input box. * Output a colour picker input box.
* *
@ -285,44 +230,6 @@ class WC_Settings_General extends WC_Settings_Page {
$settings = $this->get_settings(); $settings = $this->get_settings();
WC_Admin_Settings::save_fields( $settings ); WC_Admin_Settings::save_fields( $settings );
if ( isset( $_POST['woocommerce_frontend_css_primary'] ) ) {
// Save settings
$primary = ( ! empty( $_POST['woocommerce_frontend_css_primary'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_primary'] ) : '';
$secondary = ( ! empty( $_POST['woocommerce_frontend_css_secondary'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_secondary'] ) : '';
$highlight = ( ! empty( $_POST['woocommerce_frontend_css_highlight'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_highlight'] ) : '';
$content_bg = ( ! empty( $_POST['woocommerce_frontend_css_content_bg'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_content_bg'] ) : '';
$subtext = ( ! empty( $_POST['woocommerce_frontend_css_subtext'] ) ) ? wc_format_hex( $_POST['woocommerce_frontend_css_subtext'] ) : '';
$colors = array(
'primary' => $primary,
'secondary' => $secondary,
'highlight' => $highlight,
'content_bg' => $content_bg,
'subtext' => $subtext
);
// Check the colors.
$valid_colors = true;
foreach ( $colors as $color ) {
if ( ! preg_match( '/^#[a-f0-9]{6}$/i', $color ) ) {
$valid_colors = false;
WC_Admin_Settings::add_error( sprintf( __( 'Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'woocommerce' ), $color ) );
break;
}
}
if ( $valid_colors ) {
$old_colors = get_option( 'woocommerce_frontend_css_colors' );
update_option( 'woocommerce_frontend_css_colors', $colors );
if ( $old_colors != $colors ) {
woocommerce_compile_scss_styles();
}
}
}
} }
} }

View File

@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<thead> <thead>
<tr> <tr>
<th colspan="3"><?php _e( 'WordPress', 'woocommerce' ); ?></th> <th colspan="3"><?php _e( 'WordPress Environment', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
@ -100,7 +100,7 @@ if ( ! defined( 'ABSPATH' ) ) {
<thead> <thead>
<tr> <tr>
<th colspan="3"><?php _e( 'Server', 'woocommerce' ); ?></th> <th colspan="3"><?php _e( 'Server Environment', 'woocommerce' ); ?></th>
</tr> </tr>
</thead> </thead>
@ -200,28 +200,45 @@ If enabled on your server, Suhosin may need to be configured to increase its dat
$posting['soap_client']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'woocommerce' ) . '">[?]</a>'; $posting['soap_client']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'woocommerce' ) . '">[?]</a>';
// WP Remote Post Check // WP Remote Post Check
$posting['wp_remote_post']['name'] = __( 'Remote Post','woocommerce'); $posting['wp_remote_post']['name'] = __( 'Remote Post', 'woocommerce');
$request['cmd'] = '_notify-validate'; $posting['wp_remote_post']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__( 'PayPal uses this method of commnuicating when sending back transaction information.', 'woocommerce' ) . '">[?]</a>';
$params = array(
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array(
'sslverify' => false, 'sslverify' => false,
'timeout' => 60, 'timeout' => 60,
'user-agent' => 'WooCommerce/' . WC()->version, 'user-agent' => 'WooCommerce/' . WC()->version,
'body' => $request 'body' => array(
); 'cmd' => '_notify-validate'
$response = wp_remote_post( 'https://www.paypal.com/cgi-bin/webscr', $params ); )
) );
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce' ); $posting['wp_remote_post']['note'] = __( 'wp_remote_post() was successful - PayPal IPN is working.', 'woocommerce' );
$posting['wp_remote_post']['success'] = true; $posting['wp_remote_post']['success'] = true;
} elseif ( is_wp_error( $response ) ) {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider. Error:', 'woocommerce' ) . ' ' . $response->get_error_message();
$posting['wp_remote_post']['success'] = false;
} else { } else {
$posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN may not work with your server.', 'woocommerce' ); $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'woocommerce' ) . ' ' . $response->get_error_message();
if ( $response->get_error_message() ) {
$posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'woocommerce' ), $response->get_error_message() );
}
$posting['wp_remote_post']['success'] = false; $posting['wp_remote_post']['success'] = false;
} }
$posting['wp_remote_post']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__( 'PayPal uses this method of commnuicating when sending back transaction information.', 'woocommerce' ) . '">[?]</a>'; // WP Remote Get Check
$posting['wp_remote_get']['name'] = __( 'Remote Get', 'woocommerce');
$posting['wp_remote_get']['help'] = '<a href="#" class="help_tip" data-tip="' . esc_attr__( 'WooCommerce plugins may use this method of communication when checking for plugin updates.', 'woocommerce' ) . '">[?]</a>';
$response = wp_remote_get( 'http://www.woothemes.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) );
if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) {
$posting['wp_remote_get']['note'] = __( 'wp_remote_get() was successful - The WooCommerce plugin updater should work.', 'woocommerce' );
$posting['wp_remote_get']['success'] = true;
} else {
$posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'woocommerce' ) . ' ' . $response->get_error_message();
if ( $response->get_error_message() ) {
$posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'woocommerce' ), $response->get_error_message() );
}
$posting['wp_remote_get']['success'] = false;
}
$posting = apply_filters( 'woocommerce_debug_posting', $posting ); $posting = apply_filters( 'woocommerce_debug_posting', $posting );

View File

@ -144,88 +144,6 @@ function woocommerce_settings_get_option( $option_name, $default = '' ) {
return WC_Admin_Settings::get_option( $option_name, $default ); return WC_Admin_Settings::get_option( $option_name, $default );
} }
/**
* Generate CSS from the scss file when changing colours.
*
* @since 2.3
* @return void
*/
function woocommerce_compile_scss_styles() {
global $woocommerce;
$colors = array_map( 'esc_attr', (array) get_option( 'woocommerce_frontend_css_colors' ) );
$css_diretory = WC()->plugin_path() . '/assets/css/';
$base_file = $css_diretory . '_woocommerce-base.scss';
$scss_file = $css_diretory . 'woocommerce.scss';
$css_file = $css_diretory . 'woocommerce.css';
// Write scss file
if ( is_writable( $base_file ) && is_writable( $css_file ) ) {
// Colours changed - recompile scss
if ( ! class_exists( 'scssc' ) ) {
include_once( WC()->plugin_path() . '/includes/libraries/class-scssc.php' );
}
if ( ! class_exists( 'cssmin' ) ) {
include_once( WC()->plugin_path() . '/includes/libraries/class-cssmin.php' );
}
try {
// Set default if colours not set
if ( ! $colors['primary'] ) {
$colors['primary'] = '#ad74a2';
}
if ( ! $colors['secondary'] ) {
$colors['secondary'] = '#f7f6f7';
}
if ( ! $colors['highlight'] ) {
$colors['highlight'] = '#85ad74';
}
if ( ! $colors['content_bg'] ) {
$colors['content_bg'] = '#ffffff';
}
if ( ! $colors['subtext'] ) {
$colors['subtext'] = '#777777';
}
// Write new color to base file
$color_rules = '$primary: ' . $colors['primary'] . ';
$primarytext: ' . wc_light_or_dark( $colors['primary'], 'desaturate(darken($primary, 50%), 18%)', 'desaturate(lighten($primary, 50%), 18%)' ) . ';
$secondary: ' . $colors['secondary'] . ';
$secondarytext: ' . wc_light_or_dark( $colors['secondary'], 'desaturate(darken($secondary, 60%), 18%)', 'desaturate(lighten($secondary, 60%), 18%)' ) . ';
$highlight: ' . $colors['highlight'] . ';
$highlightext: ' . wc_light_or_dark( $colors['highlight'], 'desaturate(darken($highlight, 60%), 18%)', 'desaturate(lighten($highlight, 60%), 18%)' ) . ';
$contentbg: ' . $colors['content_bg'] . ';
$subtext: ' . $colors['subtext'] . ';
';
file_put_contents( $base_file, $color_rules );
$scss = new scssc;
$scss->setImportPaths( $css_diretory );
$compiled_css = $scss->compile( trim( file_get_contents( $scss_file ) ) );
$compiled_css = CssMin::minify( $compiled_css );
error_log( print_r( $compiled_css, true ) );
if ( $compiled_css ) {
file_put_contents( $css_file, $compiled_css );
}
} catch ( exception $ex ) {
wp_die( __( 'Could not compile woocommerce.scss:', 'woocommerce' ) . ' ' . $ex->getMessage() );
}
}
}
/** /**
* Save order items * Save order items
* *

View File

@ -748,30 +748,33 @@ class WC_Checkout {
return $value; return $value;
} }
if ( is_user_logged_in() && array_key_exists( $input, WC()->countries->get_address_fields() ) ) { // Get the billing_ and shipping_ address fields
$address_fields = array_merge( WC()->countries->get_address_fields(), WC()->countries->get_address_fields( '', 'shipping_' ) );
if ( is_user_logged_in() && array_key_exists( $input, $address_fields ) ) {
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
if ( $meta = get_user_meta( $current_user->ID, $input, true ) ) { if ( $meta = get_user_meta( $current_user->ID, $input, true ) ) {
return $meta; return $meta;
} }
if ( $input == "billing_email" ) { if ( $input == 'billing_email' ) {
return $current_user->user_email; return $current_user->user_email;
} }
} }
switch ( $input ) { switch ( $input ) {
case "billing_country" : case 'billing_country' :
return apply_filters( 'default_checkout_country', WC()->customer->get_country() ? WC()->customer->get_country() : WC()->countries->get_base_country(), 'billing' ); return apply_filters( 'default_checkout_country', WC()->customer->get_country() ? WC()->customer->get_country() : WC()->countries->get_base_country(), 'billing' );
case "billing_state" : case 'billing_state' :
return apply_filters( 'default_checkout_state', WC()->customer->has_calculated_shipping() ? WC()->customer->get_state() : '', 'billing' ); return apply_filters( 'default_checkout_state', WC()->customer->has_calculated_shipping() ? WC()->customer->get_state() : '', 'billing' );
case "billing_postcode" : case 'billing_postcode' :
return apply_filters( 'default_checkout_postcode', WC()->customer->get_postcode() ? WC()->customer->get_postcode() : '', 'billing' ); return apply_filters( 'default_checkout_postcode', WC()->customer->get_postcode() ? WC()->customer->get_postcode() : '', 'billing' );
case "shipping_country" : case 'shipping_country' :
return apply_filters( 'default_checkout_country', WC()->customer->get_shipping_country() ? WC()->customer->get_shipping_country() : WC()->countries->get_base_country(), 'shipping' ); return apply_filters( 'default_checkout_country', WC()->customer->get_shipping_country() ? WC()->customer->get_shipping_country() : WC()->countries->get_base_country(), 'shipping' );
case "shipping_state" : case 'shipping_state' :
return apply_filters( 'default_checkout_state', WC()->customer->has_calculated_shipping() ? WC()->customer->get_shipping_state() : '', 'shipping' ); return apply_filters( 'default_checkout_state', WC()->customer->has_calculated_shipping() ? WC()->customer->get_shipping_state() : '', 'shipping' );
case "shipping_postcode" : case 'shipping_postcode' :
return apply_filters( 'default_checkout_postcode', WC()->customer->get_shipping_postcode() ? WC()->customer->get_shipping_postcode() : '', 'shipping' ); return apply_filters( 'default_checkout_postcode', WC()->customer->get_shipping_postcode() ? WC()->customer->get_shipping_postcode() : '', 'shipping' );
default : default :
return apply_filters( 'default_checkout_' . $input, null, $input ); return apply_filters( 'default_checkout_' . $input, null, $input );

View File

@ -660,7 +660,7 @@ class WC_Coupon {
$err = sprintf( __( 'The minimum spend for this coupon is %s.', 'woocommerce' ), wc_price( $this->minimum_amount ) ); $err = sprintf( __( 'The minimum spend for this coupon is %s.', 'woocommerce' ), wc_price( $this->minimum_amount ) );
break; break;
case self::E_WC_COUPON_MAX_SPEND_LIMIT_MET: case self::E_WC_COUPON_MAX_SPEND_LIMIT_MET:
$err = sprintf( __( 'The maximum spend for this coupon is %s.', 'woocommerce' ), wc_price( $this->minimum_amount ) ); $err = sprintf( __( 'The maximum spend for this coupon is %s.', 'woocommerce' ), wc_price( $this->maximum_amount ) );
break; break;
case self::E_WC_COUPON_NOT_APPLICABLE: case self::E_WC_COUPON_NOT_APPLICABLE:
$err = __( 'Sorry, this coupon is not applicable to your cart contents.', 'woocommerce' ); $err = __( 'Sorry, this coupon is not applicable to your cart contents.', 'woocommerce' );

View File

@ -309,7 +309,7 @@ class WC_Emails {
*/ */
public function low_stock( $product ) { public function low_stock( $product ) {
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product low in stock', 'woocommerce' ) ); $subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product low in stock', 'woocommerce' ) );
$message = sprintf( __( '%s is low in stock.', 'woocommerce' ), html_entity_decode( $product->get_formatted_name() ) ); $message = sprintf( __( '%s is low in stock.', 'woocommerce' ), html_entity_decode( strip_tags( $product->get_formatted_name() ) ) );
wp_mail( wp_mail(
apply_filters( 'woocommerce_email_recipient_low_stock', get_option( 'woocommerce_stock_email_recipient' ), $product ), apply_filters( 'woocommerce_email_recipient_low_stock', get_option( 'woocommerce_stock_email_recipient' ), $product ),
@ -327,7 +327,7 @@ class WC_Emails {
*/ */
public function no_stock( $product ) { public function no_stock( $product ) {
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product out of stock', 'woocommerce' ) ); $subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product out of stock', 'woocommerce' ) );
$message = sprintf( __( '%s is out of stock.', 'woocommerce' ), html_entity_decode( $product->get_formatted_name() ) ); $message = sprintf( __( '%s is out of stock.', 'woocommerce' ), html_entity_decode( strip_tags( $product->get_formatted_name() ) ) );
wp_mail( wp_mail(
apply_filters( 'woocommerce_email_recipient_no_stock', get_option( 'woocommerce_stock_email_recipient' ), $product ), apply_filters( 'woocommerce_email_recipient_no_stock', get_option( 'woocommerce_stock_email_recipient' ), $product ),
@ -357,7 +357,7 @@ class WC_Emails {
} }
$subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product Backorder', 'woocommerce' ) ); $subject = sprintf( '[%s] %s', $this->get_blogname(), __( 'Product Backorder', 'woocommerce' ) );
$message = sprintf( __( '%s units of %s have been backordered in order %s.', 'woocommerce' ), $quantity, html_entity_decode( $product->get_formatted_name() ), $order->get_order_number() ); $message = sprintf( __( '%s units of %s have been backordered in order %s.', 'woocommerce' ), $quantity, html_entity_decode( strip_tags( $product->get_formatted_name() ) ), $order->get_order_number() );
wp_mail( wp_mail(
apply_filters( 'woocommerce_email_recipient_backorder', get_option( 'woocommerce_stock_email_recipient' ), $args ), apply_filters( 'woocommerce_email_recipient_backorder', get_option( 'woocommerce_stock_email_recipient' ), $args ),

View File

@ -41,7 +41,6 @@ class WC_Install {
/** /**
* check_version function. * check_version function.
* *
* @access public
* @return void * @return void
*/ */
public function check_version() { public function check_version() {
@ -116,7 +115,6 @@ class WC_Install {
$this->create_terms(); $this->create_terms();
$this->create_cron_jobs(); $this->create_cron_jobs();
$this->create_files(); $this->create_files();
$this->create_css_from_scss();
// Queue upgrades // Queue upgrades
$current_version = get_option( 'woocommerce_version', null ); $current_version = get_option( 'woocommerce_version', null );
@ -222,7 +220,6 @@ class WC_Install {
/** /**
* Create pages that the plugin relies on, storing page id's in variables. * Create pages that the plugin relies on, storing page id's in variables.
* *
* @access public
* @return void * @return void
*/ */
public static function create_pages() { public static function create_pages() {
@ -257,7 +254,6 @@ class WC_Install {
/** /**
* Add the default terms for WC taxonomies - product types and order statuses. Modify this at your own risk. * Add the default terms for WC taxonomies - product types and order statuses. Modify this at your own risk.
* *
* @access public
* @return void * @return void
*/ */
private function create_terms() { private function create_terms() {
@ -285,9 +281,9 @@ class WC_Install {
* *
* Sets up the default options used on the settings page * Sets up the default options used on the settings page
* *
* @access public * @return void
*/ */
function create_options() { public function create_options() {
// Include settings so that we can run through defaults // Include settings so that we can run through defaults
include_once( 'admin/class-wc-admin-settings.php' ); include_once( 'admin/class-wc-admin-settings.php' );
@ -330,7 +326,6 @@ class WC_Install {
* woocommerce_tax_rates - Tax Rates are stored inside 2 tables making tax queries simple and efficient. * woocommerce_tax_rates - Tax Rates are stored inside 2 tables making tax queries simple and efficient.
* woocommerce_tax_rate_locations - Each rate can be applied to more than one postcode/city hence the second table. * woocommerce_tax_rate_locations - Each rate can be applied to more than one postcode/city hence the second table.
* *
* @access public
* @return void * @return void
*/ */
private function create_tables() { private function create_tables() {
@ -525,7 +520,6 @@ class WC_Install {
/** /**
* Get capabilities for WooCommerce - these are assigned to admin/shop manager during installation or reset * Get capabilities for WooCommerce - these are assigned to admin/shop manager during installation or reset
* *
* @access public
* @return array * @return array
*/ */
public function get_core_capabilities() { public function get_core_capabilities() {
@ -570,7 +564,6 @@ class WC_Install {
/** /**
* woocommerce_remove_roles function. * woocommerce_remove_roles function.
* *
* @access public
* @return void * @return void
*/ */
public function remove_roles() { public function remove_roles() {
@ -638,27 +631,12 @@ class WC_Install {
} }
} }
/**
* Create CSS from SCSS file
*/
private function create_css_from_scss() {
// Recompile SCSS styles if they are custom
$colors = get_option( 'woocommerce_frontend_css_colors' );
if ( ( ! empty( $colors['primary'] ) && ! empty( $colors['secondary'] ) && ! empty( $colors['highlight'] ) && ! empty( $colors['content_bg'] ) && ! empty( $colors['subtext'] ) ) && ( $colors['primary'] != '#ad74a2' || $colors['secondary'] != '#f7f6f7' || $colors['highlight'] != '#85ad74' || $colors['content_bg'] != '#ffffff' || $colors['subtext'] != '#777777' ) ) {
if ( ! function_exists( 'woocommerce_compile_scss_styles' ) ) {
include_once( 'admin/wc-admin-functions.php' );
}
woocommerce_compile_scss_styles();
}
}
/** /**
* Show plugin changes. Code adapted from W3 Total Cache. * Show plugin changes. Code adapted from W3 Total Cache.
* *
* @return void * @return void
*/ */
function in_plugin_update_message( $args ) { public function in_plugin_update_message( $args ) {
$transient_name = 'wc_upgrade_notice_' . $args['Version']; $transient_name = 'wc_upgrade_notice_' . $args['Version'];
if ( false === ( $upgrade_notice = get_transient( $transient_name ) ) ) { if ( false === ( $upgrade_notice = get_transient( $transient_name ) ) ) {
@ -698,7 +676,6 @@ class WC_Install {
/** /**
* Show action links on the plugin screen. * Show action links on the plugin screen.
* *
* @access public
* @param mixed $links Plugin Action links * @param mixed $links Plugin Action links
* @return array * @return array
*/ */
@ -713,7 +690,6 @@ class WC_Install {
/** /**
* Show row meta on the plugin screen. * Show row meta on the plugin screen.
* *
* @access public
* @param mixed $links Plugin Row Meta * @param mixed $links Plugin Row Meta
* @param mixed $file Plugin Base file * @param mixed $file Plugin Base file
* @return array * @return array

View File

@ -157,9 +157,6 @@ class WC_Email extends WC_Settings_API {
// For multipart messages // For multipart messages
add_filter( 'phpmailer_init', array( $this, 'handle_multipart' ) ); add_filter( 'phpmailer_init', array( $this, 'handle_multipart' ) );
// Inline CSS styles for html emails
add_filter( 'woocommerce_mail_content', array( $this, 'style_inline' ), 10 );
} }
/** /**
@ -317,7 +314,6 @@ class WC_Email extends WC_Settings_API {
* @return string * @return string
*/ */
public function style_inline( $content ) { public function style_inline( $content ) {
// make sure we only inline CSS for html emails // make sure we only inline CSS for html emails
if ( 'text/html' == $this->get_content_type() ) { if ( 'text/html' == $this->get_content_type() ) {
@ -382,14 +378,8 @@ class WC_Email extends WC_Settings_API {
add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
/** $message = apply_filters( 'woocommerce_mail_content', $this->style_inline( $message ) );
* Filter all WooCommerce mail content $return = wp_mail( $to, $subject, $message, $headers, $attachments );
*
* @hooked inline_styles - 10
*/
$message = apply_filters( 'woocommerce_mail_content', $message );
$return = wp_mail( $to, $subject, $message, $headers, $attachments );
remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );

View File

@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
* *
* @class WC_Paypal * @class WC_Paypal
* @extends WC_Gateway_Paypal * @extends WC_Gateway_Paypal
* @version 2.0.0 * @version 2.3.0
* @package WooCommerce/Classes/Payment * @package WooCommerce/Classes/Payment
* @author WooThemes * @author WooThemes
*/ */
@ -150,10 +150,10 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
if ( is_array( $icon ) ) { if ( is_array( $icon ) ) {
$icon_html = ''; $icon_html = '';
foreach ( $icon as $i ) { foreach ( $icon as $i ) {
$icon_html .= '<img src="' . esc_attr( $i ) . '" alt="PayPal Acceptance Mark" />'; $icon_html .= '<img src="' . esc_attr( $i ) . '" alt="' . __( 'PayPal Acceptance Mark', 'woocommerce' ) . '" />';
} }
} else { } else {
$icon_html = '<img src="' . esc_attr( apply_filters( 'woocommerce_paypal_icon', $icon ) ) . '" alt="PayPal Acceptance Mark" />'; $icon_html = '<img src="' . esc_attr( apply_filters( 'woocommerce_paypal_icon', $icon ) ) . '" alt="' . __( 'PayPal Acceptance Mark', 'woocommerce' ) . '" />';
} }
if ( $link ) { if ( $link ) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -717,13 +717,9 @@ add_action( 'pre_get_posts', 'wc_shop_order_status_backwards_compatibility' );
/** /**
* @since 2.3 * @since 2.3
* @deprecated in favor to woocommerce_compile_scss_styles() * @deprecated has no replacement
* @return void
*/ */
function woocommerce_compile_less_styles() { function woocommerce_compile_less_styles() {
_deprecated_function( 'woocommerce_compile_less_styles', '2.3', 'woocommerce_compile_scss_styles' ); _deprecated_function( 'woocommerce_compile_less_styles', '2.3' );
// Prevents errors if used outside of admin dashboard
if ( function_exists( 'woocommerce_compile_scss_styles' ) ) {
woocommerce_compile_scss_styles();
}
} }