Yasr – Yet Another Stars Rating - Version 1.4.2

Version Description

  • TWEAKED: progressbars and tooltip classes have been fixed
Download this release

Release Info

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

Code changes from version 1.4.1 to 1.4.2

changelog.txt CHANGED
@@ -1,3 +1,25 @@
1
= 1.2.5 =
2
* NEW FEATURE: in settings -> Multi Set tab is now possible to choose if show or hide by default the average for multi set
3
* FIXED: logo image for rich snippet
1
+ = 1.3.4 =
2
+ * TWEAKED: minor changes
3
+
4
+ = 1.3.3 =
5
+ * FIXED: security fix
6
+
7
+ = 1.3.1 =
8
+ * TWAKED: an absolute url is passed on get_image_size instead of an URL. This id due to compatibility in some cheap hosting
9
+
10
+ = 1.3.0 =
11
+ * NEW FEATURE: Widget support for yasr_overall_rating and yasr_visitor_votes shortcodes
12
+ * TWEAKED: Yasr shortcode creator will appear only in backend
13
+
14
+ = 1.2.9 =
15
+ * NEW FEATURE: If auto insert is enabled, it's now possible to exclude the single post or page
16
+ * TWEAKED: Restyling for settings panel
17
+
18
+ = 1.2.8 =
19
+ * FIXED: Fatal error on first install
20
+ * TWEAKED: Flat stars set is the new default theme
21
+ * Minor changes
22
+
23
= 1.2.5 =
24
* NEW FEATURE: in settings -> Multi Set tab is now possible to choose if show or hide by default the average for multi set
25
* FIXED: logo image for rich snippet
css/yasr.css CHANGED
@@ -241,34 +241,43 @@ yasr_pro_comment_reviews_stats shortcode too***/
241
}
242
243
.yasr-progress-bar-name {
244
- width: 60px;
245
text-align: left;
246
display: inline-block;
247
}
248
249
.yasr-progress-bar {
250
display: inline-block;
251
- width: 150px;
252
- height: 15px;
253
margin-right: 5px;
254
- border-bottom-right-radius: 0px;
255
- border-bottom-left-radius: 0px;
256
- border-top-right-radius: 0px;
257
- border-top-left-radius: 0px;
258
margin-bottom: -2px;
259
}
260
261
/*I must use this to remove radius on top left.*/
262
263
.yasr-progress-bar > .ui-progressbar-value {
264
- border-bottom-left-radius: 0px;
265
- border-top-left-radius: 0px;
266
- background: #FFD700;
267
}
268
269
.yasr-progress-bar-votes-count {
270
display: inline-block;
271
- width: 40px;
272
}
273
274
@@ -278,7 +287,8 @@ yasr_pro_comment_reviews_stats shortcode too***/
278
/*** Tooltip ***/
279
280
.yasr-visitors-stats-tooltip {
281
- width: 300px;
282
}
283
284
/*** Tooltip ***/
241
}
242
243
.yasr-progress-bar-name {
244
+ width: 55px;
245
+ font-size: 100%;
246
+ line-height: 1.5;
247
text-align: left;
248
display: inline-block;
249
}
250
251
.yasr-progress-bar {
252
display: inline-block;
253
+ width: 100px;
254
+ height: 17px !important;
255
+ border: 0px !important;
256
+ border-bottom-left-radius: 0px !important;
257
+ border-top-left-radius: 0px !important;
258
+ border-bottom-right-radius: 0px !important;
259
+ border-top-right-radius: 0px !important;
260
margin-right: 5px;
261
margin-bottom: -2px;
262
+ box-shadow: inset 0 1px 2px rgba(0,0,0,.4), inset 0 0 0 1px rgba(0,0,0,.1);
263
}
264
265
/*I must use this to remove radius on top left.*/
266
267
.yasr-progress-bar > .ui-progressbar-value {
268
+ border-bottom-left-radius: 0px !important;
269
+ border-top-left-radius: 0px !important;
270
+ border-bottom-right-radius: 0px !important;
271
+ border-top-right-radius: 0px !important;
272
+ background: linear-gradient(to bottom,#ffce00,#ffa700);
273
+ background-color: #ffce00;
274
+ box-shadow: inset 0px 0px 0px 1px rgba(0,0,0,.25);
275
}
276
277
.yasr-progress-bar-votes-count {
278
+ min-width: 45px;
279
+ font-size: 100%;
280
display: inline-block;
281
}
282
283
287
/*** Tooltip ***/
288
289
.yasr-visitors-stats-tooltip {
290
+ min-width:200px;
291
+ text-align: center;
292
}
293
294
/*** Tooltip ***/
js/yasr-front.js CHANGED
@@ -195,8 +195,13 @@ document.addEventListener('DOMContentLoaded', function(event) {
195
196
jQuery('#yasr-total-average-dashicon-' + yasrCommonData.postid).tooltip({
197
198
- position: { my: 'center bottom' , at: 'center top-10' },
199
tooltipClass: "yasr-visitors-stats-tooltip",
200
content: function(tipsContent) {
201
202
if (!varTipsContent) {
@@ -238,28 +243,6 @@ document.addEventListener('DOMContentLoaded', function(event) {
238
/****** End tooltipfunction ******/
239
240
241
- /****** draw progress bar for yasr_pro_comment_reviews_summary ******/
242
-
243
- function yasrDrawProgressBarsReviewsSummery (valueProgressbar, postId) {
244
-
245
- var i = null;
246
-
247
- var j = 0; //This is for the array
248
-
249
- for (i=5; i>0; i--) {
250
-
251
- jQuery( "#yasr-pro-reviews-summary-postid-"+postId+"-progress-bar-" + i).progressbar({
252
- value: valueProgressbar[j]
253
- });
254
-
255
- j=j+1;
256
-
257
- }
258
-
259
- }
260
-
261
- /****** End progressbar function *******/
262
-
263
// this should give support for all plugin that add content with ajax
264
jQuery( document ).ajaxComplete(function() {
265
195
196
jQuery('#yasr-total-average-dashicon-' + yasrCommonData.postid).tooltip({
197
198
+ position: {
199
+ my: 'center bottom' ,
200
+ at: 'center top-10',
201
+ },
202
+
203
tooltipClass: "yasr-visitors-stats-tooltip",
204
+
205
content: function(tipsContent) {
206
207
if (!varTipsContent) {
243
/****** End tooltipfunction ******/
244
245
246
// this should give support for all plugin that add content with ajax
247
jQuery( document ).ajaxComplete(function() {
248
lib/yasr-admin-actions.php CHANGED
@@ -3,33 +3,6 @@
3
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
4
5
6
- //css
7
- add_action('yasr_add_front_script_css', 'yasr_pro_front_script_css' );
8
-
9
- function yasr_pro_front_script_css () {
10
-
11
- //if visitors stats are enabled
12
- if (YASR_VISITORS_STATS === 'yes') {
13
- wp_enqueue_style( 'jquery-ui','//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css', FALSE, NULL, 'all' );
14
- wp_enqueue_style( 'dashicons' ); //dashicons
15
- }
16
-
17
- }
18
-
19
- //js
20
- add_action('yasr_add_front_script_js', 'yasr_pro_front_script_js' );
21
-
22
- function yasr_pro_front_script_js () {
23
-
24
- //if visitors stats are enabled
25
- if (YASR_VISITORS_STATS === 'yes') {
26
- wp_enqueue_script( 'jquery-ui-progressbar' ); //script
27
- wp_enqueue_script( 'jquery-ui-tooltip' ); //script
28
- }
29
-
30
- }
31
-
32
-
33
//Delete caches for wp_super_Cache and wp_rocket
34
add_action('yasr_action_on_visitor_vote', 'yasr_delete_cache' );
35
add_action('yasr_action_on_update_visitor_vote', 'yasr_delete_cache');
3
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
4
5
6
//Delete caches for wp_super_Cache and wp_rocket
7
add_action('yasr_action_on_visitor_vote', 'yasr_delete_cache' );
8
add_action('yasr_action_on_update_visitor_vote', 'yasr_delete_cache');
lib/yasr-ajax-functions.php CHANGED
@@ -1311,6 +1311,29 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
1311
exit();
1312
}
1313
1314
$missing_vote = NULL; //avoid undefined variable
1315
1316
global $wpdb;
@@ -1371,51 +1394,65 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
1371
1372
arsort($stats); //sort it by $votes[n_of_votes]
1373
1374
- echo "<div class=\"yasr-progress-bars-container\">\n";
1375
1376
- if ($total_votes == 0) {
1377
- $increase_bar_value = 0;
1378
- }
1379
- else {
1380
- $increase_bar_value = 100 / $total_votes; //Find how much all the bars should increase per vote
1381
- }
1382
1383
- $i=5;
1384
1385
- $stars_text = __("stars", 'yet-another-stars-rating');
1386
1387
- foreach ($stats as $logged_votes) {
1388
1389
- if ($i==1) {
1390
- $stars_text = __("star", 'yet-another-stars-rating');
1391
- }
1392
1393
- echo "<div class=\"yasr-progress-bar-row-container\">
1394
- <span class=\"yasr-progress-bar-name\">$i $stars_text</span>
1395
- <span class=\"yasr-progress-bar\" id=\"yasr-progress-bar-postid-$post_id-progress-bar-$i\" ></span>
1396
- <span class=\"yasr-progress-bar-votes-count\">$logged_votes[n_of_votes]</span>
1397
- </div>";
1398
1399
- $value_progressbar = $increase_bar_value * $logged_votes['n_of_votes']; //value of the single bar
1400
1401
- $value_progressbar = round ($value_progressbar, 2); //use only 2 decimal
1402
1403
- $array_values_progressbar[] = $value_progressbar;
1404
1405
- $i--;
1406
1407
1408
- } //End foreach
1409
1410
- echo "</div>";
1411
1412
- ?>
1413
1414
<script type="text/javascript">
1415
jQuery( document ).ready(function() {
1416
1417
- var postId = <?php echo json_encode($post_id)?>;
1418
- var arrayValueProgressbar = <?php echo (json_encode($array_values_progressbar)) ?>;
1419
1420
yasrDrawProgressBars (arrayValueProgressbar, postId);
1421
1311
exit();
1312
}
1313
1314
+ $votes = yasr_get_visitor_votes($post_id);
1315
+
1316
+ $medium_rating=0; //Avoid undefined variable
1317
+
1318
+ if (!$votes) {
1319
+ $votes=0; //Avoid undefined variable if there is not overall rating
1320
+ $votes_number=0; //Avoid undefined variable
1321
+ }
1322
+
1323
+ else {
1324
+ foreach ($votes as $user_votes) {
1325
+ $votes_number = $user_votes->number_of_votes;
1326
+ if ($votes_number != 0 ) {
1327
+ $medium_rating = ($user_votes->sum_votes/$votes_number);
1328
+ }
1329
+ else {
1330
+ $medium_rating = 0;
1331
+ }
1332
+ }
1333
+ }
1334
+
1335
+ $medium_rating=round($medium_rating, 1);
1336
+
1337
$missing_vote = NULL; //avoid undefined variable
1338
1339
global $wpdb;
1394
1395
arsort($stats); //sort it by $votes[n_of_votes]
1396
1397
+ ?>
1398
1399
+ <div class="yasr-visitors-stats-tooltip">
1400
1401
+ <?php echo $medium_rating . ' ';
1402
1403
+ _e('out of 5 stars', 'yet-another-stars-rating');
1404
1405
+ ?>
1406
1407
+ <div class="yasr-progress-bars-container">
1408
+
1409
+ <?php
1410
+
1411
+ if ($total_votes == 0) {
1412
+ $increase_bar_value = 0;
1413
+ }
1414
+ else {
1415
+ $increase_bar_value = 100 / $total_votes; //Find how much all the bars should increase per vote
1416
+ }
1417
1418
+ $i=5;
1419
1420
+ $stars_text = __("stars", 'yet-another-stars-rating');
1421
1422
+ foreach ($stats as $logged_votes) {
1423
1424
+ if ($i==1) {
1425
+ $stars_text = __("star", 'yet-another-stars-rating');
1426
+ }
1427
1428
+ echo "<div class=\"yasr-progress-bar-row-container\">
1429
+ <span class=\"yasr-progress-bar-name\">$i $stars_text</span>
1430
+ <span class=\"yasr-progress-bar\" id=\"yasr-progress-bar-postid-$post_id-progress-bar-$i\" ></span>
1431
+ <span class=\"yasr-progress-bar-votes-count\">$logged_votes[n_of_votes]</span>
1432
+ </div>";
1433
1434
+ $value_progressbar = $increase_bar_value * $logged_votes['n_of_votes']; //value of the single bar
1435
1436
+ $value_progressbar = round ($value_progressbar, 2); //use only 2 decimal
1437
1438
+ $array_values_progressbar[] = $value_progressbar;
1439
1440
+ $i--;
1441
+
1442
+
1443
+ } //End foreach
1444
+
1445
+ ?>
1446
+
1447
+ </div>
1448
+
1449
+ </div>
1450
1451
<script type="text/javascript">
1452
jQuery( document ).ready(function() {
1453
1454
+ var postId = <?php echo(json_encode($post_id)); ?>;
1455
+ var arrayValueProgressbar = <?php echo(json_encode($array_values_progressbar)); ?>;
1456
1457
yasrDrawProgressBars (arrayValueProgressbar, postId);
1458
lib/yasr-functions.php CHANGED
@@ -30,7 +30,10 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
30
31
wp_enqueue_style( 'yasrcss', YASR_CSS_DIR . 'yasr.css', FALSE, NULL, 'all' );
32
33
- //Run after yasrcss is loaded
34
do_action( 'yasr_add_front_script_css' );
35
36
//If choosen is light or not dark (force to be default)
@@ -48,6 +51,10 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
48
49
wp_enqueue_script( 'rateit', YASR_JS_DIR . 'jquery.rateit.min.js' , array('jquery'), '1.0.22', TRUE );
50
51
wp_enqueue_script( 'yasrfront', YASR_JS_DIR . 'yasr-front.js' , array('jquery', 'rateit'), '1.0.0', TRUE );
52
53
do_action('yasr_add_front_script_js');
30
31
wp_enqueue_style( 'yasrcss', YASR_CSS_DIR . 'yasr.css', FALSE, NULL, 'all' );
32
33
+ wp_enqueue_style( 'jquery-ui','//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css', FALSE, NULL, 'all' );
34
+ wp_enqueue_style( 'dashicons' ); //dashicons
35
+
36
+ //Run after default css are loaded
37
do_action( 'yasr_add_front_script_css' );
38
39
//If choosen is light or not dark (force to be default)
51
52
wp_enqueue_script( 'rateit', YASR_JS_DIR . 'jquery.rateit.min.js' , array('jquery'), '1.0.22', TRUE );
53
54
+ wp_enqueue_script( 'jquery-ui-progressbar' ); //script
55
+
56
+ wp_enqueue_script( 'jquery-ui-tooltip' ); //script
57
+
58
wp_enqueue_script( 'yasrfront', YASR_JS_DIR . 'yasr-front.js' , array('jquery', 'rateit'), '1.0.0', TRUE );
59
60
do_action('yasr_add_front_script_js');
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post r
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
Tested up to: 4.6.1
7
- Stable tag: 1.4.1
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
@@ -107,9 +107,12 @@ Of course not: you can easily add it on the visual editor just by clicking the "
107
108
The full changelog can be found in the plugin's directory. Recent entries:
109
110
= 1.4.1 =
111
* TWEAKED: Yasr now supports ajax added content
112
- * TWEAKED: rate updated to version 1.0.24
113
114
= 1.4.0 =
115
* Fixed post title get echeod
@@ -136,25 +139,5 @@ The full changelog can be found in the plugin's directory. Recent entries:
136
A database backup is strongly suggested.
137
* NEW FEATURE: new widget that shows the last 5 recent ratings.
138
139
- = 1.3.4 =
140
- * TWEAKED: minor changes
141
-
142
- = 1.3.3 =
143
- * FIXED: security fix
144
-
145
- = 1.3.1 =
146
- * TWAKED: an absolute url is passed on get_image_size instead of an URL. This id due to compatibility in some cheap hosting
147
-
148
- = 1.3.0 =
149
- * NEW FEATURE: Widget support for yasr_overall_rating and yasr_visitor_votes shortcodes
150
- * TWEAKED: Yasr shortcode creator will appear only in backend
151
-
152
- = 1.2.9 =
153
- * NEW FEATURE: If auto insert is enabled, it's now possible to exclude the single post or page
154
- * TWEAKED: Restyling for settings panel
155
156
- = 1.2.8 =
157
- * FIXED: Fatal error on first install
158
- * TWEAKED: Flat stars set is the new default theme
159
- * Minor changes
160
4
Requires at least: 4.3.0
5
Contributors: Dudo
6
Tested up to: 4.6.1
7
+ Stable tag: 1.4.2
8
License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
10
Yet Another Stars Rating is a simple plugin which allows you and / or your visitor to rate a post or element. Ideal for review's website
107
108
The full changelog can be found in the plugin's directory. Recent entries:
109
110
+ = 1.4.2 =
111
+ * TWEAKED: progressbars and tooltip classes have been fixed
112
+
113
= 1.4.1 =
114
* TWEAKED: Yasr now supports ajax added content
115
+ * TWEAKED: RateIt updated to version 1.0.24
116
117
= 1.4.0 =
118
* Fixed post title get echeod
139
A database backup is strongly suggested.
140
* NEW FEATURE: new widget that shows the last 5 recent ratings.
141
142
143
yet-another-stars-rating.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: Yet Another Stars Rating
4
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
6
- * Version: 1.4.1
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
31
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
- define('YASR_VERSION_NUM', '1.4.1');
35
36
//Plugin relative path
37
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
3
* Plugin Name: Yet Another Stars Rating
4
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
5
* Description: Yet Another Stars Rating turn your WordPress into a complete review website.
6
+ * Version: 1.4.2
7
* Author: Dario Curvino
8
* Author URI: https://yetanotherstarsrating.com/
9
* Text Domain: yet-another-stars-rating
31
32
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
33
34
+ define('YASR_VERSION_NUM', '1.4.2');
35
36
//Plugin relative path
37
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );