Version Description
- Avoid multiple vote in a same post for logged in user
- Bug fixes and cleanup
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 0.3.1 |
Comparing to | |
See all releases |
Code changes from version 0.3.0 to 0.3.1
- css/yasr.css +6 -0
- lib/yasr-ajax-functions.php +1 -1
- lib/yasr-db-functions.php +37 -0
- lib/yasr-settings-functions.php +5 -2
- lib/yasr-shortcode-functions.php +111 -25
- readme.txt +5 -2
- yasr-settings-page.php +53 -44
- yet-another-stars-rating.php +2 -2
css/yasr.css
CHANGED
@@ -64,6 +64,12 @@ h2.nav-tab-wrapper, h3.nav-tab-wrapper {
|
|
64 |
}
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
.yasr-list-set-table {
|
68 |
margin-left:5px;
|
69 |
}
|
64 |
}
|
65 |
}
|
66 |
|
67 |
+
#yasr-snippet-explained {
|
68 |
+
border: 2px dashed #CCC;
|
69 |
+
padding: 15px;
|
70 |
+
margin: 10px;
|
71 |
+
}
|
72 |
+
|
73 |
.yasr-list-set-table {
|
74 |
margin-left:5px;
|
75 |
}
|
lib/yasr-ajax-functions.php
CHANGED
@@ -835,7 +835,7 @@ add_action( 'wp_ajax_yasr_change_log_page', 'yasr_change_log_page_callback' );
|
|
835 |
}
|
836 |
|
837 |
echo "<div class=\"rateit bigstars\" id=\"yasr_rateit_user_votes_voted_ro\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$average_rating\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
|
838 |
-
<br
|
839 |
|
840 |
|
841 |
|
835 |
}
|
836 |
|
837 |
echo "<div class=\"rateit bigstars\" id=\"yasr_rateit_user_votes_voted_ro\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$average_rating\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
|
838 |
+
<br />" . __("Average Rating", "yasr") . " $average_rating / 5 ($number_of_votes " . __("votes casts", "yasr") . ")<strong><br />" . __("You've already voted this article with $rating", "yasr") . "</strong>";
|
839 |
|
840 |
|
841 |
|
lib/yasr-db-functions.php
CHANGED
@@ -341,4 +341,41 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
|
|
341 |
|
342 |
} //End callback function
|
343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
?>
|
341 |
|
342 |
} //End callback function
|
343 |
|
344 |
+
|
345 |
+
|
346 |
+
/****** Check if a logged in user has already rated. Return user vote for a post if exists ******/
|
347 |
+
|
348 |
+
function yasr_check_if_user_already_voted() {
|
349 |
+
global $wpdb;
|
350 |
+
|
351 |
+
global $current_user;
|
352 |
+
get_currentuserinfo();
|
353 |
+
|
354 |
+
$user_id = $current_user->ID;
|
355 |
+
|
356 |
+
$post_id = get_the_ID();
|
357 |
+
|
358 |
+
$result = $wpdb->get_results("SELECT vote FROM " . YASR_LOG_TABLE . " WHERE post_id=$post_id AND user_id=$user_id ORDER BY id DESC LIMIT 1 ");
|
359 |
+
|
360 |
+
if ($result) {
|
361 |
+
|
362 |
+
foreach ($result as $row) {
|
363 |
+
|
364 |
+
$vote = $row->vote;
|
365 |
+
|
366 |
+
}
|
367 |
+
|
368 |
+
return $vote;
|
369 |
+
|
370 |
+
}
|
371 |
+
|
372 |
+
else {
|
373 |
+
|
374 |
+
return FALSE;
|
375 |
+
|
376 |
+
}
|
377 |
+
|
378 |
+
|
379 |
+
}
|
380 |
+
|
381 |
?>
|
lib/yasr-settings-functions.php
CHANGED
@@ -138,8 +138,11 @@
|
|
138 |
<?php _e('Aggregate Rating', 'yasr')?>
|
139 |
<br />
|
140 |
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
143 |
<?php
|
144 |
|
145 |
_e("If you select \"Review Rating\", your site will be indexed from search engines like this: ", "yasr");
|
138 |
<?php _e('Aggregate Rating', 'yasr')?>
|
139 |
<br />
|
140 |
|
141 |
+
<br />
|
142 |
+
|
143 |
+
<a href="#" id="yasr-snippet-explained-link"><?php _e("What is this?", "yasr") ?></a>
|
144 |
+
|
145 |
+
<div id="yasr-snippet-explained" style="display:none">
|
146 |
<?php
|
147 |
|
148 |
_e("If you select \"Review Rating\", your site will be indexed from search engines like this: ", "yasr");
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -63,9 +63,53 @@ function shortcode_visitor_votes_callback () {
|
|
63 |
|
64 |
$medium_rating=round($medium_rating, 1);
|
65 |
|
|
|
|
|
66 |
//if anonymous are allowed to vote
|
67 |
if ($allow_logged_option['allowed_user']==='allow_anonymous') {
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
if ($votes_number>0) {
|
70 |
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
71 |
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
|
@@ -75,30 +119,55 @@ function shortcode_visitor_votes_callback () {
|
|
75 |
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
76 |
</div><br /> " . __("No rating yet" , "yasr") . "</div>";
|
77 |
}
|
|
|
|
|
78 |
|
79 |
-
}
|
|
|
|
|
80 |
|
81 |
//If only logged in users can vote
|
82 |
elseif ($allow_logged_option['allowed_user']==='logged_only') {
|
83 |
|
84 |
-
//If user is logged in
|
85 |
if ( is_user_logged_in() ) {
|
86 |
|
87 |
-
if
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
|
92 |
else {
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
}
|
96 |
|
97 |
-
|
|
|
98 |
|
99 |
//Else mean user is not logged in
|
100 |
else {
|
101 |
|
|
|
102 |
if ($votes_number>0) {
|
103 |
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
|
104 |
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br />" . __("You must sign to vote", "yasr") . "</div>";
|
@@ -119,6 +188,16 @@ function shortcode_visitor_votes_callback () {
|
|
119 |
<script>
|
120 |
jQuery(document).ready(function() {
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
|
123 |
jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipvalues[value-1]); });
|
124 |
|
@@ -155,22 +234,29 @@ function shortcode_visitor_votes_callback () {
|
|
155 |
|
156 |
//Else user cannot vote
|
157 |
else {
|
158 |
-
var cookievote=jQuery.cookie(cookiename);
|
159 |
-
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
|
160 |
-
|
161 |
-
var data = {
|
162 |
-
action: 'yasr_readonly_visitor_shortcode',
|
163 |
-
rating: cookievote,
|
164 |
-
votes: <?php echo $medium_rating ?>,
|
165 |
-
votes_number: <?php echo $votes_number ?>,
|
166 |
-
post_id: postid
|
167 |
-
}
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
});
|
176 |
|
@@ -180,9 +266,9 @@ function shortcode_visitor_votes_callback () {
|
|
180 |
|
181 |
} //End if is singular
|
182 |
|
183 |
-
|
184 |
|
185 |
-
}
|
186 |
|
187 |
|
188 |
/****** Add shortcode for multiple set ******/
|
63 |
|
64 |
$medium_rating=round($medium_rating, 1);
|
65 |
|
66 |
+
$ready_only_stars_for_logged_users_showed = 0;
|
67 |
+
|
68 |
//if anonymous are allowed to vote
|
69 |
if ($allow_logged_option['allowed_user']==='allow_anonymous') {
|
70 |
|
71 |
+
//I've to block a logged in user that has already rated
|
72 |
+
if ( is_user_logged_in() ) {
|
73 |
+
|
74 |
+
//Chek if a logged in user has already rated for this post
|
75 |
+
$vote_if_user_already_rated = yasr_check_if_user_already_voted();
|
76 |
+
|
77 |
+
//If user has already rated show readonly stars
|
78 |
+
if ($vote_if_user_already_rated) {
|
79 |
+
|
80 |
+
global $current_user;
|
81 |
+
get_currentuserinfo();
|
82 |
+
|
83 |
+
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
|
84 |
+
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
|
85 |
+
|
86 |
+
$ready_only_stars_for_logged_users_showed = 1;
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
//else logged user can vote
|
91 |
+
else {
|
92 |
+
|
93 |
+
$vote_if_user_already_rated = 0;
|
94 |
+
|
95 |
+
if ($votes_number>0) {
|
96 |
+
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
97 |
+
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
|
98 |
+
}
|
99 |
+
|
100 |
+
else {
|
101 |
+
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
102 |
+
</div><br /> " . __("No rating yet" , "yasr") . "</div>";
|
103 |
+
}
|
104 |
+
|
105 |
+
} //End else
|
106 |
+
|
107 |
+
} //End if user is logged
|
108 |
+
|
109 |
+
|
110 |
+
//else is not logged can vote
|
111 |
+
else {
|
112 |
+
|
113 |
if ($votes_number>0) {
|
114 |
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
115 |
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
|
119 |
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
120 |
</div><br /> " . __("No rating yet" , "yasr") . "</div>";
|
121 |
}
|
122 |
+
|
123 |
+
} //end else
|
124 |
|
125 |
+
} //end if ($allow_logged_option['allowed_user']==='allow_anonymous') {
|
126 |
+
|
127 |
+
|
128 |
|
129 |
//If only logged in users can vote
|
130 |
elseif ($allow_logged_option['allowed_user']==='logged_only') {
|
131 |
|
132 |
+
//If user is logged in and can vote
|
133 |
if ( is_user_logged_in() ) {
|
134 |
|
135 |
+
//Chek if a logged in user has already rated for this post
|
136 |
+
$vote_if_user_already_rated = yasr_check_if_user_already_voted();
|
137 |
+
|
138 |
+
if ($vote_if_user_already_rated) {
|
139 |
+
|
140 |
+
global $current_user;
|
141 |
+
get_currentuserinfo();
|
142 |
+
|
143 |
+
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
|
144 |
+
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br /><strong>" . __("User ") . "$current_user->user_login" . __(" has already voted this article with $vote_if_user_already_rated ", "yasr") . "</strong></div>";
|
145 |
+
|
146 |
+
$ready_only_stars_for_logged_users_showed = 1;
|
147 |
+
|
148 |
}
|
149 |
|
150 |
else {
|
151 |
+
|
152 |
+
if ($votes_number>0) {
|
153 |
+
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
154 |
+
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ")</div>";
|
155 |
+
}
|
156 |
+
|
157 |
+
else {
|
158 |
+
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"0\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\">
|
159 |
+
</div><br /> " . __("No rating yet" , "yasr") . "</div>";
|
160 |
+
}
|
161 |
+
|
162 |
}
|
163 |
|
164 |
+
|
165 |
+
} //End if user is logged in
|
166 |
|
167 |
//Else mean user is not logged in
|
168 |
else {
|
169 |
|
170 |
+
|
171 |
if ($votes_number>0) {
|
172 |
$shortcode_html="<div id=\"yasr_visitor_votes\"><div class=\"rateit bigstars\" id=\"yasr_rateit_visitor_votes\" data-rateit-starwidth=\"32\" data-rateit-starheight=\"32\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\">
|
173 |
</div><br /> " . __("Average Rating", "yasr") . " $medium_rating / 5 (" . __("$votes_number votes casts" , "yasr") . ") <br />" . __("You must sign to vote", "yasr") . "</div>";
|
188 |
<script>
|
189 |
jQuery(document).ready(function() {
|
190 |
|
191 |
+
<?php
|
192 |
+
|
193 |
+
echo "var read_only_stars_showed = $ready_only_stars_for_logged_users_showed;";
|
194 |
+
|
195 |
+
?>
|
196 |
+
|
197 |
+
if (read_only_stars_showed != 1) {
|
198 |
+
read_only_stars_showed = 0;
|
199 |
+
}
|
200 |
+
|
201 |
var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
|
202 |
jQuery("#yasr_rateit_visitor_votes").bind('over', function (event, value) { jQuery(this).attr('title', tooltipvalues[value-1]); });
|
203 |
|
234 |
|
235 |
//Else user cannot vote
|
236 |
else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
|
238 |
+
//if php read only stars are not be showes echo readonly stars from cookie
|
239 |
+
if (read_only_stars_showed == 0) {
|
240 |
+
|
241 |
+
var cookievote=jQuery.cookie(cookiename);
|
242 |
+
var ajaxurl = "<?php echo admin_url('admin-ajax.php'); ?>";
|
243 |
+
|
244 |
+
var data = {
|
245 |
+
action: 'yasr_readonly_visitor_shortcode',
|
246 |
+
rating: cookievote,
|
247 |
+
votes: <?php echo $medium_rating ?>,
|
248 |
+
votes_number: <?php echo $votes_number ?>,
|
249 |
+
post_id: postid
|
250 |
+
}
|
251 |
+
|
252 |
+
jQuery.post(ajaxurl, data, function(response) {
|
253 |
+
jQuery('#yasr_visitor_votes').html(response);
|
254 |
+
jQuery('.rateit').rateit();
|
255 |
+
});
|
256 |
+
|
257 |
+
}
|
258 |
+
|
259 |
+
} //End else !logged_user_already_rated)
|
260 |
|
261 |
});
|
262 |
|
266 |
|
267 |
} //End if is singular
|
268 |
|
269 |
+
return $shortcode_html;
|
270 |
|
271 |
+
} //End function shortcode_visitor_votes_callback
|
272 |
|
273 |
|
274 |
/****** Add shortcode for multiple set ******/
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
3 |
Tags: Rating, Review, Star, Snippet, Rich snippet, Schema, Schema.org, Serp
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.9.1
|
6 |
-
Stable tag: 0.3.
|
7 |
License: GPL2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -42,13 +42,16 @@ If with gd-star-rating you're using a different number of stars from the default
|
|
42 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
43 |
3. Go to the Yet Another Star Rating menu in Settings and set your options.
|
44 |
|
45 |
-
|
46 |
== Screenshots ==
|
47 |
1. Example of yasr in a videogame review
|
48 |
2. Another example of a restaurant review
|
49 |
|
50 |
== Changelog ==
|
51 |
|
|
|
|
|
|
|
|
|
52 |
= 0.3.0 =
|
53 |
* Now admin can choose if allow only logged in users to vote or logged in and anonymous
|
54 |
* Code cleanup and bug fixes
|
3 |
Tags: Rating, Review, Star, Snippet, Rich snippet, Schema, Schema.org, Serp
|
4 |
Requires at least: 3.5
|
5 |
Tested up to: 3.9.1
|
6 |
+
Stable tag: 0.3.1
|
7 |
License: GPL2
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
42 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
43 |
3. Go to the Yet Another Star Rating menu in Settings and set your options.
|
44 |
|
|
|
45 |
== Screenshots ==
|
46 |
1. Example of yasr in a videogame review
|
47 |
2. Another example of a restaurant review
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 0.3.1 =
|
52 |
+
* Avoid multiple vote in a same post for logged in user
|
53 |
+
* Bug fixes and cleanup
|
54 |
+
|
55 |
= 0.3.0 =
|
56 |
* Now admin can choose if allow only logged in users to vote or logged in and anonymous
|
57 |
* Code cleanup and bug fixes
|
yasr-settings-page.php
CHANGED
@@ -5,8 +5,11 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
5 |
if ( !current_user_can( 'manage_options' ) ) {
|
6 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yasr' ));
|
7 |
}
|
|
|
8 |
?>
|
9 |
|
|
|
|
|
10 |
<div class="wrap">
|
11 |
|
12 |
<h2>Yet Another Stars Rating: Settings</h2>
|
@@ -64,7 +67,7 @@ if ( !current_user_can( 'manage_options' ) ) {
|
|
64 |
|
65 |
<?php
|
66 |
|
67 |
-
if ($active_tab=='general_settings') {
|
68 |
|
69 |
?>
|
70 |
|
@@ -175,7 +178,7 @@ if ( !current_user_can( 'manage_options' ) ) {
|
|
175 |
|
176 |
<?php
|
177 |
|
178 |
-
if ($active_tab=='manage_multi') {
|
179 |
|
180 |
$multi_set=yasr_get_multi_set();
|
181 |
|
@@ -293,7 +296,9 @@ if ( !current_user_can( 'manage_options' ) ) {
|
|
293 |
|
294 |
<script type="text/javascript">
|
295 |
|
296 |
-
|
|
|
|
|
297 |
jQuery('#yasr_auto_insert_radio_on').on('click', function(){
|
298 |
jQuery('.yasr_auto_insert_where_what_radio').prop('disabled', false);
|
299 |
});
|
@@ -302,13 +307,56 @@ if ( !current_user_can( 'manage_options' ) ) {
|
|
302 |
jQuery('.yasr_auto_insert_where_what_radio').prop('disabled', true);
|
303 |
});
|
304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
|
306 |
<?php
|
307 |
|
308 |
-
|
|
|
|
|
309 |
?>
|
310 |
|
311 |
-
//Second div code
|
312 |
jQuery('#yasr-multi-set-doc-link').on('click', function() {
|
313 |
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
314 |
});
|
@@ -406,44 +454,5 @@ if ( !current_user_can( 'manage_options' ) ) {
|
|
406 |
} //end if $active_tab=='manage_multi'
|
407 |
|
408 |
?>
|
409 |
-
|
410 |
-
|
411 |
-
//Terzo div code
|
412 |
-
|
413 |
-
//On click show proceed button
|
414 |
-
jQuery('#import-gdstar').on('click', function() {
|
415 |
-
jQuery('#yasr-import-gdstar-div').toggle();
|
416 |
-
});
|
417 |
-
|
418 |
-
//On click begin step1
|
419 |
-
jQuery('#import-button').on('click', function() {
|
420 |
-
|
421 |
-
var data = {
|
422 |
-
action : 'yasr_import_step1'
|
423 |
-
};
|
424 |
-
|
425 |
-
jQuery.post(ajaxurl, data, function(response) {
|
426 |
-
jQuery('#result-import').html(response);
|
427 |
-
});
|
428 |
-
|
429 |
-
}); //End step1
|
430 |
-
|
431 |
-
jQuery('#result-import').on('click', '.yasr-result-step-1', function() {
|
432 |
-
//Now we are going to prepare another ajax call to check if multiple set exists
|
433 |
-
|
434 |
-
var data = {
|
435 |
-
action: 'yasr_import_multi_set'
|
436 |
-
};
|
437 |
-
|
438 |
-
jQuery.post(ajaxurl, data, function(response) {
|
439 |
-
jQuery('#result-import').append(response);
|
440 |
-
});
|
441 |
-
|
442 |
-
}); //End second ajax call */
|
443 |
-
|
444 |
-
//Reload page after importing is done
|
445 |
-
jQuery('#result-import').on('click', '.yasr-result-step-2', function() {
|
446 |
-
location.reload(true);
|
447 |
-
});
|
448 |
|
449 |
</script>
|
5 |
if ( !current_user_can( 'manage_options' ) ) {
|
6 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yasr' ));
|
7 |
}
|
8 |
+
|
9 |
?>
|
10 |
|
11 |
+
|
12 |
+
|
13 |
<div class="wrap">
|
14 |
|
15 |
<h2>Yet Another Stars Rating: Settings</h2>
|
67 |
|
68 |
<?php
|
69 |
|
70 |
+
if ($active_tab == 'general_settings') {
|
71 |
|
72 |
?>
|
73 |
|
178 |
|
179 |
<?php
|
180 |
|
181 |
+
if ($active_tab == 'manage_multi') {
|
182 |
|
183 |
$multi_set=yasr_get_multi_set();
|
184 |
|
296 |
|
297 |
<script type="text/javascript">
|
298 |
|
299 |
+
//-------------------General Settings Code---------------------
|
300 |
+
|
301 |
+
//First Div
|
302 |
jQuery('#yasr_auto_insert_radio_on').on('click', function(){
|
303 |
jQuery('.yasr_auto_insert_where_what_radio').prop('disabled', false);
|
304 |
});
|
307 |
jQuery('.yasr_auto_insert_where_what_radio').prop('disabled', true);
|
308 |
});
|
309 |
|
310 |
+
jQuery('#yasr-snippet-explained-link').on('click', function () {
|
311 |
+
jQuery('#yasr-snippet-explained').toggle('slow');
|
312 |
+
});
|
313 |
+
|
314 |
+
|
315 |
+
//Second div code
|
316 |
+
|
317 |
+
//On click show proceed button
|
318 |
+
jQuery('#import-gdstar').on('click', function() {
|
319 |
+
jQuery('#yasr-import-gdstar-div').toggle();
|
320 |
+
});
|
321 |
+
|
322 |
+
//On click begin step1
|
323 |
+
jQuery('#import-button').on('click', function() {
|
324 |
+
|
325 |
+
var data = {
|
326 |
+
action : 'yasr_import_step1'
|
327 |
+
};
|
328 |
+
|
329 |
+
jQuery.post(ajaxurl, data, function(response) {
|
330 |
+
jQuery('#result-import').html(response);
|
331 |
+
});
|
332 |
+
|
333 |
+
}); //End step1
|
334 |
+
|
335 |
+
jQuery('#result-import').on('click', '.yasr-result-step-1', function() {
|
336 |
+
//Now we are going to prepare another ajax call to check if multiple set exists
|
337 |
+
|
338 |
+
var data = {
|
339 |
+
action: 'yasr_import_multi_set'
|
340 |
+
};
|
341 |
+
|
342 |
+
jQuery.post(ajaxurl, data, function(response) {
|
343 |
+
jQuery('#result-import').append(response);
|
344 |
+
});
|
345 |
+
|
346 |
+
}); //End second ajax call */
|
347 |
+
|
348 |
+
//Reload page after importing is done
|
349 |
+
jQuery('#result-import').on('click', '.yasr-result-step-2', function() {
|
350 |
+
location.reload(true);
|
351 |
+
});
|
352 |
|
353 |
<?php
|
354 |
|
355 |
+
//--------------Multi Sets Page ------------------
|
356 |
+
|
357 |
+
if ($active_tab==='manage_multi') {
|
358 |
?>
|
359 |
|
|
|
360 |
jQuery('#yasr-multi-set-doc-link').on('click', function() {
|
361 |
jQuery('#yasr-multi-set-doc-box').toggle("slow");
|
362 |
});
|
454 |
} //end if $active_tab=='manage_multi'
|
455 |
|
456 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
457 |
|
458 |
</script>
|
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: Rating system with rich snippets
|
6 |
-
* Version: 0.3.
|
7 |
* Author: Dario Curvino
|
8 |
* Author URI: http://profiles.wordpress.org/dudo/
|
9 |
* License: GPL2
|
@@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
28 |
*/
|
29 |
|
30 |
|
31 |
-
define('YASR_VERSION_NUM', '0.3.
|
32 |
|
33 |
//Plugin absolute path
|
34 |
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: Rating system with rich snippets
|
6 |
+
* Version: 0.3.1
|
7 |
* Author: Dario Curvino
|
8 |
* Author URI: http://profiles.wordpress.org/dudo/
|
9 |
* License: GPL2
|
28 |
*/
|
29 |
|
30 |
|
31 |
+
define('YASR_VERSION_NUM', '0.3.1');
|
32 |
|
33 |
//Plugin absolute path
|
34 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|