Suggested code changes in #4266
This commit is contained in:
parent
f937c36250
commit
61a783886d
|
@ -681,8 +681,7 @@ class WC_Product {
|
|||
* @return string
|
||||
*/
|
||||
public function get_weight() {
|
||||
if ( $this->weight ) return $this->weight;
|
||||
/** @todo [tivnet] else return ''; ? */
|
||||
return ( $this->weight ) ? return $this->weight : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,8 +69,8 @@ function wc_create_page( $slug, $option = '', $page_title = '', $page_content =
|
|||
if ( $page_found ) {
|
||||
if ( ! $option_value )
|
||||
update_option( $option, $page_found );
|
||||
/** @todo [tivnet] return some int value here */
|
||||
return;
|
||||
|
||||
return $page_found;
|
||||
}
|
||||
|
||||
$page_data = array(
|
||||
|
|
|
@ -548,7 +548,8 @@ class WC_Cart {
|
|||
|
||||
return ob_get_clean();
|
||||
}
|
||||
/** @todo [tivnet] return ''; */
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -581,7 +582,7 @@ class WC_Cart {
|
|||
if ( $cart_page_id )
|
||||
return apply_filters( 'woocommerce_get_cart_url', get_permalink( $cart_page_id ) );
|
||||
|
||||
/** @todo [tivnet] return ''; Meaning of this: no cart page ? */
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -700,12 +701,12 @@ class WC_Cart {
|
|||
*/
|
||||
public function find_product_in_cart( $cart_id = false ) {
|
||||
if ( $cart_id !== false )
|
||||
if( is_array( $this->cart_contents ) )
|
||||
if ( is_array( $this->cart_contents ) )
|
||||
foreach ( $this->cart_contents as $cart_item_key => $cart_item )
|
||||
if ( $cart_item_key == $cart_id )
|
||||
return $cart_item_key;
|
||||
|
||||
/** @todo [tivnet] return ''; Meaning of this? Depends on which "if" fired. */
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -716,15 +717,14 @@ class WC_Cart {
|
|||
* @param array $variation data for the cart item
|
||||
* @param array $cart_item_data other cart item data passed which affects this items uniqueness in the cart
|
||||
* @return string cart item key
|
||||
* @todo [tivnet] Default values have wrong types. Consider $variation_id = 0, $variation = array()
|
||||
*/
|
||||
public function generate_cart_id( $product_id, $variation_id = '', $variation = '', $cart_item_data = array() ) {
|
||||
public function generate_cart_id( $product_id, $variation_id = 0, $variation = array(), $cart_item_data = array() ) {
|
||||
$id_parts = array( $product_id );
|
||||
|
||||
if ( $variation_id )
|
||||
if ( $variation_id && 0 != $variation_id )
|
||||
$id_parts[] = $variation_id;
|
||||
|
||||
if ( is_array( $variation ) ) {
|
||||
if ( is_array( $variation ) && ! empty( $variation ) ) {
|
||||
$variation_key = '';
|
||||
foreach ( $variation as $key => $value ) {
|
||||
$variation_key .= trim( $key ) . trim( $value );
|
||||
|
@ -1366,7 +1366,6 @@ class WC_Cart {
|
|||
$return = wc_price( $this->shipping_total );
|
||||
|
||||
if ( $this->shipping_tax_total > 0 && $this->prices_include_tax ) {
|
||||
/** @todo [tivnet] Small or not is for theme. Consider <span class="..."> ? */
|
||||
$return .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>';
|
||||
}
|
||||
|
||||
|
@ -1377,7 +1376,6 @@ class WC_Cart {
|
|||
$return = wc_price( $this->shipping_total + $this->shipping_tax_total );
|
||||
|
||||
if ( $this->shipping_tax_total > 0 && ! $this->prices_include_tax ) {
|
||||
/** @todo [tivnet] Small or not is for theme. Consider <span class="..."> ? */
|
||||
$return .= ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>';
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1388,7 @@ class WC_Cart {
|
|||
}
|
||||
}
|
||||
|
||||
/** @todo [tivnet] return ''; Meaning of this? */
|
||||
return '';
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
|
|
@ -548,9 +548,7 @@ class WC_Countries {
|
|||
* @return array of states
|
||||
*/
|
||||
public function get_states( $cc ) {
|
||||
if (isset( $this->states[$cc] )) return $this->states[$cc];
|
||||
|
||||
/** @todo [tivnet] Else return array(); ??? */
|
||||
return ( isset( $this->states[ $cc ] ) ) ? $this->states[ $cc ] : array();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,9 +44,6 @@ class WC_Order_Item_Meta {
|
|||
if ( empty( $meta_values ) || ( ! empty( $hideprefix ) && substr( $meta_key, 0, 1 ) == $hideprefix ) )
|
||||
continue;
|
||||
|
||||
/** @todo [tivnet] Unused var */
|
||||
$found_meta = true;
|
||||
|
||||
foreach( $meta_values as $meta_value ) {
|
||||
|
||||
// Skip serialised meta
|
||||
|
@ -69,8 +66,7 @@ class WC_Order_Item_Meta {
|
|||
}
|
||||
|
||||
if ( ! sizeof( $meta_list ) )
|
||||
/** @todo [tivnet] return ''; */
|
||||
return;
|
||||
return '';
|
||||
|
||||
$output = $flat ? '' : '<dl class="variation">';
|
||||
|
||||
|
@ -87,6 +83,7 @@ class WC_Order_Item_Meta {
|
|||
else
|
||||
echo $output;
|
||||
}
|
||||
/** @todo [tivnet] return ''; */
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
|
@ -775,8 +775,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
$order = $this->get_paypal_order( $posted['cm'] );
|
||||
|
||||
if ( $order->status != 'pending' )
|
||||
/** @todo [tivnet] return a boolean */
|
||||
return;
|
||||
return false;
|
||||
|
||||
$posted['st'] = strtolower( $posted['st'] );
|
||||
|
||||
|
@ -818,6 +817,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
// Put this order on-hold for manual checking
|
||||
$order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal amounts do not match (amt %s).', 'woocommerce' ), $posted['amt'] ) );
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -826,13 +826,14 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
$order->add_order_note( __( 'PDT payment completed', 'woocommerce' ) );
|
||||
$order->payment_complete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
/** @todo [tivnet] return a boolean */
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -305,9 +305,6 @@ function wc_placeholder_img( $size = 'shop_thumbnail' ) {
|
|||
* @return string
|
||||
*/
|
||||
function wc_get_formatted_variation( $variation = '', $flat = false ) {
|
||||
/** @todo [tivnet] Remove */
|
||||
global $woocommerce;
|
||||
|
||||
if ( is_array( $variation ) ) {
|
||||
|
||||
if ( ! $flat )
|
||||
|
@ -345,7 +342,8 @@ function wc_get_formatted_variation( $variation = '', $flat = false ) {
|
|||
|
||||
return $return;
|
||||
}
|
||||
/** @todo [tivnet] return ''; */
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -355,8 +353,7 @@ function wc_get_formatted_variation( $variation = '', $flat = false ) {
|
|||
* @return void
|
||||
*/
|
||||
function wc_scheduled_sales() {
|
||||
/** @todo [tivnet] Remove $woocommerce */
|
||||
global $woocommerce, $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
// Sales which are due to start
|
||||
$product_ids = $wpdb->get_col( $wpdb->prepare( "
|
||||
|
@ -453,7 +450,6 @@ add_action( 'woocommerce_scheduled_sales', 'wc_scheduled_sales' );
|
|||
* @return array
|
||||
*/
|
||||
function wc_get_attachment_image_attributes( $attr ) {
|
||||
/** @todo [tivnet] if(empty($attr['src'])) should cause the same. Even if that's impossible */
|
||||
if ( strstr( $attr['src'], 'woocommerce_uploads/' ) )
|
||||
$attr['src'] = wc_placeholder_img_src();
|
||||
|
||||
|
|
Loading…
Reference in New Issue