Yasr – Yet Another Stars Rating - Version 0.2.9

Version Description

  • Settings page has been rewritten: now it use multi tab navigation
Download this release

Release Info

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

Code changes from version 0.2.7 to 0.2.9

css/yasr.css CHANGED
@@ -7,6 +7,16 @@
7
  display: block;
8
  }
9
 
 
 
 
 
 
 
 
 
 
 
10
  @media (min-width: 972px) {
11
 
12
  .yasr-settingsdiv {
@@ -63,6 +73,10 @@
63
  clear: both;
64
  }
65
 
 
 
 
 
66
  .yasr-multi-set-left {
67
  float:left;
68
  width: 40%;
@@ -74,7 +88,6 @@
74
  }
75
 
76
  .yasr-new-multi-set {
77
- display: none;
78
  overflow: auto;
79
  margin-top: 10px;
80
  padding: 8px;
@@ -83,7 +96,6 @@
83
  }
84
 
85
  .yasr-manage-multiset {
86
- display: none;
87
  overflow: auto;
88
  margin-top: 10px;
89
  padding: 8px;
@@ -92,7 +104,6 @@
92
  }
93
 
94
  .yasr-manage-multiset-single {
95
- display: none;
96
  overflow: auto;
97
  margin-top: 10px;
98
  padding: 8px;
@@ -129,6 +140,12 @@
129
  background-color: #f7f7f7;
130
  }
131
 
 
 
 
 
 
 
132
  #yasr-table-form-edit-multi-set {
133
  width: 100%;
134
  }
7
  display: block;
8
  }
9
 
10
+
11
+ h2.nav-tab-wrapper, h3.nav-tab-wrapper {
12
+ border-bottom: none !important;
13
+ }
14
+
15
+ .nav-tab-active, .nav-tab-active:hover {
16
+ background-color: white !important;
17
+ }
18
+
19
+
20
  @media (min-width: 972px) {
21
 
22
  .yasr-settingsdiv {
73
  clear: both;
74
  }
75
 
76
+ .yasr-multi-set-form-headers {
77
+ text-align: center;
78
+ }
79
+
80
  .yasr-multi-set-left {
81
  float:left;
82
  width: 40%;
88
  }
89
 
90
  .yasr-new-multi-set {
 
91
  overflow: auto;
92
  margin-top: 10px;
93
  padding: 8px;
96
  }
97
 
98
  .yasr-manage-multiset {
 
99
  overflow: auto;
100
  margin-top: 10px;
101
  padding: 8px;
104
  }
105
 
106
  .yasr-manage-multiset-single {
 
107
  overflow: auto;
108
  margin-top: 10px;
109
  padding: 8px;
140
  background-color: #f7f7f7;
141
  }
142
 
143
+ #yasr-multi-set-doc-box {
144
+ border: 2px dashed #CCC;
145
+ padding: 15px;
146
+ margin: 30px;
147
+ }
148
+
149
  #yasr-table-form-edit-multi-set {
150
  width: 100%;
151
  }
img/yasr-multi-set-insert-rate-small.jpg ADDED
Binary file
img/yasr-multi-set-insert-rate.jpg ADDED
Binary file
img/yasr-multi-set.png ADDED
Binary file
lib/yasr-functions.php CHANGED
@@ -50,55 +50,6 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
50
  if ( ! current_user_can( 'manage_options' ) ) {
51
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'yasr' ) );
52
  }
53
- ?>
54
-
55
- <div class="wrap">
56
-
57
- <h2>Yet Another Stars Rating: Settings</h2>
58
-
59
- <?php
60
-
61
- $error_new_multi_set=yasr_process_new_multi_set_form(); //defined in yasr-db-functions
62
-
63
- $error_edit_multi_set=yasr_process_edit_multi_set_form(); //defined in yasr-db-functions
64
-
65
- if ($error_new_multi_set) {
66
- echo "<div class=\"error\"> <p> <strong>";
67
-
68
- foreach ($error_new_multi_set as $error) {
69
- _e($error, 'yasr');
70
- echo "<br />";
71
- }
72
-
73
- echo "</strong></p></div>";
74
- }
75
-
76
- if ($error_edit_multi_set) {
77
- echo "<div class=\"error\"> <p> <strong>";
78
-
79
- foreach ($error_edit_multi_set as $error) {
80
- _e($error, 'yasr');
81
- echo "<br />";
82
- }
83
-
84
- echo "</strong></p></div>";
85
- }
86
- ?>
87
-
88
- <div class="yasr-settingsdiv">
89
- <form action="options.php" method="post" id="yasr_settings_form">
90
- <?php
91
- settings_fields( 'yasr_auto_insert_options_group' );
92
- //settings_fields( 'yasr_choose_snippet_group' );
93
- do_settings_sections('yasr_settings_page' );
94
- submit_button( __('Save') );
95
- ?>
96
- </form>
97
- </div>
98
-
99
- <!--End div wrap is in yasr-settings-page-->
100
-
101
- <?php
102
 
