Fixed includes/class-wc-embed.php PHPCS violations
This commit is contained in:
parent
a1a82b09bb
commit
d989627125
|
@ -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' ) ) {
|
||||
|
@ -14,10 +12,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
|
||||
/**
|
||||
* 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 {
|
||||
|
||||
|
@ -80,7 +74,7 @@ class WC_Embed {
|
|||
|
||||
// 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();
|
||||
|
@ -121,12 +115,18 @@ class WC_Embed {
|
|||
*/
|
||||
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() )
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue