@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if ( ! defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | 22 | $this->widget_cssclass = 'woocommerce widget_recent_reviews'; |
23 | - $this->widget_description = __( 'Display a list of your most recent reviews on your site.', 'lsx' ); |
|
23 | + $this->widget_description = __('Display a list of your most recent reviews on your site.', 'lsx'); |
|
24 | 24 | $this->widget_id = 'woocommerce_recent_reviews'; |
25 | - $this->widget_name = __( 'WooCommerce recent reviews', 'lsx' ); |
|
25 | + $this->widget_name = __('WooCommerce recent reviews', 'lsx'); |
|
26 | 26 | $this->settings = array( |
27 | 27 | 'title' => array( |
28 | 28 | 'type' => 'text', |
29 | - 'std' => __( 'Recent reviews', 'lsx' ), |
|
30 | - 'label' => __( 'Title', 'lsx' ), |
|
29 | + 'std' => __('Recent reviews', 'lsx'), |
|
30 | + 'label' => __('Title', 'lsx'), |
|
31 | 31 | ), |
32 | 32 | 'number' => array( |
33 | 33 | 'type' => 'number', |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | 'min' => 1, |
36 | 36 | 'max' => '', |
37 | 37 | 'std' => 10, |
38 | - 'label' => __( 'Number of reviews to show', 'lsx' ), |
|
38 | + 'label' => __('Number of reviews to show', 'lsx'), |
|
39 | 39 | ), |
40 | 40 | ); |
41 | 41 | |
@@ -50,42 +50,42 @@ discard block |
||
50 | 50 | * @param array $args |
51 | 51 | * @param array $instance |
52 | 52 | */ |
53 | - public function widget( $args, $instance ) { |
|
54 | - if ( $this->get_cached_widget( $args ) ) { |
|
53 | + public function widget($args, $instance) { |
|
54 | + if ($this->get_cached_widget($args)) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | ob_start(); |
58 | - $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std']; |
|
59 | - $comments = get_comments( array( |
|
58 | + $number = ! empty($instance['number']) ? absint($instance['number']) : $this->settings['number']['std']; |
|
59 | + $comments = get_comments(array( |
|
60 | 60 | 'number' => $number, |
61 | 61 | 'status' => 'approve', |
62 | 62 | 'post_status' => 'publish', |
63 | 63 | 'post_type' => 'product', |
64 | 64 | 'parent' => 0, |
65 | - ) ); |
|
65 | + )); |
|
66 | 66 | |
67 | - if ( $comments ) { |
|
68 | - $this->widget_start( $args, $instance ); |
|
67 | + if ($comments) { |
|
68 | + $this->widget_start($args, $instance); |
|
69 | 69 | |
70 | - echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) ); |
|
70 | + echo wp_kses_post(apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">')); |
|
71 | 71 | |
72 | 72 | global $stored_comment, $_product, $rating; |
73 | 73 | |
74 | 74 | the_comment(); |
75 | - foreach ( (array) $comments as $comment ) { |
|
76 | - $_product = wc_get_product( $comment->comment_post_ID ); |
|
77 | - $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); |
|
75 | + foreach ((array) $comments as $comment) { |
|
76 | + $_product = wc_get_product($comment->comment_post_ID); |
|
77 | + $rating = intval(get_comment_meta($comment->comment_ID, 'rating', true)); |
|
78 | 78 | $stored_comment = $comment; |
79 | 79 | |
80 | - wc_get_template( 'content-widget-review.php' ); |
|
80 | + wc_get_template('content-widget-review.php'); |
|
81 | 81 | } |
82 | 82 | |
83 | - echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) ); |
|
83 | + echo wp_kses_post(apply_filters('woocommerce_after_widget_product_list', '</ul>')); |
|
84 | 84 | |
85 | - $this->widget_end( $args ); |
|
85 | + $this->widget_end($args); |
|
86 | 86 | } |
87 | 87 | $content = ob_get_clean(); |
88 | - echo wp_kses_post( $content ); |
|
89 | - $this->cache_widget( $args, $content ); |
|
88 | + echo wp_kses_post($content); |
|
89 | + $this->cache_widget($args, $content); |
|
90 | 90 | } |
91 | 91 | } |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | 6 | global $comment, $stored_comment, $_product, $rating; |
7 | 7 | $the_comment = $comment; |
8 | -if ( null !== $stored_comment ) { |
|
8 | +if (null !== $stored_comment) { |
|
9 | 9 | $the_comment = $stored_comment; |
10 | 10 | } |
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="lsx-woocommerce-review-slot"> |
14 | 14 | <div class="lsx-woocommerce-review-flex"> |
15 | - <a href="<?php echo esc_url( get_comment_link( $the_comment->comment_ID ) ); ?>"> |
|
15 | + <a href="<?php echo esc_url(get_comment_link($the_comment->comment_ID)); ?>"> |
|
16 | 16 | <figure class="lsx-woocommerce-avatar"> |
17 | - <?php echo wp_kses_post( $_product->get_image( 'lsx-thumbnail-square' ) ); ?> |
|
17 | + <?php echo wp_kses_post($_product->get_image('lsx-thumbnail-square')); ?> |
|
18 | 18 | </figure> |
19 | 19 | </a> |
20 | 20 | |
21 | 21 | <div class="lsx-woocommerce-review-box"> |
22 | 22 | <div class="lsx-woocommerce-rating"> |
23 | - <?php echo wp_kses_post( wc_get_rating_html( $rating ) ); ?> |
|
23 | + <?php echo wp_kses_post(wc_get_rating_html($rating)); ?> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <h5 class="lsx-woocommerce-title"> |
27 | - <a href="<?php echo esc_url( get_comment_link( $the_comment->comment_ID ) ); ?>"><?php echo wp_kses_post( $_product->get_name() ); ?></a> |
|
27 | + <a href="<?php echo esc_url(get_comment_link($the_comment->comment_ID)); ?>"><?php echo wp_kses_post($_product->get_name()); ?></a> |
|
28 | 28 | </h5> |
29 | 29 | |
30 | 30 | <p class="lsx-woocommerce-reviewer"> |
31 | 31 | <?php |
32 | 32 | /* translators: %s: review author */ |
33 | - echo wp_kses_post( esc_html__( 'by ', 'lsx' ) . get_comment_author( $the_comment->comment_ID ) ); |
|
33 | + echo wp_kses_post(esc_html__('by ', 'lsx') . get_comment_author($the_comment->comment_ID)); |
|
34 | 34 | ?> |
35 | 35 | </p> |
36 | 36 | |
37 | 37 | <div class="lsx-woocommerce-content"> |
38 | - <p><?php echo wp_kses_post( $the_comment->comment_content ); ?></p> |
|
39 | - <p><a href="<?php echo esc_url( get_comment_link( $the_comment->comment_ID ) ); ?>" class="moretag"><?php esc_attr_e( 'View more', 'lsx' ); ?></a></p> |
|
38 | + <p><?php echo wp_kses_post($the_comment->comment_content); ?></p> |
|
39 | + <p><a href="<?php echo esc_url(get_comment_link($the_comment->comment_ID)); ?>" class="moretag"><?php esc_attr_e('View more', 'lsx'); ?></a></p> |
|
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | </div> |