Skip to content

Commit

Permalink
WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenth…
Browse files Browse the repository at this point in the history
…esis
  • Loading branch information
aristath committed Aug 27, 2016
1 parent 4e3c1fd commit 82f3cc2
Show file tree
Hide file tree
Showing 43 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public static function template_file_check_notice() {
$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
$theme_file = get_template_directory() . '/' . $file;
} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
} elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
$theme_file = get_template_directory() . '/woocommerce/' . $file;
}

Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wc-admin-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ public function restrict_manage_posts() {
$this->shop_order_filters();
} elseif ( 'product' == $typenow ) {
$this->product_filters();
} elseif( 'shop_coupon' == $typenow ) {
} elseif ( 'shop_coupon' == $typenow ) {
$this->shop_coupon_filters();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function output( $post ) {

<option value="regenerate_download_permissions"><?php _e( 'Regenerate download permissions', 'woocommerce' ); ?></option>

<?php foreach( apply_filters( 'woocommerce_order_actions', array() ) as $action => $title ) { ?>
<?php foreach ( apply_filters( 'woocommerce_order_actions', array() ) as $action => $title ) { ?>
<option value="<?php echo $action; ?>"><?php echo $title; ?></option>
<?php } ?>
</select>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function output( $post ) {

if ( $notes ) {

foreach( $notes as $note ) {
foreach ( $notes as $note ) {

$note_classes = array( 'note' );
$note_classes[] = get_comment_meta( $note->comment_ID, 'is_customer_note', true ) ? 'customer-note' : '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ public static function save( $post_id, $post ) {
// Update post terms
if ( taxonomy_exists( $attribute_names[ $i ] ) ) {

foreach( $values as $key => $value ) {
foreach ( $values as $key => $value ) {
$term = get_term_by( $values_are_slugs ? 'slug' : 'name', trim( $value ), $attribute_names[ $i ] );

if ( $term ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/reports/class-wc-admin-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ public function calculate_current_range( $current_range ) {
* @return string
*/
public function get_currency_tooltip() {
switch( get_option( 'woocommerce_currency_pos' ) ) {
switch ( get_option( 'woocommerce_currency_pos' ) ) {
case 'right':
$currency_tooltip = 'append_tooltip: "' . get_woocommerce_currency_symbol() . '"'; break;
case 'right_space':
Expand Down
4 changes: 2 additions & 2 deletions includes/admin/reports/class-wc-report-sales-by-date.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ private function query_report_data() {
$this->report_data->total_tax_refunded += ( $value->total_tax * -1 );
$this->report_data->total_refunds += $value->total_refund;
}
elseif( 'shipping' === $value->item_type ) {
elseif ( 'shipping' === $value->item_type ) {
$this->report_data->total_shipping_tax_refunded += ( $value->total_shipping_tax * -1 );
$this->report_data->total_shipping_refunded += wc_format_decimal( $value->total_refund, 2 );
$this->report_data->total_refunds += $value->total_refund;
}
elseif( 'line_item' === $value->item_type ) {
elseif ( 'line_item' === $value->item_type ) {
$this->report_data->total_tax_refunded += ( $value->total_tax * -1 );
$this->report_data->refunded_order_items += absint( $value->order_item_count );
$this->report_data->total_refunds += $value->total_refund;
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/reports/class-wc-report-stock.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function column_default( $item, $column_name ) {
$product = wc_get_product( $item->id );
}

switch( $column_name ) {
switch ( $column_name ) {

case 'product' :
if ( $sku = $product->get_sku() ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/settings/class-wc-settings-tax.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private static function get_current_tax_class() {
$tax_classes = WC_Tax::get_tax_classes();
$current_class = '';

foreach( $tax_classes as $class ) {
foreach ( $tax_classes as $class ) {
if ( sanitize_title( $class ) == $current_section ) {
$current_class = $class;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/views/html-admin-page-status-report.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@
?></td>
</tr>
<?php
if( $theme['is_child_theme'] ) :
if ( $theme['is_child_theme'] ) :
?>
<tr>
<td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'woocommerce' ); ?>:</td>
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v1/class-wc-api-coupons.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function get_coupons( $fields = null, $filter = array(), $page = 1 ) {

$coupons = array();

foreach( $query->posts as $coupon_id ) {
foreach ( $query->posts as $coupon_id ) {

if ( ! $this->is_readable( $coupon_id ) )
continue;
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v1/class-wc-api-customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function get_customers( $fields = null, $filter = array(), $page = 1 ) {

$customers = array();

foreach( $query->get_results() as $user_id ) {
foreach ( $query->get_results() as $user_id ) {

if ( ! $this->is_readable( $user_id ) )
continue;
Expand Down
4 changes: 2 additions & 2 deletions includes/api/legacy/v1/class-wc-api-orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function get_orders( $fields = null, $filter = array(), $status = null, $

$orders = array();

foreach( $query->posts as $order_id ) {
foreach ( $query->posts as $order_id ) {

if ( ! $this->is_readable( $order_id ) )
continue;
Expand Down Expand Up @@ -174,7 +174,7 @@ public function get_order( $id, $fields = null ) {
);

// add line items
foreach( $order->get_items() as $item_id => $item ) {
foreach ( $order->get_items() as $item_id => $item ) {
$product = $item->get_product();
$order_data['line_items'][] = array(
'id' => $item_id,
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v1/class-wc-api-products.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function get_products( $fields = null, $type = null, $filter = array(), $

$products = array();

foreach( $query->posts as $product_id ) {
foreach ( $query->posts as $product_id ) {

if ( ! $this->is_readable( $product_id ) )
continue;
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v1/class-wc-api-resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function maybe_add_meta( $data, $resource ) {
$meta = (array) get_post_meta( $resource->id );
}

foreach( $meta as $meta_key => $meta_value ) {
foreach ( $meta as $meta_key => $meta_value ) {

// don't add hidden meta by default
if ( ! is_protected_meta( $meta_key ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v2/class-wc-api-resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function maybe_add_meta( $data, $resource ) {
$meta = (array) get_post_meta( $resource->id );
}

foreach( $meta as $meta_key => $meta_value ) {
foreach ( $meta as $meta_key => $meta_value ) {

// don't add hidden meta by default
if ( ! is_protected_meta( $meta_key ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v2/class-wc-api-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public function add_pagination_headers( $query ) {
$single = count( $query->get_results() ) == 1;
$total = $query->get_total();

if( $query->get( 'number' ) > 0 ) {
if ( $query->get( 'number' ) > 0 ) {
$page = ( $query->get( 'offset' ) / $query->get( 'number' ) ) + 1;
$total_pages = ceil( $total / $query->get( 'number' ) );
} else {
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v3/class-wc-api-resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public function maybe_add_meta( $data, $resource ) {
$meta = (array) get_post_meta( $resource->id );
}

foreach( $meta as $meta_key => $meta_value ) {
foreach ( $meta as $meta_key => $meta_value ) {

// don't add hidden meta by default
if ( ! is_protected_meta( $meta_key ) ) {
Expand Down
2 changes: 1 addition & 1 deletion includes/api/legacy/v3/class-wc-api-server.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public function add_pagination_headers( $query ) {
$single = count( $query->get_results() ) == 1;
$total = $query->get_total();

if( $query->get( 'number' ) > 0 ) {
if ( $query->get( 'number' ) > 0 ) {
$page = ( $query->get( 'offset' ) / $query->get( 'number' ) ) + 1;
$total_pages = ceil( $total / $query->get( 'number' ) );
} else {
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@ public static function link_all_variations() {
// Get existing variations so we don't create duplicates
$available_variations = array();

foreach( $_product->get_children() as $child_id ) {
foreach ( $_product->get_children() as $child_id ) {
$child = $_product->get_child( $child_id );

if ( ! empty( $child->variation_id ) ) {
Expand Down Expand Up @@ -1282,7 +1282,7 @@ public static function remove_order_item() {
}

if ( sizeof( $order_item_ids ) > 0 ) {
foreach( $order_item_ids as $id ) {
foreach ( $order_item_ids as $id ) {
wc_delete_order_item( absint( $id ) );
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-cache-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static function prevent_caching() {
if ( isset( $_GET['download_file'] ) ) {
self::nocache();
} elseif ( is_array( $wc_page_uris ) ) {
foreach( $wc_page_uris as $uri ) {
foreach ( $wc_page_uris as $uri ) {
if ( stristr( $_SERVER['REQUEST_URI'], $uri ) ) {
self::nocache();
break;
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-countries.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ public function get_allowed_countries() {
return $this->countries;
}

if( 'all_except' === get_option( 'woocommerce_allowed_countries' ) ) {
if ( 'all_except' === get_option( 'woocommerce_allowed_countries' ) ) {
$except_countries = get_option( 'woocommerce_all_except_countries', array() );

if ( ! $except_countries ) {
return $this->countries;
} else {
$all_except_countries = $this->countries;
foreach( $except_countries as $country ) {
foreach ( $except_countries as $country ) {
unset( $all_except_countries[ $country ] );
}
return apply_filters( 'woocommerce_countries_allowed_countries', $all_except_countries );
Expand Down
18 changes: 9 additions & 9 deletions includes/class-wc-coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ private function validate_product_ids() {
if ( sizeof( $this->get_product_ids() ) > 0 ) {
$valid_for_cart = false;
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( in_array( $cart_item['product_id'], $this->get_product_ids() ) || in_array( $cart_item['variation_id'], $this->get_product_ids() ) || in_array( $cart_item['data']->get_parent(), $this->get_product_ids() ) ) {
$valid_for_cart = true;
}
Expand All @@ -965,7 +965,7 @@ private function validate_product_categories() {
if ( sizeof( $this->get_product_categories() ) > 0 ) {
$valid_for_cart = false;
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product_cats = wc_get_product_cat_ids( $cart_item['product_id'] );

// If we find an item with a cat in our allowed cat list, the coupon is valid
Expand All @@ -991,7 +991,7 @@ private function validate_sale_items() {
$product_ids_on_sale = wc_get_product_ids_on_sale();

if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( ! empty( $cart_item['variation_id'] ) ) {
if ( ! in_array( $cart_item['variation_id'], $product_ids_on_sale, true ) ) {
$valid_for_cart = true;
Expand All @@ -1014,7 +1014,7 @@ private function validate_excluded_items() {
if ( ! WC()->cart->is_empty() && $this->is_type( wc_get_product_coupon_types() ) ) {
$valid = false;

foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( $this->is_valid_for_product( $cart_item['data'], $cart_item ) ) {
$valid = true;
break;
Expand Down Expand Up @@ -1048,7 +1048,7 @@ private function validate_cart_excluded_product_ids() {
if ( sizeof( $this->get_excluded_product_ids() ) > 0 ) {
$valid_for_cart = true;
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( in_array( $cart_item['product_id'], $this->get_excluded_product_ids() ) || in_array( $cart_item['variation_id'], $this->get_excluded_product_ids() ) || in_array( $cart_item['data']->get_parent(), $this->get_excluded_product_ids() ) ) {
$valid_for_cart = false;
}
Expand All @@ -1069,7 +1069,7 @@ private function validate_cart_excluded_product_categories() {
if ( sizeof( $this->get_excluded_product_categories() ) > 0 ) {
$valid_for_cart = true;
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product_cats = wc_get_product_cat_ids( $cart_item['product_id'] );
if ( sizeof( array_intersect( $product_cats, $this->get_excluded_product_categories() ) ) > 0 ) {
$valid_for_cart = false;
Expand All @@ -1092,7 +1092,7 @@ private function validate_cart_excluded_sale_items() {
$valid_for_cart = true;
$product_ids_on_sale = wc_get_product_ids_on_sale();
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if ( ! empty( $cart_item['variation_id'] ) ) {
if ( in_array( $cart_item['variation_id'], $product_ids_on_sale, true ) ) {
$valid_for_cart = false;
Expand Down Expand Up @@ -1303,12 +1303,12 @@ public function get_coupon_error( $err_code ) {
// Store excluded categories that are in cart in $categories
$categories = array();
if ( ! WC()->cart->is_empty() ) {
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product_cats = wc_get_product_cat_ids( $cart_item['product_id'] );

if ( sizeof( $intersect = array_intersect( $product_cats, $this->get_excluded_product_categories() ) ) > 0 ) {

foreach( $intersect as $cat_id) {
foreach ( $intersect as $cat_id) {
$cat = get_term( $cat_id, 'product_cat' );
$categories[] = $cat->name;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-order-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static function get_order_item( $item_id = 0 ) {
} elseif ( $item_id instanceof WC_Order_Item ) {
$item_data = $item_id->get_data();
$item_type = $item_data->get_type();
} elseif( is_object( $item_id ) && ! empty( $item_id->order_item_type ) ) {
} elseif ( is_object( $item_id ) && ! empty( $item_id->order_item_type ) ) {
$item_data = $item_id;
$item_type = $item_id->order_item_type;
} else {
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-payment-gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function get_available_payment_gateways() {
if ( $gateway->is_available() ) {
if ( ! is_add_payment_method_page() ) {
$_available_gateways[ $gateway->id ] = $gateway;
} else if( $gateway->supports( 'add_payment_method' ) ) {
} else if ( $gateway->supports( 'add_payment_method' ) ) {
$_available_gateways[ $gateway->id ] = $gateway;
} else if ( $gateway->supports( 'tokenization' ) ) {
$_available_gateways[ $gateway->id ] = $gateway;
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-payment-tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public static function get( $token_id, $token_result = null ) {
$meta = get_metadata( 'payment_token', $token_id );
$passed_meta = array();
if ( ! empty( $meta ) ) {
foreach( $meta as $meta_key => $meta_value ) {
foreach ( $meta as $meta_key => $meta_value ) {
$passed_meta[ $meta_key ] = $meta_value[0];
}
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-product-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private function get_product_class( $the_product, $args = array() ) {
$terms = get_the_terms( $the_product, 'product_type' );
$product_type = ! empty( $terms ) ? sanitize_title( current( $terms )->name ) : 'simple';
}
} elseif( 'product_variation' === $post_type ) {
} elseif ( 'product_variation' === $post_type ) {
$product_type = 'variation';
} else {
$product_type = false;
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-product-variation.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ public function has_all_attributes_set() {
$set = true;

// undefined attributes have null strings as array values
foreach( $this->get_variation_attributes() as $att ){
if( ! $att ){
foreach ( $this->get_variation_attributes() as $att ){
if ( ! $att ){
$set = false;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ public static function product_page( $atts ) {
jQuery( document ).ready( function( $ ) {
var $variations_form = $( '[data-product-page-preselected-id="<?php echo esc_attr( $preselected_id ); ?>"]' ).find( 'form.variations_form' );

<?php foreach( $attributes as $attr => $value ) { ?>
<?php foreach ( $attributes as $attr => $value ) { ?>
$variations_form.find( 'select[name="<?php echo esc_attr( $attr ); ?>"]' ).val( '<?php echo $value; ?>' );
<?php } ?>
});
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private static function get_server_info() {
*/
private static function get_all_plugins() {
// Ensure get_plugins function is loaded
if( ! function_exists( 'get_plugins' ) ) {
if ( ! function_exists( 'get_plugins' ) ) {
include ABSPATH . '/wp-admin/includes/plugin.php';
}

Expand Down Expand Up @@ -382,7 +382,7 @@ private static function get_all_template_overrides() {
$theme_file = get_stylesheet_directory() . '/woocommerce/' . $file;
} elseif ( file_exists( get_template_directory() . '/' . $file ) ) {
$theme_file = get_template_directory() . '/' . $file;
} elseif( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
} elseif ( file_exists( get_template_directory() . '/woocommerce/' . $file ) ) {
$theme_file = get_template_directory() . '/woocommerce/' . $file;
} else {
$theme_file = false;
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wc-webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private function build_payload( $resource_id ) {
WC()->api->includes();
WC()->api->register_resources( new WC_API_Server( '/' ) );

switch( $resource ) {
switch ( $resource ) {

case 'coupon':
$payload = WC()->api->WC_API_Coupons->get_coupon( $resource_id );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ protected function save_subscription_meta( $order_id, $customer_id ) {
update_post_meta( $order_id, '_simplify_customer_id', $customer_id );

// Also store it on the subscriptions being purchased in the order
foreach( wcs_get_subscriptions_for_order( $order_id ) as $subscription ) {
foreach ( wcs_get_subscriptions_for_order( $order_id ) as $subscription ) {
update_post_meta( $subscription->id, '_simplify_customer_id', $customer_id );
}
}
Expand Down
Loading

0 comments on commit 82f3cc2

Please sign in to comment.