Yasr – Yet Another Stars Rating - Version 2.5.1

Version Description

  • TWEAKED: added new hooks: yasr_vv_shortcode, yasr_vv_ro_shortcode and yasr_overall_shortcode. These hooks can be used to customize the shortcodes.
Download this release

Release Info

Developer Dudo
Plugin Icon 128x128 Yasr – Yet Another Stars Rating
Version 2.5.1
Comparing to
See all releases

Code changes from version 2.5.0 to 2.5.1

admin/settings/classes/YasrImportRatingPlugins.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+
4
+ Copyright 2020 Dario Curvino (email : d.curvino@tiscali.it)
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 2 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>
18
+ */
19
+
20
+ if (!defined('ABSPATH')) {
21
+ exit('You\'re not allowed to see this page');
22
+ } // Exit if accessed directly
23
+
24
+ /****** Check for previous rate my post INSTALLATION *******/
25
+ class YasrImportRatingPlugins {
26
+
27
+ //Search for WP-PostRatings
28
+ public function yasr_search_wppr() {
29
+ //only check for active plugin, since import from table will be not used
30
+ if (is_plugin_active('wp-postratings/wp-postratings.php')) {
31
+ return true;
32
+ }
33
+ return false;
34
+ }
35
+
36
+ //Search for KK STar Rating
37
+ public function yasr_search_kksr() {
38
+ //only check for active plugin, since import from table will be not used
39
+ if (is_plugin_active('kk-star-ratings/index.php')) {
40
+ return true;
41
+ }
42
+ return false;
43
+ }
44
+
45
+ //Search for Rate My Post
46
+ public function yasr_search_rmp() {
47
+ if (is_plugin_active('rate-my-post/rate-my-post.php')) {
48
+ return true;
49
+ }
50
+ global $wpdb;
51
+
52
+ $rmp_table = $wpdb->prefix . 'rmp_analytics';
53
+
54
+ if ($wpdb->get_var("SHOW TABLES LIKE '$rmp_table'") === $rmp_table) {
55
+ return true;
56
+ }
57
+ return false;
58
+ }
59
+
60
+ //Search for Multi Rating
61
+ function yasr_search_mr() {
62
+ //only check for active plugin, since import from table will be not used
63
+ if (is_plugin_active('multi-rating/multi-rating.php')) {
64
+ return true;
65
+ }
66
+ return false;
67
+ }
68
+
69
+ public function yasr_count_wppr_query_number() {
70
+ $number_of_query_transient = get_transient('yasr_wppr_import_query_number');
71
+
72
+ if ($number_of_query_transient !== false) {
73
+ return $number_of_query_transient;
74
+ }
75
+
76
+ $logs = $this->yasr_return_wppr_data();
77
+
78
+ //set counter to 0
79
+ $i = 0;
80
+
81
+ if (empty($logs)) {
82
+ return 0;
83
+ }
84
+
85
+ //count insert queries
86
+ foreach ($logs as $column) {
87
+ for ($j = 1; $j <= $column->ratings_users; $j++) {
88
+ $i++;
89
+ }
90
+ }
91
+
92
+ set_transient('yasr_wppr_import_query_number', $i, DAY_IN_SECONDS);
93
+
94
+ return $i;
95
+
96
+ }
97
+
98
+ public function yasr_count_kksr_query_number() {
99
+ $number_of_query_transient = get_transient('yasr_kksr_import_query_number');
100
+
101
+ if ($number_of_query_transient !== false) {
102
+ return $number_of_query_transient;
103
+ }
104
+
105
+ $logs = $this->yasr_return_kksr_data();
106
+
107
+ //set counter to 0
108
+ $i = 0;
109
+
110
+ if (empty($logs)) {
111
+ return 0;
112
+ }
113
+
114
+ //count insert queries
115
+ foreach ($logs as $column) {
116
+ for ($j = 1; $j <= $column->ratings_users; $j++) {
117
+ $i++;
118
+ }
119
+ }
120
+
121
+ set_transient('yasr_kksr_import_query_number', $i, DAY_IN_SECONDS);
122
+
123
+ return $i;
124
+
125
+ }
126
+
127
+ public function yasr_count_rmp_query_number() {
128
+ global $wpdb;
129
+
130
+ $number_of_query_transient = get_transient('yasr_rmp_import_query_number');
131
+
132
+ if ($number_of_query_transient !== false) {
133
+ return $number_of_query_transient;
134
+ }
135
+
136
+ $logs = $this->yasr_return_rmp_data();
137
+
138
+ if (empty($logs)) {
139
+ return 0;
140
+ }
141
+
142
+ set_transient('yasr_rmp_import_query_number', $wpdb->num_rows, DAY_IN_SECONDS);
143
+
144
+ return $wpdb->num_rows;
145
+
146
+ }
147
+
148
+ public function yasr_count_mr_query_number() {
149
+ $number_of_query_transient = get_transient('yasr_mr_import_query_number');
150
+
151
+ if ($number_of_query_transient !== false) {
152
+ return $number_of_query_transient;
153
+ }
154
+
155
+ $logs = $this->yasr_return_mr_data();
156
+
157
+ //set counter to 0
158
+ $i = 0;
159
+
160
+ if (empty($logs)) {
161
+ return 0;
162
+ }
163
+
164
+ //count insert queries
165
+ foreach ($logs as $column) {
166
+ for ($j = 1; $j <= $column->ratings_users; $j++) {
167
+ $i++;
168
+ }
169
+ }
170
+ set_transient('yasr_mr_import_query_number', $i, DAY_IN_SECONDS);
171
+
172
+ return $i;
173
+
174
+ }
175
+
176
+ //Import WpPostRating Data
177
+ public function yasr_return_wppr_data() {
178
+ global $wpdb;
179
+
180
+ $logs = $wpdb->get_results(
181
+ "
182
+ SELECT pm.post_id,
183
+ MAX(CASE WHEN pm.meta_key = 'ratings_average' THEN pm.meta_value END) as ratings_average,
184
+ MAX(CASE WHEN pm.meta_key = 'ratings_users' THEN pm.meta_value END) as ratings_users
185
+ FROM $wpdb->postmeta as pm,
186
+ $wpdb->posts as p
187
+ WHERE pm.meta_key IN ('ratings_average', 'ratings_users')
188
+ AND pm.meta_value <> 0
189
+ AND pm.post_id = p.ID
190
+ GROUP BY pm.post_id ASC
191
+ ORDER BY pm.post_id
192
+ "
193
+ );
194
+
195
+ if (empty($logs)) {
196
+ return 0;
197
+ }
198
+
199
+ return $logs;
200
+ }
201
+
202
+ //Import KK Star Rating Data
203
+ function yasr_return_kksr_data() {
204
+ global $wpdb;
205
+
206
+ $logs = $wpdb->get_results(
207
+ "
208
+ SELECT pm.post_id,
209
+ MAX(CASE WHEN pm.meta_key = '_kksr_avg' THEN pm.meta_value END) as ratings_average,
210
+ MAX(CASE WHEN pm.meta_key = '_kksr_casts' THEN pm.meta_value END) as ratings_users
211
+ FROM $wpdb->postmeta as pm,
212
+ $wpdb->posts as p
213
+ WHERE pm.meta_key IN ('_kksr_avg', '_kksr_casts')
214
+ AND pm.meta_value <> 0
215
+ AND pm.post_id = p.ID
216
+ GROUP BY pm.post_id ASC
217
+ ORDER BY pm.post_id
218
+ "
219
+ );
220
+
221
+ if (empty($logs)) {
222
+ return 0;
223
+ }
224
+
225
+ return $logs;
226
+ }
227
+
228
+ public function yasr_return_rmp_data() {
229
+ global $wpdb;
230
+
231
+ $rmp_table = $wpdb->prefix . 'rmp_analytics';
232
+
233
+ //get logs
234
+ $logs = $wpdb->get_results(
235
+ "
236
+ SELECT rmp.post AS post_id,
237
+ rmp.value as vote,
238
+ rmp.time AS date,
239
+ p.ID
240
+ FROM $rmp_table AS rmp,
241
+ $wpdb->posts AS p
242
+ WHERE rmp.post = p.id"
243
+ );
244
+
245
+ if (empty($logs)) {
246
+ return 0;
247
+ }
248
+
249
+ return $logs;
250
+ }
251
+
252
+ //Import Multi Rating Data
253
+ public function yasr_return_mr_data() {
254
+ global $wpdb;
255
+
256
+ $logs = $wpdb->get_results(
257
+ "
258
+ SELECT pm.post_id,
259
+ MAX(CASE WHEN pm.meta_key = 'mr_rating_results_star_rating' THEN pm.meta_value END) as ratings_average,
260
+ MAX(CASE WHEN pm.meta_key = 'mr_rating_results_count_entries' THEN pm.meta_value END) as ratings_users
261
+ FROM $wpdb->postmeta as pm,
262
+ $wpdb->posts as p
263
+ WHERE pm.meta_key IN ('mr_rating_results_star_rating', 'mr_rating_results_count_entries')
264
+ AND pm.meta_value <> 0
265
+ AND pm.post_id = p.ID
266
+ GROUP BY pm.post_id ASC
267
+ ORDER BY pm.post_id
268
+ "
269
+ );
270
+
271
+ if (empty($logs)) {
272
+ return 0;
273
+ }
274
+
275
+ return $logs;
276
+ }
277
+
278
+ }
admin/settings/classes/YasrStatsVisitorMulti.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see <http://www.gnu.org/licenses/>
19
+ */
20
+
21
+ if ( ! defined( 'ABSPATH' ) ) {
22
+ exit( 'You\'re not allowed to see this page' );
23
+ } // Exit if accessed directly
24
+
25
+ /**
26
+ * Create a new table class that will extend the WP_List_Table
27
+ */
28
+ class YasrStatsVisitorMulti extends YASR_WP_List_Table {
29
+
30
+ private $active_tab;
31
+
32
+ function __construct($active_tab) {
33
+ parent::__construct();
34
+ $this->active_tab = $active_tab;
35
+ }
36
+ /**
37
+ * Prepare the items for the table to process
38
+ *
39
+ * @return Void
40
+ */
41
+ public function prepare_items() {
42
+ $columns = $this->get_columns();
43
+ $hidden = $this->get_hidden_columns();
44
+ $sortable = $this->get_sortable_columns();
45
+
46
+ //print bulk_Actions
47
+ $this->get_bulk_actions();
48
+ $this->process_bulk_action();
49
+
50
+ $table = YASR_LOG_TABLE;
51
+
52
+ if($this->active_tab === 'logs_multi') {
53
+ $table = YASR_LOG_MULTI_SET;
54
+ }
55
+
56
+ global $wpdb;
57
+
58
+ $query = "SELECT * FROM $table ORDER BY date";
59
+
60
+ if ($table === YASR_LOG_MULTI_SET) {
61
+ $query .= ', set_type, post_id DESC';
62
+ }
63
+
64
+ $data = $wpdb->get_results($query, ARRAY_A);
65
+
66
+ usort($data, array( $this, 'sort_data' ));
67
+
68
+ $perPage = 25;
69
+ $currentPage = $this->get_pagenum();
70
+ $totalItems = count($data);
71
+
72
+ $this->set_pagination_args(
73
+ array(
74
+ 'total_items' => $totalItems,
75
+ 'per_page' => $perPage
76
+ )
77
+ );
78
+
79
+ $data = array_slice($data, (( $currentPage - 1 ) * $perPage ), $perPage);
80
+
81
+ $this->_column_headers = array( $columns, $hidden, $sortable );
82
+ $this->items = $data;
83
+
84
+ }
85
+
86
+ /**
87
+ * Override the parent columns method. Defines the columns to use in your listing table
88
+ *
89
+ * @return Array
90
+ */
91
+ public function get_columns() {
92
+
93
+ $columns = array(
94
+ 'cb' => '<input type="checkbox" />',
95
+ 'id' => 'ID',
96
+ 'post_id' => 'Title',
97
+ 'vote' => 'Vote',
98
+ 'user_id' => 'User ID',
99
+ 'date' => 'Date'
100
+ );
101
+
102
+ if($this->active_tab === 'logs_multi') {
103
+ //insert multiset and field name
104
+ $columns = array_slice($columns, 0, 3, true) +
105
+ array('set_type' => 'MultiSet', 'field_id' => 'Field Name') +
106
+ array_slice($columns, 3, count($columns) - 1, true) ;
107
+ }
108
+
109
+ if (YASR_ENABLE_IP === 'yes') {
110
+ $columns['ip'] = 'IP';
111
+ }
112
+ return $columns;
113
+ }
114
+
115
+ /**
116
+ * Define which columns are hidden
117
+ *
118
+ * @return Array
119
+ */
120
+ public function get_hidden_columns() {
121
+ return array('id');
122
+ }
123
+
124
+ /**
125
+ * Define the sortable columns
126
+ *
127
+ * @return Array
128
+ */
129
+ public function get_sortable_columns() {
130
+
131
+ $sortable_columns = array(
132
+ 'post_id' => array('post_id', false),
133
+ 'user_id' => array('user_id', false),
134
+ 'vote' => array('vote', false),
135
+ 'date' => array('date', false),
136
+ 'ip' => array('ip', false)
137
+ );
138
+
139
+ if($this->active_tab === 'logs_multi') {
140
+ $sortable_columns['set_type'] = array('set_type', false);
141
+ $sortable_columns['field_id'] = array('field_id', false);
142
+ }
143
+
144
+ return $sortable_columns;
145
+ }
146
+
147
+ /**
148
+ * Define what data to show on each column of the table
149
+ *
150
+ * @param Array $item Data
151
+ * @param String $column_name - Current column name
152
+ *
153
+ * @return Mixed|void
154
+ */
155
+ protected function column_default( $item, $column_name ) {
156
+
157
+ global $wpdb;
158
+
159
+ if (isset($item['set_type'])) {
160
+ $set_id = (int)$item['set_type'];
161
+ }
162
+
163
+ switch ($column_name) {
164
+ case 'post_id':
165
+ $post_id = $item[$column_name];
166
+
167
+ $title_post = wp_strip_all_tags(get_the_title($post_id));
168
+ $link = get_permalink($post_id);
169
+
170
+ return '<a href="' . $link . '">' . $title_post . '</a>';
171
+
172
+ case 'user_id':
173
+ $user_id = $item[$column_name];
174
+
175
+ $user = get_user_by('id', $user_id);
176
+
177
+ //If !user means that the vote are anonymous
178
+ if ($user === false) {
179
+ $user = (object) array( 'user_login' );
180
+ $user->user_login = __('anonymous', 'yet-another-stars-rating');
181
+ }
182
+
183
+ return $user->user_login;
184
+
185
+ case 'set_type':
186
+ $data = $wpdb->get_results(
187
+ $wpdb->prepare(
188
+ "SELECT set_name
189
+ FROM " . YASR_MULTI_SET_NAME_TABLE . "
190
+ WHERE set_id = %d", $set_id),
191
+ ARRAY_A);
192
+
193
+ if(!empty($data)) {
194
+ return $data[0]['set_name'];
195
+ }
196
+
197
+ return __('Multi Set doesn\'t exists', 'yet-another-stars-rating');
198
+
199
+ case 'field_id':
200
+ $field_id = $item[$column_name];
201
+ $data = $wpdb->get_results(
202
+ $wpdb->prepare(
203
+ "SELECT field_name
204
+ FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
205
+ WHERE parent_set_id = %d
206
+ AND field_id = %d",
207
+ $set_id, $field_id),
208
+ ARRAY_A);
209
+
210
+ if(!empty($data)) {
211
+ return $data[0]['field_name'];
212
+ }
213
+
214
+ return __('Field doesn\'t exists', 'yet-another-stars-rating');
215
+
216
+ case 'date':
217
+ $date = $item[$column_name];
218
+ if($item[$column_name] === '0000-00-00 00:00:00') {
219
+ $date = __('Imported Data', 'yet-another-stars-rating');
220
+ }
221
+ return $date;
222
+
223
+ //All other columns must return their content
224
+ case 'vote':
225
+ case 'ip':
226
+ return $item[$column_name];
227
+ }
228
+ return;
229
+ }
230
+
231
+ /**
232
+ * Allows you to sort the data by the variables set in the $_GET
233
+ *
234
+ * @return Mixed
235
+ */
236
+ protected function sort_data( $a, $b ) {
237
+
238
+ // Set defaults (just need to avoid undefined variable at first load,
239
+ // it is already ordered with the query
240
+ $orderby = 'date';
241
+ $order = 'desc';
242
+
243
+ // If orderby is set, use this as the sort column
244
+ if (!empty($_GET['orderby'])) {
245
+ $orderby = $_GET['orderby'];
246
+ }
247
+
248
+ // If order is set use this as the order
249
+ if (!empty($_GET['order'])) {
250
+ $order = $_GET['order'];
251
+ }
252
+
253
+ $result = strcmp($a[ $orderby ], $b[ $orderby ]);
254
+
255
+ if ($order === 'asc') {
256
+ return $result;
257
+ }
258
+
259
+ return - $result;
260
+ }
261
+
262
+
263
+ protected function get_bulk_actions() {
264
+ $actions = array(
265
+ 'delete' => 'Delete'
266
+ );
267
+ return $actions;
268
+ }
269
+
270
+ protected function column_cb($item) {
271
+
272
+ return sprintf(
273
+ "<input type='checkbox' name='yasr_logs_votes_to_delete[]' id='{$item['id']}' value='{$item['id']}' />"
274
+ );
275
+ }
276
+
277
+ //process bulk action
278
+ protected function process_bulk_action() {
279
+ if ($this->current_action() === 'delete') {
280
+ check_admin_referer( 'yasr-delete-stats-logs', 'yasr-nonce-delete-stats-logs' );
281
+
282
+ global $wpdb;
283
+
284
+ $table = YASR_LOG_TABLE;
285
+
286
+ if($this->active_tab === 'logs_multi') {
287
+ $table = YASR_LOG_MULTI_SET;
288
+ }
289
+
290
+ foreach ($_POST['yasr_logs_votes_to_delete'] as $log_id) {
291
+ //force to be an int
292
+ $log_id = (int)$log_id;
293
+
294
+ //Find the post_id
295
+ $post_id = $wpdb->get_var(
296
+ $wpdb->prepare(
297
+ "SELECT post_id FROM
298
+ $table
299
+ WHERE id = %d",
300
+ $log_id
301
+ )
302
+ );
303
+
304
+ //find set_id
305
+ if($this->active_tab === 'logs_multi') {
306
+ $set_id = $wpdb->get_var(
307
+ $wpdb->prepare(
308
+ "SELECT set_type FROM $table WHERE id = %d",
309
+ $log_id
310
+ )
311
+ );
312
+ }
313
+
314
+ //delete the log id
315
+ $wpdb->delete(
316
+ $table,
317
+ array(
318
+ 'id' => $log_id
319
+ ),
320
+ array( '%d' )
321
+ );
322
+
323
+ }
324
+ }
325
+
326
+ }
327
+
328
+ }
admin/settings/migrations/yasr-settings-migration-functions.php CHANGED
@@ -1,256 +1,26 @@
1
  <?php
2
 
3
- /****** Check for previous rate my post INSTALLATION *******/
4
- class YasrSearchAndImportRatingPlugin {
5
-
6
- //Search for WP-PostRatings
7
- function yasr_search_wppr() {
8
- //only check for active plugin, since import from table will be not used
9
- if (is_plugin_active('wp-postratings/wp-postratings.php')) {
10
- return true;
11
- }
12
- return false;
13
- }
14
-
15
- //Search for KK STar Rating
16
- function yasr_search_kksr () {
17
- //only check for active plugin, since import from table will be not used
18
- if (is_plugin_active('kk-star-ratings/index.php')) {
19
- return true;
20
- }
21
- return false;
22
- }
23
-
24
- //Search for Rate My Post
25
- function yasr_search_rmp () {
26
- if (is_plugin_active('rate-my-post/rate-my-post.php')) {
27
- return true;
28
- }
29
- global $wpdb;
30
-
31
- $rmp_table = $wpdb->prefix . 'rmp_analytics';
32
-
33
- if ($wpdb->get_var("SHOW TABLES LIKE '$rmp_table'") === $rmp_table) {
34
- return true;
35
- }
36
- return false;
37
- }
38
 
39
- //Search for Multi Rating
40
- function yasr_search_mr () {
41
- //only check for active plugin, since import from table will be not used
42
- if (is_plugin_active('multi-rating/multi-rating.php')) {
43
- return true;
44
- }
45
- return false;
46
- }
47
-
48
- public function yasr_count_wppr_query_number () {
49
- $number_of_query_transient = get_transient('yasr_wppr_import_query_number');
50
-
51
- if($number_of_query_transient !== false) {
52
- return $number_of_query_transient;
53
- }
54
-
55
- $logs = $this->yasr_return_wppr_data();
56
 
57
- //set counter to 0
58
- $i = 0;
 
 
59
 
60
- if (empty($logs)) {
61
- return 0;
62
- }
63
-
64
- //count insert queries
65
- foreach ($logs as $column) {
66
- for ($j=1; $j<=$column->ratings_users; $j++) {
67
- $i ++;
68
- }
69
- }
70
 
71
- set_transient('yasr_wppr_import_query_number', $i, DAY_IN_SECONDS);
 
 
72
 
73
- return $i;
74
-
75
- }
76
-
77
- public function yasr_count_kksr_query_number () {
78
- $number_of_query_transient = get_transient('yasr_kksr_import_query_number');
79
-
80
- if($number_of_query_transient !== false) {
81
- return $number_of_query_transient;
82
- }
83
-
84
- $logs = $this->yasr_return_kksr_data();
85
-
86
- //set counter to 0
87
- $i = 0;
88
-
89
- if (empty($logs)) {
90
- return 0;
91
- }
92
-
93
- //count insert queries
94
- foreach ($logs as $column) {
95
- for ($j=1; $j<=$column->ratings_users; $j++) {
96
- $i ++;
97
- }
98
- }
99
-
100
- set_transient('yasr_kksr_import_query_number', $i, DAY_IN_SECONDS);
101
-
102
- return $i;
103
-
104
- }
105
-
106
- public function yasr_count_rmp_query_number () {
107
- global $wpdb;
108
-
109
- $number_of_query_transient = get_transient('yasr_rmp_import_query_number');
110
-
111
- if($number_of_query_transient !== false) {
112
- return $number_of_query_transient;
113
- }
114
-
115
- $logs = $this->yasr_return_rmp_data();
116
-
117
- if (empty($logs)) {
118
- return 0;
119
- }
120
-
121
- set_transient('yasr_rmp_import_query_number', $wpdb->num_rows, DAY_IN_SECONDS);
122
-
123
- return $wpdb->num_rows;
124
-
125
- }
126
-
127
- public function yasr_count_mr_query_number () {
128
- $number_of_query_transient = get_transient('yasr_mr_import_query_number');
129
-
130
- if($number_of_query_transient !== false) {
131
- return $number_of_query_transient;
132
- }
133
-
134
- $logs =$this->yasr_return_mr_data();
135
-
136
- //set counter to 0
137
- $i = 0;
138
-
139
- if (empty($logs)) {
140
- return 0;
141
- }
142
-
143
- //count insert queries
144
- foreach ($logs as $column) {
145
- for ($j=1; $j<=$column->ratings_users; $j++) {
146
- $i ++;
147
- }
148
- }
149
- set_transient('yasr_mr_import_query_number', $i, DAY_IN_SECONDS);
150
-
151
- return $i;
152
-
153
- }
154
-
155
- //Import WpPostRating Data
156
- public function yasr_return_wppr_data () {
157
- global $wpdb;
158
-
159
- $logs = $wpdb->get_results("
160
- SELECT pm.post_id,
161
- MAX(CASE WHEN pm.meta_key = 'ratings_average' THEN pm.meta_value END) as ratings_average,
162
- MAX(CASE WHEN pm.meta_key = 'ratings_users' THEN pm.meta_value END) as ratings_users
163
- FROM $wpdb->postmeta as pm,
164
- $wpdb->posts as p
165
- WHERE pm.meta_key IN ('ratings_average', 'ratings_users')
166
- AND pm.meta_value <> 0
167
- AND pm.post_id = p.ID
168
- GROUP BY pm.post_id ASC
169
- ORDER BY pm.post_id
170
- "
171
- );
172
-
173
- if (empty($logs)) {
174
- return 0;
175
- }
176
-
177
- return $logs;
178
- }
179
-
180
- //Import KK Star Rating Data
181
- function yasr_return_kksr_data() {
182
- global $wpdb;
183
-
184
- $logs=$wpdb->get_results("
185
- SELECT pm.post_id,
186
- MAX(CASE WHEN pm.meta_key = '_kksr_avg' THEN pm.meta_value END) as ratings_average,
187
- MAX(CASE WHEN pm.meta_key = '_kksr_casts' THEN pm.meta_value END) as ratings_users
188
- FROM $wpdb->postmeta as pm,
189
- $wpdb->posts as p
190
- WHERE pm.meta_key IN ('_kksr_avg', '_kksr_casts')
191
- AND pm.meta_value <> 0
192
- AND pm.post_id = p.ID
193
- GROUP BY pm.post_id ASC
194
- ORDER BY pm.post_id
195
- "
196
- );
197
-
198
- if (empty($logs)) {
199
- return 0;
200
- }
201
-
202
- return $logs;
203
- }
204
-
205
- public function yasr_return_rmp_data() {
206
- global $wpdb;
207
-
208
- $rmp_table=$wpdb->prefix . 'rmp_analytics';
209
-
210
- //get logs
211
- $logs=$wpdb->get_results("
212
- SELECT rmp.post AS post_id,
213
- rmp.value as vote,
214
- rmp.time AS date,
215
- p.ID
216
- FROM $rmp_table AS rmp,
217
- $wpdb->posts AS p
218
- WHERE rmp.post = p.id"
219
- );
220
-
221
- if (empty($logs)) {
222
- return 0;
223
- }
224
-
225
- return $logs;
226
- }
227
-
228
- //Import Multi Rating Data
229
- public function yasr_return_mr_data() {
230
- global $wpdb;
231
-
232
- $logs = $wpdb->get_results("
233
- SELECT pm.post_id,
234
- MAX(CASE WHEN pm.meta_key = 'mr_rating_results_star_rating' THEN pm.meta_value END) as ratings_average,
235
- MAX(CASE WHEN pm.meta_key = 'mr_rating_results_count_entries' THEN pm.meta_value END) as ratings_users
236
- FROM $wpdb->postmeta as pm,
237
- $wpdb->posts as p
238
- WHERE pm.meta_key IN ('mr_rating_results_star_rating', 'mr_rating_results_count_entries')
239
- AND pm.meta_value <> 0
240
- AND pm.post_id = p.ID
241
- GROUP BY pm.post_id ASC
242
- ORDER BY pm.post_id
243
- "
244
- );
245
-
246
- if (empty($logs)) {
247
- return 0;
248
- }
249
-
250
- return $logs;
251
- }
252
-
253
- }
254
 
255
  add_action( 'wp_ajax_yasr_import_wppr', 'yasr_import_wppr_callback' );
256
 
@@ -277,7 +47,7 @@ function yasr_import_wppr_callback() {
277
  //It has his own table too, but can be disabled in the settings.
278
  //The only way to be sure is get the postmeta
279
 
280
- $wppr = new YasrSearchAndImportRatingPlugin();
281
 
282
  $logs = $wppr->yasr_return_wppr_data();
283
 
@@ -347,7 +117,7 @@ function yasr_import_kksr_callback() {
347
 
348
  //get logs
349
  //With KK star rating I need to import postmeta.
350
- $kksr = new YasrSearchAndImportRatingPlugin();
351
 
352
  $logs= $kksr->yasr_return_kksr_data();
353
 
@@ -408,7 +178,7 @@ function yasr_import_ratemypost_callback() {
408
 
409
  global $wpdb;
410
 
411
- $rmp = new YasrSearchAndImportRatingPlugin();
412
 
413
  //get logs
414
  $logs=$rmp->yasr_return_rmp_data();
@@ -463,7 +233,7 @@ function yasr_import_mr_callback() {
463
 
464
  global $wpdb;
465
 
466
- $mr_exists = new YasrSearchAndImportRatingPlugin;
467
 
468
  //get logs
469
  //With Multi Rating I need to import postmeta.
1
  <?php
2
 
3
+ /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 2 of the License, or
10
+ (at your option) any later version.
11
 
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
 
 
 
 
 
 
16
 
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see <http://www.gnu.org/licenses/>
19
+ */
20
 
21
+ if ( ! defined( 'ABSPATH' ) ) {
22
+ exit( 'You\'re not allowed to see this page' );
23
+ } // Exit if accessed directly
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  add_action( 'wp_ajax_yasr_import_wppr', 'yasr_import_wppr_callback' );
26
 
47
  //It has his own table too, but can be disabled in the settings.
48
  //The only way to be sure is get the postmeta
49
 
50
+ $wppr = new YasrImportRatingPlugins();
51
 
52
  $logs = $wppr->yasr_return_wppr_data();
53
 
117
 
118
  //get logs
119
  //With KK star rating I need to import postmeta.
120
+ $kksr = new YasrImportRatingPlugins();
121
 
122
  $logs= $kksr->yasr_return_kksr_data();
123
 
178
 
179
  global $wpdb;
180
 
181
+ $rmp = new YasrImportRatingPlugins();
182
 
183
  //get logs
184
  $logs=$rmp->yasr_return_rmp_data();
233
 
234
  global $wpdb;
235
 
236
+ $mr_exists = new YasrImportRatingPlugins();
237
 
238
  //get logs
239
  //With Multi Rating I need to import postmeta.
admin/settings/migrations/yasr-settings-migration-page.php CHANGED
@@ -33,7 +33,7 @@ $plugin_imported = get_option('yasr_plugin_imported');
33
  <td>
34
  <div>
35
  <?php
36
- $rating_plugin_exists = new YasrSearchAndImportRatingPlugin;
37
 
38
  if (!$rating_plugin_exists->yasr_search_wppr() && !$rating_plugin_exists->yasr_search_rmp()
39
  && !$rating_plugin_exists->yasr_search_kksr() && !!$rating_plugin_exists->yasr_search_mr()) {
33
  <td>
34
  <div>
35
  <?php
36
+ $rating_plugin_exists = new YasrImportRatingPlugins;
37
 
38
  if (!$rating_plugin_exists->yasr_search_wppr() && !$rating_plugin_exists->yasr_search_rmp()
39
  && !$rating_plugin_exists->yasr_search_kksr() && !!$rating_plugin_exists->yasr_search_mr()) {
admin/settings/yasr-settings-functions-misc.php CHANGED
@@ -45,7 +45,7 @@ function yasr_settings_tabs( $active_tab )
45
 
46
  <?php
47
  do_action( 'yasr_add_settings_tab', $active_tab );
48
- $rating_plugin_exists = new YasrSearchAndImportRatingPlugin();
49
 
50
  if ( $rating_plugin_exists->yasr_search_wppr() || $rating_plugin_exists->yasr_search_rmp() || $rating_plugin_exists->yasr_search_kksr() || $rating_plugin_exists->yasr_search_mr() ) {
51
  ?>
@@ -201,7 +201,7 @@ function yasr_resources_box( $position = false )
201
  function yasr_ask_rating( $position = false )
202
  {
203
 
204
- if ( $position && $position == "bottom" ) {
205
  $yasr_metabox_class = "yasr-donatedivbottom";
206
  } else {
207
  $yasr_metabox_class = "yasr-donatedivdx";
45
 
46
  <?php
47
  do_action( 'yasr_add_settings_tab', $active_tab );
48
+ $rating_plugin_exists = new YasrImportRatingPlugins();
49
 
50
  if ( $rating_plugin_exists->yasr_search_wppr() || $rating_plugin_exists->yasr_search_rmp() || $rating_plugin_exists->yasr_search_kksr() || $rating_plugin_exists->yasr_search_mr() ) {
51
  ?>
201
  function yasr_ask_rating( $position = false )
202
  {
203
 
204
+ if ( $position && $position === "bottom" ) {
205
  $yasr_metabox_class = "yasr-donatedivbottom";
206
  } else {
207
  $yasr_metabox_class = "yasr-donatedivdx";
admin/settings/yasr-stats-page.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see <http://www.gnu.org/licenses/>
19
+ */
20
+
21
+ if (!defined('ABSPATH')) {
22
+ exit('You\'re not allowed to see this page');
23
+ } // Exit if accessed directly
24
+
25
+ if (!current_user_can('manage_options')) {
26
+ wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
27
+ }
28
+
29
+ ?>
30
+
31
+ <div class="wrap">
32
+
33
+ <h2>Yet Another Stars Rating: <?php _e("Ratings Stats", 'yet-another-stars-rating'); ?></h2>
34
+
35
+ <?php
36
+ if (isset($_GET['tab'])) {
37
+ $active_tab = $_GET['tab'];
38
+ } else {
39
+ $active_tab = 'logs';
40
+ }
41
+ ?>
42
+
43
+ <h2 class="nav-tab-wrapper yasr-no-underline">
44
+
45
+ <?php /*
46
+ <a href="?page=yasr_stats_page&tab=logs_overall" class="nav-tab
47
+ <?php echo ($active_tab === 'logs_overall') ? 'nav-tab-active' : ''; ?>"
48
+ >
49
+ <?php _e("Overall Rating", 'yet-another-stars-rating'); ?>
50
+ </a>
51
+ */ ?>
52
+
53
+ <a href="?page=yasr_stats_page&tab=logs" class="nav-tab
54
+ <?php echo ($active_tab === 'logs') ? 'nav-tab-active' : ''; ?>"
55
+ >
56
+ <?php _e("Visitor Votes", 'yet-another-stars-rating'); ?>
57
+ </a>
58
+
59
+ <a href="?page=yasr_stats_page&tab=logs_multi" class="nav-tab
60
+ <?php echo ($active_tab === 'logs_multi') ? 'nav-tab-active' : ''; ?>"
61
+ >
62
+ <?php _e("MultiSet", 'yet-another-stars-rating'); ?>
63
+ </a>
64
+
65
+ <?php do_action('yasr_add_stats_tab', $active_tab); ?>
66
+
67
+ <a href="?page=yasr_settings_page-pricing" class="nav-tab">
68
+ <?php _e("Upgrade", 'yet-another-stars-rating'); ?>
69
+ </a>
70
+
71
+ </h2>
72
+
73
+ <?php
74
+
75
+ if ($active_tab === 'logs' || $active_tab === '') {
76
+ ?>
77
+
78
+ <div class="yasr-settingsdiv">
79
+ <form action="#" id="" method="POST">
80
+ <?php
81
+ wp_nonce_field('yasr-delete-stats-logs', 'yasr-nonce-delete-stats-logs');
82
+ $yasr_stats_log_table = new YasrStatsVisitorMulti($active_tab);
83
+ $yasr_stats_log_table->prepare_items();
84
+ $yasr_stats_log_table->display();
85
+ ?>
86
+ </form>
87
+ </div>
88
+
89
+ <?php
90
+ yasr_right_settings_panel();
91
+ ?>
92
+
93
+ <div class="yasr-space-settings-div">
94
+ </div>
95
+
96
+ <?php
97
+
98
+ } //End if tab 'logs'
99
+
100
+ if ($active_tab === 'logs_multi') {
101
+ ?>
102
+
103
+ <div class="yasr-settingsdiv">
104
+ <form action="#" id="" method="POST">
105
+ <?php
106
+ wp_nonce_field('yasr-delete-stats-logs', 'yasr-nonce-delete-stats-logs');
107
+ $yasr_stats_log_table = new YasrStatsVisitorMulti($active_tab);
108
+ $yasr_stats_log_table->prepare_items();
109
+ $yasr_stats_log_table->display();
110
+ ?>
111
+ </form>
112
+ </div>
113
+
114
+ <?php
115
+ yasr_right_settings_panel();
116
+ ?>
117
+
118
+ <div class="yasr-space-settings-div">
119
+ </div>
120
+
121
+ <?php
122
+
123
+ } //End if tab 'general_settings'
124
+
125
+ do_action('yasr_settings_check_active_tab', $active_tab);
126
+ yasr_right_settings_panel('bottom');
127
+ ?>
128
+
129
+ <!--End div wrap-->
130
+ </div>
admin/yasr-admin-functions.php CHANGED
@@ -171,7 +171,7 @@ function yasr_stats_page_callback() {
171
  wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
172
  }
173
 
174
- include(YASR_ABSOLUTE_PATH_ADMIN . '/yasr-stats-page.php');
175
  }
176
 
177
 
171
  wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
172
  }
173
 
174
+ include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-stats-page.php');
175
  }
176
 
177
 
includes/classes/YasrDatabaseRatings.php CHANGED
@@ -56,6 +56,10 @@ class YasrDatabaseRatings {
56
  * @param bool|integer $post_id
57
  *
58
  * @return array|bool|mixed|object|null
 
 
 
 
59
  */
60
  public static function getVisitorVotes ($post_id = false) {
61
  global $wpdb;
56
  * @param bool|integer $post_id
57
  *
58
  * @return array|bool|mixed|object|null
59
+ * array(
60
+ * 'number_of_votes' = (int)$user_votes->number_of_votes;
61
+ * 'sum_votes' = (int)$user_votes->sum_votes;
62
+ * )
63
  */
64
  public static function getVisitorVotes ($post_id = false) {
65
  global $wpdb;
includes/classes/YasrPhpFieldsHelper.php CHANGED
@@ -12,70 +12,74 @@
12
  *
13
  * Class YasrPhpFieldsHelper
14
  */
15
- class YasrPhpFieldsHelper {
16
-
17
- /**
18
- * Default class
19
- *
20
- * @var string
21
- */
22
- public static $field_class;
23
-
24
- public function __construct($field_class=false) {
25
- if($field_class) {
26
- self::$field_class = htmlspecialchars($field_class);
27
- }
28
- }
29
 
30
- /**
31
- *
32
- * @param bool|string $title
33
- * @param bool|string $class
34
- * @param array $options
35
- * @param bool|string $name
36
- * @param bool|string|int $default_value
37
- * @param bool|string $id
38
- *
39
- * @return string
40
- */
41
-
42
- public static function radio($title=false, $class=false, $options=[], $name=false, $default_value=false, $id=false) {
43
-
44
- $attribute = self::escape_attributes($class, $title, $name, $id, $default_value, false );
45
- $radio_options = self::escape_array($options);
46
-
47
- $container = '';
48
- $end_container = '';
49
- $title_string = '';
50
-
51
- if($attribute['title']) {
52
- $title_string .= '<strong>' . $attribute['title'] . '</strong><br />';
53
  }
54
 
55
- if (is_array($radio_options)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
- $container .= '<div class="yasr-indented-answer">';
58
 
59
- $radio_fields = '';
60
- foreach ( $radio_options as $value => $label ) {
61
- $id_string = $attribute['id'] . '-' . strtolower( trim( str_replace( ' ', '', $value ) ) );
62
- //must be inside foreach, or when loop arrive to last element
63
- //checked is defined
64
- $checked = '';
65
 
66
- //escape_attributes use htmlspecialchars that always return a string, so control must be weak
67
- /** @noinspection TypeUnsafeComparisonInspection */
68
- if ($attribute['value'] == $value) {
69
- $checked = 'checked';
70
- }
 
71
 
72
- //string value must be empty
73
- if ($value === 0) {
74
- $value = '';
75
- }
 
76
 
77
- $radio_fields .= sprintf(
78
- '<div>
 
 
 
 
 
79
  <label for="%s">
80
  <input type="radio"
81
  name="%s"
@@ -86,195 +90,205 @@ class YasrPhpFieldsHelper {
86
  >
87
  %s
88
  </label>
89
- </div>',
90
- $id_string, $attribute['name'], $value, $attribute['class'], $id_string, $checked,
91
- __( ucfirst( $label ), 'yet-another-stars-rating' ) );
92
 
93
- } //end foreach
94
 
95
- $end_container .= '</div>';
96
 
97
- return $container . $title_string . $radio_fields . $end_container;
 
 
98
  }
99
- return false;
100
- }
101
 
102
- /**
103
- * @param bool|string $class
104
- * @param bool|string|int $label
105
- * @param bool|string|int $name
106
- * @param bool|string|int $id
107
- * @param bool|string|int $placeholder
108
- * @param bool|string|int $default_value
109
- *
110
- * @return string
111
- */
112
- public static function text($class=false, $label=false, $name=false, $id=false, $placeholder=false, $default_value=false) {
113
- $attribute = self::escape_attributes($class, $label, $name, $id, $default_value, $placeholder);
114
-
115
- $container = "<div class='$attribute[class]'>";
116
- $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
117
- $input_text = "<input type='text' name='$attribute[name]' id='$attribute[id]' value='$attribute[value]'
 
 
118
  placeholder='$attribute[placeholder]'>";
119
- $end_container = "</div>";
120
 
121
- return($container.$label_string.$input_text.$end_container);
122
- }
123
 
124
- /**
125
- * @param bool|string $class
126
- * @param bool|string|int $label
127
- * @param array $options
128
- * @param bool|string|int $name
129
- * @param bool|string|int $id
130
- * @param bool|string|int $default_value
131
- *
132
- * @return string
133
- */
134
- public static function select($class=false, $label=false, $options=[], $name=false, $id=false, $default_value=false) {
135
- $attribute = self::escape_attributes($class, $label, $name, $id, $default_value);
136
- $select_options = self::escape_array($options);
137
-
138
- $container = "<div class='$attribute[class]'>";
139
- $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
140
- $select = "<select name='$attribute[name]' id='$attribute[id]'>";
141
- $end_select = "</select>";
142
- $end_container = "</div>";
143
-
144
- foreach ($select_options as $key=>$option) {
145
- if($option === $attribute['value']) {
146
- $select .= "<option value='$option' selected>$option</option>";
147
- } else {
148
- $select .= "<option value='$option'>$option</option>";
 
 
 
 
149
  }
 
 
150
  }
151
 
152
- return($container.$label_string.$select.$end_select.$end_container);
153
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
- /**
156
- * @param bool|string $class
157
- * @param bool|string|int $label
158
- * @param bool|string|int $name
159
- * @param bool|string|int $id
160
- * @param bool|string|int $placeholder
161
- * @param bool|string|int $default_value
162
- *
163
- * @return string
164
- */
165
- public static function textArea($class=false, $label=false, $name=false, $id=false, $placeholder=false, $default_value=false) {
166
- $attribute = self::escape_attributes($class, $label, $name, $id, $default_value, $placeholder);
167
-
168
- $container = "<div class='$attribute[class]'>";
169
- $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
170
- $textarea = "<textarea name='$attribute[name]' id='$attribute[id]' placeholder='$attribute[placeholder]'>";
171
- $end_textarea = "</textarea>";
172
- $end_container = "</div>";
173
-
174
- return($container.$label_string.$textarea.$attribute['value'].$end_textarea.$end_container);
175
- }
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
 
178
- /**
179
- * @param bool|string $class
180
- * @param bool|string|int $label
181
- * @param bool|string|int $name
182
- * @param bool|string|int $id
183
- * @param bool|string|int $placeholder
184
- * @param bool|string|int $default_value
185
- *
186
- * @return array
187
- */
188
- private static function escape_attributes($class=false, $label=false, $name=false, $id=false, $default_value=false, $placeholder=false ) {
189
-
190
- $dbt=debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2);
191
- $caller = isset($dbt[1]['function']) ? $dbt[1]['function'] : null;
192
-
193
- //defalt value
194
- $title_or_label = 'label';
195
-
196
- if($caller === 'radio') {
197
- $title_or_label = 'title';
198
- if(!$name) {
199
- $name = 'radio_group';
200
  }
201
- }
202
 
203
- //Use the self::field_class attribute if $class is false or empty
204
- if(!$class && self::$field_class) {
205
- $class = self::$field_class;
206
- }
 
 
 
 
207
 
208
- //if id is not set but name is, id get same value as name
209
- if(!$id && $name) {
210
- $id = $name;
211
- }
212
- //viceversa
213
- elseif (!$name && $id) {
214
- $name = $id;
215
- }
216
 
217
- //Use a random string (uniqueid and str_shuffle to add randomness) if id is still empty
218
- if(!$id) {
219
- $id = str_shuffle(uniqid('', true));
 
 
 
 
 
220
  }
221
 
222
- return array(
223
- 'class' => htmlspecialchars($class, ENT_QUOTES),
224
- 'id' => htmlspecialchars($id, ENT_QUOTES),
225
- $title_or_label => htmlspecialchars($label, ENT_QUOTES),
226
- 'name' => htmlspecialchars($name, ENT_QUOTES),
227
- 'placeholder' => htmlspecialchars($placeholder, ENT_QUOTES),
228
- 'value' => htmlspecialchars($default_value, ENT_QUOTES),
229
- );
230
- }
231
 
232
- private static function escape_array($array=[]) {
233
- $cleaned_array = [];
234
- if(!is_array($array)) {
235
- return $cleaned_array;
236
- }
237
 
238
- foreach ($array as $key=>$value) {
239
- $key = htmlspecialchars($key, ENT_QUOTES);
240
- $cleaned_array[$key] = htmlspecialchars($value, ENT_QUOTES);
241
  }
242
 
243
- return $cleaned_array;
244
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
- /**
247
- * @param $name
248
- * @param $class
249
- * @param $db_value
250
- * @param $id
251
- *
252
- * return void
253
- *
254
- *@since 2.3.3
255
- *
256
- */
257
- public static function radioSelectSize($name, $class, $db_value = false, $id = false) {
258
- $array_size = array( 'small', 'medium', 'large' );
259
-
260
- foreach($array_size as $size) {
261
- $id_string = $id . $size;
262
-
263
- //must be inside for each, or when loop arrive to last element
264
- //checked is defined
265
- $checked = '';
266
-
267
- //If db_value === false, there is no need to check for db value
268
- //so checked is the medium star (i.e. ranking page)
269
- if($db_value === false) {
270
- if($size === 'medium') {
271
  $checked = 'checked';
272
  }
273
- } else if($db_value === $size) {
274
- $checked = 'checked';
275
- }
276
 
277
- echo sprintf('<div class="yasr-option-div">
 
278
  <label for="%s">
279
  <input type="radio"
280
  name="%s"
@@ -289,11 +303,12 @@ class YasrPhpFieldsHelper {
289
  %s
290
  </span>
291
  </label>
292
- </div>',
293
- $id_string, $name, $size, $class, $id_string, $checked, YASR_IMG_DIR, $size, $size,
294
- __(ucwords($size), 'yet-another-stars-rating'));
295
 
296
- } //end foreach
 
297
  }
298
 
299
  }
12
  *
13
  * Class YasrPhpFieldsHelper
14
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ if (!class_exists('YasrPhpFieldsHelper') ) {
17
+
18
+ class YasrPhpFieldsHelper {
19
+
20
+ /**
21
+ * Default class
22
+ *
23
+ * @var string
24
+ */
25
+ public static $field_class;
26
+
27
+ public function __construct($field_class = false) {
28
+ if ($field_class) {
29
+ self::$field_class = htmlspecialchars($field_class);
30
+ }
 
 
 
 
 
 
 
 
31
  }
32
 
33
+ /**
34
+ * @param bool|string $title
35
+ * @param bool|string $class
36
+ * @param array $options
37
+ * @param bool|string $name
38
+ * @param bool|string|int $default_value
39
+ * @param bool|string $id
40
+ *
41
+ * @return string
42
+ */
43
+
44
+ public static function radio(
45
+ $title = false, $class = false, $options = [], $name = false, $default_value = false, $id = false
46
+ ) {
47
+
48
+ $attribute = self::escape_attributes($class, $title, $name, $id, $default_value, false);
49
+ $radio_options = self::escape_array($options);
50
+
51
+ $container = '';
52
+ $end_container = '';
53
+ $title_string = '';
54
+
55
+ if ($attribute['title']) {
56
+ $title_string .= '<strong>' . $attribute['title'] . '</strong><br />';
57
+ }
58
 
59
+ if (is_array($radio_options)) {
60
 
61
+ $container .= '<div class="yasr-indented-answer">';
 
 
 
 
 
62
 
63
+ $radio_fields = '';
64
+ foreach ($radio_options as $value => $label) {
65
+ $id_string = $attribute['id'] . '-' . strtolower(trim(str_replace(' ', '', $value)));
66
+ //must be inside foreach, or when loop arrive to last element
67
+ //checked is defined
68
+ $checked = '';
69
 
70
+ //escape_attributes use htmlspecialchars that always return a string, so control must be weak
71
+ /** @noinspection TypeUnsafeComparisonInspection */
72
+ if ($attribute['value'] == $value) {
73
+ $checked = 'checked';
74
+ }
75
 
76
+ //string value must be empty
77
+ if ($value === 0) {
78
+ $value = '';
79
+ }
80
+
81
+ $radio_fields .= sprintf(
82
+ '<div>
83
  <label for="%s">
84
  <input type="radio"
85
  name="%s"
90
  >
91
  %s
92
  </label>
93
+ </div>', $id_string, $attribute['name'], $value, $attribute['class'], $id_string, $checked,
94
+ __(ucfirst($label), 'yet-another-stars-rating')
95
+ );
96
 
97
+ } //end foreach
98
 
99
+ $end_container .= '</div>';
100
 
101
+ return $container . $title_string . $radio_fields . $end_container;
102
+ }
103
+ return false;
104
  }
 
 
105
 
106
+ /**
107
+ * @param bool|string $class
108
+ * @param bool|string|int $label
109
+ * @param bool|string|int $name
110
+ * @param bool|string|int $id
111
+ * @param bool|string|int $placeholder
112
+ * @param bool|string|int $default_value
113
+ *
114
+ * @return string
115
+ */
116
+ public static function text(
117
+ $class = false, $label = false, $name = false, $id = false, $placeholder = false, $default_value = false
118
+ ) {
119
+ $attribute = self::escape_attributes($class, $label, $name, $id, $default_value, $placeholder);
120
+
121
+ $container = "<div class='$attribute[class]'>";
122
+ $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
123
+ $input_text = "<input type='text' name='$attribute[name]' id='$attribute[id]' value='$attribute[value]'
124
  placeholder='$attribute[placeholder]'>";
125
+ $end_container = "</div>";
126
 
127
+ return ($container . $label_string . $input_text . $end_container);
128
+ }
129
 
130
+ /**
131
+ * @param bool|string $class
132
+ * @param bool|string|int $label
133
+ * @param array $options
134
+ * @param bool|string|int $name
135
+ * @param bool|string|int $id
136
+ * @param bool|string|int $default_value
137
+ *
138
+ * @return string
139
+ */
140
+ public static function select(
141
+ $class = false, $label = false, $options = [], $name = false, $id = false, $default_value = false
142
+ ) {
143
+ $attribute = self::escape_attributes($class, $label, $name, $id, $default_value);
144
+ $select_options = self::escape_array($options);
145
+
146
+ $container = "<div class='$attribute[class]'>";
147
+ $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
148
+ $select = "<select name='$attribute[name]' id='$attribute[id]'>";
149
+ $end_select = "</select>";
150
+ $end_container = "</div>";
151
+
152
+ foreach ($select_options as $key => $option) {
153
+ if ($option === $attribute['value']) {
154
+ $select .= "<option value='$option' selected>$option</option>";
155
+ }
156
+ else {
157
+ $select .= "<option value='$option'>$option</option>";
158
+ }
159
  }
160
+
161
+ return ($container . $label_string . $select . $end_select . $end_container);
162
  }
163
 
164
+ /**
165
+ * @param bool|string $class
166
+ * @param bool|string|int $label
167
+ * @param bool|string|int $name
168
+ * @param bool|string|int $id
169
+ * @param bool|string|int $placeholder
170
+ * @param bool|string|int $default_value
171
+ *
172
+ * @return string
173
+ */
174
+ public static function textArea(
175
+ $class = false, $label = false, $name = false, $id = false, $placeholder = false, $default_value = false
176
+ ) {
177
+ $attribute = self::escape_attributes($class, $label, $name, $id, $default_value, $placeholder);
178
+
179
+ $container = "<div class='$attribute[class]'>";
180
+ $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
181
+ $textarea
182
+ = "<textarea name='$attribute[name]' id='$attribute[id]' placeholder='$attribute[placeholder]'>";
183
+ $end_textarea = "</textarea>";
184
+ $end_container = "</div>";
185
+
186
+ return ($container . $label_string . $textarea . $attribute['value'] . $end_textarea . $end_container);
187
+ }
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
 
190
+ /**
191
+ * @param bool|string $class
192
+ * @param bool|string|int $label
193
+ * @param bool|string|int $name
194
+ * @param bool|string|int $id
195
+ * @param bool|string|int $placeholder
196
+ * @param bool|string|int $default_value
197
+ *
198
+ * @return array
199
+ */
200
+ private static function escape_attributes(
201
+ $class = false, $label = false, $name = false, $id = false, $default_value = false, $placeholder = false
202
+ ) {
203
+
204
+ $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
205
+ $caller = isset($dbt[1]['function']) ? $dbt[1]['function'] : null;
206
+
207
+ //defalt value
208
+ $title_or_label = 'label';
209
+
210
+ if ($caller === 'radio') {
211
+ $title_or_label = 'title';
212
+ if (!$name) {
213
+ $name = 'radio_group';
214
+ }
215
+ }
216
 
217
+ //Use the self::field_class attribute if $class is false or empty
218
+ if (!$class && self::$field_class) {
219
+ $class = self::$field_class;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  }
 
221
 
222
+ //if id is not set but name is, id get same value as name
223
+ if (!$id && $name) {
224
+ $id = $name;
225
+ }
226
+ //viceversa
227
+ elseif (!$name && $id) {
228
+ $name = $id;
229
+ }
230
 
231
+ //Use a random string (uniqueid and str_shuffle to add randomness) if id is still empty
232
+ if (!$id) {
233
+ $id = str_shuffle(uniqid('', true));
234
+ }
 
 
 
 
235
 
236
+ return array(
237
+ 'class' => htmlspecialchars($class, ENT_QUOTES),
238
+ 'id' => htmlspecialchars($id, ENT_QUOTES),
239
+ $title_or_label => htmlspecialchars($label, ENT_QUOTES),
240
+ 'name' => htmlspecialchars($name, ENT_QUOTES),
241
+ 'placeholder' => htmlspecialchars($placeholder, ENT_QUOTES),
242
+ 'value' => htmlspecialchars($default_value, ENT_QUOTES),
243
+ );
244
  }
245
 
246
+ private static function escape_array($array = []) {
247
+ $cleaned_array = [];
248
+ if (!is_array($array)) {
249
+ return $cleaned_array;
250
+ }
 
 
 
 
251
 
252
+ foreach ($array as $key => $value) {
253
+ $key = htmlspecialchars($key, ENT_QUOTES);
254
+ $cleaned_array[$key] = htmlspecialchars($value, ENT_QUOTES);
255
+ }
 
256
 
257
+ return $cleaned_array;
 
 
258
  }
259
 
260
+ /**
261
+ * @param $name
262
+ * @param $class
263
+ * @param $db_value
264
+ * @param $id
265
+ * return void
266
+ *
267
+ * @since 2.3.3
268
+ */
269
+ public static function radioSelectSize($name, $class, $db_value = false, $id = false) {
270
+ $array_size = array('small', 'medium', 'large');
271
+
272
+ foreach ($array_size as $size) {
273
+ $id_string = $id . $size;
274
+
275
+ //must be inside for each, or when loop arrive to last element
276
+ //checked is defined
277
+ $checked = '';
278
 
279
+ //If db_value === false, there is no need to check for db value
280
+ //so checked is the medium star (i.e. ranking page)
281
+ if ($db_value === false) {
282
+ if ($size === 'medium') {
283
+ $checked = 'checked';
284
+ }
285
+ }
286
+ else if ($db_value === $size) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  $checked = 'checked';
288
  }
 
 
 
289
 
290
+ echo sprintf(
291
+ '<div class="yasr-option-div">
292
  <label for="%s">
293
  <input type="radio"
294
  name="%s"
303
  %s
304
  </span>
305
  </label>
306
+ </div>', $id_string, $name, $size, $class, $id_string, $checked, YASR_IMG_DIR, $size, $size,
307
+ __(ucwords($size), 'yet-another-stars-rating')
308
+ );
309
 
310
+ } //end foreach
311
+ }
312
  }
313
 
314
  }
includes/rest/classes/YasrCustomFields.php CHANGED
@@ -10,7 +10,7 @@ class YasrCustomFields extends WP_REST_Controller {
10
  * Add in rest_api_init
11
  */
12
  public function restApiInit() {
13
- add_action('rest_api_init', array( $this, 'customFields'));
14
  }
15
 
16
 
10
  * Add in rest_api_init
11
  */
12
  public function restApiInit() {
13
+ add_action('rest_api_init', array($this, 'customFields'));
14
  }
15
 
16
 
includes/shortcodes/classes/YasrOverallRating.php CHANGED
@@ -38,16 +38,21 @@ class YasrOverallRating extends YasrShortcode {
38
  */
39
  public function returnShortcode () {
40
 
41
- $this->shortcode_html = '<!--Yasr Overall Rating Shortcode-->';
 
 
42
 
43
  $this->shortcode_html .= $this->customTextBefore();
44
 
45
  $this->shortcode_html .= '<div class="yasr-overall-rating">';
46
- $this->shortcode_html .= $this->returnHtml();
47
  $this->shortcode_html .= '</div>';
48
 
49
  $this->shortcode_html .= '<!--End Yasr Overall Rating Shortcode-->';
50
 
 
 
 
51
  //If overall rating in loop is enabled don't use is_singular && is main_query
52
  if (YASR_SHOW_OVERALL_IN_LOOP === 'enabled') {
53
  return $this->shortcode_html;
@@ -66,9 +71,14 @@ class YasrOverallRating extends YasrShortcode {
66
  * @param string | bool $class
67
  * @param string | bool $rating
68
  *
69
- * @return string
 
 
 
 
 
70
  */
71
- public function returnHtml($stars_size=false, $post_id=false, $class=false, $rating=false) {
72
 
73
  if(!is_int($stars_size)) {
74
  $stars_size = $this->starSize();
@@ -101,7 +111,13 @@ class YasrOverallRating extends YasrShortcode {
101
  data-rater-starsize='$stars_size'>
102
  </div>";
103
 
104
- return $html_stars;
 
 
 
 
 
 
105
 
106
  }
107
 
38
  */
39
  public function returnShortcode () {
40
 
41
+ $overall_attributes = $this->returnAttributes();
42
+
43
+ $this->shortcode_html = '<!--Yasr Overall Rating Shortcode-->';
44
 
45
  $this->shortcode_html .= $this->customTextBefore();
46
 
47
  $this->shortcode_html .= '<div class="yasr-overall-rating">';
48
+ $this->shortcode_html .= $overall_attributes['html_stars'];
49
  $this->shortcode_html .= '</div>';
50
 
51
  $this->shortcode_html .= '<!--End Yasr Overall Rating Shortcode-->';
52
 
53
+ //Use this filter to customize overall rating
54
+ $this->shortcode_html = apply_filters('yasr_overall_rating_shortcode', $this->shortcode_html, $overall_attributes);
55
+
56
  //If overall rating in loop is enabled don't use is_singular && is main_query
57
  if (YASR_SHOW_OVERALL_IN_LOOP === 'enabled') {
58
  return $this->shortcode_html;
71
  * @param string | bool $class
72
  * @param string | bool $rating
73
  *
74
+ * @return array
75
+ * array(
76
+ * 'overall_rating' => $overall_rating,
77
+ * 'post_id' => $post_id,
78
+ * 'html_stars' => $html_stars
79
+ * );
80
  */
81
+ public function returnAttributes($stars_size=false, $post_id=false, $class=false, $rating=false) {
82
 
83
  if(!is_int($stars_size)) {
84
  $stars_size = $this->starSize();
111
  data-rater-starsize='$stars_size'>
112
  </div>";
113
 
114
+ $array_to_return = array(
115
+ 'overall_rating' => $overall_rating,
116
+ 'post_id' => $post_id,
117
+ 'html_stars' => $html_stars
118
+ );
119
+
120
+ return $array_to_return;
121
 
122
  }
123
 
includes/shortcodes/classes/YasrVisitorVotes.php CHANGED
@@ -92,6 +92,9 @@ class YasrVisitorVotes extends YasrShortcode {
92
  data-cpt='$this->post_type'
93
  ></div>";
94
 
 
 
 
95
  return $this->shortcode_html;
96
  }
97
 
@@ -117,6 +120,8 @@ class YasrVisitorVotes extends YasrShortcode {
117
  data-cpt='$this->post_type'>
118
  </div>";
119
 
 
 
120
  return $this->returnYasrVisitorVotes($cookie_value, $this->post_id);
121
 
122
  } //end function
92
  data-cpt='$this->post_type'
93
  ></div>";
94
 
95
+ //Use this filter to customize yasr_visitor_votes readonly
96
+ $this->shortcode_html = apply_filters('yasr_vv_ro_shortcode', $this->shortcode_html, $stored_votes);
97
+
98
  return $this->shortcode_html;
99
  }
100
 
120
  data-cpt='$this->post_type'>
121
  </div>";
122
 
123
+ $this->shortcode_html = apply_filters('yasr_vv_shortcode', $this->shortcode_html, $stored_votes);
124
+
125
  return $this->returnYasrVisitorVotes($cookie_value, $this->post_id);
126
 
127
  } //end function
public/classes/YasrPublicFilters.php CHANGED
@@ -423,9 +423,11 @@ class YasrPublicFilters {
423
  //only if overall rating > 0
424
  if($overall_rating > 0) {
425
  $overall_rating_obj = new YasrOverallRating(false, false);
 
426
 
427
- $overall_widget = $overall_rating_obj->returnHtml(16, $post_id, 'yasr-stars-title', $overall_rating);
428
- $overall_widget .= "<span class='yasr-stars-title-average'>$overall_rating</span>";
 
429
  }
430
 
431
  //Use this hook to customize widget overall
423
  //only if overall rating > 0
424
  if($overall_rating > 0) {
425
  $overall_rating_obj = new YasrOverallRating(false, false);
426
+ $overall_attributes = $overall_rating_obj->returnAttributes(16, $post_id, 'yasr-stars-title', $overall_rating);
427
 
428
+ $overall_widget = "<span class='yasr-stars-title-average'>";
429
+ $overall_widget .= $overall_attributes['html_stars'];
430
+ $overall_widget .= "</span>";
431
  }
432
 
433
  //Use this hook to customize widget overall
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.9.0
5
  Contributors: Dudo
6
  Tested up to: 5.5.2
7
  Requires PHP: 5.3
8
- Stable tag: 2.5.0
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
@@ -181,6 +181,11 @@ If doesn't, you should work on your seo reputation.
181
 
182
  The full changelog can be found in the plugin's directory. Recent entries:
183
 
 
 
 
 
 
184
  = 2.5.0 =
185
  * TWEAKED: minor changes. Nothing to be excited about
186
 
5
  Contributors: Dudo
6
  Tested up to: 5.5.2
7
  Requires PHP: 5.3
8
+ Stable tag: 2.5.1
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
181
 
182
  The full changelog can be found in the plugin's directory. Recent entries:
183
 
184
+ = 2.5.1 =
185
+ * TWEAKED: added new hooks: yasr_vv_shortcode, yasr_vv_ro_shortcode and yasr_overall_shortcode. These hooks can
186
+ be used to customize the shortcodes.
187
+
188
+
189
  = 2.5.0 =
190
  * TWEAKED: minor changes. Nothing to be excited about
191
 
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
7
- * Version: 2.5.0
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
- define( 'YASR_VERSION_NUM', '2.5.0' );
80
  //Plugin absolute path
81
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
82
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
7
+ * Version: 2.5.1
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
+ define( 'YASR_VERSION_NUM', '2.5.1' );
80
  //Plugin absolute path
81
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
82
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );