Skip to content

Commit

Permalink
Removed more some unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Nov 20, 2014
1 parent 45ddc1d commit 8eeb6fc
Show file tree
Hide file tree
Showing 22 changed files with 136 additions and 161 deletions.
3 changes: 0 additions & 3 deletions includes/admin/reports/class-wc-report-taxes-by-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report {
* @return array
*/
public function get_chart_legend() {

$legend = array();

return array();
}

Expand Down
3 changes: 0 additions & 3 deletions includes/admin/reports/class-wc-report-taxes-by-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report {
* @return array
*/
public function get_chart_legend() {

$legend = array();

return array();
}

Expand Down
4 changes: 0 additions & 4 deletions includes/admin/settings/class-wc-settings-emails.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,6 @@ public function save() {
WC_Admin_Settings::save_fields( $settings );

} else {

// Load mailer
$mailer = WC()->mailer();

if ( class_exists( $current_section ) ) {

$current_section_class = new $current_section();
Expand Down
9 changes: 0 additions & 9 deletions includes/admin/settings/class-wc-settings-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ public function save() {
public function get_settings( $current_section = '' ) {
if ( 'display' == $current_section ) {

// Get shop page
$shop_page_id = wc_get_page_id( 'shop' );
$base_slug = ( $shop_page_id > 0 && get_post( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : 'shop';
$woocommerce_shop_page_children_warning = '';

if ( $shop_page_id > 0 && sizeof( get_pages( "child_of=$shop_page_id" ) ) > 0 ) {
$woocommerce_shop_page_children_warning = ' <mark class="notice">' . __( 'Note: The shop page has children - child pages will not work if you enable this option.', 'woocommerce' ) . '</mark>';
}

$settings = apply_filters( 'woocommerce_product_settings', array(

array(
Expand Down
2 changes: 0 additions & 2 deletions includes/admin/wc-admin-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ function wc_create_page( $slug, $option = '', $page_title = '', $page_content =
return -1;
}

$page_found = null;

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}%" ) );
Expand Down
4 changes: 2 additions & 2 deletions includes/api/class-wc-api-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function get_order( $id, $fields = null, $filter = array() ) {
'status' => $order->get_status(),
'currency' => $order->get_order_currency(),
'total' => wc_format_decimal( $order->get_total(), 2 ),
'subtotal' => wc_format_decimal( $order->get_subtotal( $order ), 2 ),
'subtotal' => wc_format_decimal( $order->get_subtotal(), 2 ),
'total_line_items_quantity' => $order->get_item_count(),
'total_tax' => wc_format_decimal( $order->get_total_tax(), 2 ),
'total_shipping' => wc_format_decimal( $order->get_total_shipping(), 2 ),
Expand Down Expand Up @@ -529,7 +529,7 @@ public function edit_order( $id, $data ) {

$this->set_item( $order, $line_type, $item, 'create' );

} elseif ( $this->item_is_null( $item, $line_type ) ) {
} elseif ( $this->item_is_null( $item ) ) {

// delete item
wc_delete_order_item( $item['id'] );
Expand Down
6 changes: 0 additions & 6 deletions includes/api/class-wc-api-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -1196,12 +1196,6 @@ protected function save_variations( $id, $data ) {
if ( isset( $variation['in_stock'] ) ) {
$stock_status = ( true === $variation['in_stock'] ) ? 'instock' : 'outofstock';
wc_update_product_stock_status( $variation_id, $stock_status );
} else {
$stock_status = get_post_meta( $variation_id, '_stock_status', true );

if ( '' === $stock_status ) {
$stock_status = 'instock';
}
}

if ( 'yes' === $manage_stock ) {
Expand Down
13 changes: 9 additions & 4 deletions includes/api/class-wc-api-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,18 +458,21 @@ public function get_index() {
$data = array();

$route = preg_replace( '#\(\?P(<\w+?>).*?\)#', '$1', $route );
$methods = array();

foreach ( self::$method_map as $name => $bitmask ) {
foreach ( $callbacks as $callback ) {
// Skip to the next route if any callback is hidden
if ( $callback[1] & self::HIDDEN_ENDPOINT )
if ( $callback[1] & self::HIDDEN_ENDPOINT ) {
continue 3;
}

if ( $callback[1] & $bitmask )
if ( $callback[1] & $bitmask ) {
$data['supports'][] = $name;
}

if ( $callback[1] & self::ACCEPT_DATA )
if ( $callback[1] & self::ACCEPT_DATA ) {
$data['accepts_data'] = true;
}

// For non-variable routes, generate links
if ( strpos( $route, '<' ) === false ) {
Expand All @@ -479,8 +482,10 @@ public function get_index() {
}
}
}

$available['store']['routes'][ $route ] = apply_filters( 'woocommerce_api_endpoints_description', $data );
}

return apply_filters( 'woocommerce_api_index', $available );
}

Expand Down
9 changes: 6 additions & 3 deletions includes/class-wc-countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,12 @@ public function get_european_union_countries() {
* @return string
*/
public function shipping_to_prefix() {
$return = '';
if (in_array(WC()->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __( 'to the', 'woocommerce' );
else $return = __( 'to', 'woocommerce' );
if ( in_array( WC()->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ) ) ) {
$return = __( 'to the', 'woocommerce' );
} else {
$return = __( 'to', 'woocommerce' );
}

return apply_filters('woocommerce_countries_shipping_to_prefix', $return, WC()->customer->get_shipping_country());
}

Expand Down
1 change: 0 additions & 1 deletion includes/class-wc-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public function install() {
$this->create_files();

// Queue upgrades
$current_version = get_option( 'woocommerce_version', null );
$current_db_version = get_option( 'woocommerce_db_version', null );

if ( version_compare( $current_db_version, '2.2.0', '<' ) && null !== $current_db_version ) {
Expand Down
2 changes: 0 additions & 2 deletions includes/class-wc-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,6 @@ public function remove_posts_where() {
public function get_products_in_view() {
global $wp_the_query;

$unfiltered_product_ids = array();

// Get main query
$current_wp_query = $wp_the_query->query;

Expand Down
4 changes: 1 addition & 3 deletions includes/class-wc-webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ public function __isset( $key ) {
*
* @since 2.2
* @param string $key
* @return mixed|null|void value
* @return mixed value
*/
public function __get( $key ) {

$value = null;

if ( 'status' === $key ) {
$value = $this->get_status();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,8 @@ protected function get_order_item_names( $order ) {
* @return string
*/
protected function get_order_item_name( $order, $item ) {
$product = $order->get_product_from_item( $item );
$item_name = $item['name'];
$item_meta = new WC_Order_Item_Meta( $item['item_meta'] );
$item_name = $item['name'];
$item_meta = new WC_Order_Item_Meta( $item['item_meta'] );

if ( $meta = $item_meta->display( true, true ) ) {
$item_name .= ' ( ' . $meta . ' )';
Expand Down
Loading

0 comments on commit 8eeb6fc

Please sign in to comment.