From 60e3918953fc794c2d5d3ea3dfb4b7db1242a600 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Wed, 14 Nov 2018 15:20:19 -0400 Subject: [PATCH] fix coding standards in templates/single-product-reviews.php --- templates/single-product-reviews.php | 160 +++++++++++++++------------ 1 file changed, 89 insertions(+), 71 deletions(-) diff --git a/templates/single-product-reviews.php b/templates/single-product-reviews.php index 87d61a5552e..fe5049779de 100644 --- a/templates/single-product-reviews.php +++ b/templates/single-product-reviews.php @@ -10,13 +10,13 @@ * happen. When this occurs the version of the template file will be bumped and * the readme will list any important changes. * - * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes - * @package WooCommerce/Templates - * @version 3.5.2 + * @see https://docs.woocommerce.com/document/template-structure/ + * @package WooCommerce/Templates + * @version 3.5.2 */ + if ( ! defined( 'ABSPATH' ) ) { - exit; // Exit if accessed directly + exit; // Exit if accessed directly. } global $product; @@ -28,90 +28,108 @@ if ( ! comments_open() ) { ?>
-

get_review_count() ) ) { - /* translators: 1: reviews count 2: product name */ - $reviews_title = sprintf( esc_html( _n( '%1$s review for %2$s', '%1$s reviews for %2$s', $count, 'woocommerce' ) ), esc_html( $count ), '' . get_the_title() . '' ); - echo apply_filters( 'woocommerce_reviews_title', $reviews_title, $count, $product ); - } else { - _e( 'Reviews', 'woocommerce' ); - } - ?>

+

+ get_review_count() ) ) { + /* translators: 1: reviews count 2: product name */ + $reviews_title = sprintf( esc_html( _n( '%1$s review for %2$s', '%1$s reviews for %2$s', $count, 'woocommerce' ) ), esc_html( $count ), '' . get_the_title() . '' ); + echo apply_filters( 'woocommerce_reviews_title', $reviews_title, $count, $product ); // WPCS: XSS ok. + } else { + _e( 'Reviews', 'woocommerce' ); + } + ?> +

- + -
    - 'woocommerce_comments' ) ) ); ?> -
+
    + 'woocommerce_comments' ) ) ); + ?> +
- 1 && get_option( 'page_comments' ) ) : - echo ''; - endif; ?> + 1 && get_option( 'page_comments' ) ) : + echo ''; + endif; + ?> - + -

+

- +
- get_id() ) ) : ?> + get_id() ) ) : + ?> -
-
- +
+ have_comments() ? __( 'Add a review', 'woocommerce' ) : sprintf( __( 'Be the first to review “%s”', 'woocommerce' ), get_the_title() ), - 'title_reply_to' => __( 'Leave a Reply to %s', 'woocommerce' ), - 'title_reply_before' => '', - 'title_reply_after' => '', - 'comment_notes_after' => '', - 'fields' => array( - 'author' => '

' . ' ' . - '

', - 'email' => '', - ), - 'label_submit' => __( 'Submit', 'woocommerce' ), - 'logged_in_as' => '', - 'comment_field' => '', - ); + $comment_form = array( + 'title_reply' => have_comments() ? __( 'Add a review', 'woocommerce' ) : sprintf( __( 'Be the first to review “%s”', 'woocommerce' ), get_the_title() ), + 'title_reply_to' => __( 'Leave a Reply to %s', 'woocommerce' ), + 'title_reply_before' => '', + 'title_reply_after' => '', + 'comment_notes_after' => '', + 'fields' => array( + 'author' => '

' . ' ' . + '

', + 'email' => '', + ), + 'label_submit' => __( 'Submit', 'woocommerce' ), + 'logged_in_as' => '', + 'comment_field' => '', + ); - if ( $account_page_url = wc_get_page_permalink( 'myaccount' ) ) { - $comment_form['must_log_in'] = ''; - } + if ( $account_page_url = wc_get_page_permalink( 'myaccount' ) ) { + $comment_form['must_log_in'] = ''; + } - if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { - $comment_form['comment_field'] = '
'; - } + if ( get_option( 'woocommerce_enable_review_rating' ) === 'yes' ) { + $comment_form['comment_field'] = '
'; + } - $comment_form['comment_field'] .= '

'; + $comment_form['comment_field'] .= '

'; - comment_form( apply_filters( 'woocommerce_product_review_comment_form_args', $comment_form ) ); - ?> -
+ comment_form( apply_filters( 'woocommerce_product_review_comment_form_args', $comment_form ) ); + ?>
+
- + -

+

- +