103
  include(YASR_ABSOLUTE_PATH . '/yasr-settings-page.php');
104
 
@@ -143,6 +94,70 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
143
  }
144
 
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
 
147
 
148
  /****** Add review schema data at the end of the post *******/
@@ -189,7 +204,7 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
189
  return $content;
190
  }
191
 
192
- }
193
 
194
  if ($choosen_snippet['snippet'] == 'visitor_rating') {
195
 
@@ -215,85 +230,17 @@ if ( ! defined( 'ABSPATH' ) ) exit('You\'re not allowed to see this page'); // E
215
 
216
  if( is_singular() && is_main_query() ) {
217
  return $content . $schema;
218
- }
219
 
220
- else {
221
  return $content;
222
- }
223
 
224
  }
225
 
226
  } //End function
227
 
228
 
229
-
230
- /****** Auto insert shortcode ******/
231
-
232
- add_filter('the_content', 'yasr_auto_insert_shortcode_callback');
233
-
234
- function yasr_auto_insert_shortcode_callback($content) {
235
-
236
- $option = get_option( 'yasr_auto_insert_options' );
237
-
238
- if ($option['enabled'] == 1) {
239
-
240
- $auto_insert_shortcode=NULL; //To avoid undefined variable notice outside the loop (if (is_singular) )
241
-
242
- if( is_singular() && is_main_query() ) {
243
-
244
- $overall_rating_shortcode='[yasr_overall_rating]';
245
- $visitor_votes_shortcode='[yasr_visitor_votes]';
246
-
247
- if ($option['what']=='overall_rating') {
248
- switch ($option['where']) {
249
- case 'top':
250
- return $overall_rating_shortcode . $content;
251
- break;
252
-
253
- case 'bottom':
254
- return $content . $overall_rating_shortcode;
255
- break;
256
- } //End Switch
257
- } //end ($option['what']=='overall_rating')
258
-
259
- elseif ($option['what']=='visitor_rating') {
260
- switch ($option['where']) {
261
- case 'top':
262
- return $visitor_votes_shortcode . $content;
263
- break;
264
-
265
- case 'bottom':
266
- return $content . $visitor_votes_shortcode;
267
- break;
268
- } //End Switch
269
- }
270
-
271
- elseif ($option['what']=='both') {
272
- switch ($option['where']) {
273
- case 'top':
274
- return $overall_rating_shortcode . $visitor_votes_shortcode . $content;
275
- break;
276
-
277
- case 'bottom':
278
- return $content . $overall_rating_shortcode . $visitor_votes_shortcode;
279
- break;
280
- } //End Switch
281
- }
282
-
283
- } //End if( is_singular() && is_main_query() )
284
-
285
- return $content;
286
-
287
- } //End if ($option['enabled'] == 1)
288
-
289
- else {
290
- return $content;
291
- }
292
-
293
- } //End function yasr_auto_insert_shortcode_callback
294
-
295
-
296
-
297
  /****** Create a new button in Tinymce for use shortag
298
  (Thanks to wordpress.stackexchange) ******/
299
 
50
  if ( ! current_user_can( 'manage_options' ) ) {
51
  wp_die( __( 'You do not have sufficient permissions to access this page.', 'yasr' ) );
52
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  include(YASR_ABSOLUTE_PATH . '/yasr-settings-page.php');
55
 
94
  }
95
 
96
 
