Version Description
- TWEAKED: code changes and bug fixes on Multi Set shortcodes
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 0.8.5 |
Comparing to | |
See all releases |
Code changes from version 0.8.4 to 0.8.5
- lib/yasr-ajax-functions.php +52 -20
- lib/yasr-functions.php +46 -17
- lib/yasr-settings-functions.php +3 -1
- lib/yasr-shortcode-functions.php +86 -77
- readme.txt +5 -2
- yet-another-stars-rating.php +2 -2
lib/yasr-ajax-functions.php
CHANGED
@@ -212,7 +212,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
212 |
foreach ($set_name as $name) {
|
213 |
|
214 |
//get the highest id in table
|
215 |
-
|
216 |
|
217 |
if (!$highest_id) {
|
218 |
$new_id=0;
|
@@ -234,7 +234,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
234 |
'sum_votes' => '0'
|
235 |
),
|
236 |
array ("%d", "%d", "%d", "%s", "%d", "%d", "%d")
|
237 |
-
)
|
238 |
|
239 |
echo "<tr> <td>";
|
240 |
echo "$name->name </td>";
|
@@ -1235,29 +1235,60 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1235 |
",
|
1236 |
$post_id, $set_type, $id_field));
|
1237 |
|
1238 |
-
|
1239 |
-
|
1240 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1241 |
}
|
1242 |
|
1243 |
-
|
1244 |
-
$user_votes_sum=$user_votes_sum+$rating;
|
1245 |
|
|
|
|
|
|
|
|
|
|
|
1246 |
|
1247 |
-
|
|
|
|
|
|
|
|
|
1248 |
YASR_MULTI_SET_VALUES_TABLE,
|
1249 |
array (
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
|
|
1261 |
|
1262 |
if ($query_success) {
|
1263 |
|
@@ -1305,7 +1336,8 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
1305 |
|
1306 |
} //End callback function
|
1307 |
|
1308 |
-
|
|
|
1309 |
add_action( 'wp_ajax_nopriv_yasr_stats_visitors_votes', 'yasr_stats_visitors_votes_callback' );
|
1310 |
|
1311 |
function yasr_stats_visitors_votes_callback () {
|
212 |
foreach ($set_name as $name) {
|
213 |
|
214 |
//get the highest id in table
|
215 |
+
/*$highest_id=$wpdb->get_results("SELECT id FROM " . YASR_MULTI_SET_VALUES_TABLE . " ORDER BY id DESC LIMIT 1 ");
|
216 |
|
217 |
if (!$highest_id) {
|
218 |
$new_id=0;
|
234 |
'sum_votes' => '0'
|
235 |
),
|
236 |
array ("%d", "%d", "%d", "%s", "%d", "%d", "%d")
|
237 |
+
);*/
|
238 |
|
239 |
echo "<tr> <td>";
|
240 |
echo "$name->name </td>";
|
1235 |
",
|
1236 |
$post_id, $set_type, $id_field));
|
1237 |
|
1238 |
+
if(!empty($existing_vote)) {
|
1239 |
+
|
1240 |
+
foreach ($existing_vote as $user_votes) {
|
1241 |
+
$number_of_votes = $user_votes->number_of_votes;
|
1242 |
+
$user_votes_sum = $user_votes->sum_votes;
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
$number_of_votes=$number_of_votes+1;
|
1246 |
+
$user_votes_sum=$user_votes_sum+$rating;
|
1247 |
+
|
1248 |
+
$query_success=$wpdb->update(
|
1249 |
+
YASR_MULTI_SET_VALUES_TABLE,
|
1250 |
+
array (
|
1251 |
+
'number_of_votes' => $number_of_votes,
|
1252 |
+
'sum_votes' => $user_votes_sum,
|
1253 |
+
),
|
1254 |
+
array (
|
1255 |
+
'post_id' => $post_id,
|
1256 |
+
'field_id' => $id_field,
|
1257 |
+
'set_type' => $set_type
|
1258 |
+
),
|
1259 |
+
array('%d', '%s' ),
|
1260 |
+
array( '%d', '%d', '%d' )
|
1261 |
+
);
|
1262 |
+
|
1263 |
}
|
1264 |
|
1265 |
+
else {
|
|
|
1266 |
|
1267 |
+
$highest_id=$wpdb->get_results("SELECT id FROM " . YASR_MULTI_SET_VALUES_TABLE . " ORDER BY id DESC LIMIT 1 ");
|
1268 |
+
|
1269 |
+
if (!$highest_id) {
|
1270 |
+
$new_id=0;
|
1271 |
+
}
|
1272 |
|
1273 |
+
foreach ($highest_id as $id) {
|
1274 |
+
$new_id=$id->id + 1;
|
1275 |
+
}
|
1276 |
+
|
1277 |
+
$query_success=$wpdb->replace(
|
1278 |
YASR_MULTI_SET_VALUES_TABLE,
|
1279 |
array (
|
1280 |
+
'id'=>$new_id,
|
1281 |
+
'post_id'=>$post_id,
|
1282 |
+
'field_id'=>$id_field,
|
1283 |
+
'set_type'=>$set_type,
|
1284 |
+
'number_of_votes' => 1,
|
1285 |
+
'sum_votes' => $rating
|
1286 |
+
),
|
1287 |
+
array ("%d", "%d", "%d", "%d", "%d", "%d")
|
1288 |
+
);
|
1289 |
+
|
1290 |
+
}
|
1291 |
+
|
1292 |
|
1293 |
if ($query_success) {
|
1294 |
|
1336 |
|
1337 |
} //End callback function
|
1338 |
|
1339 |
+
|
1340 |
+
add_action( 'wp_ajax_yasr_stats_visitors_votes', 'yasr_stats_visitors_votes_callback' );
|
1341 |
add_action( 'wp_ajax_nopriv_yasr_stats_visitors_votes', 'yasr_stats_visitors_votes_callback' );
|
1342 |
|
1343 |
function yasr_stats_visitors_votes_callback () {
|
lib/yasr-functions.php
CHANGED
@@ -135,21 +135,20 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
135 |
|
136 |
}
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
}
|
153 |
|
154 |
function yasr_metabox_overall_rating_content() {
|
155 |
if ( current_user_can( 'publish_posts' ) ) {
|
@@ -408,7 +407,7 @@ add_action('admin_init', 'yasr_shortcode_button_init');
|
|
408 |
|
409 |
//This callback adds our button to the toolbar
|
410 |
function yasr_add_tinymce_button($buttons) {
|
411 |
-
|
412 |
$buttons[] = "yasr_button";
|
413 |
return $buttons;
|
414 |
}
|
@@ -446,6 +445,36 @@ add_action( 'admin_init', 'yasr_get_custom_post_type');
|
|
446 |
|
447 |
}
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
/*** Add support for wp super cache ***/
|
450 |
function yasr_wp_super_cache_support($post_id) {
|
451 |
|
@@ -456,7 +485,7 @@ function yasr_wp_super_cache_support($post_id) {
|
|
456 |
}
|
457 |
|
458 |
|
459 |
-
/*** Function to set cookie ***/
|
460 |
function yasr_setcookie($cookiename, $value) {
|
461 |
|
462 |
if (!$value || !$cookiename) {
|
135 |
|
136 |
}
|
137 |
|
138 |
+
//Always add this metabox
|
139 |
+
foreach ($post_type_where_display_metabox as $post_type) {
|
140 |
+
add_meta_box( 'yasr_metabox_overall_rating', 'YASR', 'yasr_metabox_overall_rating_content', $post_type, 'side', 'high' );
|
141 |
+
}
|
142 |
+
|
143 |
+
$multi_set=yasr_get_multi_set();
|
144 |
+
//If multiset are used then add the second metabox
|
145 |
+
if ($multi_set) {
|
146 |
+
foreach ($post_type_where_display_metabox as $post_type) {
|
147 |
+
add_meta_box( 'yasr_metabox_multiple_rating', __( 'Yet Another Stars Rating: Multiple set', 'yasr' ), 'yasr_metabox_multiple_rating_content', $post_type, 'normal', 'high' );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
|
151 |
+
} //End function
|
|
|
152 |
|
153 |
function yasr_metabox_overall_rating_content() {
|
154 |
if ( current_user_can( 'publish_posts' ) ) {
|
407 |
|
408 |
//This callback adds our button to the toolbar
|
409 |
function yasr_add_tinymce_button($buttons) {
|
410 |
+
//Add the button ID to the $button array
|
411 |
$buttons[] = "yasr_button";
|
412 |
return $buttons;
|
413 |
}
|
445 |
|
446 |
}
|
447 |
|
448 |
+
|
449 |
+
/*** function that get the star size and return ***/
|
450 |
+
function yasr_stars_size ($size) {
|
451 |
+
|
452 |
+
$size = sanitize_text_field($size);
|
453 |
+
|
454 |
+
$stars_attribute = array();
|
455 |
+
|
456 |
+
if ($size === 'small') {
|
457 |
+
$stars_attribute['class'] = 'rateit';
|
458 |
+
$stars_attribute['px_size'] = '16';
|
459 |
+
}
|
460 |
+
|
461 |
+
elseif ($size === 'medium') {
|
462 |
+
$stars_attribute['class'] = 'rateit medium';
|
463 |
+
$stars_attribute['px_size'] = '24';
|
464 |
+
}
|
465 |
+
|
466 |
+
//default values
|
467 |
+
else {
|
468 |
+
$stars_attribute['class'] = 'rateit bigstars';
|
469 |
+
$stars_attribute['px_size'] = '32';
|
470 |
+
}
|
471 |
+
|
472 |
+
return $stars_attribute;
|
473 |
+
|
474 |
+
}
|
475 |
+
|
476 |
+
|
477 |
+
|
478 |
/*** Add support for wp super cache ***/
|
479 |
function yasr_wp_super_cache_support($post_id) {
|
480 |
|
485 |
}
|
486 |
|
487 |
|
488 |
+
/*** Function to set cookie, since version 0.8.3 ***/
|
489 |
function yasr_setcookie($cookiename, $value) {
|
490 |
|
491 |
if (!$value || !$cookiename) {
|
lib/yasr-settings-functions.php
CHANGED
@@ -18,9 +18,11 @@ 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 |
/****** Add yasr general options ******/
|
22 |
|
23 |
-
|
24 |
|
25 |
function yasr_general_options_init() {
|
26 |
register_setting(
|
18 |
along with this program. If not, see <http://www.gnu.org/licenses/>
|
19 |
*/
|
20 |
|
21 |
+
if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // Exit if accessed directly
|
22 |
+
|
23 |
/****** Add yasr general options ******/
|
24 |
|
25 |
+
add_action( 'admin_init', 'yasr_general_options_init' ); //This is for general options
|
26 |
|
27 |
function yasr_general_options_init() {
|
28 |
register_setting(
|
lib/yasr-shortcode-functions.php
CHANGED
@@ -37,65 +37,51 @@ function shortcode_overall_rating_callback ($atts) {
|
|
37 |
);
|
38 |
}
|
39 |
|
40 |
-
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
$shortcode_html = '';
|
47 |
-
|
48 |
-
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
49 |
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
<span id=\"yasr-custom-text-before-overall\">" . $text_before_star . "</span>";
|
54 |
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
$px_size = '16';
|
60 |
-
}
|
61 |
|
62 |
-
|
63 |
-
$rateit_class = 'rateit medium';
|
64 |
-
$px_size = '24';
|
65 |
-
}
|
66 |
|
67 |
-
|
68 |
-
else {
|
69 |
-
$rateit_class = 'rateit bigstars';
|
70 |
-
$px_size = '32';
|
71 |
-
}
|
72 |
|
73 |
-
|
74 |
|
75 |
|
76 |
-
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
|
84 |
|
85 |
-
|
86 |
|
87 |
-
|
88 |
|
89 |
-
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
|
96 |
-
|
97 |
|
98 |
-
|
99 |
|
100 |
} //end function
|
101 |
|
@@ -151,21 +137,7 @@ function shortcode_visitor_votes_callback ($atts) {
|
|
151 |
);
|
152 |
}
|
153 |
|
154 |
-
|
155 |
-
$rateit_class='rateit';
|
156 |
-
$px_size = '16';
|
157 |
-
}
|
158 |
-
|
159 |
-
elseif ($size === 'medium') {
|
160 |
-
$rateit_class = 'rateit medium';
|
161 |
-
$px_size = '24';
|
162 |
-
}
|
163 |
-
|
164 |
-
//default values
|
165 |
-
else {
|
166 |
-
$rateit_class = 'rateit bigstars';
|
167 |
-
$px_size = '32';
|
168 |
-
}
|
169 |
|
170 |
$cookiename = 'yasr_visitor_vote_' . $post_id;
|
171 |
|
@@ -313,7 +285,7 @@ function shortcode_visitor_votes_callback ($atts) {
|
|
313 |
|
314 |
}
|
315 |
|
316 |
-
$shortcode_html .= "<div class=\"$
|
317 |
|
318 |
$shortcode_html .= $span_dashicon;
|
319 |
|
@@ -434,26 +406,12 @@ function yasr_visitor_votes_readonly_callback ($atts) {
|
|
434 |
);
|
435 |
}
|
436 |
|
437 |
-
|
438 |
-
$rateit_class='rateit';
|
439 |
-
$px_size = '16';
|
440 |
-
}
|
441 |
-
|
442 |
-
elseif ($size === 'medium') {
|
443 |
-
$rateit_class = 'rateit medium';
|
444 |
-
$px_size = '24';
|
445 |
-
}
|
446 |
-
|
447 |
-
//default values
|
448 |
-
else {
|
449 |
-
$rateit_class = 'rateit bigstars';
|
450 |
-
$px_size = '32';
|
451 |
-
}
|
452 |
|
453 |
$shortcode_html = "<div id=\"yasr_visitor_votes_$post_id\" class=\"yasr-visitor-votes_readonly\">";
|
454 |
$span_after_rate_it = "";
|
455 |
|
456 |
-
$shortcode_html .= "<div class=\"$
|
457 |
|
458 |
$shortcode_html .= "</div>";
|
459 |
|
@@ -512,6 +470,23 @@ function shortcode_multi_set_callback( $atts ) {
|
|
512 |
$shortcode_html.="</table>";
|
513 |
}
|
514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
return $shortcode_html;
|
516 |
} //End function
|
517 |
|
@@ -535,7 +510,6 @@ function yasr_visitor_multiset_callback ( $atts ) {
|
|
535 |
), $atts )
|
536 |
);
|
537 |
|
538 |
-
|
539 |
$cookiename = 'yasr_multi_visitor_cookie_' . $post_id;
|
540 |
|
541 |
$image = YASR_IMG_DIR . "/loader.gif";
|
@@ -631,6 +605,40 @@ function yasr_visitor_multiset_callback ( $atts ) {
|
|
631 |
</table>";
|
632 |
}
|
633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
$var_post_id = json_encode($post_id);
|
635 |
$var_set_id = json_encode($setid);
|
636 |
$var_ajax_url = json_encode(admin_url('admin-ajax.php'));
|
@@ -755,9 +763,10 @@ function yasr_most_or_highest_rated_posts_callback () {
|
|
755 |
|
756 |
$shortcode_html .= "<tr>
|
757 |
<td width=\"60%\"><a href=\"$link\">$post_title</a></td>
|
758 |
-
<td width=\"40%\"><div id=\"yasr_visitor_votes\"
|
759 |
-
|
760 |
-
|
|
|
761 |
</tr>";
|
762 |
|
763 |
|
@@ -918,7 +927,7 @@ function yasr_top_ten_active_users_callback () {
|
|
918 |
if ($query_result) {
|
919 |
|
920 |
$shortcode_html = "
|
921 |
-
|
922 |
<tr>
|
923 |
<th>UserName</th>
|
924 |
<th>Number of votes</th>
|
37 |
);
|
38 |
}
|
39 |
|
40 |
+
$overall_rating=yasr_get_overall_rating();
|
41 |
|
42 |
+
if (!$overall_rating) {
|
43 |
+
$overall_rating = "-1";
|
44 |
+
}
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
$shortcode_html = '';
|
47 |
|
48 |
+
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
|
|
49 |
|
50 |
+
$text_before_star = str_replace('%overall_rating%', $overall_rating, YASR_TEXT_BEFORE_OVERALL);
|
51 |
|
52 |
+
$shortcode_html = "<div class=\"yasr-container-custom-text-and-overall\">
|
53 |
+
<span id=\"yasr-custom-text-before-overall\">" . $text_before_star . "</span>";
|
|
|
|
|
54 |
|
55 |
+
}
|
|
|
|
|
|
|
56 |
|
57 |
+
$stars_attribute = yasr_stars_size($size);
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_overall\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$overall_rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>";
|
60 |
|
61 |
|
62 |
+
if (YASR_TEXT_BEFORE_STARS == 1 && YASR_TEXT_BEFORE_OVERALL != '') {
|
63 |
|
64 |
+
$shortcode_html .= "</div>";
|
65 |
+
|
66 |
+
}
|
67 |
|
68 |
+
//IF show overall rating in loop is disabled use is_singular && is_main query
|
69 |
+
if ( YASR_SHOW_OVERALL_IN_LOOP === 'disabled' ) {
|
70 |
|
71 |
+
if( is_singular() && is_main_query() ) {
|
72 |
|
73 |
+
return $shortcode_html;
|
74 |
|
75 |
+
}
|
76 |
|
77 |
+
} // End if YASR_SHOW_OVERALL_IN_LOOP === 'disabled') {
|
78 |
|
79 |
+
//If overall rating in loop is enabled don't use is_singular && is main_query
|
80 |
+
elseif ( YASR_SHOW_OVERALL_IN_LOOP === 'enabled' ) {
|
81 |
|
82 |
+
return $shortcode_html;
|
83 |
|
84 |
+
}
|
85 |
|
86 |
} //end function
|
87 |
|
137 |
);
|
138 |
}
|
139 |
|
140 |
+
$stars_attribute = yasr_stars_size($size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
$cookiename = 'yasr_visitor_vote_' . $post_id;
|
143 |
|
285 |
|
286 |
}
|
287 |
|
288 |
+
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_visitor_votes_$post_id\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"$readonly\"></div>";
|
289 |
|
290 |
$shortcode_html .= $span_dashicon;
|
291 |
|
406 |
);
|
407 |
}
|
408 |
|
409 |
+
$stars_attribute = yasr_stars_size($size);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
$shortcode_html = "<div id=\"yasr_visitor_votes_$post_id\" class=\"yasr-visitor-votes_readonly\">";
|
412 |
$span_after_rate_it = "";
|
413 |
|
414 |
+
$shortcode_html .= "<div class=\"$stars_attribute[class]\" id=\"yasr_rateit_visitor_votes_readonly_$post_id\" data-rateit-starwidth=\"$stars_attribute[px_size]\" data-rateit-starheight=\"$stars_attribute[px_size]\" data-rateit-value=\"$medium_rating\" data-rateit-step=\"1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>";
|
415 |
|
416 |
$shortcode_html .= "</div>";
|
417 |
|
470 |
$shortcode_html.="</table>";
|
471 |
}
|
472 |
|
473 |
+
else {
|
474 |
+
$set_name=$wpdb->get_results("SELECT field_name AS name, field_id AS id
|
475 |
+
FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
|
476 |
+
WHERE parent_set_id=$setid
|
477 |
+
ORDER BY field_id ASC");
|
478 |
+
|
479 |
+
$shortcode_html="<table class=\"yasr_table_multi_set_shortcode\">";
|
480 |
+
|
481 |
+
foreach ($set_name as $set_content) {
|
482 |
+
$shortcode_html .= "<tr> <td><span class=\"yasr-multi-set-name-field\">$set_content->name </span></td>
|
483 |
+
<td><div class=\"rateit\" id=\"$set_content->id\" data-rateit-value=\"0\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div></td>
|
484 |
+
</tr>";
|
485 |
+
}
|
486 |
+
$shortcode_html.="</table>";
|
487 |
+
|
488 |
+
}
|
489 |
+
|
490 |
return $shortcode_html;
|
491 |
} //End function
|
492 |
|
510 |
), $atts )
|
511 |
);
|
512 |
|
|
|
513 |
$cookiename = 'yasr_multi_visitor_cookie_' . $post_id;
|
514 |
|
515 |
$image = YASR_IMG_DIR . "/loader.gif";
|
605 |
</table>";
|
606 |
}
|
607 |
|
608 |
+
else {
|
609 |
+
|
610 |
+
$set_name=$wpdb->get_results("SELECT field_name AS name, field_id AS id
|
611 |
+
FROM " . YASR_MULTI_SET_FIELDS_TABLE . "
|
612 |
+
WHERE parent_set_id=$setid
|
613 |
+
ORDER BY field_id ASC");
|
614 |
+
|
615 |
+
$shortcode_html="<table class=\"yasr_table_multi_set_shortcode\">";
|
616 |
+
|
617 |
+
foreach ($set_name as $set_content) {
|
618 |
+
$shortcode_html .= "<tr>
|
619 |
+
<td>
|
620 |
+
<span class=\"yasr-multi-set-name-field\">$set_content->name </span>
|
621 |
+
</td>
|
622 |
+
<td>
|
623 |
+
<div class=\"rateit yasr-visitor-multi-$post_id\" id=\"$set_content->id\" data-rateit-value=\"0\" data-rateit-step=\"0.5\" data-rateit-resetable=\"false\" data-rateit-readonly=\"false\"></div>
|
624 |
+
<span class=\"yasr-visitor-multiset-vote-count\"> 0 </span>
|
625 |
+
</td>
|
626 |
+
</tr>";
|
627 |
+
}
|
628 |
+
|
629 |
+
$shortcode_html.="<tr>
|
630 |
+
<td colspan=\"2\">
|
631 |
+
$button
|
632 |
+
$loader_html
|
633 |
+
<span class=\"yasr-visitor-multiset-message\">$span_message_content</span>
|
634 |
+
</td>
|
635 |
+
</tr>
|
636 |
+
</table>";
|
637 |
+
|
638 |
+
$shortcode_html.="</table>";
|
639 |
+
|
640 |
+
}
|
641 |
+
|
642 |
$var_post_id = json_encode($post_id);
|
643 |
$var_set_id = json_encode($setid);
|
644 |
$var_ajax_url = json_encode(admin_url('admin-ajax.php'));
|
763 |
|
764 |
$shortcode_html .= "<tr>
|
765 |
<td width=\"60%\"><a href=\"$link\">$post_title</a></td>
|
766 |
+
<td width=\"40%\"><div id=\"yasr_visitor_votes\">
|
767 |
+
<div class=\"rateit medium\" data-rateit-starwidth=\"24\" data-rateit-starheight=\"24\" data-rateit-value=\"$rating\" data-rateit-step=\"0.1\" data-rateit-resetable=\"false\" data-rateit-readonly=\"true\"></div>
|
768 |
+
<br /> [" . __("Total:" , "yasr") . "$result->number_of_votes " . __("Average" , "yasr") . " $rating]
|
769 |
+
</td>
|
770 |
</tr>";
|
771 |
|
772 |
|
927 |
if ($query_result) {
|
928 |
|
929 |
$shortcode_html = "
|
930 |
+
<table class=\"yasr-table-chart\">
|
931 |
<tr>
|
932 |
<th>UserName</th>
|
933 |
<th>Number of votes</th>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post r
|
|
4 |
Requires at least: 3.5
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 4.2
|
7 |
-
Stable tag: 0.8.
|
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
|
@@ -119,7 +119,10 @@ Of course not: you can easily add it on the visual editor just by clicking on th
|
|
119 |
|
120 |
== Changelog ==
|
121 |
|
122 |
-
= 0.
|
|
|
|
|
|
|
123 |
* NEW FEATURE: User can customize text after Visitor Votes.
|
124 |
* TWIKED: Visitor Votes have been partially rewritten, is much faster now
|
125 |
* REMOVED: Removed jquery cookie
|
4 |
Requires at least: 3.5
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 4.2
|
7 |
+
Stable tag: 0.8.5
|
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
|
119 |
|
120 |
== Changelog ==
|
121 |
|
122 |
+
= 0.8.5 =
|
123 |
+
* TWEAKED: code changes and bug fixes on Multi Set shortcodes
|
124 |
+
|
125 |
+
= 0.8.4 =
|
126 |
* NEW FEATURE: User can customize text after Visitor Votes.
|
127 |
* TWIKED: Visitor Votes have been partially rewritten, is much faster now
|
128 |
* REMOVED: Removed jquery cookie
|
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.8.
|
7 |
* Author: Dario Curvino
|
8 |
* Author URI: https://yetanotherstarsrating.com/
|
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.8.
|
32 |
|
33 |
//Plugin relative path
|
34 |
define( "YASR_RELATIVE_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.8.5
|
7 |
* Author: Dario Curvino
|
8 |
* Author URI: https://yetanotherstarsrating.com/
|
9 |
* License: GPL2
|
28 |
*/
|
29 |
|
30 |
|
31 |
+
define('YASR_VERSION_NUM', '0.8.5');
|
32 |
|
33 |
//Plugin relative path
|
34 |
define( "YASR_RELATIVE_PATH", dirname(__FILE__) );
|