Skip to content

Commit

Permalink
Fixed includes/class-wc-embed.php PHPCS violations
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Mar 21, 2018
1 parent a1a82b0 commit d989627
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions includes/class-wc-embed.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?php
/**
* WooCommerce Product Embed.
* WooCommerce product embed
*
* @version 2.4.11
* @package WooCommerce/Classes/Embed
* @category Class
* @author WooThemes
*/

if ( ! defined( 'ABSPATH' ) ) {
Expand All @@ -14,10 +12,6 @@

/**
* Embed Class which handles any WooCommerce Products that are embedded on this site or another site.
*
* @class WC_Embed
* @version 2.4.11
* @author WooThemes
*/
class WC_Embed {

Expand Down Expand Up @@ -80,7 +74,7 @@ public static function the_excerpt( $excerpt ) {

// Make sure we're only affecting embedded products.
if ( self::is_embedded_product() ) {
echo '<p><span class="wc-embed-price">' . $_product->get_price_html() . '</span></p>';
echo '<p><span class="wc-embed-price">' . $_product->get_price_html() . '</span></p>'; // WPCS: XSS ok.

if ( ! empty( $post->post_excerpt ) ) {
ob_start();
Expand Down Expand Up @@ -121,12 +115,18 @@ public static function product_buttons() {
*/
public static function get_ratings() {
// Make sure we're only affecting embedded products.
if ( self::is_embedded_product() && ( $_product = wc_get_product( get_the_ID() ) ) && $_product->get_average_rating() > 0 ) {
if ( ! self::is_embedded_product() ) {
return;
}

$_product = wc_get_product( get_the_ID() );

if ( $_product && $_product->get_average_rating() > 0 ) {
?>
<div class="wc-embed-rating">
<?php
/* translators: %s: average rating */
printf(
/* translators: %s: average rating */
esc_html__( 'Rated %s out of 5', 'woocommerce' ),
esc_html( $_product->get_average_rating() )
);
Expand Down

0 comments on commit d989627

Please sign in to comment.