97
+ /****** Auto insert shortcode ******/
98
+
99
+ add_filter('the_content', 'yasr_auto_insert_shortcode_callback');
100
+
101
+ function yasr_auto_insert_shortcode_callback($content) {
102
+
103
+ $option = get_option( 'yasr_auto_insert_options' );
104
+
105
+ if ($option['enabled'] == 1) {
106
+
107
+ $auto_insert_shortcode=NULL; //To avoid undefined variable notice outside the loop (if (is_singular) )
108
+
109
+ if( is_singular() && is_main_query() ) {
110
+
111
+ $overall_rating_shortcode='[yasr_overall_rating]';
112
+ $visitor_votes_shortcode='[yasr_visitor_votes]';
113
+
114
+ if ($option['what']=='overall_rating') {
115
+ switch ($option['where']) {
116
+ case 'top':
117
+ return $overall_rating_shortcode . $content;
118
+ break;
119
+
120
+ case 'bottom':
121
+ return $content . $overall_rating_shortcode;
122
+ break;
123
+ } //End Switch
124
+ } //end ($option['what']=='overall_rating')
125
+
126
+ elseif ($option['what']=='visitor_rating') {
127
+ switch ($option['where']) {
128
+ case 'top':
129
+ return $visitor_votes_shortcode . $content;
130
+ break;
131
+
132
+ case 'bottom':
133
+ return $content . $visitor_votes_shortcode;
134
+ break;
135
+ } //End Switch
136
+ }
137
+
138
+ elseif ($option['what']=='both') {
139
+ switch ($option['where']) {
140
+ case 'top':
141
+ return $overall_rating_shortcode . $visitor_votes_shortcode . $content;
142
+ break;
143
+
144
+ case 'bottom':
145
+ return $content . $overall_rating_shortcode . $visitor_votes_shortcode;
146
+ break;
147
+ } //End Switch
148
+ }
149
+
150
+ } //End if( is_singular() && is_main_query() )
151
+
152
+ return $content;
153
+
154
+ } //End if ($option['enabled'] == 1)
155
+
156
+ else {
157
+ return $content;
158
+ }
159
+
160
+ } //End function yasr_auto_insert_shortcode_callback
161
 
162
 
163
  /****** Add review schema data at the end of the post *******/
204
  return $content;
205
  }
206
 
207
+ } //end if ($choosen_snippet['snippet'] == 'overall_rating')
208
 
209
  if ($choosen_snippet['snippet'] == 'visitor_rating') {
210
 
230
 
231
  if( is_singular() && is_main_query() ) {
232
  return $content . $schema;
233
+ }
234
 
235
+ else {
236
  return $content;
237
+ }
238
 
239
  }
240
 
241
  } //End function
242
 
243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
244
  /****** Create a new button in Tinymce for use shortag
245
  (Thanks to wordpress.stackexchange) ******/
246
 
