Version Description
- TWEAKED: READ CAREFULLY: this is the first step of an important yasr database change: the main goal is to switch from yasr_votes table to wordpress default post_meta. A database backup is strongly suggested.
- NEW FEATURE: new widget that shows the last 5 recent ratings.
Download this release
Release Info
Developer | Dudo |
Plugin | Yasr – Yet Another Stars Rating |
Version | 1.3.5 |
Comparing to | |
See all releases |
Code changes from version 1.3.4 to 1.3.5
- css/yasr.css +23 -0
- lib/yasr-ajax-functions.php +26 -69
- lib/yasr-db-functions.php +6 -6
- lib/yasr-widgets.php +170 -2
- readme.txt +6 -1
- yet-another-stars-rating.php +35 -3
css/yasr.css
CHANGED
@@ -203,6 +203,29 @@ div.bigstars .rateit-selected
|
|
203 |
text-align: center;
|
204 |
}
|
205 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
/*** Progress bar, this class are used in
|
207 |
yasr_pro_comment_reviews_stats shortcode too***/
|
208 |
|
203 |
text-align: center;
|
204 |
}
|
205 |
|
206 |
+
|
207 |
+
|
208 |
+
/*** Widgets ***/
|
209 |
+
|
210 |
+
.yasr-widget-recent-ratings-table {
|
211 |
+
|
212 |
+
border: none;
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
.yasr-widget-recent-ratings-td {
|
217 |
+
|
218 |
+
border: none;
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
.yasr-widget-recent-ratings-text {
|
223 |
+
|
224 |
+
font-weight: bold;
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
|
229 |
/*** Progress bar, this class are used in
|
230 |
yasr_pro_comment_reviews_stats shortcode too***/
|
231 |
|
lib/yasr-ajax-functions.php
CHANGED
@@ -49,57 +49,31 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
49 |
die( 'Security check' );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
52 |
if ($rating > 5) {
|
53 |
|
54 |
$rating = 5;
|
55 |
|
56 |
}
|
57 |
|
|
|
58 |
do_action('yasr_action_on_overall_rating', $post_id, $rating);
|
59 |
|
60 |
-
|
61 |
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
array (
|
66 |
-
'overall_rating' => $rating,
|
67 |
-
),
|
68 |
-
array('post_id' => $post_id),
|
69 |
-
array('%s', '%d')
|
70 |
-
);
|
71 |
|
72 |
-
|
73 |
-
if(!$update_result) {
|
74 |
|
75 |
-
|
76 |
-
YASR_VOTES_TABLE,
|
77 |
-
array (
|
78 |
-
'post_id' => $post_id,
|
79 |
-
'overall_rating' => $rating,
|
80 |
-
'review_type' => YASR_ITEMTYPE //default review type in a new post
|
81 |
-
),
|
82 |
-
array('%d', '%s', '%s')
|
83 |
-
);
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
if (!$snippet_type) {
|
89 |
-
|
90 |
-
$wpdb->replace(
|
91 |
-
YASR_VOTES_TABLE,
|
92 |
-
array (
|
93 |
-
'review_type' => YASR_ITEMTYPE //default review type in a new post
|
94 |
-
),
|
95 |
-
array('%s')
|
96 |
-
);
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
} // End if(!$update_result)
|
101 |
-
|
102 |
-
if ($update_result || $replace_result) {
|
103 |
|
104 |
$transient_name = 'yasr_overall_rating_' . $post_id;
|
105 |
|
@@ -116,7 +90,8 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
116 |
|
117 |
}
|
118 |
|
119 |
-
|
|
|
120 |
}
|
121 |
|
122 |
|
@@ -142,6 +117,12 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
142 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
if ($reviewtype === "1") {
|
146 |
|
147 |
$reviewtype = 'Product';
|
@@ -166,43 +147,19 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
|
|
166 |
|
167 |
}
|
168 |
|
169 |
-
|
170 |
-
die( 'Security check' );
|
171 |
-
}
|
172 |
-
|
173 |
-
global $wpdb;
|
174 |
|
175 |
-
|
176 |
-
$review_type = $wpdb->update(
|
177 |
-
YASR_VOTES_TABLE,
|
178 |
-
array (
|
179 |
-
'review_type' => $reviewtype //data
|
180 |
-
),
|
181 |
-
array('post_id' => $post_id), //where
|
182 |
-
array('%s'),
|
183 |
-
array('%d')
|
184 |
-
);
|
185 |
|
186 |
-
|
187 |
-
if($review_type === 0) {
|
188 |
|
189 |
-
|
190 |
-
YASR_VOTES_TABLE,
|
191 |
-
array (
|
192 |
-
'post_id' => $post_id,
|
193 |
-
'review_type' => $reviewtype
|
194 |
-
),
|
195 |
-
array('%d', '%s')
|
196 |
-
);
|
197 |
|
198 |
-
|
199 |
|
200 |
if($review_type) {
|
201 |
_e("Type Saved", "yet-another-stars-rating");
|
202 |
}
|
203 |
-
else {
|
204 |
-
_e("There was an error while trying to insert the review type. Please report it", "yet-another-stars-rating");
|
205 |
-
}
|
206 |
|
207 |
die();
|
208 |
|
49 |
die( 'Security check' );
|
50 |
}
|
51 |
|
52 |
+
$post_id = (int)$post_id;
|
53 |
+
$rating = (float)$rating;
|
54 |
+
|
55 |
if ($rating > 5) {
|
56 |
|
57 |
$rating = 5;
|
58 |
|
59 |
}
|
60 |
|
61 |
+
//Put an action to hook into
|
62 |
do_action('yasr_action_on_overall_rating', $post_id, $rating);
|
63 |
|
64 |
+
$update_result = update_post_meta($post_id, 'yasr_overall_rating', $rating );
|
65 |
|
66 |
+
//if update_post_meta returns an integer means this is a new post
|
67 |
+
//so we're going to insert the default YASR_ITEMTYPE
|
68 |
+
if (is_int($update_result)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
+
add_post_meta($post_id, 'yasr_review_type', YASR_ITEMTYPE);
|
|
|
71 |
|
72 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
//this will not work on error or
|
75 |
+
//if the value is the same in the db
|
76 |
+
if ($update_result) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
$transient_name = 'yasr_overall_rating_' . $post_id;
|
79 |
|
90 |
|
91 |
}
|
92 |
|
93 |
+
die(); // this is required to return a proper result
|
94 |
+
|
95 |
}
|
96 |
|
97 |
|
117 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ) );
|
118 |
}
|
119 |
|
120 |
+
if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_review_type' ) ) {
|
121 |
+
die( 'Security check' );
|
122 |
+
}
|
123 |
+
|
124 |
+
$post_id = (int)$post_id;
|
125 |
+
|
126 |
if ($reviewtype === "1") {
|
127 |
|
128 |
$reviewtype = 'Product';
|
147 |
|
148 |
}
|
149 |
|
150 |
+
else {
|
|
|
|
|
|
|
|
|
151 |
|
152 |
+
die();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
+
}
|
|
|
155 |
|
156 |
+
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
|
158 |
+
$review_type = update_post_meta($post_id, 'yasr_review_type', $reviewtype);
|
159 |
|
160 |
if($review_type) {
|
161 |
_e("Type Saved", "yet-another-stars-rating");
|
162 |
}
|
|
|
|
|
|
|
163 |
|
164 |
die();
|
165 |
|
lib/yasr-db-functions.php
CHANGED
@@ -156,6 +156,8 @@ function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
156 |
|
157 |
}
|
158 |
|
|
|
|
|
159 |
$overall_rating = FALSE;
|
160 |
|
161 |
$transient_name = 'yasr_overall_rating_' . $post_id;
|
@@ -172,7 +174,7 @@ function yasr_get_overall_rating($post_id=FALSE, $create_transient=TRUE) {
|
|
172 |
//get value from db
|
173 |
else {
|
174 |
|
175 |
-
$overall_rating
|
176 |
|
177 |
}
|
178 |
|
@@ -204,12 +206,11 @@ function yasr_get_snippet_type() {
|
|
204 |
|
205 |
else {
|
206 |
|
207 |
-
$result
|
208 |
|
209 |
if($result) {
|
210 |
-
|
211 |
-
|
212 |
-
}
|
213 |
|
214 |
if ($snippet_type != 'Product' && $snippet_type != 'Place' && $snippet_type != 'Recipe' && $snippet_type != 'Other') {
|
215 |
|
@@ -564,7 +565,6 @@ add_action( 'plugins_loaded', 'add_action_dashboard_widget_log' );
|
|
564 |
|
565 |
function yasr_users_dashboard_widget_callback () {
|
566 |
|
567 |
-
|
568 |
$limit = 8; //max number of row to echo
|
569 |
|
570 |
//Get current user id: don't need to check if is >0 cause user is logged in here
|
156 |
|
157 |
}
|
158 |
|
159 |
+
$post_id = (int)$post_id;
|
160 |
+
|
161 |
$overall_rating = FALSE;
|
162 |
|
163 |
$transient_name = 'yasr_overall_rating_' . $post_id;
|
174 |
//get value from db
|
175 |
else {
|
176 |
|
177 |
+
$overall_rating = get_post_meta($post_id, 'yasr_overall_rating', TRUE);
|
178 |
|
179 |
}
|
180 |
|
206 |
|
207 |
else {
|
208 |
|
209 |
+
$result = get_post_meta($post_id, 'yasr_review_type', TRUE);
|
210 |
|
211 |
if($result) {
|
212 |
+
|
213 |
+
$snippet_type = trim($result);
|
|
|
214 |
|
215 |
if ($snippet_type != 'Product' && $snippet_type != 'Place' && $snippet_type != 'Recipe' && $snippet_type != 'Other') {
|
216 |
|
565 |
|
566 |
function yasr_users_dashboard_widget_callback () {
|
567 |
|
|
|
568 |
$limit = 8; //max number of row to echo
|
569 |
|
570 |
//Get current user id: don't need to check if is >0 cause user is logged in here
|
lib/yasr-widgets.php
CHANGED
@@ -186,10 +186,12 @@ class Yasr_Overall_Rating_Widget extends WP_Widget {
|
|
186 |
} // class Yasr Overall Rating widget
|
187 |
|
188 |
|
|
|
|
|
189 |
|
190 |
add_action( 'widgets_init', 'yasr_visitor_votes_widget' );
|
191 |
|
192 |
-
// register Yasr
|
193 |
function yasr_visitor_votes_widget() {
|
194 |
register_widget( 'Yasr_Visitor_Votes_Widget' );
|
195 |
}
|
@@ -378,7 +380,173 @@ class Yasr_Visitor_Votes_Widget extends WP_Widget {
|
|
378 |
return $instance;
|
379 |
}
|
380 |
|
381 |
-
} // class Yasr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
|
|
|
383 |
|
384 |
?>
|
186 |
} // class Yasr Overall Rating widget
|
187 |
|
188 |
|
189 |
+
////////////////////////////////////////////////////////
|
190 |
+
|
191 |
|
192 |
add_action( 'widgets_init', 'yasr_visitor_votes_widget' );
|
193 |
|
194 |
+
// register Yasr Visitor Votes widget
|
195 |
function yasr_visitor_votes_widget() {
|
196 |
register_widget( 'Yasr_Visitor_Votes_Widget' );
|
197 |
}
|
380 |
return $instance;
|
381 |
}
|
382 |
|
383 |
+
} // class Yasr Visitor Votes widget
|
384 |
+
|
385 |
+
|
386 |
+
/////////////////////////////////////////////////////////
|
387 |
+
|
388 |
+
|
389 |
+
|
390 |
+
add_action( 'widgets_init', 'yasr_recent_ratings_widget' );
|
391 |
+
|
392 |
+
// register recent ratings widget
|
393 |
+
function yasr_recent_ratings_widget() {
|
394 |
+
register_widget( 'Yasr_Recent_Ratings_Widget' );
|
395 |
+
}
|
396 |
+
|
397 |
+
class Yasr_Recent_Ratings_Widget extends WP_Widget {
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Register widget with WordPress.
|
401 |
+
*/
|
402 |
+
function __construct() {
|
403 |
+
|
404 |
+
parent::__construct(
|
405 |
+
'yasr_recent_ratings_widget', // Base ID
|
406 |
+
__( 'Yasr Recent Ratings', 'yet-another-stars-rating' ), // Name
|
407 |
+
array(
|
408 |
+
'description' => __( 'Show the 5 most recent rated posts', 'yet-another-stars-rating' ),
|
409 |
+
'readonly' => 'no',
|
410 |
+
'size' => 'large'
|
411 |
+
) // Args
|
412 |
+
);
|
413 |
+
|
414 |
+
}
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Front-end display of widget.
|
418 |
+
*
|
419 |
+
* @see WP_Widget::widget()
|
420 |
+
*
|
421 |
+
* @param array $args Widget arguments.
|
422 |
+
* @param array $instance Saved values from database.
|
423 |
+
*/
|
424 |
+
|
425 |
+
public function widget( $args, $instance ) {
|
426 |
+
|
427 |
+
echo $args['before_widget'];
|
428 |
+
|
429 |
+
if ( ! empty( $instance['title'] ) ) {
|
430 |
+
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
|
431 |
+
}
|
432 |
+
|
433 |
+
global $wpdb;
|
434 |
+
|
435 |
+
$log_result = $wpdb->get_results ("SELECT post_id, vote, user_id FROM ". YASR_LOG_TABLE . " ORDER BY date DESC LIMIT 5");
|
436 |
+
|
437 |
+
if ($log_result) {
|
438 |
+
|
439 |
+
|
440 |
+
$widget_recent_ratings = "<table class=\"yasr-widget-recent-ratings-table\">";
|
441 |
+
|
442 |
+
foreach ($log_result as $result) {
|
443 |
+
|
444 |
+
$user = get_user_by( 'id', $result->user_id );
|
445 |
+
|
446 |
+
//If ! user means that the vote are anonymous
|
447 |
+
if ($user == FALSE) {
|
448 |
+
|
449 |
+
$user = (object) array('user_login');
|
450 |
+
$user->user_login = __('anonymous');
|
451 |
+
|
452 |
+
}
|
453 |
+
|
454 |
+
$title_post = get_the_title( $result->post_id );
|
455 |
+
$link = get_permalink( $result->post_id );
|
456 |
+
$vote = round ($result->vote);
|
457 |
+
|
458 |
+
$widget_recent_ratings .= "<tr>
|
459 |
+
<td width=\"40%\" class=\"yasr-widget-recent-ratings-td\">";
|
460 |
+
|
461 |
+
$widget_recent_ratings .= sprintf(__('Vote %s from %s on %s', 'yet-another-stars-rating'), '<span class="yasr-widget-recent-ratings-text">'. $vote . '</span>', '<span class="yasr-widget-recent-ratings-text">' . $user->user_login . '</span>', '<span class="yasr-widget-recent-ratings-text">' . $title_post . '</span>' );
|
462 |
+
|
463 |
+
$widget_recent_ratings .= "</td>
|
464 |
+
</tr>";
|
465 |
+
|
466 |
+
|
467 |
+
} //End foreach
|
468 |
+
|
469 |
+
$widget_recent_ratings .= "</table>";
|
470 |
+
|
471 |
+
}
|
472 |
+
|
473 |
+
|
474 |
+
echo $widget_recent_ratings;
|
475 |
+
|
476 |
+
echo $args['after_widget'];
|
477 |
+
|
478 |
+
}
|
479 |
+
|
480 |
+
|
481 |
+
/**
|
482 |
+
* Back-end widget form.
|
483 |
+
*
|
484 |
+
* @see WP_Widget::form()
|
485 |
+
*
|
486 |
+
* @param array $instance Previously saved values from database.
|
487 |
+
*/
|
488 |
+
|
489 |
+
public function form( $instance ) {
|
490 |
+
|
491 |
+
if (!empty($instance['title'])) {
|
492 |
+
|
493 |
+
$title = $instance['title'];
|
494 |
+
|
495 |
+
}
|
496 |
+
|
497 |
+
else {
|
498 |
+
|
499 |
+
$title = __( 'Recent Ratings', 'yet-another-stars-rating' );
|
500 |
+
|
501 |
+
}
|
502 |
+
|
503 |
+
?>
|
504 |
+
|
505 |
+
<p>
|
506 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
507 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
|
508 |
+
</p>
|
509 |
+
|
510 |
+
<?php
|
511 |
+
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Sanitize widget form values as they are saved.
|
516 |
+
*
|
517 |
+
* @see WP_Widget::update()
|
518 |
+
*
|
519 |
+
* @param array $new_instance Values just sent to be saved.
|
520 |
+
* @param array $old_instance Previously saved values from database.
|
521 |
+
*
|
522 |
+
* @return array Updated safe values to be saved.
|
523 |
+
*/
|
524 |
+
public function update( $new_instance, $old_instance ) {
|
525 |
+
|
526 |
+
$instance = $old_instance;
|
527 |
+
|
528 |
+
if (!$instance) {
|
529 |
+
|
530 |
+
$instance = array();
|
531 |
+
|
532 |
+
}
|
533 |
+
|
534 |
+
if (!empty($new_instance['title'])) {
|
535 |
+
|
536 |
+
$instance['title'] = strip_tags($new_instance['title']);
|
537 |
+
|
538 |
+
}
|
539 |
+
|
540 |
+
else {
|
541 |
+
|
542 |
+
$instance['title'] = '';
|
543 |
+
|
544 |
+
}
|
545 |
+
|
546 |
+
|
547 |
+
return $instance;
|
548 |
+
}
|
549 |
|
550 |
+
} // class Yasr Visitor Votes widget
|
551 |
|
552 |
?>
|
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
|
7 |
-
Stable tag: 1.3.
|
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
|
@@ -113,6 +113,11 @@ Of course not: you can easily add it on the visual editor just by clicking the "
|
|
113 |
|
114 |
The full changelog can be found in the plugin's directory. Recent entries:
|
115 |
|
|
|
|
|
|
|
|
|
|
|
116 |
= 1.3.4 =
|
117 |
* TWEAKED: minor changes
|
118 |
|
4 |
Requires at least: 4.3.0
|
5 |
Contributors: Dudo
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 1.3.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
|
113 |
|
114 |
The full changelog can be found in the plugin's directory. Recent entries:
|
115 |
|
116 |
+
= 1.3.5 =
|
117 |
+
* TWEAKED: READ CAREFULLY: this is the first step of an important yasr database change: the main goal is to switch from yasr_votes table to wordpress default post_meta.
|
118 |
+
A database backup is strongly suggested.
|
119 |
+
* NEW FEATURE: new widget that shows the last 5 recent ratings.
|
120 |
+
|
121 |
= 1.3.4 =
|
122 |
* TWEAKED: minor changes
|
123 |
|
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.3.
|
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.3.
|
35 |
|
36 |
//Plugin relative path
|
37 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|
@@ -225,7 +225,6 @@ require (YASR_ABSOLUTE_PATH . '/lib/yasr-shortcode-functions.php');
|
|
225 |
|
226 |
require (YASR_ABSOLUTE_PATH . '/lib/yasr-widgets.php');
|
227 |
|
228 |
-
|
229 |
global $wpdb;
|
230 |
|
231 |
define ("YASR_VOTES_TABLE", $wpdb->prefix . 'yasr_votes');
|
@@ -281,6 +280,39 @@ function yasr_update_version() {
|
|
281 |
global $yasr_stored_options;
|
282 |
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
//Remove end Sept 2016
|
285 |
if ($yasr_version_installed && $yasr_version_installed < '1.2.2') {
|
286 |
|
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.3.5
|
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.3.5');
|
35 |
|
36 |
//Plugin relative path
|
37 |
define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
|
225 |
|
226 |
require (YASR_ABSOLUTE_PATH . '/lib/yasr-widgets.php');
|
227 |
|
|
|
228 |
global $wpdb;
|
229 |
|
230 |
define ("YASR_VOTES_TABLE", $wpdb->prefix . 'yasr_votes');
|
280 |
global $yasr_stored_options;
|
281 |
|
282 |
|
283 |
+
//Remove end March 2017
|
284 |
+
//This is a very important update: yasr_votes table will not be used anymore, using post meta instead
|
285 |
+
//
|
286 |
+
|
287 |
+
if ($yasr_version_installed && $yasr_version_installed < '1.3.5') {
|
288 |
+
|
289 |
+
$overall_rating_array=$wpdb->get_results("SELECT post_id, overall_rating, review_type
|
290 |
+
FROM " . YASR_VOTES_TABLE ."
|
291 |
+
WHERE overall_rating >0
|
292 |
+
OR review_type IS NOT NULL
|
293 |
+
ORDER BY post_id ASC");
|
294 |
+
|
295 |
+
foreach ($overall_rating_array as $rating) {
|
296 |
+
|
297 |
+
//add post meta only if overall rating is > 0
|
298 |
+
if($rating->overall_rating > 0) {
|
299 |
+
|
300 |
+
add_post_meta($rating->post_id, 'yasr_overall_rating', $rating->overall_rating, TRUE);
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
//add review type only if is not empty
|
305 |
+
if($rating->review_type != '') {
|
306 |
+
|
307 |
+
add_post_meta($rating->post_id, 'yasr_review_type', $rating->review_type, TRUE);
|
308 |
+
|
309 |
+
}
|
310 |
+
|
311 |
+
}
|
312 |
+
|
313 |
+
}
|
314 |
+
|
315 |
+
|
316 |
//Remove end Sept 2016
|
317 |
if ($yasr_version_installed && $yasr_version_installed < '1.2.2') {
|
318 |
|