lightspeeddevelopment /
lsx
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||||||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||||||
| 2 | |||||||
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
||||||
| 4 | exit; |
||||||
| 5 | } |
||||||
| 6 | |||||||
| 7 | /** |
||||||
| 8 | * Recent Reviews Widget. |
||||||
| 9 | * |
||||||
| 10 | * @author WooThemes |
||||||
| 11 | * @category Widgets |
||||||
| 12 | * @package WooCommerce/Widgets |
||||||
| 13 | * @version 2.3.0 |
||||||
| 14 | * @extends WC_Widget |
||||||
| 15 | */ |
||||||
| 16 | class LSX_WC_Widget_Recent_Reviews extends WC_Widget { |
||||||
|
0 ignored issues
–
show
The type
WC_Widget was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 17 | |||||||
| 18 | /** |
||||||
| 19 | * Constructor. |
||||||
| 20 | */ |
||||||
| 21 | public function __construct() { |
||||||
| 22 | $this->widget_cssclass = 'woocommerce widget_recent_reviews'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 23 | $this->widget_description = __( 'Display a list of your most recent reviews on your site.', 'lsx' ); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 24 | $this->widget_id = 'woocommerce_recent_reviews'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 25 | $this->widget_name = __( 'WooCommerce recent reviews', 'lsx' ); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 26 | $this->settings = array( |
||||||
|
0 ignored issues
–
show
|
|||||||
| 27 | 'title' => array( |
||||||
| 28 | 'type' => 'text', |
||||||
| 29 | 'std' => __( 'Recent reviews', 'lsx' ), |
||||||
| 30 | 'label' => __( 'Title', 'lsx' ), |
||||||
| 31 | ), |
||||||
| 32 | 'number' => array( |
||||||
| 33 | 'type' => 'number', |
||||||
| 34 | 'step' => 1, |
||||||
| 35 | 'min' => 1, |
||||||
| 36 | 'max' => '', |
||||||
| 37 | 'std' => 10, |
||||||
| 38 | 'label' => __( 'Number of reviews to show', 'lsx' ), |
||||||
| 39 | ), |
||||||
| 40 | ); |
||||||
| 41 | |||||||
| 42 | parent::__construct(); |
||||||
| 43 | } |
||||||
| 44 | |||||||
| 45 | /** |
||||||
| 46 | * Output widget. |
||||||
| 47 | * |
||||||
| 48 | * @see WP_Widget |
||||||
| 49 | * |
||||||
| 50 | * @param array $args |
||||||
|
0 ignored issues
–
show
|
|||||||
| 51 | * @param array $instance |
||||||
|
0 ignored issues
–
show
|
|||||||
| 52 | */ |
||||||
| 53 | public function widget( $args, $instance ) { |
||||||
| 54 | if ( $this->get_cached_widget( $args ) ) { |
||||||
| 55 | return; |
||||||
| 56 | } |
||||||
| 57 | ob_start(); |
||||||
| 58 | $number = ! empty( $instance['number'] ) ? absint( $instance['number'] ) : $this->settings['number']['std']; |
||||||
| 59 | $comments = get_comments( |
||||||
| 60 | array( |
||||||
| 61 | 'number' => $number, |
||||||
| 62 | 'status' => 'approve', |
||||||
| 63 | 'post_status' => 'publish', |
||||||
| 64 | 'post_type' => 'product', |
||||||
| 65 | 'parent' => 0, |
||||||
| 66 | ) |
||||||
| 67 | ); |
||||||
| 68 | |||||||
| 69 | if ( $comments ) { |
||||||
| 70 | $this->widget_start( $args, $instance ); |
||||||
| 71 | |||||||
| 72 | echo wp_kses_post( apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ) ); |
||||||
| 73 | |||||||
| 74 | global $stored_comment, $_product, $rating; |
||||||
| 75 | |||||||
| 76 | the_comment(); |
||||||
| 77 | foreach ( (array) $comments as $comment ) { |
||||||
| 78 | $_product = wc_get_product( $comment->comment_post_ID ); |
||||||
|
0 ignored issues
–
show
The function
wc_get_product was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 79 | $rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) ); |
||||||
| 80 | $stored_comment = $comment; |
||||||
| 81 | |||||||
| 82 | wc_get_template( 'content-widget-review.php' ); |
||||||
|
0 ignored issues
–
show
The function
wc_get_template was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 83 | } |
||||||
| 84 | |||||||
| 85 | echo wp_kses_post( apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ) ); |
||||||
| 86 | |||||||
| 87 | $this->widget_end( $args ); |
||||||
| 88 | } |
||||||
| 89 | $content = ob_get_clean(); |
||||||
| 90 | echo wp_kses_post( $content ); |
||||||
| 91 | $this->cache_widget( $args, $content ); |
||||||
| 92 | } |
||||||
| 93 | } |
||||||
| 94 |