PluginProbe
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment / 3.1.14
FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment v3.1.14
3.1.14 3.1.13 3.1.12 3.1.11 3.1.10 3.1.9 3.1.8 3.1.7 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 All 123 releases
firebox / Inc / Framework / Inc / Base / Widgets / Rating.php

Rating.php in FireBox – WooCommerce Popup Builder, Exit Intent Popup, Email Optin & Cart Abandonment 3.1.14, at Inc/Framework/Inc/Base/Widgets/Rating.php

122 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package FirePlugins Framework
4 * @version 1.2.6
5 *
6 * @author FirePlugins <[email protected]>
7 * @link https://www.fireplugins.com
8 * @copyright Copyright © 2026 FirePlugins All Rights Reserved
9 * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later
10 */
11
12 namespace FPFramework\Base\Widgets;
13
14 if (!defined('ABSPATH'))
15 {
16 exit; // Exit if accessed directly.
17 }
18
19 /**
20 * The Rating Widget
21 */
22 class Rating extends Widget
23 {
24 /**
25 * Widget default options
26 *
27 * @var array
28 */
29 protected $widget_options = [
30 // The SVG icon representing the rating icon. Available values: check, circle, flag, heart, smiley, square, star, thumbs_up
31 'icon' => 'star',
32
33 // The default value of the widget.
34 'value' => 0,
35
36 // How many stars to show?
37 'max_rating' => 5,
38
39 // Whether to show half ratings
40 'half_ratings' => false,
41
42 // The size of the rating icon in pixels.
43 'size' => 24,
44
45 // The color of the icon in the default state
46 'selected_color' => '#f6cc01',
47
48 // The color of the icon in the selected and hover state
49 'unselected_color' => '#bdbdbd'
50 ];
51
52 /**
53 * Class constructor
54 *
55 * @param array $options
56 */
57 public function __construct($options = [])
58 {
59 parent::__construct($options);
60
61 $this->options['value'] = $this->options['value'] > $this->options['max_rating'] ? $this->options['max_rating'] : $this->options['value'];
62 $this->options['icon_url'] = FPF_MEDIA_URL . 'public/images/svg/rating/' . $this->options['icon'] . '.svg';
63 $this->options['max_rating'] = $this->options['half_ratings'] ? 2 * $this->options['max_rating'] : $this->options['max_rating'];
64 }
65
66 /**
67 * Registers assets
68 *
69 * @return void
70 */
71 public static function register_assets()
72 {
73 wp_register_script(
74 'fpframework-rating-widget',
75 FPF_MEDIA_URL . 'public/js/widgets/rating.js',
76 [],
77 FPF_VERSION,
78 true
79 );
80
81 wp_register_style(
82 'fpframework-rating-widget',
83 FPF_MEDIA_URL . 'public/css/widgets/rating.css',
84 [],
85 FPF_VERSION,
86 false
87 );
88 }
89
90 /**
91 * Enqueues assets
92 *
93 * @return void
94 */
95 public function enqueue_assets()
96 {
97 if ($this->options['load_stylesheet'])
98 {
99 wp_enqueue_style('fpframework-rating-widget');
100 }
101 else
102 {
103 wp_deregister_style('fpframework-rating-widget');
104 }
105
106 if (!$this->options['readonly'] && !$this->options['disabled'])
107 {
108 wp_enqueue_script('fpframework-rating-widget');
109 }
110 }
111
112 /**
113 * Registers & enqueues assets
114 *
115 * @return void
116 */
117 public function public_assets()
118 {
119 self::register_assets();
120 $this->enqueue_assets();
121 }
122 }