This commit is contained in:
Tarun 2014-09-17 14:50:47 +05:30
commit 838fa1c56c
27 changed files with 949 additions and 750 deletions

File diff suppressed because one or more lines are too long

View File

@ -2113,6 +2113,9 @@ img.help_tip {
.iconbefore( "\e007" );
}
}
h4.wc-settings-sub-title {
font-size: 1.2em;
}
}
@media only screen and (max-width: 900px) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +1,44 @@
<?php
/**
* Iran
* Iran States
*
* @author Khalil Delavaran
* @category i18n
* @package WooCommerce/i18n
* @version 2.2.3
* @author Khalil Delavaran
* @category i18n
* @package WooCommerce/i18n
* @version 2.2.3
*/
global $states;
$states['IR'] = array(
'KHZ' => __( 'Khuzestan (خوزستان)', 'woocommerce' ) ,
'THR' => __( 'Tehran (تهران)', 'woocommerce' ) ,
'ILM' => __( 'Ilaam (ایلام)', 'woocommerce' ) ,
'BHR' => __( 'Bushehr (بوشهر)', 'woocommerce' ) ,
'ADL' => __( 'Ardabil (اردبیل)', 'woocommerce' ) ,
'ESF' => __( 'Isfahan (اصفهان)', 'woocommerce' ) ,
'YZD' => __( 'Yazd (یزد)', 'woocommerce' ) ,
'KRH' => __( 'Kermanshah (کرمانشاه)', 'woocommerce' ) ,
'KRN' => __( 'Kerman (کرمان)', 'woocommerce' ) ,
'HDN' => __( 'Hamadan (همدان)', 'woocommerce' ) ,
'GZN' => __( 'Ghazvin (قزوین)', 'woocommerce' ) ,
'ZJN' => __( 'Zanjan (زنجان)', 'woocommerce' ) ,
'LRS' => __( 'Luristan (لرستان)', 'woocommerce' ) ,
'ABZ' => __( 'Alborz (البرز)', 'woocommerce' ) ,
'EAZ' => __( 'East Azarbaijan (آذربایجان شرقی)', 'woocommerce' ) ,
'WAZ' => __( 'West Azarbaijan (آذربایجان غربی)', 'woocommerce' ) ,
'CHB' => __( 'Chaharmahal and Bakhtiari (چهارمحال و بختیاری)', 'woocommerce' ) ,
'SKH' => __( 'South Khorasan (خراسان جنوبی)', 'woocommerce' ) ,
'RKH' => __( 'Razavi Khorasan (خراسان رضوی)', 'woocommerce' ) ,
'NKH' => __( 'North Khorasan (خراسان جنوبی)', 'woocommerce' ) ,
'SMN' => __( 'Semnan (سمنان)', 'woocommerce' ) ,
'FRS' => __( 'Fars (فارس)', 'woocommerce' ) ,
'QHM' => __( 'Qom (قم)', 'woocommerce' ) ,
'KRD' => __( 'Kurdistan / کردستان)', 'woocommerce' ) ,
'KBD' => __( 'Kohgiluyeh and BoyerAhmad (کهگیلوییه و بویراحمد)', 'woocommerce' ) ,
'GLS' => __( 'Golestan (گلستان)', 'woocommerce' ) ,
'GIL' => __( 'Gilan (گیلان)', 'woocommerce' ) ,
'MZN' => __( 'Mazandaran (مازندران)', 'woocommerce' ) ,
'MKZ' => __( 'Markazi (مرکزی)', 'woocommerce' ) ,
'HRZ' => __( 'Hormozgan (هرمزگان)', 'woocommerce' ) ,
'ُSBN' => __( 'Sistan and Baluchestan (سیستان و بلوچستان)', 'woocommerce' )
);
'KHZ' => __( 'Khuzestan (خوزستان)', 'woocommerce' ),
'THR' => __( 'Tehran (تهران)', 'woocommerce' ),
'ILM' => __( 'Ilaam (ایلام)', 'woocommerce' ),
'BHR' => __( 'Bushehr (بوشهر)', 'woocommerce' ),
'ADL' => __( 'Ardabil (اردبیل)', 'woocommerce' ),
'ESF' => __( 'Isfahan (اصفهان)', 'woocommerce' ),
'YZD' => __( 'Yazd (یزد)', 'woocommerce' ),
'KRH' => __( 'Kermanshah (کرمانشاه)', 'woocommerce' ),
'KRN' => __( 'Kerman (کرمان)', 'woocommerce' ),
'HDN' => __( 'Hamadan (همدان)', 'woocommerce' ),
'GZN' => __( 'Ghazvin (قزوین)', 'woocommerce' ),
'ZJN' => __( 'Zanjan (زنجان)', 'woocommerce' ),
'LRS' => __( 'Luristan (لرستان)', 'woocommerce' ),
'ABZ' => __( 'Alborz (البرز)', 'woocommerce' ),
'EAZ' => __( 'East Azarbaijan (آذربایجان شرقی)', 'woocommerce' ),
'WAZ' => __( 'West Azarbaijan (آذربایجان غربی)', 'woocommerce' ),
'CHB' => __( 'Chaharmahal and Bakhtiari (چهارمحال و بختیاری)', 'woocommerce' ),
'SKH' => __( 'South Khorasan (خراسان جنوبی)', 'woocommerce' ),
'RKH' => __( 'Razavi Khorasan (خراسان رضوی)', 'woocommerce' ),
'NKH' => __( 'North Khorasan (خراسان جنوبی)', 'woocommerce' ),
'SMN' => __( 'Semnan (سمنان)', 'woocommerce' ),
'FRS' => __( 'Fars (فارس)', 'woocommerce' ),
'QHM' => __( 'Qom (قم)', 'woocommerce' ),
'KRD' => __( 'Kurdistan / کردستان)', 'woocommerce' ),
'KBD' => __( 'Kohgiluyeh and BoyerAhmad (کهگیلوییه و بویراحمد)', 'woocommerce' ),
'GLS' => __( 'Golestan (گلستان)', 'woocommerce' ),
'GIL' => __( 'Gilan (گیلان)', 'woocommerce' ),
'MZN' => __( 'Mazandaran (مازندران)', 'woocommerce' ),
'MKZ' => __( 'Markazi (مرکزی)', 'woocommerce' ),
'HRZ' => __( 'Hormozgan (هرمزگان)', 'woocommerce' ),
'SBN' => __( 'Sistan and Baluchestan (سیستان و بلوچستان)', 'woocommerce' )
);

