Yasr – Yet Another Stars Rating - Version 0.5.9

Version Description

  • New feature: When writing a post or a page it's now possible to select the category that you're reviewing. This is a good improvement for SEO.
  • Fixed loader when importing gd star rating data
  • Fixed loader in yasr-settings-page
Download this release

Release Info

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

Code changes from version 0.5.8 to 0.5.9

css/yasr-admin.css CHANGED
@@ -168,11 +168,8 @@ div.bigstars .rateit-selected
168
 
169
  /*** MEtabox overall rating ***/
170
 
171
- .yasr-switch-overall-rating-method {
172
- font-size: x-small;
173
- text-align: right;
174
- display: block;
175
- padding-bottom: 10px;
176
  }
177
 
178
  #yasr-rateit-vote-overall-text {
@@ -183,14 +180,6 @@ div.bigstars .rateit-selected
183
  display: block;
184
  }
185
 
186
- #yasr-vote-with-numbers {
187
- text-align: center;
188
- }
189
-
190
- #yasr-vote-overall-stars {
191
- text-align: center;
192
- }
193
-
194
  #yasr-comma-between-select {
195
  vertical-align: text-bottom;
196
  line-height: 0.5em;
168
 
169
  /*** MEtabox overall rating ***/
170
 
171
+ #yasr-overall-container {
172
+ text-align: center;
 
 
 
173
  }
174
 
175
  #yasr-rateit-vote-overall-text {
180
  display: block;
181
  }
182
 
 
 
 
 
 
 
 
 
183
  #yasr-comma-between-select {
184
  vertical-align: text-bottom;
185
  line-height: 0.5em;
js/yasr-admin.js CHANGED
@@ -18,20 +18,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
18
 
19
  /****** Yasr Metabox overall rating ******/
20
 
21
- function yasrDisplayOverallMetabox(defaultbox, postid, nonce) {
22
 
23
  if (defaultbox == 'stars' ) {
24
 
25
- yasrPrintEventSendOverallWithStars(postid, nonce);
26
 
27
  } //end if if (defaultbox == 'stars' )
28
 
29
  else if (defaultbox == 'numbers') {
30
 
31
- yasrPrintEventSendOverallWithNumbers(postid, nonce);
32
 
33
  } //End else if (defaultbox == 'numbers')
34
 
 
 
35
  } //End function yasr_display_metabox*/
36
 
37
 
@@ -111,6 +113,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
111
 
112
  }
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
  /****** End Yasr Metabox overall rating ******/
116
 
@@ -328,11 +354,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
328
  //On click begin step1