lib/yasr-settings-functions.php CHANGED
@@ -145,7 +145,7 @@
145
  function yasr_display_multi_set_form() {
146
  ?>
147
 
148
- <h4 align="center">Add New Multiple Set</h4>
149
  <em><?php _e('Field Name, Element#1 and Element#2 MUST be filled and must be long at least 3 characters', 'yasr') ?></em>
150
  <p>
151
  <form action="<?php echo admin_url('options-general.php?page=yasr_settings_page') ?>" id="form_add_multi_set" method="post">
@@ -189,10 +189,10 @@ function yasr_edit_multi_form() {
189
  if ($n_multi_set > 1) {
190
  ?>
191
 
192
- <button href="#" class="button-delete" id="yasr-manage-multi-set"> <?php _e("Manage existing multi-set", 'yasr'); ?> </button>
193
-
194
  <div class="yasr-manage-multiset">
195
 
 
 
196
  <?php _e('Wich set do you want to edit or remove?', 'yasr')?>
197
 
198
  <select id ="yasr_select_edit_set">
@@ -218,10 +218,10 @@ function yasr_edit_multi_form() {
218
 
219
  ?>
220
 
221
- <button href="#" class="button-delete" id="yasr-manage-multi-set-single"> <?php _e("Manage existing multi-set", 'yasr'); ?> </button>
222
-
223
  <div class="yasr-manage-multiset-single">
224
 
 
 
225
  <form action=" <?php echo admin_url('options-general.php?page=yasr_settings_page') ?>" id="form_edit_multi_set" method="post">
226
 
227
  <input type="hidden" name="yasr_edit_multi_set_form" value="<?php echo $set_type ?>" />
145
  function yasr_display_multi_set_form() {
146
  ?>
147
 
148
+ <h4 class="yasr-multi-set-form-headers">Add New Multiple Set</h4>
149
  <em><?php _e('Field Name, Element#1 and Element#2 MUST be filled and must be long at least 3 characters', 'yasr') ?></em>
150
  <p>
151
  <form action="<?php echo admin_url('options-general.php?page=yasr_settings_page') ?>" id="form_add_multi_set" method="post">
189
  if ($n_multi_set > 1) {
190
  ?>
191
 
 
 
192
  <div class="yasr-manage-multiset">
193
 
194
+ <h4 class="yasr-multi-set-form-headers">Manage Multiple Set</h4>
195
+
196
  <?php _e('Wich set do you want to edit or remove?', 'yasr')?>
197
 
198
  <select id ="yasr_select_edit_set">
218
 
219
  ?>
220
 
 
 
221
  <div class="yasr-manage-multiset-single">
222
 
223
+ <h4 class="yasr-multi-set-form-headers">Manage Multiple Set</h4>
224
+
225
  <form action=" <?php echo admin_url('options-general.php?page=yasr_settings_page') ?>" id="form_edit_multi_set" method="post">
226
 
227
  <input type="hidden" name="yasr_edit_multi_set_form" value="<?php echo $set_type ?>" />
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.2.7
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -12,7 +12,7 @@ Yet Another Stars Rating is a simple plugin which allows you and / or your visit
12
  == Description ==
13
  Yet Another Stars Rating (YASR) is a new system review based on jquery plugin RateIT.
14
  With YASR you can make your own review or let your visitors vote, and you can even create multiple sets (a set of stars for each aspect to
15
- rate). Review scores will be indexed by search engines through snippets .
16
  Most important, if you are a gd star rating user, with YASR you can import all the data from gd star rating (which isn't maintained anymore).
17
 
18
  = How To use =
@@ -49,6 +49,9 @@ If with gd-star-rating you're using a different number of stars from the default
49
 
50
  == Changelog ==
51
 
 
 
 
52
  = 0.2.7 =
53
  * Many bug fixes on the settings page
54
  * Minor change and code cleanup
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.2.9
7
  License: GPL2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
12
  == Description ==
13
  Yet Another Stars Rating (YASR) is a new system review based on jquery plugin RateIT.
14
  With YASR you can make your own review or let your visitors vote, and you can even create multiple sets (a set of stars for each aspect to
15
+ rate). Review scores or visitor ratings will be indexed by search engines through snippets .
16
  Most important, if you are a gd star rating user, with YASR you can import all the data from gd star rating (which isn't maintained anymore).
17
 
18
  = How To use =
49
 
50
  == Changelog ==
51
 
52
+ = 0.2.9 =
53
+ * Settings page has been rewritten: now it use multi tab navigation
54
+
55
  = 0.2.7 =
56
  * Many bug fixes on the settings page
57
  * Minor change and code cleanup
yasr-settings-page.php CHANGED
@@ -5,135 +5,270 @@ 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
- $multi_set=yasr_get_multi_set();
10
 
11
- global $wpdb;
12
 
13
- $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
14
 
15
- ?>
16
 
 
17
 
18
- <div class="yasr-donatedivdx" style="display:none">
19
- <h3><?php _e('Donations'); ?></h3>
20
 
21
- <?php _e('If you have found this plugin useful, please consider making a donation to help support future development. Your support will be much appreciated. '); ?>
22
- <br />
23
- <?php _e('Thank you!'); ?>
24
- <br />
25
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
26
- <input type="hidden" name="cmd" value="_s-xclick">
27
- <input type="hidden" name="hosted_button_id" value="F3XJX2BSG3H4J">
28
- <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
29
- <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
30
- </form>
31
- </div>
 
 
 
 
32
 
33
- <div class="yasr-space-settings-div">
34
- </div>
35
 
36
- <div class="yasr-settingsdiv">
37
 
38
- <h3> <?php _e("Manage multi set"); ?></h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
- <div class="yasr-multi-set-left">
41
 
42
- <button href="#" class="button-delete" id="yasr-add-new-multi-set"> <?php _e("Add new multi-set", 'yasr'); ?> </button>
43
 
44
- <div class="yasr-new-multi-set" >
45
 
46
- <?php yasr_display_multi_set_form(); ?>
47
 
48
- </div> <!--yasr-new-multi-set-->
49
 
 
 
 
 
 
 
 
 
 
50
 
51
- </div> <!--End yasr-multi-set-left-->
 
52
 
53
- <div class="yasr-multi-set-right">
 
 
 
 
 
 
 
 
 
 
54
 
55
- <?php yasr_edit_multi_form(); ?>
 
56
 
57
- <div id="yasr-multi-set-response" style="display:none">
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  </div>
60
 
61
- </div> <!--End yasr-multi-set-right-->
 
62
 
 
63
 
64
- </div>
65
 
66
- <div class="yasr-space-settings-div">
67
- </div>
68
 
69
- <?php
 
 
 
 
 
70
 
71
- $gd_star_rating_found = yasr_search_gd_star_rating();
 
 
 
 
 
72
 
73
- $gd_star_imported = get_option('yasr-gdstar-imported');
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
- //If gdstar rating has been found but data haven't been imported yet
76
- if ($gd_star_rating_found && !$gd_star_imported) {
77
- ?>
78
- <div class="yasr-settingsdiv">
79
- <h3><?php _e("Import Gd Star Rating", "yasr"); ?></h3>
80
- <?php _e("I've found a previous installation of Gd Star Rating . <br />Do you want proceed to import data?", 'yasr'); ?>
81
- <br />
82
- <button href="#" class="button-delete" id="import-gdstar"><?php _e('Yes, Begin Import', 'yasr'); ?></button>
83
-
84
- <div id="yasr-import-gdstar-div" style="display:none;">
85
- <strong>
86
- <?php _e("Click on Proceed to Import Gd Star Rating Data."); ?>
87
- </strong>
88
- <br />
89
- <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
90
-
91
- <span id="loader" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
92
- </span>
93
- <br />
94
-
95
- <div id="result-import">
96
- </div>
97
- </div>
98
- </div>
99
  <?php
 
100
 
101
- } //End If $gd_star_rating_found && !$gd_star_imported
102
 
103
- else if ($gd_star_rating_found && $gd_star_imported==1) {
104
  ?>
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  <div class="yasr-settingsdiv">
107
- <h3><?php _e("Manage GD Star Data", "yasr"); ?></h3>
108
- <?php _e("Gd Star Rating has been already imported."); ?> <br />
109
- <?php _e("If you wish you can import it again, but", 'yasr'); ?><strong> <?php _e("you will lose all data you've collect since the import!", "yasr"); ?> </strong>
110
- <br />
111
- <button href="#" class="button-delete" id="import-gdstar"><?php _e('Ok, Import Again'); ?></button>
112
-
113
- <div id="yasr-import-gdstar-div" style="display:none;">
114
- <strong>
115
- <?php _e("Click on Proceed to Import again Gd Star Rating Data. This may take a while!"); ?>
116
- </strong>
117
- <br />
118
- <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
119
-
120
- <span id="loader" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
121
- </span>
122
-
123
- <br />
124
-
125
- <div id="result-import">
126
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
 
128
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  </div>
130
 
131
  <?php
132
- } //$gd_star_rating_found && $gd_star_imported==1
133
- ?>
134
 
135
- <div class="yasr-space-settings-div">
136
- </div>
 
 
 
137
 
138
  <div class="yasr-donatedivbottom" style="display:none">
139
  <h3><?php _e('Donations'); ?></h3>
@@ -154,6 +289,8 @@ if ( !current_user_can( 'manage_options' ) ) {
154
  <!--End div wrap-->
155
  </div>
156
 
 
 
157
  <script type="text/javascript">
158
 
159
  //First Div code
@@ -166,99 +303,109 @@ if ( !current_user_can( 'manage_options' ) ) {
166
  });
167
 
168
 
169
- //Second div code
170
- jQuery('#yasr-add-new-multi-set').on('click', function() {
171
- jQuery('.yasr-new-multi-set').toggle();
172
- });
173
 
174
- jQuery('#yasr-manage-multi-set').on('click', function() {
175
- jQuery('.yasr-manage-multiset').toggle();
176
- });
177
 
178
- <?php if ($n_multi_set == 1) { ?>
 
 
 
179
 
 
 
 
180
 
181
- jQuery('#yasr-manage-multi-set-single').on('click', function() {
182
 
183
- jQuery('.yasr-manage-multiset-single').toggle();
184
 
185
- var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
186
 
187
- counter++;
188
 
189
- jQuery("#yasr-add-field-edit-multiset").on('click', function() {
190
 
191
- if(counter>9){
192
- jQuery('#yasr-element-limit').show();
193
- jQuery('#yasr-add-field-edit-multiset').hide();
194
- return false;
195
- }
196
-
197
- var newTextBoxDiv = jQuery(document.createElement('tr'))
198
-
199
- newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
200
-
201
- newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
202
-
203
- counter++;
204
 
205
- });
206
 
207
- });
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
- <?php
210
 
211
- } //End if ($n_multi_set == 1)
212
 
213
- if ($n_multi_set > 1) {
214
 
215
- ?>
216
 
 
217
 
218
- //If more then 1 set is used...
219
- jQuery('#yasr_select_edit_set').on("change", function() {
220
-
221
- var data = {
222
- action : 'yasr_get_multi_set',
223
- set_id : jQuery(this).val()
224
- }
225
-
226
- jQuery.post(ajaxurl, data, function(response) {
227
- jQuery('#yasr-multi-set-response').show();
228
- jQuery('#yasr-multi-set-response').toggle;
229
- jQuery('#yasr-multi-set-response').html(response);
230
- });
231
 
232
- });
233
 
234
-
235
- jQuery(document).ajaxComplete(function(){
236
-
237
- var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
238
-
239
- counter++;
240
-
241
- jQuery("#yasr-add-field-edit-multiset").on('click', function() {
242
-
243
- if(counter>9){
244
- jQuery('#yasr-element-limit').show();
245
- jQuery('#yasr-add-field-edit-multiset').hide();
246
- return false;
247
- }
248
-
249
- var newTextBoxDiv = jQuery(document.createElement('tr'))
250
-
251
- newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
252
-
253
- newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
254
-
255
- counter++;
256
-
257
- });
258
-
259
- });
260
-
261
- <?php } //End if ($n_multi_set > 1) ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
 
264
  //Terzo div code
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>
13
 
14
+ <?php
15
 
16
+ $error_new_multi_set=yasr_process_new_multi_set_form(); //defined in yasr-settings-functions
17
 
18
+ $error_edit_multi_set=yasr_process_edit_multi_set_form(); //defined in yasr-settings-functions
19
 
20
+ if ($error_new_multi_set) {
21
+ echo "<div class=\"error\"> <p> <strong>";
22
 
23
+ foreach ($error_new_multi_set as $error) {
24
+ _e($error, 'yasr');
25
+ echo "<br />";
26
+ }
27
+
28
+ echo "</strong></p></div>";
29
+ }
30
+
31
+ if ($error_edit_multi_set) {
32
+ echo "<div class=\"error\"> <p> <strong>";
33
+
34
+ foreach ($error_edit_multi_set as $error) {
35
+ _e($error, 'yasr');
36
+ echo "<br />";
37
+ }
38
 
39
+ echo "</strong></p></div>";
40
+ }
41
 
 
42
 
43
+ if( isset( $_GET[ 'tab' ] ) ) {
44
+
45
+ $active_tab = $_GET[ 'tab' ];
46
+
47
+ }
48
+
49
+ else {
50
+
51
+ $active_tab = 'general_settings';
52
+
53
+ }
54
+
55
+
56
+ ?>
57
+
58
+ <h2 class="nav-tab-wrapper">
59
+ <a href="?page=yasr_settings_page&tab=general_settings" class="nav-tab <?php if ($active_tab == 'general_settings') echo 'nav-tab-active'; ?>" > General Settings </a>
60
+ <a href="?page=yasr_settings_page&tab=manage_multi" class="nav-tab <?php if ($active_tab == 'manage_multi') echo 'nav-tab-active'; ?>" > Multi Sets </a>
61
+ </h2>
62
 
 
63
 
 
64
 
65
+ <?php
66
 
67
+ if ($active_tab=='general_settings') {
68
 
69
+ ?>
70
 
71
+ <div class="yasr-settingsdiv">
72
+ <form action="options.php" method="post" id="yasr_settings_form">
73
+ <?php
74
+ settings_fields( 'yasr_auto_insert_options_group' );
75
+ do_settings_sections('yasr_settings_page' );
76
+ submit_button( __('Save') );
77
+ ?>
78
+ </form>
79
+ </div>
80
 
81
+ <div class="yasr-donatedivdx" style="display:none">
82
+ <h3><?php _e('Donations'); ?></h3>
83
 
84
+ <?php _e('If you have found this plugin useful, please consider making a donation to help support future development. Your support will be much appreciated. '); ?>
85
+ <br />
86
+ <?php _e('Thank you!'); ?>
87
+ <br />
88
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
89
+ <input type="hidden" name="cmd" value="_s-xclick">
90
+ <input type="hidden" name="hosted_button_id" value="F3XJX2BSG3H4J">
91
+ <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
92
+ <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
93
+ </form>
94
+ </div>
95
 
96
+ <div class="yasr-space-settings-div">
97
+ </div>
98
 
99
+ <?php
100
 
101
+ $gd_star_rating_found = yasr_search_gd_star_rating();
102
+
103
+ $gd_star_imported = get_option('yasr-gdstar-imported');
104
+
105
+ //If gdstar rating has been found but data haven't been imported yet
106
+ if ($gd_star_rating_found && !$gd_star_imported) {
107
+ ?>
108
+ <div class="yasr-settingsdiv">
109
+ <h3><?php _e("Import Gd Star Rating", "yasr"); ?></h3>
110
+ <?php _e("I've found a previous installation of Gd Star Rating . <br />Do you want proceed to import data?", 'yasr'); ?>
111
+ <br />
112
+ <button href="#" class="button-delete" id="import-gdstar"><?php _e('Yes, Begin Import', 'yasr'); ?></button>
113
+
114
+ <div id="yasr-import-gdstar-div" style="display:none;">
115
+ <strong>
116
+ <?php _e("Click on Proceed to Import Gd Star Rating Data."); ?>
117
+ </strong>
118
+ <br />
119
+ <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
120
+
121
+ <span id="loader" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
122
+ </span>
123
+ <br />
124
+
125
+ <div id="result-import">
126
+ </div>
127
+ </div>
128
  </div>
129
 
130
+ <div class="yasr-space-settings-div">
131
+ </div>
132
 
133
+ <?php
134
 
135
+ } //End If $gd_star_rating_found && !$gd_star_imported
136
 
137
+ else if ($gd_star_rating_found && $gd_star_imported==1) {
138
+ ?>
139
 
140
+ <div class="yasr-settingsdiv">
141
+ <h3><?php _e("Manage GD Star Data", "yasr"); ?></h3>
142
+ <?php _e("Gd Star Rating has been already imported."); ?> <br />
143
+ <?php _e("If you wish you can import it again, but", 'yasr'); ?><strong> <?php _e("you will lose all data you've collect since the import!", "yasr"); ?> </strong>
144
+ <br />
145
+ <button href="#" class="button-delete" id="import-gdstar"><?php _e('Ok, Import Again'); ?></button>
146
 
147
+ <div id="yasr-import-gdstar-div" style="display:none;">
148
+ <strong>
149
+ <?php _e("Click on Proceed to Import again Gd Star Rating Data. This may take a while!"); ?>
150
+ </strong>
151
+ <br />
152
+ <button href="#" class="button-primary" id="import-button"> <?php _e('Proceed', 'yasr'); ?></button>
153
 
154
+ <span id="loader" style="display:none;" >&nbsp;<img src="<?php echo YASR_IMG_DIR . "/loader.gif" ?>">
155
+ </span>
156
+
157
+ <br />
158
+
159
+ <div id="result-import">
160
+ </div>
161
+
162
+ </div>
163
+ </div>
164
+
165
+ <div class="yasr-space-settings-div">
166
+ </div>
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  <?php
169
+ } //$gd_star_rating_found && $gd_star_imported==1$gd_star_rating_found = yasr_search_gd_star_rating();
170
 
171
+ } //End if tab 'general_settings'
172
 
 
173
  ?>
174
 
175
+
176
+ <?php
177
+
178
+ if ($active_tab=='manage_multi') {
179
+
180
+ $multi_set=yasr_get_multi_set();
181
+
182
+ global $wpdb;
183
+
184
+ $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
185
+
186
+
187
+ ?>
188
+
189
  <div class="yasr-settingsdiv">
190
+
191
+ <h3> <?php _e("Manage multi-set"); ?></h3>
192
+
193
+ <p>
194
+
195
+ <a href="#" id="yasr-multi-set-doc-link"><?php _e("What is a Multi-set?") ?></a>
196
+
197
+ </p>
198
+
199
+ <div id="yasr-multi-set-doc-box" style="display:none">
200
+ <?php _e("Multi-set allows you to insert a rate for each aspect about the product / local business / whetever
201
+ you're reviewing, example in the image below.", "yasr");
202
+
203
+ echo "<br /><br /><img src=" . YASR_IMG_DIR . "/yasr-multi-set.png> <br /> <br />";
204
+
205
+ _e("You can create up to 99 different multi-sets and each one can contain up to 9 different fields.
206
+ Once you've saved it, you can insert the rates while typing your article in the box below the editor,
207
+ as you can see in this image (click to see it larger)", "yasr");
208
+
209
+ echo "<br /><br /><a href=\"" . YASR_IMG_DIR ."yasr-multi-set-insert-rate.jpg\"><img src=" . YASR_IMG_DIR . "/yasr-multi-set-insert-rate-small.jpg></a> <br /> <br />";
210
+
211
+ _e("In order to insert your text into a post or page, you can either past
212
+ the short code that will appear at the bottom of the box or just click
213
+ on the star in the graphic editor and select \"Insert Multi-Set\".", "yasr");
214
+
215
+ ?>
216
+
217
+ <br /> <br />
218
+
219
+ <a href="#" id="yasr-multi-set-doc-link-hide"><?php _e("Close this message") ?></a>
220
+
221
+ </div>
222
+
223
+ <div class="yasr-multi-set-left">
224
+
225
+ <div class="yasr-new-multi-set" >
226
+
227
+ <?php yasr_display_multi_set_form(); ?>
228
+
229
+ </div> <!--yasr-new-multi-set-->
230
+
231
+
232
+ </div> <!--End yasr-multi-set-left-->
233
+
234
+ <div class="yasr-multi-set-right">
235
+
236
+ <?php yasr_edit_multi_form(); ?>
237
+
238
+ <div id="yasr-multi-set-response" style="display:none">
239
+
240
+ </div>
241
+
242
+ </div> <!--End yasr-multi-set-right-->
243
+
244
 
245
+ </div>
246
+
247
+ <div class="yasr-donatedivdx" style="display:none">
248
+ <h3><?php _e('Donations'); ?></h3>
249
+
250
+ <?php _e('If you have found this plugin useful, please consider making a donation to help support future development. Your support will be much appreciated. '); ?>
251
+ <br />
252
+ <?php _e('Thank you!'); ?>
253
+ <br />
254
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
255
+ <input type="hidden" name="cmd" value="_s-xclick">
256
+ <input type="hidden" name="hosted_button_id" value="F3XJX2BSG3H4J">
257
+ <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
258
+ <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
259
+ </form>
260
+ </div>
261
+
262
+ <div class="yasr-space-settings-div">
263
  </div>
264
 
265
  <?php
 
 
266
 
267
+ } //End if ($active_tab=='manage_multi')
268
+
269
+
270
+
271
+ ?>
272
 
273
  <div class="yasr-donatedivbottom" style="display:none">
274
  <h3><?php _e('Donations'); ?></h3>
289
  <!--End div wrap-->
290
  </div>
291
 
292
+
293
+
294
  <script type="text/javascript">
295
 
296
  //First Div code
303
  });
304
 
305
 
306
+ <?php
 
 
 
307
 
308
+ if ($active_tab=='manage_multi') {
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
+ });
315
 
316
+ jQuery('#yasr-multi-set-doc-link-hide').on('click', function() {
317
+ jQuery('#yasr-multi-set-doc-box').toggle("slow");
318
+ });
319
 
320
+ <?php if ($n_multi_set == 1) { ?>
321
 
 
322
 
323
+ jQuery('#yasr-manage-multi-set-single').on('click', function() {
324
 
325
+ jQuery('.yasr-manage-multiset-single').toggle();
326
 
327
+ var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
328
 
329
+ counter++;
 
 
 
 
 
 
 
 
 
 
 
 
330
 
331
+ jQuery("#yasr-add-field-edit-multiset").on('click', function() {
332
 
333
+ if(counter>9){
334
+ jQuery('#yasr-element-limit').show();
335
+ jQuery('#yasr-add-field-edit-multiset').hide();
336
+ return false;
337
+ }
338
+
339
+ var newTextBoxDiv = jQuery(document.createElement('tr'))
340
+
341
+ newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
342
+
343
+ newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
344
+
345
+ counter++;
346
 
347
+ });
348
 
349
+ });
350
 
351
+ <?php
352
 
353
+ } //End if ($n_multi_set == 1)
354
 
355
+ if ($n_multi_set > 1) {
356
 
357
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
358
 
 
359
 
360
+ //If more then 1 set is used...
361
+ jQuery('#yasr_select_edit_set').on("change", function() {
362
+
363
+ var data = {
364
+ action : 'yasr_get_multi_set',
365
+ set_id : jQuery(this).val()
366
+ }
367
+
368
+ jQuery.post(ajaxurl, data, function(response) {
369
+ jQuery('#yasr-multi-set-response').show();
370
+ jQuery('#yasr-multi-set-response').toggle;
371
+ jQuery('#yasr-multi-set-response').html(response);
372
+ });
373
+
374
+ });
375
+
376
+
377
+ jQuery(document).ajaxComplete(function(){
378
+
379
+ var counter = jQuery("#yasr-edit-form-number-elements").attr('value');
380
+
381
+ counter++;
382
+
383
+ jQuery("#yasr-add-field-edit-multiset").on('click', function() {
384
+
385
+ if(counter>9){
386
+ jQuery('#yasr-element-limit').show();
387
+ jQuery('#yasr-add-field-edit-multiset').hide();
388
+ return false;
389
+ }
390
+
391
+ var newTextBoxDiv = jQuery(document.createElement('tr'))
392
+
393
+ newTextBoxDiv.html('<td colspan="2">Element #' + counter + ' <input type="text" name="edit-multi-set-element-' + counter + '" value="" ></td>');
394
+
395
+ newTextBoxDiv.appendTo("#yasr-table-form-edit-multi-set");
396
+
397
+ counter++;
398
+
399
+ });
400
+
401
+ });
402
+
403
+ <?php
404
+ } //End if ($n_multi_set > 1)
405
+
406
+ } //end if $active_tab=='manage_multi'
407
+
408
+ ?>
409
 
410
 
411
  //Terzo div code
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.2.7
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.2.7');
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.2.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.2.9');
32
 
33
  //Plugin absolute path
34
  define( "YASR_ABSOLUTE_PATH", dirname(__FILE__) );