Version Description
FIXED: %overall_rating% pattern didn't work for custom text FIXED: fixed link in yasr_most_or_highest_rated_posts FIXED: warning in yasr-settings-functions-multiset.php TWEAKED: minor changes
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 2.4.5 |
Comparing to | |
See all releases |
Code changes from version 2.4.4 to 2.4.5
- admin/classes/YasrOnInstall.php +3 -4
- admin/settings/multiset/yasr-settings-functions-multiset.php +10 -4
- admin/settings/yasr-settings-functions.php +1 -1
- changelog.txt +12 -3
- includes/classes/YasrCustomPostTypes.php +10 -0
- includes/classes/YasrPhpFieldsHelper.php +17 -17
- includes/js/src/yasr-front.js +25 -13
- includes/js/yasr-front.js +1 -1
- includes/rest/yasr-rest.php +5 -1
- includes/shortcodes/classes/YasrOverallRating.php +12 -2
- includes/shortcodes/classes/YasrRankings.php +30 -30
- public/yasr-public-actions.php +8 -7
- readme.txt +8 -18
- yet-another-stars-rating.php +2 -2
admin/classes/YasrOnInstall.php
CHANGED
@@ -141,11 +141,10 @@ class YasrOnInstall {
|
|
141 |
$option['auto_insert_align'] = 'center';
|
142 |
$option['auto_insert_exclude_pages'] = 'yes';
|
143 |
$option['auto_insert_custom_post_only'] = 'no';
|
144 |
-
$option['stars_title'] = '
|
145 |
$option['stars_title_what'] = 'visitor_rating';
|
146 |
-
$option['
|
147 |
-
$option['
|
148 |
-
$option['show_visitor_votes_in_loop'] = 'disabled';
|
149 |
$option['text_before_stars'] = 1;
|
150 |
$option['text_before_overall'] = __('Our Score', 'yet-another-stars-rating');
|
151 |
$option['text_before_visitor_rating'] = __('Click to rate this post!', 'yet-another-stars-rating');
|
141 |
$option['auto_insert_align'] = 'center';
|
142 |
$option['auto_insert_exclude_pages'] = 'yes';
|
143 |
$option['auto_insert_custom_post_only'] = 'no';
|
144 |
+
$option['stars_title'] = 'no';
|
145 |
$option['stars_title_what'] = 'visitor_rating';
|
146 |
+
$option['show_overall_in_loop'] = 'enabled';
|
147 |
+
$option['show_visitor_votes_in_loop'] = 'enabled';
|
|
|
148 |
$option['text_before_stars'] = 1;
|
149 |
$option['text_before_overall'] = __('Our Score', 'yet-another-stars-rating');
|
150 |
$option['text_before_visitor_rating'] = __('Click to rate this post!', 'yet-another-stars-rating');
|
admin/settings/multiset/yasr-settings-functions-multiset.php
CHANGED
@@ -36,7 +36,9 @@ function yasr_multiset_options_init() {
|
|
36 |
$option_multiset = get_option('yasr_multiset_options');
|
37 |
|
38 |
if ($option_multiset === false) {
|
39 |
-
$option_multiset = array(
|
|
|
|
|
40 |
}
|
41 |
|
42 |
if (!isset($option_multiset['show_average'])) {
|
@@ -82,10 +84,14 @@ function yasr_multiset_hide_average_callback($option_multiset) {
|
|
82 |
|
83 |
function yasr_sanitize_multiset_options($option_multiset) {
|
84 |
|
85 |
-
if (
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
} else {
|
88 |
-
$option_multiset['show_average'] = '
|
89 |
}
|
90 |
|
91 |
return $option_multiset;
|
36 |
$option_multiset = get_option('yasr_multiset_options');
|
37 |
|
38 |
if ($option_multiset === false) {
|
39 |
+
$option_multiset = array(
|
40 |
+
'show_average' => 'no'
|
41 |
+
);
|
42 |
}
|
43 |
|
44 |
if (!isset($option_multiset['show_average'])) {
|
84 |
|
85 |
function yasr_sanitize_multiset_options($option_multiset) {
|
86 |
|
87 |
+
if (is_array($option_multiset)) {
|
88 |
+
if( ! array_key_exists('show_average', $option_multiset)) {
|
89 |
+
$option_multiset['show_average'] = 'no';
|
90 |
+
} else {
|
91 |
+
$option_multiset['show_average'] = 'yes';
|
92 |
+
}
|
93 |
} else {
|
94 |
+
$option_multiset['show_average'] = 'no';
|
95 |
}
|
96 |
|
97 |
return $option_multiset;
|
admin/settings/yasr-settings-functions.php
CHANGED
@@ -471,7 +471,7 @@ function yasr_custom_text_callback($option) {
|
|
471 |
|
472 |
<div id="yasr-doc-custom-text-div" class="yasr-help-box-settings">
|
473 |
<?php
|
474 |
-
$string_custom_overall = sprintf(__('In the first field you can use %s pattern to show the overall rating.',
|
475 |
'yet-another-stars-rating'), '<strong>%overall_rating%</strong>');
|
476 |
|
477 |
$string_custom_visitor = sprintf(__('In the second and third fields you can use %s pattern to show the
|
471 |
|
472 |
<div id="yasr-doc-custom-text-div" class="yasr-help-box-settings">
|
473 |
<?php
|
474 |
+
$string_custom_overall = sprintf(__('In the first field you can use %s pattern to show the overall rating (as text).',
|
475 |
'yet-another-stars-rating'), '<strong>%overall_rating%</strong>');
|
476 |
|
477 |
$string_custom_visitor = sprintf(__('In the second and third fields you can use %s pattern to show the
|
changelog.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= 2.3.0 =
|
2 |
* NEW FEATURE: YASR now support all caching plugin available out there.
|
3 |
Just select "yes" at the question "Load results with AJAX" in the settings page.
|
@@ -11,9 +23,6 @@ Just select "yes" at the question "Load results with AJAX" in the settings page
|
|
11 |
fields where reset
|
12 |
* ENHANCEMENT: rich snippet are returned only if a YASR shortcode is in the post or page
|
13 |
* ENHANCEMENT: changed classes names star-rating and star-value in yasr-star-rating and yasr-star-value. **DELETE YOUR BROWSER CACHE**
|
14 |
-
[//]: # fs_premium_only_begin
|
15 |
-
* FIXED: fix in rankings if more then one were in same pages
|
16 |
-
[//]: # fs_premium_only_end
|
17 |
|
18 |
= 2.2.8 =
|
19 |
* FIXED: empty schema field can return error on existing post or page.
|
1 |
+
= 2.3.3 =
|
2 |
+
* FIXED: "Load results with AJAX" option works with all post types, not only the "posts" one
|
3 |
+
* FIXED: CSS fix in settings pages
|
4 |
+
* FIXED: minor fix with multiSet
|
5 |
+
|
6 |
+
= 2.3.2 =
|
7 |
+
* FIXED: Uncaught TypeError randomly shows up in the browser console
|
8 |
+
* TWEAKED: removed deprecated multisite function
|
9 |
+
* TWEAKED: in the settings page, the "custom css" textarea is now a text editor
|
10 |
+
* TWEAKED: CSS improvement in settings page
|
11 |
+
* TWEAKED: minor code cleanup
|
12 |
+
|
13 |
= 2.3.0 =
|
14 |
* NEW FEATURE: YASR now support all caching plugin available out there.
|
15 |
Just select "yes" at the question "Load results with AJAX" in the settings page.
|
23 |
fields where reset
|
24 |
* ENHANCEMENT: rich snippet are returned only if a YASR shortcode is in the post or page
|
25 |
* ENHANCEMENT: changed classes names star-rating and star-value in yasr-star-rating and yasr-star-value. **DELETE YOUR BROWSER CACHE**
|
|
|
|
|
|
|
26 |
|
27 |
= 2.2.8 =
|
28 |
* FIXED: empty schema field can return error on existing post or page.
|
includes/classes/YasrCustomPostTypes.php
CHANGED
@@ -8,6 +8,13 @@
|
|
8 |
*/
|
9 |
class YasrCustomPostTypes {
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
public static function addFilterExistingCpt() {
|
12 |
add_filter('register_post_type_args', 'YasrCustomPostTypes::enableRestAllCPT', 10, 2);
|
13 |
}
|
@@ -19,6 +26,9 @@ class YasrCustomPostTypes {
|
|
19 |
* @return mixed
|
20 |
* @since 2.3.3
|
21 |
*
|
|
|
|
|
|
|
22 |
* Filter all post types and enables rest response and rest base, only if:
|
23 |
* there isn't (or set to false) show_in_rest arg
|
24 |
* there isn't (or set to false) _builtin arg
|
8 |
*/
|
9 |
class YasrCustomPostTypes {
|
10 |
|
11 |
+
|
12 |
+
/**
|
13 |
+
** @since 2.3.3
|
14 |
+
*
|
15 |
+
* @depreacted 2.4.5
|
16 |
+
* This function is deprecated since version 2.4.5, the caller (in yasr-rest.php) is commented out
|
17 |
+
*/
|
18 |
public static function addFilterExistingCpt() {
|
19 |
add_filter('register_post_type_args', 'YasrCustomPostTypes::enableRestAllCPT', 10, 2);
|
20 |
}
|
26 |
* @return mixed
|
27 |
* @since 2.3.3
|
28 |
*
|
29 |
+
* @depreacted 2.4.5
|
30 |
+
* @deprecated the add_filter addFilterExistingCpt is just above
|
31 |
+
*
|
32 |
* Filter all post types and enables rest response and rest base, only if:
|
33 |
* there isn't (or set to false) show_in_rest arg
|
34 |
* there isn't (or set to false) _builtin arg
|
includes/classes/YasrPhpFieldsHelper.php
CHANGED
@@ -35,13 +35,14 @@ class YasrPhpFieldsHelper {
|
|
35 |
* @param bool|string $id
|
36 |
*/
|
37 |
public static function radio($title=false, $class=false, $options=[], $name=false, $default_value=false, $id=false) {
|
|
|
38 |
$attribute = self::escape_attributes($class, $title, $name, $id, $default_value, false );
|
39 |
$radio_options = self::escape_array($options);
|
40 |
|
41 |
$container = '';
|
42 |
$end_container = '';
|
43 |
-
|
44 |
$title_string = '';
|
|
|
45 |
if($attribute['title']) {
|
46 |
$title_string .= '<strong>' . $attribute['title'] . '</strong><br />';
|
47 |
}
|
@@ -57,9 +58,9 @@ class YasrPhpFieldsHelper {
|
|
57 |
//checked is defined
|
58 |
$checked = '';
|
59 |
|
60 |
-
//
|
61 |
-
|
62 |
-
if ($attribute['value']
|
63 |
$checked = 'checked';
|
64 |
}
|
65 |
|
@@ -68,18 +69,18 @@ class YasrPhpFieldsHelper {
|
|
68 |
$value = '';
|
69 |
}
|
70 |
|
71 |
-
$radio_fields .=
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
$id_string, $attribute['name'], $value, $attribute['class'], $id_string, $checked,
|
84 |
__( ucfirst( $label ), 'yet-another-stars-rating' ) );
|
85 |
|
@@ -190,7 +191,6 @@ class YasrPhpFieldsHelper {
|
|
190 |
$title_or_label = 'title';
|
191 |
if(!$name) {
|
192 |
$name = 'radio_group';
|
193 |
-
|
194 |
}
|
195 |
}
|
196 |
|
35 |
* @param bool|string $id
|
36 |
*/
|
37 |
public static function radio($title=false, $class=false, $options=[], $name=false, $default_value=false, $id=false) {
|
38 |
+
|
39 |
$attribute = self::escape_attributes($class, $title, $name, $id, $default_value, false );
|
40 |
$radio_options = self::escape_array($options);
|
41 |
|
42 |
$container = '';
|
43 |
$end_container = '';
|
|
|
44 |
$title_string = '';
|
45 |
+
|
46 |
if($attribute['title']) {
|
47 |
$title_string .= '<strong>' . $attribute['title'] . '</strong><br />';
|
48 |
}
|
58 |
//checked is defined
|
59 |
$checked = '';
|
60 |
|
61 |
+
//escape_attributes use htmlspecialchars that always return a string, so control must be weak
|
62 |
+
/** @noinspection TypeUnsafeComparisonInspection */
|
63 |
+
if ($attribute['value'] == $value) {
|
64 |
$checked = 'checked';
|
65 |
}
|
66 |
|
69 |
$value = '';
|
70 |
}
|
71 |
|
72 |
+
$radio_fields .= sprintf( '<div>
|
73 |
+
<label for="%s">
|
74 |
+
<input type="radio"
|
75 |
+
name="%s"
|
76 |
+
value="%s"
|
77 |
+
class="%s"
|
78 |
+
id="%s"
|
79 |
+
%s
|
80 |
+
>
|
81 |
+
%s
|
82 |
+
</label>
|
83 |
+
</div>',
|
84 |
$id_string, $attribute['name'], $value, $attribute['class'], $id_string, $checked,
|
85 |
__( ucfirst( $label ), 'yet-another-stars-rating' ) );
|
86 |
|
191 |
$title_or_label = 'title';
|
192 |
if(!$name) {
|
193 |
$name = 'radio_group';
|
|
|
194 |
}
|
195 |
}
|
196 |
|
includes/js/src/yasr-front.js
CHANGED
@@ -43,27 +43,39 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|
43 |
}
|
44 |
}
|
45 |
|
46 |
-
|
|
|
|
|
47 |
|
48 |
//By default, hide the highest rated chart
|
49 |
document.getElementById('yasr-highest-rated-posts').style.display = 'none';
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
|
|
|
|
|
|
|
54 |
|
55 |
|
56 |
-
//
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
|
69 |
/****** End Yasr shortcode page ******/
|
43 |
}
|
44 |
}
|
45 |
|
46 |
+
|
47 |
+
//check if yasr-highest-rated-posts exists (from yasr_most_or_highest_rated_posts shortcode)
|
48 |
+
if (document.getElementById('yasr-highest-rated-posts') !== null) {
|
49 |
|
50 |
//By default, hide the highest rated chart
|
51 |
document.getElementById('yasr-highest-rated-posts').style.display = 'none';
|
52 |
|
53 |
+
//This work on top10 ranking chart, show the highest rated and hide most rated
|
54 |
+
document.getElementById("link-yasr-highest-rated-posts").addEventListener("click",
|
55 |
+
function (e) {
|
56 |
+
document.getElementById('yasr-most-rated-posts').style.display = 'none';
|
57 |
+
document.getElementById('yasr-highest-rated-posts').style.display = '';
|
58 |
|
59 |
+
e.preventDefault();
|
60 |
+
},
|
61 |
+
false
|
62 |
+
);
|
63 |
|
64 |
|
65 |
+
//Vice versa
|
66 |
+
document.getElementById("link-yasr-most-rated-posts").addEventListener("click",
|
67 |
+
function (e) {
|
68 |
+
document.getElementById('yasr-highest-rated-posts').style.display = 'none';
|
69 |
+
document.getElementById('yasr-most-rated-posts').style.display = '';
|
70 |
|
71 |
+
e.preventDefault();
|
72 |
+
},
|
73 |
+
false
|
74 |
+
);
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
});
|
79 |
|
80 |
|
81 |
/****** End Yasr shortcode page ******/
|
includes/js/yasr-front.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e){var r=wp.i18n.__;function a(t,e){t=parseInt(t),raterJs({starSize:t,step:.1,showToolTip:!1,readOnly:!0,element:document.getElementById(e)})}function n(t,e,r,a,n,i,
|
1 |
+
!function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e){var r=wp.i18n.__;function a(t,e){t=parseInt(t),raterJs({starSize:t,step:.1,showToolTip:!1,readOnly:!0,element:document.getElementById(e)})}function n(t,e,r,a,n,o,i,d,u){e=parseFloat(e),a=s(a),raterJs({starSize:t,rating:e,step:1,showToolTip:!1,readOnly:a,element:document.getElementById(n),rateCallback:function(t,e){document.getElementById(u).innerHTML=yasrCommonData.loaderHtml;var a={action:"yasr_send_visitor_rating",rating:t,post_id:r,nonce_visitor:i,is_singular:d};this.setRating(t),this.disable(),jQuery.post(yasrCommonData.ajaxurl,a,(function(t){t=JSON.parse(t),document.getElementById(u).innerHTML=t})),e()}})}function s(t){return null!=t&&""!==t||(t=!0),"true"!==t&&"1"!==t||(t=!0),"false"!==t&&"0"!==t||(t=!1),t}document.addEventListener("DOMContentLoaded",(function(t){var e=document.getElementsByClassName("yasr-rater-stars");e.length>0&&function(t){for(var e=0;e<t.length;e++){var r=t.item(e).id;a(t.item(e).getAttribute("data-rater-starsize"),r)}}(e);var o=document.getElementsByClassName("yasr-rater-stars-visitor-votes");o.length>0&&function(t){for(var e=0;e<t.length;e++)!function(e){var a=t.item(e).getAttribute("data-rating"),o=t.item(e).getAttribute("data-readonly-attribute"),i=t.item(e).getAttribute("data-rater-readonly");null===o&&(o=!1),o=s(o),i=s(i),!0===o&&(i=!0);var d=t.item(e).getAttribute("data-rater-postid"),u=t.item(e).id,l=u.replace("yasr-visitor-votes-rater-",""),m=parseInt(t.item(e).getAttribute("data-rater-starsize")),y=t.item(e).getAttribute("data-rater-nonce"),c=t.item(e).getAttribute("data-issingular"),v="yasr-vv-votes-number-container-"+l,f="yasr-vv-average-container-"+l,p="yasr-visitor-votes-container-after-stars-"+l,g=!1;if("yes"===yasrCommonData.ajaxEnabled){var _=t.item(e).getAttribute("data-cpt");""===_&&(_="posts");var b="wp/v2/"+_+"/"+d+"?_fields=yasr_visitor_votes&_wpnonce="+yasrCommonData.nonce;jQuery.get(yasrCommonData.restEndpoint+b).done((function(t){var e;(e=!0===o||t.yasr_visitor_votes.stars_attributes.read_only,a=(a=t.yasr_visitor_votes.number_of_votes>0?t.yasr_visitor_votes.sum_votes/t.yasr_visitor_votes.number_of_votes:0).toFixed(1),a=parseFloat(a),n(m,a,d,e,u,l,y,c,p),!0!==o)&&(document.getElementById(v).innerHTML=t.yasr_visitor_votes.number_of_votes,document.getElementById(f).innerHTML=a,!1!==t.yasr_visitor_votes.stars_attributes.span_bottom&&(g=t.yasr_visitor_votes.stars_attributes.span_bottom,document.getElementById(p).insertAdjacentHTML("beforeend",g)))})).fail((function(t,e,s,o){console.info(r("YASR ajax call failed. Showing ratings from html","yet-another-stars-rating")),n(m,a,d,i,u,l,y,c,p)}))}else n(m,a,d,i,u,l,y,c,p)}(e)}(o);var i=document.getElementsByClassName("yasr-multiset-visitors-rater");if(i.length>0&&function(t){for(var e="",r=[],a=0;a<t.length;a++)!function(a){var n=t.item(a).id,o=t.item(a).getAttribute("data-rater-readonly");o=s(o);var i=document.querySelector("#"+n);raterJs({starSize:16,step:1,showToolTip:!1,readOnly:o,element:i,rateCallback:function(t,a){var n=i.getAttribute("data-rater-postid"),s=i.getAttribute("data-rater-setid"),o=i.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var d=parseInt(t);this.setRating(d),e={postid:n,setid:s,field:o,rating:d},r.push(e),a()}})}(a);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),a=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n={action:"yasr_visitor_multiset_field_vote",nonce:a,post_id:t,rating:r,set_type:e};jQuery.post(yasrCommonData.ajaxurl,n,(function(r){jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)}))}))}(i),o&&"yes"===yasrCommonData.visitorStatsEnabled){var d=document.getElementsByClassName("yasr-dashicons-visitor-stats");d&&function(t){for(var e=!1,r=0;r<t.length;r++)!function(r){var a="#"+t.item(r).id,n={action:"yasr_stats_visitors_votes",post_id:t.item(r).getAttribute("data-postid")};tippy(a,{content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:"true",arrowType:"round",onShow:function(t){a!==e&&jQuery.post(yasrCommonData.ajaxurl,n,(function(e){e=JSON.parse(e),t.setContent(e)}))},onHidden:function(){e=a}})}(r)}(d)}null!==document.getElementById("yasr-highest-rated-posts")&&(document.getElementById("yasr-highest-rated-posts").style.display="none",document.getElementById("link-yasr-highest-rated-posts").addEventListener("click",(function(t){document.getElementById("yasr-most-rated-posts").style.display="none",document.getElementById("yasr-highest-rated-posts").style.display="",t.preventDefault()}),!1),document.getElementById("link-yasr-most-rated-posts").addEventListener("click",(function(t){document.getElementById("yasr-highest-rated-posts").style.display="none",document.getElementById("yasr-most-rated-posts").style.display="",t.preventDefault()}),!1))}))}]);
|
includes/rest/yasr-rest.php
CHANGED
@@ -42,4 +42,8 @@ $yasr_custom_fields->restApiInit();
|
|
42 |
$yasr_custom_endpoint->restApiInit();
|
43 |
|
44 |
//Filter existing CPT to work with YASR
|
45 |
-
|
|
|
|
|
|
|
|
42 |
$yasr_custom_endpoint->restApiInit();
|
43 |
|
44 |
//Filter existing CPT to work with YASR
|
45 |
+
/****
|
46 |
+
* Since version 2.4.5 this is comment out,
|
47 |
+
* to avoid security problems tha may occour
|
48 |
+
*/
|
49 |
+
//YasrCustomPostTypes::addFilterExistingCpt();
|
includes/shortcodes/classes/YasrOverallRating.php
CHANGED
@@ -80,7 +80,13 @@ class YasrOverallRating extends YasrShortcode {
|
|
80 |
|
81 |
$class .= ' yasr-rater-stars';
|
82 |
|
83 |
-
$overall_rating
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
$unique_id = str_shuffle(uniqid());
|
86 |
$overall_rating_html_id = 'yasr-overall-rating-rater-' . $unique_id;
|
@@ -104,7 +110,11 @@ class YasrOverallRating extends YasrShortcode {
|
|
104 |
*
|
105 |
*/
|
106 |
protected function customTextBefore() {
|
107 |
-
if (YASR_TEXT_BEFORE_STARS
|
|
|
|
|
|
|
|
|
108 |
$text_before_star = str_replace('%overall_rating%', $this->overall_rating, YASR_TEXT_BEFORE_OVERALL);
|
109 |
$shortcode_html = "<div class='yasr-container-custom-text-and-overall'>
|
110 |
<span id='yasr-custom-text-before-overall'>" . $text_before_star . "</span>
|
80 |
|
81 |
$class .= ' yasr-rater-stars';
|
82 |
|
83 |
+
//if here $this->overall_rating is still null, get the overall_rating
|
84 |
+
//this could happens when function is called directly
|
85 |
+
if($this->overall_rating === null) {
|
86 |
+
$overall_rating = YasrDatabaseRatings::getOverallRating($post_id);
|
87 |
+
} else {
|
88 |
+
$overall_rating = $this->overall_rating;
|
89 |
+
}
|
90 |
|
91 |
$unique_id = str_shuffle(uniqid());
|
92 |
$overall_rating_html_id = 'yasr-overall-rating-rater-' . $unique_id;
|
110 |
*
|
111 |
*/
|
112 |
protected function customTextBefore() {
|
113 |
+
if (YASR_TEXT_BEFORE_STARS === 1 && YASR_TEXT_BEFORE_OVERALL !== '') {
|
114 |
+
|
115 |
+
//Get overall Rating
|
116 |
+
$this->overall_rating = YasrDatabaseRatings::getOverallRating();
|
117 |
+
|
118 |
$text_before_star = str_replace('%overall_rating%', $this->overall_rating, YASR_TEXT_BEFORE_OVERALL);
|
119 |
$shortcode_html = "<div class='yasr-container-custom-text-and-overall'>
|
120 |
<span id='yasr-custom-text-before-overall'>" . $text_before_star . "</span>
|
includes/shortcodes/classes/YasrRankings.php
CHANGED
@@ -129,45 +129,45 @@ class YasrRankings extends YasrShortcode {
|
|
129 |
LIMIT 10"
|
130 |
);
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
<th>" . __('
|
136 |
-
|
137 |
-
<a href='' onclick='yasrShowMost(); return false'>"
|
138 |
-
. __("Most Rated", 'yet-another-stars-rating') .
|
139 |
-
"</a> |
|
140 |
<span id='yasr_multi_chart_link_to_nothing'>"
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
143 |
</th>
|
144 |
</tr>";
|
145 |
|
146 |
-
$this->
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
|
|
|
|
160 |
|
161 |
$this->vvMostRated();
|
162 |
$this->vvHighestRated();
|
163 |
|
164 |
$this->shortcode_html .= '<!-- End Yasr Most Or Highest Rated Shortcode-->';
|
165 |
|
166 |
-
wp_localize_script( 'yasrfront', "yasrMostHighestRanking", array(
|
167 |
-
'enable' => 'yes'
|
168 |
-
)
|
169 |
-
);
|
170 |
-
|
171 |
return $this->shortcode_html;
|
172 |
|
173 |
}
|
@@ -235,7 +235,7 @@ class YasrRankings extends YasrShortcode {
|
|
235 |
} //end if $query_result
|
236 |
|
237 |
else {
|
238 |
-
$this->shortcode_html = __("You've not
|
239 |
}
|
240 |
}
|
241 |
|
129 |
LIMIT 10"
|
130 |
);
|
131 |
|
132 |
+
|
133 |
+
$this->vv_most_rated_table = "<table class='yasr-table-chart' id='yasr-most-rated-posts'>
|
134 |
+
<tr class='yasr-visitor-votes-title'>
|
135 |
+
<th>" . __('Post / Page', 'yet-another-stars-rating') . " </th>
|
136 |
+
<th>" . __('Order By', 'yet-another-stars-rating') . ":
|
|
|
|
|
|
|
137 |
<span id='yasr_multi_chart_link_to_nothing'>"
|
138 |
+
. __('Most Rated', 'yet-another-stars-rating') .
|
139 |
+
"</span> |
|
140 |
+
<span id='link-yasr-highest-rated-posts'>
|
141 |
+
<a href='#'>"
|
142 |
+
. __('Highest Rated', 'yet-another-stars-rating') .
|
143 |
+
"</a>
|
144 |
+
</span>
|
145 |
</th>
|
146 |
</tr>";
|
147 |
|
148 |
+
$this->vv_highest_rated_table = "<table class='yasr-table-chart' id='yasr-highest-rated-posts'>
|
149 |
+
<tr class='yasr-visitor-votes-title'>
|
150 |
+
<th>" . __('Post / Page', 'yet-another-stars-rating') . "</th>
|
151 |
+
<th>" . __('Order By', 'yet-another-stars-rating') . ":
|
152 |
+
<span id='link-yasr-most-rated-posts'>
|
153 |
+
<a href='#'>"
|
154 |
+
. __("Most Rated", 'yet-another-stars-rating') .
|
155 |
+
"</a>
|
156 |
+
|
|
157 |
+
</span>
|
158 |
+
<span id='yasr_multi_chart_link_to_nothing'>"
|
159 |
+
. __("Highest Rated", 'yet-another-stars-rating') .
|
160 |
+
"</span>
|
161 |
+
</th>
|
162 |
+
</tr>";
|
163 |
+
|
164 |
+
|
165 |
|
166 |
$this->vvMostRated();
|
167 |
$this->vvHighestRated();
|
168 |
|
169 |
$this->shortcode_html .= '<!-- End Yasr Most Or Highest Rated Shortcode-->';
|
170 |
|
|
|
|
|
|
|
|
|
|
|
171 |
return $this->shortcode_html;
|
172 |
|
173 |
}
|
235 |
} //end if $query_result
|
236 |
|
237 |
else {
|
238 |
+
$this->shortcode_html = __("You've not enough data",'yet-another-stars-rating') . "<br />";
|
239 |
}
|
240 |
}
|
241 |
|
public/yasr-public-actions.php
CHANGED
@@ -75,13 +75,6 @@ function yasr_add_scripts() {
|
|
75 |
true
|
76 |
);
|
77 |
|
78 |
-
wp_enqueue_script(
|
79 |
-
'yasrfront',
|
80 |
-
YASR_JS_DIR_INCLUDES . 'yasr-front.js',
|
81 |
-
array('jquery', 'rater', 'wp-i18n'),
|
82 |
-
YASR_VERSION_NUM,
|
83 |
-
true);
|
84 |
-
|
85 |
wp_enqueue_script(
|
86 |
'tippy',
|
87 |
YASR_JS_DIR_INCLUDES . 'tippy.all.min.js',
|
@@ -90,6 +83,14 @@ function yasr_add_scripts() {
|
|
90 |
true
|
91 |
);
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
do_action('yasr_add_front_script_js');
|
94 |
|
95 |
$yasr_visitor_votes_loader = '<div id="loader-visitor-rating" style="display: inline"> '.
|
75 |
true
|
76 |
);
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
wp_enqueue_script(
|
79 |
'tippy',
|
80 |
YASR_JS_DIR_INCLUDES . 'tippy.all.min.js',
|
83 |
true
|
84 |
);
|
85 |
|
86 |
+
wp_enqueue_script(
|
87 |
+
'yasrfront',
|
88 |
+
YASR_JS_DIR_INCLUDES . 'yasr-front.js',
|
89 |
+
array('jquery', 'rater', 'wp-i18n'),
|
90 |
+
YASR_VERSION_NUM,
|
91 |
+
true
|
92 |
+
);
|
93 |
+
|
94 |
do_action('yasr_add_front_script_js');
|
95 |
|
96 |
$yasr_visitor_votes_loader = '<div id="loader-visitor-rating" style="display: inline"> '.
|
readme.txt
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
|
3 |
Tags: rating, rate post, rate page, star rating, google rating, votes
|
4 |
Requires at least: 4.9.0
|
5 |
-
Contributors: Dudo
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.3
|
8 |
-
Stable tag: 2.4.
|
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
|
@@ -168,6 +168,12 @@ If doesn't, you should work on your seo reputation.
|
|
168 |
|
169 |
The full changelog can be found in the plugin's directory. Recent entries:
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
= 2.4.4 =
|
172 |
* TWEAKED: added yasr_auto_insert_exclude_cpt hook
|
173 |
* TWEAKED: code cleanup
|
@@ -195,7 +201,6 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
195 |
* FIXED: missing fragment error if gutenber used
|
196 |
* FIXED: empty tooltip on yasr_visitor_votes
|
197 |
|
198 |
-
|
199 |
= 2.3.8 =
|
200 |
* TWEAKED: Using GET instead of POST when getting rest response
|
201 |
|
@@ -211,27 +216,12 @@ The full changelog can be found in the plugin's directory. Recent entries:
|
|
211 |
You may need to save again "Publisher name" and "Image Url"
|
212 |
* IMPROVED: code cleanup
|
213 |
|
214 |
-
|
215 |
= 2.3.4 =
|
216 |
* IMPROVED: added Software Application itemType
|
217 |
* IMPROVED: added Organization itemType
|
218 |
* IMPORVED: added reviewBody and description properties
|
219 |
* FIXED: "Your ratings" widget in admin dashboard
|
220 |
|
221 |
-
|
222 |
-
= 2.3.3 =
|
223 |
-
* FIXED: "Load results with AJAX" option works with all post types, not the "posts" one
|
224 |
-
* FIXED: CSS fix in settings pages
|
225 |
-
* FIXED: minor fix with multiSet
|
226 |
-
|
227 |
-
|
228 |
-
= 2.3.2 =
|
229 |
-
* FIXED: Uncaught TypeError randomly shows up in the browser console
|
230 |
-
* TWEAKED: removed deprecated multisite function
|
231 |
-
* TWEAKED: in the settings page, the "custom css" textarea is now a text editor
|
232 |
-
* TWEAKED: CSS improvement in settings page
|
233 |
-
* TWEAKED: minor code cleanup
|
234 |
-
|
235 |
= 2.3.1 =
|
236 |
* Code refactor, according to boilerplate standards
|
237 |
|
2 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
|
3 |
Tags: rating, rate post, rate page, star rating, google rating, votes
|
4 |
Requires at least: 4.9.0
|
5 |
+
Contributors: Dudo
|
6 |
Tested up to: 5.5
|
7 |
Requires PHP: 5.3
|
8 |
+
Stable tag: 2.4.5
|
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
|
168 |
|
169 |
The full changelog can be found in the plugin's directory. Recent entries:
|
170 |
|
171 |
+
= 2.4.5 =
|
172 |
+
FIXED: %overall_rating% pattern didn't work for custom text
|
173 |
+
FIXED: fixed link in yasr_most_or_highest_rated_posts
|
174 |
+
FIXED: warning in yasr-settings-functions-multiset.php
|
175 |
+
TWEAKED: minor changes
|
176 |
+
|
177 |
= 2.4.4 =
|
178 |
* TWEAKED: added yasr_auto_insert_exclude_cpt hook
|
179 |
* TWEAKED: code cleanup
|
201 |
* FIXED: missing fragment error if gutenber used
|
202 |
* FIXED: empty tooltip on yasr_visitor_votes
|
203 |
|
|
|
204 |
= 2.3.8 =
|
205 |
* TWEAKED: Using GET instead of POST when getting rest response
|
206 |
|
216 |
You may need to save again "Publisher name" and "Image Url"
|
217 |
* IMPROVED: code cleanup
|
218 |
|
|
|
219 |
= 2.3.4 =
|
220 |
* IMPROVED: added Software Application itemType
|
221 |
* IMPROVED: added Organization itemType
|
222 |
* IMPORVED: added reviewBody and description properties
|
223 |
* FIXED: "Your ratings" widget in admin dashboard
|
224 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
= 2.3.1 =
|
226 |
* Code refactor, according to boilerplate standards
|
227 |
|
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.4.
|
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.4.
|
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.4.5
|
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.4.5' );
|
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__ );
|