PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.2.2
ShopBuilder – WooCommerce Builder For Elementor v2.2.2
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
shopbuilder / app / Elementor / Widgets / Single / ProductReviews.php

ProductReviews.php in ShopBuilder – WooCommerce Builder For Elementor 2.2.2, at app/Elementor/Widgets/Single/ProductReviews.php

98 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Main ProductDescription class.
5 *
6 * @package RadiusTheme\SB
7 */
8
9 namespace RadiusTheme\SB\Elementor\Widgets\Single;
10
11 use RadiusTheme\SB\Helpers\Fns;
12 use RadiusTheme\SB\Abstracts\ElementorWidgetBase;
13 use RadiusTheme\SB\Elementor\Widgets\Controls\ReviewsSettings;
14
15 // Do not allow directly accessing this file.
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit( 'This script cannot be accessed directly.' );
18 }
19
20 /**
21 * Product Description class
22 */
23 class ProductReviews extends ElementorWidgetBase {
24
25 /**
26 * Construct function
27 *
28 * @param array $data default array.
29 * @param mixed $args default arg.
30 */
31 public function __construct( $data = [], $args = null ) {
32 $this->rtsb_name = esc_html__( 'Product Reviews', 'shopbuilder' );
33 $this->rtsb_base = 'rtsb-product-reviews';
34 parent::__construct( $data, $args );
35 $this->pro_tab = 'style';
36 }
37 /**
38 * Widget Field
39 *
40 * @return array
41 */
42 public function widget_fields() {
43 return ReviewsSettings::widget_fields( $this );
44 }
45 /**
46 * Undocumented function
47 *
48 * @return void
49 */
50 public function product_page_script() {
51 ?>
52 <script type="text/javascript">
53 jQuery(function($) {
54 jQuery('.rtsb-product-comment').find('#rating')
55 .hide()
56 .before(
57 '<p class="stars">\
58 <span>\
59 <a class="star-1" href="#">1</a>\
60 <a class="star-2" href="#">2</a>\
61 <a class="star-3" href="#">3</a>\
62 <a class="star-4" href="#">4</a>\
63 <a class="star-5" href="#">5</a>\
64 </span>\
65 </p>'
66 );
67 });
68 </script>
69 <?php
70 }
71 /**
72 * Render Function
73 *
74 * @return void
75 */
76 protected function render() {
77 global $product, $post, $comments;
78 $_post = $post;
79 $_product = $product;
80 $product = Fns::get_product();
81 $controllers = $this->get_settings_for_display();
82 $this->theme_support();
83 $data = [
84 'template' => 'elementor/single-product/reviews',
85 'controllers' => $controllers,
86 ];
87 if ( $this->is_builder_mode() ) {
88 // Overriding Global.
89 $post = get_post( Fns::get_prepared_product_id() ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
90 $this->product_page_script();
91 }
92 Fns::load_template( $data['template'], $data );
93 $this->theme_support( 'render_reset' );
94 $product = $_product; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
95 $post = $_post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
96 }
97 }
98