Merge pull request #5290 from splashingpixels/templates

template coding standard fixes
This commit is contained in:
Mike Jolley 2014-04-08 09:15:08 +01:00
commit 5228e3f653
13 changed files with 43 additions and 41 deletions

View File

@ -11,8 +11,9 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce;
if ( ! WC()->cart->coupons_enabled() )
if ( ! WC()->cart->coupons_enabled() ) {
return;
}
$info_message = apply_filters( 'woocommerce_checkout_coupon_message', __( 'Have a coupon?', 'woocommerce' ) );
$info_message .= ' <a href="#" class="showcoupon">' . __( 'Click here to enter your code', 'woocommerce' ) . '</a>';

View File

@ -9,7 +9,7 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( is_user_logged_in() || 'no' == get_option( 'woocommerce_enable_checkout_login_reminder' ) ) return;
if ( is_user_logged_in() || 'no' === get_option( 'woocommerce_enable_checkout_login_reminder' ) ) return;
$info_message = apply_filters( 'woocommerce_checkout_login_message', __( 'Returning customer?', 'woocommerce' ) );
$info_message .= ' <a href="#" class="showlogin">' . __( 'Click here to login', 'woocommerce' ) . '</a>';

View File

@ -35,7 +35,7 @@ global $woocommerce;
</tfoot>
<tbody>
<?php
if ( sizeof( $order->get_items() )>0 ) :
if ( sizeof( $order->get_items() ) > 0 ) :
foreach ( $order->get_items() as $item ) :
echo '
<tr>

View File

@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php
if ( empty( $_POST ) ) {
$ship_to_different_address = get_option( 'woocommerce_ship_to_billing' ) == 'no' ? 1 : 0;
$ship_to_different_address = get_option( 'woocommerce_ship_to_billing' ) === 'no' ? 1 : 0;
$ship_to_different_address = apply_filters( 'woocommerce_ship_to_different_address_checked', $ship_to_different_address );
} else {

View File

@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php do_action( 'woocommerce_email_header', $email_heading ); ?>
<?php if ( $order->status=='pending' ) : ?>
<?php if ( $order->status === 'pending' ) : ?>
<p><?php printf( __( 'An order has been created for you on %s. To pay for this order please use the following link: %s', 'woocommerce' ), get_bloginfo( 'name' ), '<a href="' . esc_url( $order->get_checkout_payment_url() ) . '">' . __( 'pay', 'woocommerce' ) . '</a>' ); ?></p>

View File

@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
</td>
<?php if ( get_option( 'woocommerce_ship_to_billing_address_only' ) == 'no' && ( $shipping = $order->get_formatted_shipping_address() ) ) : ?>
<?php if ( get_option( 'woocommerce_ship_to_billing_address_only' ) === 'no' && ( $shipping = $order->get_formatted_shipping_address() ) ) : ?>
<td valign="top" width="50%">

View File

@ -17,15 +17,15 @@ if ( $wp_query->max_num_pages <= 1 )
<nav class="woocommerce-pagination">
<?php
echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
'format' => '',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_text' => '&larr;',
'next_text' => '&rarr;',
'type' => 'list',
'end_size' => 3,
'mid_size' => 3
'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
'format' => '',
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
'prev_text' => '&larr;',
'next_text' => '&rarr;',
'type' => 'list',
'end_size' => 3,
'mid_size' => 3
) ) );
?>
</nav>

View File

@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce, $current_user;
$page_title = ( $load_address == 'billing' ) ? __( 'Billing Address', 'woocommerce' ) : __( 'Shipping Address', 'woocommerce' );
$page_title = ( $load_address === 'billing' ) ? __( 'Billing Address', 'woocommerce' ) : __( 'Shipping Address', 'woocommerce' );
get_currentuserinfo();
?>

View File

@ -47,15 +47,15 @@ $col = 1;
<address>
<?php
$address = apply_filters( 'woocommerce_my_account_my_address_formatted_address', array(
'first_name' => get_user_meta( $customer_id, $name . '_first_name', true ),
'last_name' => get_user_meta( $customer_id, $name . '_last_name', true ),
'company' => get_user_meta( $customer_id, $name . '_company', true ),
'address_1' => get_user_meta( $customer_id, $name . '_address_1', true ),
'address_2' => get_user_meta( $customer_id, $name . '_address_2', true ),
'city' => get_user_meta( $customer_id, $name . '_city', true ),
'state' => get_user_meta( $customer_id, $name . '_state', true ),
'postcode' => get_user_meta( $customer_id, $name . '_postcode', true ),
'country' => get_user_meta( $customer_id, $name . '_country', true )
'first_name' => get_user_meta( $customer_id, $name . '_first_name', true ),
'last_name' => get_user_meta( $customer_id, $name . '_last_name', true ),
'company' => get_user_meta( $customer_id, $name . '_company', true ),
'address_1' => get_user_meta( $customer_id, $name . '_address_1', true ),
'address_2' => get_user_meta( $customer_id, $name . '_address_2', true ),
'city' => get_user_meta( $customer_id, $name . '_city', true ),
'state' => get_user_meta( $customer_id, $name . '_state', true ),
'postcode' => get_user_meta( $customer_id, $name . '_postcode', true ),
'country' => get_user_meta( $customer_id, $name . '_country', true )
), $customer_id, $name );
$formatted_address = WC()->countries->get_formatted_address( $address );

View File

@ -18,7 +18,7 @@ if ( ! comments_open() )
<div id="comments">
<h2><?php
if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' && ( $count = $product->get_rating_count() ) )
printf( _n('%s review for %s', '%s reviews for %s', $count, 'woocommerce'), $count, get_the_title() );
printf( _n( '%s review for %s', '%s reviews for %s', $count, 'woocommerce' ), $count, get_the_title() );
else
_e( 'Reviews', 'woocommerce' );
?></h2>
@ -32,9 +32,9 @@ if ( ! comments_open() )
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
echo '<nav class="woocommerce-pagination">';
paginate_comments_links( apply_filters( 'woocommerce_comment_pagination_args', array(
'prev_text' => '&larr;',
'next_text' => '&rarr;',
'type' => 'list',
'prev_text' => '&larr;',
'next_text' => '&rarr;',
'type' => 'list',
) ) );
echo '</nav>';
endif; ?>

View File

@ -69,7 +69,7 @@ global $woocommerce, $product, $post;
}
?>
</select> <?php
if ( sizeof($attributes) == $loop )
if ( sizeof( $attributes ) == $loop )
echo '<a class="reset_variations" href="#reset">' . __( 'Clear selection', 'woocommerce' ) . '</a>';
?></td>
</tr>

View File

@ -17,12 +17,13 @@ global $post, $woocommerce, $product;
<?php
if ( has_post_thumbnail() ) {
$image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
$image_link = wp_get_attachment_url( get_post_thumbnail_id() );
$image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), array(
$image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );
$image_link = wp_get_attachment_url( get_post_thumbnail_id() );
$image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), array(
'title' => $image_title
) );
$attachment_count = count( $product->get_gallery_attachment_ids() );
$attachment_count = count( $product->get_gallery_attachment_ids() );
if ( $attachment_count > 0 ) {
$gallery = '[product-gallery]';

View File

@ -16,13 +16,13 @@ $related = $product->get_related( $posts_per_page );
if ( sizeof( $related ) == 0 ) return;
$args = apply_filters( 'woocommerce_related_products_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'post__in' => $related,
'post__not_in' => array( $product->id )
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'post__in' => $related,
'post__not_in' => array( $product->id )
) );
$products = new WP_Query( $args );