View File

@ -182,13 +182,13 @@ class WC_Product {
// Update stock in DB directly
switch ( $mode ) {
case 'add' :
$wpdb->query( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value + {$amount} WHERE post_id = {$this->id} AND meta_key='_stock'" );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value + %d WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
break;
case 'subtract' :
$wpdb->query( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value - {$amount} WHERE post_id = {$this->id} AND meta_key='_stock'" );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = meta_value - %d WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
break;
default :
$wpdb->query( "UPDATE {$wpdb->postmeta} SET meta_value = {$amount} WHERE post_id = {$this->id} AND meta_key='_stock'" );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->postmeta} SET meta_value = %d WHERE post_id = %d AND meta_key='_stock'", $amount, $this->id ) );
break;
}

View File

@ -612,8 +612,7 @@ abstract class WC_Settings_API {
$defaults = array(
'title' => '',
'class' => '',
'css' => ''
'class' => ''
);
$data = wp_parse_args( $data, $defaults );
@ -621,7 +620,7 @@ abstract class WC_Settings_API {
ob_start();
?>
</table>
<h4 class="<?php echo esc_attr( $data['class'] ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></h4>
<h4 class="wc-settings-sub-title <?php echo esc_attr( $data['class'] ); ?>"><?php echo wp_kses_post( $data['title'] ); ?></h4>
<?php if ( ! empty( $data['description'] ) ) : ?>
<p><?php echo wp_kses_post( $data['description'] ); ?></p>
<?php endif; ?>

View File

@ -5,10 +5,12 @@
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.1.0
* @version 2.2.3
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! class_exists( 'WC_Admin_Menus' ) ) :
@ -42,12 +44,13 @@ class WC_Admin_Menus {
public function admin_menu() {
global $menu;
if ( current_user_can( 'manage_woocommerce' ) )
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
if ( current_user_can( 'manage_woocommerce' ) ) {
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator woocommerce' );
}
$main_page = add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce' , null, null, '55.5' );
$main_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_submenu_page( 'edit.php?post_type=product', __( 'Attributes', 'woocommerce' ), __( 'Attributes', 'woocommerce' ), 'manage_product_terms', 'product_attributes', array( $this, 'attributes_page' ) );
}
/**
@ -92,7 +95,6 @@ class WC_Admin_Menus {
/**
* Highlights the correct top level admin menu item for post type add screens.
*
* @access public
* @return void
*/
public function menu_highlight() {
@ -121,19 +123,16 @@ class WC_Admin_Menus {
unset( $submenu['woocommerce'][1] );
}
// Sort out Orders menu when on the top level
if ( ! current_user_can( 'manage_woocommerce' ) ) {
foreach ( $menu as $key => $menu_item ) {
if ( strpos( $menu_item[0], _x('Orders', 'Admin menu name', 'woocommerce') ) === 0 ) {
if ( isset( $submenu['woocommerce'] ) && current_user_can( 'manage_woocommerce' ) ) {
foreach ( $submenu['woocommerce'] as $key => $menu_item ) {
if ( 0 === strpos( $menu_item[0], _x( 'Orders', 'Admin menu name', 'woocommerce' ) ) ) {
$menu_name = _x('Orders', 'Admin menu name', 'woocommerce');
$menu_name_count = '';
$menu_name = _x( 'Orders', 'Admin menu name', 'woocommerce' );
if ( $order_count = wc_processing_order_count() ) {
$menu_name_count = " <span class='awaiting-mod update-plugins count-$order_count'><span class='processing-count'>" . number_format_i18n( $order_count ) . "</span></span>" ;
$menu_name .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
}
$menu[$key][0] = $menu_name . $menu_name_count;
$submenu['edit.php?post_type=shop_order'][5][0] = $menu_name;
$submenu['woocommerce'][ $key ] [0] = $menu_name;
break;
}
}
@ -157,26 +156,27 @@ class WC_Admin_Menus {
$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 ) :
foreach ( $menu_order as $index => $item ) {
if ( ( ( 'woocommerce' ) == $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' ) ) ) :
} elseif ( !in_array( $item, array( 'separator-woocommerce' ) ) ) {
$woocommerce_menu_order[] = $item;
endif;
}
endforeach;
}
// Return order
return $woocommerce_menu_order;
}
/**
* custom_menu_order
* Custom menu order
*
* @return bool
*/
public function custom_menu_order() {

View File

@ -1864,13 +1864,17 @@ class WC_Admin_Post_Types {
/**
* Change "Featured Image" to "Product Image" throughout media modals.
*
* @param array $strings Array of strings to translate.
* @param object $post
* @return array
*/
public function media_view_strings( $strings = array(), $post = null ) {
$strings['setFeaturedImageTitle'] = __( 'Set product image', 'woocommerce' );
$strings['setFeaturedImage'] = __( 'Set product image', 'woocommerce' );
if ( isset( $post->post_type ) && 'product' == $post->post_type ) {
$strings['setFeaturedImageTitle'] = __( 'Set product image', 'woocommerce' );
$strings['setFeaturedImage'] = __( 'Set product image', 'woocommerce' );
}
return $strings;
}

View File

@ -107,7 +107,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
'coupon_count' => '#d4d9dc',
);
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day';
@ -317,12 +317,11 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
* Output an export link
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="chart"
data-xaxes="<?php _e( 'Date', 'woocommerce' ); ?>"

View File

@ -154,7 +154,7 @@ class WC_Report_Customers extends WC_Admin_Report {
'guests' => '#8fdece'
);
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day';
@ -199,11 +199,11 @@ class WC_Report_Customers extends WC_Admin_Report {
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="chart"
data-xaxes="<?php _e( 'Date', 'woocommerce' ); ?>"

View File

@ -91,7 +91,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'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day';
@ -230,11 +230,11 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="chart"
data-xaxes="<?php _e( 'Date', 'woocommerce' ); ?>"

View File

@ -159,7 +159,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
'shipping_amount' => '#1abc9c'
);
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = '7day';
@ -175,11 +175,11 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="chart"
data-xaxes="<?php _e( 'Date', 'woocommerce' ); ?>"

View File

@ -113,7 +113,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
'item_count' => '#d4d9dc',
);
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) )
$current_range = '7day';
@ -319,11 +319,11 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : '7day';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : '7day';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="chart"
data-xaxes="<?php _e( 'Date', 'woocommerce' ); ?>"

View File

@ -25,11 +25,11 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : 'last_month';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : 'last_month';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="table"
>
@ -49,7 +49,7 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
'month' => __( 'This Month', 'woocommerce' ),
);
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : 'last_month';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : 'last_month';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = 'last_month';

View File

@ -25,11 +25,11 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
*/
public function get_export_button() {
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : 'last_month';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : 'last_month';
?>
<a
href="#"
download="report-<?php echo $current_range; ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
download="report-<?php echo esc_attr( $current_range ); ?>-<?php echo date_i18n( 'Y-m-d', current_time('timestamp') ); ?>.csv"
class="export_csv"
data-export="table"
>
@ -49,7 +49,7 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
'month' => __( 'This Month', 'woocommerce' ),
);
$current_range = ! empty( $_GET['range'] ) ? $_GET['range'] : 'last_month';
$current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( $_GET['range'] ) : 'last_month';
if ( ! in_array( $current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ) ) ) {
$current_range = 'last_month';

View File

@ -255,8 +255,8 @@ function wc_save_order_items( $order_id, $items ) {
// Update values
wc_update_order_item_meta( $item_id, '_line_subtotal', wc_format_decimal( $line_subtotal[ $item_id ] ) );
wc_update_order_item_meta( $item_id, '_line_total', wc_format_decimal( $line_total[ $item_id ] ) );
wc_update_order_item_meta( $item_id, '_line_subtotal_tax', wc_format_decimal( array_sum( $line_subtotal_tax[ $item_id ] ) ) );
wc_update_order_item_meta( $item_id, '_line_tax', wc_format_decimal( array_sum( $line_tax[ $item_id ] ) ) );
wc_update_order_item_meta( $item_id, '_line_subtotal_tax', array_sum( array_map( 'wc_format_decimal', $line_subtotal_tax[ $item_id ] ) ) );
wc_update_order_item_meta( $item_id, '_line_tax', array_sum( array_map( 'wc_format_decimal', $line_tax[ $item_id ] ) ) );
// Save line tax data - Since 2.2
$tax_data_total = array_map( 'wc_format_decimal', $line_tax[ $item_id ] );

View File

@ -349,7 +349,7 @@ class WC_API_Orders extends WC_API_Resource {
// default order args, note that status is checked for validity in wc_create_order()
$default_order_args = array(
'status' => isset( $data['status'] ) ? $data['status'] : '',
'customer_note' => isset( $data['customer_note'] ) ? $data['customer_note'] : null,
'customer_note' => isset( $data['note'] ) ? $data['note'] : null,
);
// if creating order for existing customer
@ -478,8 +478,8 @@ class WC_API_Orders extends WC_API_Resource {
$order_args = array( 'order_id' => $order->id );
// customer note
if ( isset( $data['customer_note'] ) ) {
$order_args['customer_note'] = $data['customer_note'];
if ( isset( $data['note'] ) ) {
$order_args['customer_note'] = $data['note'];
}
// order status

View File

@ -265,6 +265,8 @@ class WC_AJAX {
* AJAX add to cart
*/
public static function add_to_cart() {
ob_start();
$product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_POST['product_id'] ) );
$quantity = empty( $_POST['quantity'] ) ? 1 : wc_stock_amount( $_POST['quantity'] );
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
@ -395,6 +397,7 @@ class WC_AJAX {
* Add a new attribute via ajax function
*/
public static function add_new_attribute() {
ob_start();
check_ajax_referer( 'add-attribute', 'security' );
@ -911,6 +914,7 @@ class WC_AJAX {
* Get customer details via ajax
*/
public static function get_customer_details() {
ob_start();
check_ajax_referer( 'get-customer-details', 'security' );
@ -1497,6 +1501,7 @@ class WC_AJAX {
* @param string $post_types (default: array('product'))
*/
public static function json_search_products( $x = '', $post_types = array('product') ) {
ob_start();
check_ajax_referer( 'search-products', 'security' );
@ -1599,6 +1604,7 @@ class WC_AJAX {
* Search for customers and return json
*/
public static function json_search_customers() {
ob_start();
check_ajax_referer( 'search-customers', 'security' );
@ -1643,6 +1649,8 @@ class WC_AJAX {
* @see WC_AJAX::json_search_products()
*/
public static function json_search_downloadable_products_and_variations() {
ob_start();
$term = (string) wc_clean( stripslashes( $_GET['term'] ) );
$args = array(
@ -1724,6 +1732,8 @@ class WC_AJAX {
public static function product_ordering() {
global $wpdb;
ob_start();
// check permissions again and make sure we have what we need
if ( ! current_user_can('edit_products') || empty( $_POST['id'] ) || ( ! isset( $_POST['previd'] ) && ! isset( $_POST['nextid'] ) ) ) {
die(-1);
@ -1808,6 +1818,8 @@ class WC_AJAX {
* Handle a refund via the edit order screen
*/
public static function refund_line_items() {
ob_start();
check_ajax_referer( 'order-item', 'security' );
$order_id = absint( $_POST['order_id'] );

View File

@ -266,12 +266,6 @@ class WC_Post_types {
)
);
$menu_name = _x( 'Orders', 'Admin menu name', 'woocommerce' );
if ( $order_count = wc_processing_order_count() ) {
$menu_name .= ' <span class="awaiting-mod update-plugins count-' . $order_count . '"><span class="processing-count">' . number_format_i18n( $order_count ) . '</span></span>';
}
wc_register_order_type(
'shop_order',
apply_filters( 'woocommerce_register_post_type_shop_order',
@ -290,7 +284,7 @@ class WC_Post_types {
'not_found' => __( 'No Orders found', 'woocommerce' ),
'not_found_in_trash' => __( 'No Orders found in trash', 'woocommerce' ),
'parent' => __( 'Parent Orders', 'woocommerce' ),
'menu_name' => $menu_name
'menu_name' => _x( 'Orders', 'Admin menu name', 'woocommerce' )
),
'description' => __( 'This is where store orders are stored.', 'woocommerce' ),
'public' => false,

View File

@ -59,6 +59,7 @@ class WC_Product_Variation extends WC_Product {
'sku' => '',
'weight' => '',
'length' => '',
'width' => '',
'height' => ''
);
@ -127,7 +128,7 @@ class WC_Product_Variation extends WC_Product {
$value = metadata_exists( 'post', $this->variation_id, '_' . $key ) ? get_post_meta( $this->variation_id, '_' . $key, true ) : get_post_meta( $this->id, '_' . $key, true );
// Handle meta data keys which can be empty at variation level to cause inheritance
if ( '' === $value && in_array( $key, array( 'sku', 'weight', 'length', 'height' ) ) ) {
if ( '' === $value && in_array( $key, array( 'sku', 'weight', 'length', 'width', 'height' ) ) ) {
$value = get_post_meta( $this->id, '_' . $key, true );
}
@ -138,6 +139,9 @@ class WC_Product_Variation extends WC_Product {
} elseif ( 'variation_data' === $key ) {
$all_meta = get_post_meta( $this->variation_id );
// The variation data array
$this->variation_data = array();
// Get the variation attributes from meta
foreach ( $all_meta as $name => $value ) {
if ( ! strstr( $name, 'attribute_' ) ) {

View File

@ -362,9 +362,6 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
if ( $line_items = $this->get_line_items( $order ) ) {
$paypal_args = array_merge( $paypal_args, $line_items );
} else {
// Discount
$paypal_args['discount_amount_cart'] = $order->get_order_discount();
// Don't pass items - paypal borks tax due to prices including tax. PayPal has no option for tax inclusive pricing sadly. Pass 1 item for the order items overall
$item_names = array();
@ -377,7 +374,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
}
$paypal_args['item_name_1'] = $this->paypal_item_name( sprintf( __( 'Order %s' , 'woocommerce'), $order->get_order_number() ) . " - " . implode( ', ', $item_names ) );
$paypal_args['quantity_1'] = 1;
$paypal_args['quantity_1'] = '1';
$paypal_args['amount_1'] = number_format( $order->get_total() - round( $order->get_total_shipping() + $order->get_shipping_tax(), 2 ) + $order->get_order_discount(), 2, '.', '' );
// Shipping Cost
@ -389,6 +386,11 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
$paypal_args['quantity_2'] = '1';
$paypal_args['amount_2'] = number_format( $order->get_total_shipping() + $order->get_shipping_tax(), 2, '.', '' );
}
// Discount
if ( $order->get_order_discount() ) {
$paypal_args['discount_amount_cart'] = $order->get_order_discount();
}
}
$paypal_args = apply_filters( 'woocommerce_paypal_args', $paypal_args );

View File

@ -322,7 +322,7 @@ class WC_Shortcode_My_Account {
$valid = $wp_hasher->CheckPassword( $key, $user->user_activation_key );
}
if ( empty( $user ) or empty( $valid ) ) {
if ( empty( $user ) || empty( $valid ) ) {
wc_add_notice( __( 'Invalid key', 'woocommerce' ), 'error' );
return false;
}

View File

@ -68,7 +68,7 @@ function wc_get_order_id_by_order_key( $order_key ) {
global $wpdb;
// Faster than get_posts()
$order_id = $wpdb->get_var( "SELECT post_id FROM {$wpdb->prefix}postmeta WHERE meta_key = '_order_key' AND meta_value = '{$order_key}'" );
$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM {$wpdb->prefix}postmeta WHERE meta_key = '_order_key' AND meta_value = %s", $order_key ) );
return $order_id;
}

View File

@ -1,7 +1,7 @@
{
"name": "woocommerce",
"title": "WooCommerce",
"version": "2.2.2",
"version": "2.2.3",
"homepage": "http://www.woothemes.com/woocommerce/",
"repository": {
"type": "git",

View File

@ -4,7 +4,7 @@ Tags: ecommerce, e-commerce, commerce, woothemes, wordpress ecommerce, affiliate
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=paypal@woothemes.com&item_name=Donation+for+WooCommerce
Requires at least: 3.8
Tested up to: 4.0
Stable tag: 2.2.2
Stable tag: 2.2.3
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html
@ -130,20 +130,31 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
== Changelog ==
= 2.2.3 =
= 2.2.3 - 16/09/2014 =
* Fix - Order status translation in admin and account page.
* Fix - Ensure shipping address gets displayed - fixes needs_shipping_address() method.
* Fix - Escaping of country names in tax settings.
* Fix - Encoding of pagination link when using default permalinks.
* Fix - NPR currency.
* Fix - Fixing "Invalid key" error when clicking link in password reset email.
* Fix - Mobile checkout via PayPal when using tax inclusive prices.
* Fix - Thumbnails "hard crop" option.
* Fix - Missing variables when add new product variation.
* Fix - Fixed minor XSS issue on reports screens by escaping and sanitizing 'range' GET variable.
* Fix - Number format when calculate the line items tax.
* Fix - Language update/install in Multisites.
* Fix - "Set product image" media gallery title in non-product post type.
* Fix - Number of processing orders in WooCommerce > Orders menu.
* Fix - Issue that preventing cookies being set on shutdown after wp_send_json.
* Fix - Incorrect shipping calculation because of missing width in product variation.
* Tweak - Display of locale information on system status page.
* Tweak - Removed postcode for Bahamas.
* Tweak - In system status, show path to template file override.
* Tweak - Dynamically get the address fields in WC_Checkout::create_order()
* Tweak - If a refund fails, delete refund post.
* Tweak - Button for hide the language update message.
* Tweak - Method for install the translations directly.
* Tweak - Display of h4 in settings pages.
* Dev - Added woocommerce_get_settings_ID filters.
= 2.2.2 - 11/09/2014 =

View File

@ -3,7 +3,7 @@
* Plugin Name: WooCommerce
* Plugin URI: http://www.woothemes.com/woocommerce/
* Description: An e-commerce toolkit that helps you sell anything. Beautifully.
* Version: 2.2.2
* Version: 2.2.3
* Author: WooThemes
* Author URI: http://woothemes.com
* Requires at least: 3.8
@ -33,7 +33,7 @@ final class WooCommerce {
/**
* @var string
*/
public $version = '2.2.2';
public $version = '2.2.3';
/**
* @var WooCommerce The single instance of the class