329
  jQuery('#import-button').on('click', function() {
330
 
 
 
331
  var data = {
332
  action : 'yasr_import_step1'
333
  };
334
 
335
  jQuery.post(ajaxurl, data, function(response) {
 
336
  jQuery('#result-import').html(response);
337
  });
338
 
@@ -341,11 +370,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
341
  jQuery('#result-import').on('click', '.yasr-result-step-1', function() {
342
  //Now we are going to prepare another ajax call to check if multiple set exists
343
 
 
 
344
  var data = {
345
  action: 'yasr_import_multi_set'
346
  };
347
 
348
  jQuery.post(ajaxurl, data, function(response) {
 
349
  jQuery('#result-import').append(response);
350
  });
351
 
18
 
19
  /****** Yasr Metabox overall rating ******/
20
 
21
+ function yasrDisplayOverallMetabox(defaultbox, postid, nonceOverall, nonceSnippet) {
22
 
23
  if (defaultbox == 'stars' ) {
24
 
25
+ yasrPrintEventSendOverallWithStars(postid, nonceOverall);
26
 
27
  } //end if if (defaultbox == 'stars' )
28
 
29
  else if (defaultbox == 'numbers') {
30
 
31
+ yasrPrintEventSendOverallWithNumbers(postid, nonceOverall);
32
 
33
  } //End else if (defaultbox == 'numbers')
34
 
35
+ yasrSnippetSelect(postid, nonceSnippet);
36
+
37
  } //End function yasr_display_metabox*/
38
 
39
 
113
 
114
  }
115
 
116
+ function yasrSnippetSelect(postid, nonceSnippet) {
117
+
118
+ jQuery('#yasr-send-review-type').on('click', function() {
119
+
120
+ reviewtype = jQuery('#yasr-choose-reviews-types-list').val()
121
+
122
+ var data = {
123
+ action: 'yasr_insert_review_type',
124
+ reviewtype: reviewtype,
125
+ postid: postid,
126
+ nonce: nonceSnippet
127
+ }
128
+
129
+ jQuery.post(ajaxurl, data, function(response) {
130
+ jQuery('#yasr-ajax-response-review-type').text(response);
131
+ }) ;
132
+
133
+ return false;
134
+ preventDefault(); // same thing as above
135
+
136
+ });
137
+
138
+ }
139
+
140
 
141
  /****** End Yasr Metabox overall rating ******/
142
 
354
  //On click begin step1
355
  jQuery('#import-button').on('click', function() {
356
 
357
+ jQuery('#yasr-loader-importer').show();
358
+
359
  var data = {
360
  action : 'yasr_import_step1'
361
  };
362
 
363
  jQuery.post(ajaxurl, data, function(response) {
364
+ jQuery('#yasr-loader-importer').hide();
365
  jQuery('#result-import').html(response);
366
  });
367
 
370
  jQuery('#result-import').on('click', '.yasr-result-step-1', function() {
371
  //Now we are going to prepare another ajax call to check if multiple set exists
372
 
373
+ jQuery('#yasr-loader-importer2').show();
374
+
375
  var data = {
376
  action: 'yasr_import_multi_set'
377
  };
378
 
379
  jQuery.post(ajaxurl, data, function(response) {
380
+ jQuery('#yasr-loader-importer2').hide();
381
  jQuery('#result-import').append(response);
382
  });
383
 
lib/yasr-ajax-functions.php CHANGED
@@ -72,12 +72,28 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
72
  array (
73
  'post_id' => $post_id,
74
  'overall_rating' => $rating,
75
- 'reviewer_id' => $reviewer_id
 
76
  ),
77
- array('%d', '%s', '%d')
78
  );
79
 
80
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
  if ($update_result || $replace_result) {
83
 
@@ -97,6 +113,71 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
97
 
98
 
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  /****** Get Set name from post or page and output the set,
101
  used in yasr-metabox-multiple-rating******/
102
 
@@ -511,8 +592,8 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
511
  <br />
512
  <?php _e ("Step2: I will check if you used Multiple Sets and if so I will import them. THIS MAY TAKE A WHILE!", 'yasr'); ?>
513
  <br />
514
- <button href=\"#\" class=\"button-primary\" id=\"import-button-step2\"> <?php _e('Proceed Step 2', 'yasr');?> </button>
515
- <span id="loader2" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
516
  </span>
517
  <?php
518
  }
72
  array (
73
  'post_id' => $post_id,
74
  'overall_rating' => $rating,
75
+ 'reviewer_id' => $reviewer_id,
76
+ 'review_type' => 'Product' //default review type in a new post
77
  ),
78
+ array('%d', '%s', '%d', '%s')
79
  );
80
 
81
+ $snippet_type = yasr_get_snippet_type();
82
+
83
+ //If there is not sinppet type, can happen when an user choose the snippet but doesn't use overall rating
84
+ if (!$snippet_type) {
85
+
86
+ $wpdb->update(
87
+ YASR_VOTES_TABLE,
88
+ array (
89
+ 'review_type' => 'Product' //default review type in a new post
90
+ ),
91
+ array('%s')
92
+ );
93
+
94
+ }
95
+
96
+ } // End if(!$update_result)
97
 
98
  if ($update_result || $replace_result) {
99
 
113
 
114
 
115
 
116
+ /****** Set the review type in yasr metabox overall rating ******/
117
+
118
+ add_action ( 'wp_ajax_yasr_insert_review_type', 'yasr_insert_review_type_callback' );
119
+
120
+ function yasr_insert_review_type_callback () {
121
+
122
+ if (isset($_POST['reviewtype']) && ($_POST['postid'])) {
123
+
124
+ $reviewtype = $_POST['reviewtype'];
125
+ $post_id = $_POST['postid'];
126
+ $nonce = $_POST['nonce'];
127
+
128
+ }
129
+
130
+ else {
131
+ exit();
132
+ }
133
+
134
+ if ( ! wp_verify_nonce( $nonce, 'yasr_nonce_review_type' ) ) {
135
+ die( 'Security check' );
136
+ }
137
+
138
+ global $wpdb;
139
+
140
+ //If update works means that there is already a row for this post
141
+ $review_type = $wpdb->update(
142
+ YASR_VOTES_TABLE,
143
+ array (
144
+ 'review_type' => $reviewtype
145
+ ),
146
+ array('post_id' => $post_id),
147
+ array('%s'),
148
+ array('%d')
149
+ );
150
+
151
+ //if fail there is no row so make new one
152
+ if(!$review_type) {
153
+
154
+ $review_type = $wpdb->replace(
155
+ YASR_VOTES_TABLE,
156
+ array (
157
+ 'post_id' => $post_id,
158
+ 'overall_rating' => '-1',
159
+ 'review_type' => $reviewtype
160
+ ),
161
+ array('%s', '%s')
162
+ );
163
+
164
+ }
165
+
166
+ if($review_type) {
167
+ _e("$reviewtype selected", "yasr");
168
+ }
169
+ else {
170
+ _e("There was an error while trying to insert the review type. Please report it", "yasr");
171
+ }
172
+
173
+ die();
174
+
175
+ }
176
+
177
+
178
+
179
+
180
+
181
  /****** Get Set name from post or page and output the set,
182
  used in yasr-metabox-multiple-rating******/
183
 
592
  <br />
593
  <?php _e ("Step2: I will check if you used Multiple Sets and if so I will import them. THIS MAY TAKE A WHILE!", 'yasr'); ?>
594
  <br />
595
+ <button href="#" class="button-primary" id="import-button-step2"> <?php _e('Proceed Step 2', 'yasr');?> </button>
596
+ <span id="yasr-loader-importer2" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "loader.gif" ?>">
597
  </span>
598
  <?php
599
  }
lib/yasr-db-functions.php CHANGED
@@ -39,6 +39,7 @@ function yasr_install() {
39
  overall_rating decimal(2,1) NOT NULL,
40
  number_of_votes bigint(20) NOT NULL,
41
  sum_votes decimal(11,1) NOT NULL,
 
42
  PRIMARY KEY (id),
43
  UNIQUE KEY post_id (post_id)
44
  );";
@@ -147,6 +148,30 @@ function yasr_get_overall_rating($post_id_referenced=FALSE) {
147
  }
148
 
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  /****** Get multi set name ******/
151
  function yasr_get_multi_set() {
152
  global $wpdb;
@@ -433,4 +458,6 @@ function yasr_check_if_user_already_voted() {
433
 
434
  }
435
 
 
 
436
  ?>
39
  overall_rating decimal(2,1) NOT NULL,
40
  number_of_votes bigint(20) NOT NULL,
41
  sum_votes decimal(11,1) NOT NULL,
42
+ review_type VARCHAR(10),
43
  PRIMARY KEY (id),
44
  UNIQUE KEY post_id (post_id)
45
  );";
148
  }
149
 
150
 
151
+ /****** Return the snippet choosen for a post or page ******/
152
+ function yasr_get_snippet_type() {
153
+
154
+ global $wpdb;
155
+
156
+ $post_id=get_the_ID();
157
+
158
+ $result=$wpdb->get_results("SELECT review_type FROM " . YASR_VOTES_TABLE . " WHERE post_id=$post_id");
159
+
160
+ if($result) {
161
+ foreach ($result as $snippet) {
162
+ $snippet_type = $snippet->review_type;
163
+ }
164
+
165
+ return $snippet_type;
166
+ }
167
+
168
+ else {
169
+ return FALSE;
170
+ }
171
+
172
+ }
173
+
174
+
175
  /****** Get multi set name ******/
176
  function yasr_get_multi_set() {
177
  global $wpdb;
458
 
459
  }
460
 
461
+
462
+
463
  ?>
lib/yasr-functions.php CHANGED
@@ -259,46 +259,60 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
259
 
260
  /****** Add review schema data at the end of the post *******/
261
 
262
- add_filter('the_content', 'yasr_add_overall_rating_schema');
263
 
264
- function yasr_add_overall_rating_schema($content) {
265
 
266
- $schema=NULL; //To avoid undefined variable notice outside the loop
267
 
268
- if (YASR_SNIPPET == 'overall_rating') {
269
 
270
- $overall_rating=yasr_get_overall_rating();
271
 
272
- if($overall_rating && $overall_rating != '-1' && $overall_rating != '0.0') {
273
 
274
- if(is_singular() && is_main_query() ) {
275
- global $post;
276
 
277
- $div = "<div class=\"yasr_schema\" itemprop=\"review\" itemscope itemtype=\"http://schema.org/Review\">";
278
- $title = "<span itemprop=\"about\">". get_the_title() ."</span>";
279
- $author = __(' reviewed by ', 'yasr') . "<span itemprop=\"author\">" . get_the_author() . "</span>";
280
- $date = __(' on ', 'yasr') . "<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date();
281
- $rating = __( ' rated ' , 'yasr' ) . "<span itemprop=\"reviewRating\">" . $overall_rating . "</span>" . __(' on 5.0' , 'yasr');
282
- $end_div= "</div>";
283
 
284
- $schema = $div . $title . $author . $date . $rating . $end_div;
285
- }
 
286
 
287
- } //END id if $overall_rating != '-1'
 
 
288
 
289
- if( is_singular() && is_main_query() ) {
290
- return $content . $schema;
291
- }
292
 
293
- else {
294
- return $content;
295
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- } //end if ($choosen_snippet['snippet'] == 'overall_rating')
298
 
299
- if (YASR_SNIPPET == 'visitor_rating') {
300
 
301
- $visitor_votes = yasr_get_visitor_votes ();
302
 
303
  if ($visitor_votes) {
304
 
@@ -313,36 +327,47 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
313
  $visitor_rating = NULL;
314
  }
315
 
316
- if ($visitor_rating['sum'] != 0) {
317
 
318
- $average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
319
 
320
- $average_rating=round($average_rating, 1);
321
 
322
- $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Product\">";
323
- $title = "<span itemprop=\"name\">". get_the_title() ."</span>";
324
- $author = __( ' written by ' , 'yasr' ) . "<span itemprop=\"author\">" . get_the_author() . "</span>";
325
- $span_1 = "<span itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">";
326
- $rating = __( ' average rating ' , 'yasr' ) . "<span itemprop=\"ratingValue\">" . $average_rating . "</span>/<span itemprop=\"bestRating\">5</span>";
327
- $n_ratings = " - <span itemprop=\"ratingCount\"> " . $visitor_rating['votes_number'] . "</span>" . __(' user ratings', 'yasr');
328
- $end_span_1 = "</span>";
329
- $end_div_1 = "</div>";
330
 
331
- $schema = $div_1 . $title . $author . $span_1 . $rating . $n_ratings . $end_span_1 . $end_div_1;
 
 
332
 
333
- }
 
 
334
 
335
- if( is_singular() && is_main_query() ) {
336
- return $content . $schema;
337
- }
 
 
 
 
338
 
339
- else {
340
- return $content;
341
- }
342
 
343
- }
 
 
 
 
 
 
 
 
 
 
344
 
345
- } //End function
346
 
347
 
348
  /****** Create a new button in Tinymce for use shortag
259
 
260
  /****** Add review schema data at the end of the post *******/
261
 
262
+ add_filter('the_content', 'yasr_add_schema');
263
 
264
+ function yasr_add_schema($content) {
265
 
266
+ $schema=NULL; //To avoid undefined variable notice outside the loop
267
 
268
+ $review_choosen = yasr_get_snippet_type();
269
 
270
+ if (YASR_SNIPPET == 'overall_rating') {
271
 
272
+ $overall_rating=yasr_get_overall_rating();
273
 
274
+ if($overall_rating && $overall_rating != '-1' && $overall_rating != '0.0') {
 
275
 
276
+ if(is_singular() && is_main_query() ) {
277
+ global $post;
 
 
 
 
278
 
279
+ if ($review_choosen == 'Place') {
280
+ $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/LocalBusiness\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
281
+ }
282
 
283
+ if ($review_choosen == 'Other') {
284
+ $title = "<span itemprop=\"itemReviewed\" itemscope itemType=\"http://schema.org/BlogPosting\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
285
+ }
286
 
287
+ else {
288
+ $title = "<span itemprop=\"itemReviewed\" itemscope itemtype=\"http://schema.org/Thing\"> <span itemprop=\"name\">". get_the_title() ."</span></span>";
289
+ }
290
 
291
+ $div = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Review\">";
292
+ $author = "<span itemprop=\"author\" itemscope itemtype=\"http://schema.org/Person\">" . __(' reviewed by ', 'yasr') . "<span itemprop=\"name\">" . get_the_author() . "</span></span>";
293
+ $date = __(' on ', 'yasr') . "<meta itemprop=\"datePublished\" content=\"" . get_the_date('c') . "\"> " . get_the_date();
294
+ $rating = "<span itemprop=\"reviewRating\" itemscope itemtype=\"http://schema.org/Rating\"> ". __( ' rated ' , 'yasr' ) . "<span itemprop=\"ratingValue\">" . $overall_rating . "</span> <span itemprop=\"bestRating\">" . __(' on 5.0' , 'yasr') . "</span></span>";
295
+ $end_div= "</div>";
296
+
297
+ $schema = $div . $title . $author . $date . $rating . $end_div;
298
+
299
+ }
300
+
301
+ } //END id if $overall_rating != '-1'
302
+
303
+ if( is_singular() && is_main_query() ) {
304
+ return $content . $schema;
305
+ }
306
+
307
+ else {
308
+ return $content;
309
+ }
310
 
311
+ } //end if ($choosen_snippet['snippet'] == 'overall_rating')
312
 
313
+ if (YASR_SNIPPET == 'visitor_rating') {
314
 
315
+ $visitor_votes = yasr_get_visitor_votes ();
316
 
317
  if ($visitor_votes) {
318
 
327
  $visitor_rating = NULL;
328
  }
329
 
330
+ if ($visitor_rating['sum'] != 0) {
331
 
332
+ $average_rating = $visitor_rating['sum'] / $visitor_rating['votes_number'];
333
 
334
+ $average_rating=round($average_rating, 1);
335
 
336
+ if ($review_choosen == 'Place') {
337
+ $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/LocalBusiness\">";
338
+ }
 
 
 
 
 
339
 
340
+ if ($review_choosen == 'Other') {
341
+ $div_1 = "<div class=\"yasr_schema\" itemscope itemType=\"http://schema.org/BlogPosting\">";
342
+ }
343
 
344
+ else {
345
+ $div_1 = "<div class=\"yasr_schema\" itemscope itemtype=\"http://schema.org/Product\">";
346
+ }
347
 
348
+ $title = "<span itemprop=\"name\">". get_the_title() ."</span>";
349
+ $author = __( ' written by ' , 'yasr' ) . get_the_author();
350
+ $span_1 = "<span itemprop=\"aggregateRating\" itemscope itemtype=\"http://schema.org/AggregateRating\">";
351
+ $rating = __( ' average rating ' , 'yasr' ) . "<span itemprop=\"ratingValue\">" . $average_rating . "</span>/<span itemprop=\"bestRating\">5</span>";
352
+ $n_ratings = " - <span itemprop=\"ratingCount\"> " . $visitor_rating['votes_number'] . "</span>" . __(' user ratings', 'yasr');
353
+ $end_span_1 = "</span>";
354
+ $end_div_1 = "</div>";
355
 
356
+ $schema = $div_1 . $title . $author . $span_1 . $rating . $n_ratings . $end_span_1 . $end_div_1;
 
 
357
 
358
+ }
359
+
360
+ if( is_singular() && is_main_query() ) {
361
+ return $content . $schema;
362
+ }
363
+
364
+ else {
365
+ return $content;
366
+ }
367
+
368
+ }
369
 
370
+ } //End function
371
 
372
 
373
  /****** Create a new button in Tinymce for use shortag
readme.txt CHANGED
@@ -3,7 +3,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
3
  Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post rating, posts, rate, rating, rating platform, rating system, ratings, review, reviews, rich snippets, seo, star, star rating, stars, vote, Votes, voting, voting contest, schema, serp
4
  Requires at least: 3.5
5
  Tested up to: 4.0
6
- Stable tag: 0.5.8
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -84,6 +84,11 @@ Of course not: you can easily add it on the visual editor just by clicking on th
84
 
85
  == Changelog ==
86
 
 
 
 
 
 
87
  = 0.5.8 =
88
  * Changed description in yasr shortcode generator (transaltor please take a look to the .po file) and other languages fix.
89
  * Added the author info in the aggregate rating snippet
3
  Tags: 5 star, admin, administrator, AJAX, five-star, javascript, jquery, post rating, posts, rate, rating, rating platform, rating system, ratings, review, reviews, rich snippets, seo, star, star rating, stars, vote, Votes, voting, voting contest, schema, serp
4
  Requires at least: 3.5
5
  Tested up to: 4.0
6
+ Stable tag: 0.5.9
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
84
 
85
  == Changelog ==
86
 
87
+ = 0.5.9 =
88
+ * New feature: When writing a post or a page it's now possible to select the category that you're reviewing. This is a good improvement for SEO.
89
+ * Fixed loader when importing gd star rating data
90
+ * Fixed loader in yasr-settings-page
91
+
92
  = 0.5.8 =
93
  * Changed description in yasr shortcode generator (transaltor please take a look to the .po file) and other languages fix.
94
  * Added the author info in the aggregate rating snippet
yasr-metabox-overall-rating.php CHANGED
@@ -43,6 +43,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
43
 
44
  $ajax_nonce_overall = wp_create_nonce( "yasr_nonce_insert_overall_rating" );
45
 
 
46
 
47
  ?>
48
 
@@ -75,19 +76,6 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
75
  <div>
76
 
77
  <span id="yasr_rateit_overall_value"></span>
78
-
79
- <?php
80
-
81
- //Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
82
- if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
83
-
84
- echo "<div>";
85
- _e ("Remember to insert this shortcode <strong>[yasr_overall_rating]</strong> where you want to display this rating", "yasr");
86
- echo "</div>";
87
-
88
- }
89
-
90
- ?>
91
 
92
  </div>
93
 
@@ -156,24 +144,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
156
 
157
  <p>
158
 
159
- <div>
160
-
161
- <?php
162
-
163
- //Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
164
- if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
165
-
166
- echo "<div>";
167
- _e ("Remember to insert this shortcode <strong>[yasr_overall_rating]</strong> where you want to display this rating", "yasr");
168
- echo "</div>";
169
-
170
- }
171
-
172
- ?>
173
-
174
- </div>
175
-
176
- <button href="#" class="button-delete" id="yasr-send-overall-numbers"><?php _e('Save Vote', 'yasr'); ?></button>
177
 
178
  <p>
179
 
@@ -185,10 +156,67 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
185
 
186
  <?php
187
 
188
- }
189
 
190
  ?>
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  </div>
193
 
194
  <script type="text/javascript">
@@ -199,9 +227,11 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
199
 
200
  var nonceOverall = <?php echo (json_encode("$ajax_nonce_overall")); ?>;
201
 
 
 
202
  var postid = <?php json_encode(the_ID()); ?>;
203
 
204
- yasrDisplayOverallMetabox(defaultbox, postid, nonceOverall);
205
 
206
  }); //End document ready
207
 
43
 
44
  $ajax_nonce_overall = wp_create_nonce( "yasr_nonce_insert_overall_rating" );
45
 
46
+ $ajax_nonce_review_type = wp_create_nonce( "yasr_nonce_review_type" );
47
 
48
  ?>
49
 
76
  <div>
77
 
78
  <span id="yasr_rateit_overall_value"></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  </div>
81
 
144
 
145
  <p>
146
 
147
+ <button href="#" class="button-secondary" id="yasr-send-overall-numbers"><?php _e('Save Vote', 'yasr'); ?></button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
149
  <p>
150
 
156
 
157
  <?php
158
 
159
+ } //End if YASR_METABOX_OVERALL_RATING == 'numbers'
160
 
161
  ?>
162
 
163
+
164
+ <div class="yasr-choose-reviews-types"><?php _e("This review is about a..."); ?>
165
+ <br />
166
+
167
+ <?php
168
+
169
+ $review_type = array("Product", "Place", "Other");
170
+ $review_type_choosen = yasr_get_snippet_type();
171
+
172
+ ?>
173
+
174
+ <select id="yasr-choose-reviews-types-list">
175
+
176
+ <?php
177
+
178
+ foreach ($review_type as $type) {
179
+
180
+ if ($type == $review_type_choosen) {
181
+ echo "<option value=\"$type\" selected>$type</option>";
182
+ }
183
+
184
+ else {
185
+ echo "<option value=\"$type\">$type</option>";
186
+ }
187
+ }
188
+
189
+ ?>
190
+
191
+ </select>
192
+
193
+ <button href="#" class="button-secondary" id="yasr-send-review-type"><?php _e('Select', 'yasr'); ?></button>
194
+
195
+ <br />
196
+
197
+ <span id="yasr-ajax-response-review-type"></span>
198
+
199
+ </div>
200
+
201
+ <p>
202
+
203
+ <div>
204
+
205
+ <?php
206
+
207
+ //Show this message if auto insert is off or if auto insert is not set to show overall rating (so if it is set to visitor rating)
208
+ if( YASR_AUTO_INSERT_ENABLED == 0 || (YASR_AUTO_INSERT_ENABLED == 1 && YASR_AUTO_INSERT_WHAT === 'visitor_rating') ) {
209
+
210
+ echo "<div>";
211
+ _e ("Remember to insert this shortcode <strong>[yasr_overall_rating]</strong> where you want to display this rating", "yasr");
212
+ echo "</div>";
213
+
214
+ }
215
+
216
+ ?>
217
+
218
+ </div>
219
+
220
  </div>
221
 
222
  <script type="text/javascript">
227
 
228
  var nonceOverall = <?php echo (json_encode("$ajax_nonce_overall")); ?>;
229
 
230
+ var nonceSnippet = <?php echo (json_encode("$ajax_nonce_review_type")); ?>;
231
+
232
  var postid = <?php json_encode(the_ID()); ?>;
233
 
234
+ yasrDisplayOverallMetabox(defaultbox, postid, nonceOverall, nonceSnippet);
235
 
236
  }); //End document ready
237
 
yasr-settings-page.php CHANGED
@@ -133,7 +133,7 @@ $n_multi_set = NULL;
133
  <br />
134
  <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
135
 
136
- <span id="loader" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
137
  </span>
138
  <br />
139
 
@@ -166,7 +166,7 @@ $n_multi_set = NULL;
166
  <br />
167
  <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
168
 
169
- <span id="loader" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
170
  </span>
171
 
172
  <br />
133
  <br />
134
  <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
135
 
136
+ <span id="yasr-loader-importer" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "loader.gif" ?>">
137
  </span>
138
  <br />
139
 
166
  <br />
167
  <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
168
 
169
+ <span id="yasr-loader-importer" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "loader.gif" ?>">
170
  </span>
171
 
172
  <br />
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.5.8
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.5.8');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
@@ -85,16 +85,6 @@ define ("YASR_LOG_TABLE", $wpdb->prefix . 'yasr_log');
85
 
86
  define ("YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif");
87
 
88
- //remove end of september
89
- if ($version_installed && $version_installed < '0.4.1') {
90
-
91
- $option = get_option( 'yasr_general_options' );
92
-
93
- $option['auto_insert_size'] = 'large';
94
-
95
- update_option("yasr_general_options", $option);
96
-
97
- }
98
 
99
  //remove mid november
100
  if ($version_installed && $version_installed < '0.5.0') {
@@ -118,6 +108,15 @@ if ($version_installed && $version_installed < '0.5.4') {
118
 
119
  }
120
 
 
 
 
 
 
 
 
 
 
121
  if ($version_installed != YASR_VERSION_NUM) {
122
 
123
  update_option('yasr-version', YASR_VERSION_NUM);
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.5.9
7
  * Author: Dario Curvino
8
  * Author URI: http://profiles.wordpress.org/dudo/
9
  * License: GPL2
28
  */
29
 
30
 
31
+ define('YASR_VERSION_NUM', '0.5.9');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );
85
 
86
  define ("YASR_LOADER_IMAGE", YASR_IMG_DIR . "/loader.gif");
87
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  //remove mid november
90
  if ($version_installed && $version_installed < '0.5.0') {
108
 
109
  }
110
 
111
+ //remove end gen 2015
112
+ if ($version_installed && $version_installed < '0.5.9') {
113
+
114
+ $wpdb->query("ALTER TABLE " . YASR_VOTES_TABLE . " ADD review_type VARCHAR( 10 )");
115
+
116
+ }
117
+
118
+
119
+
120
  if ($version_installed != YASR_VERSION_NUM) {
121
 
122
  update_option('yasr-version', YASR_VERSION_NUM);