Yasr – Yet Another Stars Rating - Version 2.3.4

Version Description

  • IMPROVED: added Software Application itemType
  • IMPROVED: added Organization itemType
  • IMPORVED: added reviewBody and description properties
  • FIXED: "Your ratings" widget in admin dashboard
Download this release

Release Info

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

Code changes from version 2.3.3 to 2.3.4

admin/css/yasr-admin.css CHANGED
@@ -103,12 +103,16 @@
103
margin-top: 10px;
104
}
105
106
- .yasr-itemtype-row-container-label-input label {
107
display: inline-block;
108
width: 130px;
109
font-weight: bold;
110
}
111
112
.yasr-itemtype-row-container-description {
113
color: #928b8b;
114
margin-top: 5px;
103
margin-top: 10px;
104
}
105
106
+ .yasr-itemtype-row-container-label-input > label {
107
display: inline-block;
108
width: 130px;
109
font-weight: bold;
110
}
111
112
+ .yasr-itemtype-row-container-label-input > textarea {
113
+ height: 7em;
114
+ }
115
+
116
.yasr-itemtype-row-container-description {
117
color: #928b8b;
118
margin-top: 5px;
admin/editor/YasrMetaboxSchemaFields.php ADDED
@@ -0,0 +1,357 @@
1
+ <?php
2
+
3
+ /*
4
+
5
+ Copyright 2014 Dario Curvino (email : d.curvino@tiscali.it)
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 2 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ 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
+ if (!defined('ABSPATH')) {
22
+ exit('You\'re not allowed to see this page');
23
+ } // Exit if accessed directly
24
+
25
+ /**
26
+ * Print additional itemType fields above the editor
27
+ * @uses class YasrPhpFieldsHelper
28
+ *
29
+ * Class YasrMetaboxSchemaFields
30
+ */
31
+ class YasrMetaboxSchemaFields {
32
+
33
+ private $saved_data;
34
+ private $input;
35
+
36
+ public function __construct($saved_data) {
37
+ $this->saved_data = $saved_data;
38
+ $this->input = new YasrPhpFieldsHelper('yasr-itemtype-row-container-label-input');
39
+ }
40
+
41
+ /**
42
+ * Generate fields for Product ItemType
43
+ */
44
+ public function product() {
45
+ ?>
46
+ <!--product-->
47
+ <div id="yasr-metabox-info-snippet-container-product"
48
+ class="yasr-metabox-info-snippet-container-child" style="display: none">
49
+ <?php
50
+ $product_array = array(
51
+ 'brand' => array(
52
+ 'label' => 'Brand',
53
+ 'name' => 'yasr_product_brand',
54
+ 'description' => __('The brand of the product.', 'yet-another-stars-rating')
55
+ ),
56
+ 'sku' => array(
57
+ 'label' => 'Sku',
58
+ 'name' => 'yasr_product_sku',
59
+ 'description' => __('Merchant-specific identifier for product.' , 'yet-another-stars-rating')
60
+ ),
61
+ 'global_identifier_select' => array(
62
+ 'type' => 'select',
63
+ 'options' => array('gtin8', 'gtin13', 'gtin14', 'mpn', 'isbn'),
64
+ 'label' => 'Global Identifier',
65
+ 'name' => 'yasr_product_global_identifier_select'
66
+ ),
67
+ 'global_identifier_value' => array(
68
+ 'label' => 'Value',
69
+ 'name' => 'yasr_product_global_identifier_value',
70
+ 'description' => sprintf(
71
+ __('Select global identifier. More info %s here %s', 'yet-another-stars-rating'),
72
+ '<a href="https://schema.org/Product" target="_blank">','</a>'
73
+ )
74
+ )
75
+ );
76
+
77
+ $this->echoFields($product_array);
78
+
79
+ $this->offer(
80
+ 'yasr_product_price',
81
+ 'yasr_product_price_currency',
82
+ 'yasr_product_price_valid_until',
83
+ 'yasr_product_price_availability',
84
+ 'yasr_product_price_url'
85
+ );
86
+ ?>
87
+ </div>
88
+ <!--End product-->
89
+ <?php
90
+ }
91
+
92
+ /**
93
+ * Generate fields for recipe localBuisness
94
+ */
95
+ public function localBuinsess() {
96
+ ?>
97
+ <div id="yasr-metabox-info-snippet-container-localbusiness"
98
+ class="yasr-metabox-info-snippet-container-child" style="display: none">
99
+
100
+ <?php
101
+ $localbuisness_array = array(
102
+ 'application' => array(
103
+ 'label' => 'Address',
104
+ 'name' => 'yasr_localbusiness_address',
105
+ 'description' => __('The physical location of the business. ', 'yet-another-stars-rating')
106
+ ),
107
+ 'pricerange' => array(
108
+ 'label' => 'PriceRange',
109
+ 'name' => 'yasr_localbusiness_pricerange',
110
+ 'description' => __('The relative price range of a business, commonly specified by either a numerical range
111
+ (for example, "$10-15") or a normalized number of currency signs (for example, "$quot;)' ,
112
+ 'yet-another-stars-rating')
113
+ ),
114
+ 'telephone' => array(
115
+ 'label' => 'Telephone',
116
+ 'name' => 'yasr_localbusiness_telephone',
117
+ 'description' => __('A business phone number meant to be the primary contact method for customers.' , 'yet-another-stars-rating')
118
+ )
119
+ );
120
+
121
+ $this->echoFields($localbuisness_array);
122
+ ?>
123
+ </div>
124
+ <?php
125
+ }
126
+
127
+ /**
128
+ * Generate fields for recipe itemType
129
+ */
130
+ public function recipe() {
131
+ $recipe_array = array(
132
+ array(
133
+ 'label' => 'cookTime',
134
+ 'name' => 'yasr_recipe_cooktime',
135
+ 'description' => __('The time it takes to actually cook the dish in ISO 8601 format.', 'yet-another-stars-rating')
136
+ ),
137
+ array(
138
+ 'label' => 'prepTime',
139
+ 'name' => 'yasr_recipe_preptime',
140
+ 'description' => __('The length of time it takes to prepare the dish, in ISO 8601 format.', 'yet-another-stars-rating')
141
+ ),
142
+ array(
143
+ 'label' => 'description',
144
+ 'name' => 'yasr_recipe_description',
145
+ 'description' => __('A short summary describing the dish.', 'yet-another-stars-rating')
146
+ ),
147
+ array(
148
+ 'label' => 'keywords',
149
+ 'name' => 'yasr_recipe_keywords',
150
+ 'description' => __('Other terms for your recipe', 'yet-another-stars-rating')
151
+ ),
152
+ array(
153
+ 'label' => 'nutrition',
154
+ 'name' => 'yasr_recipe_nutrition',
155
+ 'description' => __('The number of calories', 'yet-another-stars-rating')
156
+ ),
157
+ array(
158
+ 'label' => 'recipeCategory',
159
+ 'name' => 'yasr_recipe_recipecategory',
160
+ 'description' => __('The type of meal or course your recipe is about', 'yet-another-stars-rating')
161
+ ),
162
+ array(
163
+ 'label' => 'recipeCuisine',
164
+ 'name' => 'yasr_recipe_recipecuisine',
165
+ 'description' => __('The region associated with your recipe. For example, "Mediterranean", or "American".',
166
+ 'yet-another-stars-rating')
167
+ ),
168
+ array(
169
+ 'type' => 'textarea',
170
+ 'label' => 'recipeIngredient',
171
+ 'name' => 'yasr_recipe_recipeingredient',
172
+ 'description' => sprintf(
173
+ __('A single ingredient used in the recipe, e.g. sugar, flour or garlic. %s
174
+ Use return %s to separate the ingredients.', 'yet-another-stars-rating'),
175
+ '<br />', '<strong>(&#8629;)</strong>')
176
+ ),
177
+ array(
178
+ 'type' => 'textarea',
179
+ 'label' => 'recipeInstructions',
180
+ 'name' => 'yasr_recipe_recipeinstructions',
181
+ 'description' => sprintf(
182
+ __('The steps to make dish. %s Use return %s to separate the steps.', 'yet-another-stars-rating'),
183
+ '<br />', '<strong>(&#8629;)</strong>')
184
+ ),
185
+ array(
186
+ 'label' => 'Video',
187
+ 'name' => 'yasr_recipe_video',
188
+ 'description' => __('A video depicting the steps to make the dish (URL)', 'yet-another-stars-rating')
189
+ )
190
+ ); //End recipe array
191
+ ?>
192
+
193
+ <!-- Recipe -->
194
+ <div id="yasr-metabox-info-snippet-container-recipe"
195
+ class="yasr-metabox-info-snippet-container-child" style="display: none">
196
+
197
+ <?php $this->echoFields($recipe_array); ?>
198
+
199
+ <div class="yasr-itemtype-row-container-description">
200
+ <?php
201
+ echo sprintf(
202
+ __('More info %s here %s and %s here %s', 'yet-another-stars-rating'),
203
+ '<a href="https://developers.google.com/search/docs/data-types/recipe" target="_blank">','</a>',
204
+ '<a href="https://schema.org/Recipe" target="_blank">','</a>'
205
+ );
206
+ ?>
207
+ </div>
208
+ </div>
209
+ <!-- End Recipe -->
210
+ <?php
211
+ }
212
+
213
+ /**
214
+ * Generate fields for softwareApplication itemType
215
+ */
216
+ public function softwareApplication() {
217
+ ?>
218
+ <div id="yasr-metabox-info-snippet-container-software"
219
+ class="yasr-metabox-info-snippet-container-child" style="display: none">
220
+ <?php
221
+ $software_array = array(
222
+ 'application' => array(
223
+ 'label' => 'Application Category',
224
+ 'name' => 'yasr_software_application',
225
+ 'description' => __('Type of software application, e.g. \'Game, Multimedia\'. ', 'yet-another-stars-rating')
226
+ ),
227
+ 'os' => array(
228
+ 'label' => 'Operating System',
229
+ 'name' => 'yasr_software_os',
230
+ 'description' => __('Operating systems supported e.g. (Windows 7, OSX 10.6, Android 1.6)' , 'yet-another-stars-rating')
231
+ )
232
+ );
233
+
234
+ $this->echoFields($software_array);
235
+
236
+ $this->offer('yasr_software_price',
237
+ 'yasr_software_price_currency',
238
+ 'yasr_software_price_valid_until',
239
+ 'yasr_software_price_availability',
240
+ 'yasr_software_price_url');
241
+
242
+ ?>
243
+
244
+ </div>
245
+ <?php
246
+ }
247
+
248
+ /**
249
+ * Print the additional fields
250
+ *
251
+ * @param $itemType_array
252
+ */
253
+ private function echoFields($itemType_array) {
254
+ $string_input = false;
255
+
256
+ foreach ($itemType_array as $property) {
257
+ if (isset($property['type'])) {
258
+ if ($property['type'] === 'select') {
259
+ $string_input = $this->input->select(
260
+ '', $property['label'], $property['options'], $property['name'], '', esc_attr($this->saved_data[$property['name']])
261
+ );
262
+ }
263
+ elseif ($property['type'] === 'textarea') {
264
+ $string_input = $this->input->textArea('', $property['label'], $property['name'], '', '',
265
+ $this->saved_data[$property['name']] );
266
+ }
267
+ }
268
+ else {
269
+ $string_input = $this->input->text(
270
+ '', $property['label'], $property['name'], '', $property['label'], esc_attr($this->saved_data[$property['name']])
271
+ );
272
+ }
273
+
274
+ echo $string_input;
275
+
276
+ if(isset( $property['description'] ) && $property['description'] !== '') {
277
+ echo '<div class="yasr-itemtype-row-container-description">'
278
+ . $property['description'] .
279
+ '</div>';
280
+ }
281
+
282
+ }
283
+ }
284
+
285
+
286
+ /**
287
+ * Generate offers fields.
288
+ * get params for "name" html value
289
+ *
290
+ * @param $price_name
291
+ * @param $currency_name
292
+ * @param $valid_until_name
293
+ * @param $availability_name
294
+ * @param $url_name
295
+ */
296
+ private function offer($price_name, $currency_name, $valid_until_name, $availability_name, $url_name) {
297
+ $saved_data = $this->saved_data;
298
+ ?>
299
+ <div style="border: 1px dotted #cacaca; width: max-content; margin: 10px; padding: 5px;">
300
+ <?php
301
+ $offer_array = array(
302
+ 'price' => array(
303
+ 'label' => 'Price',
304
+ 'name' => $price_name,
305
+ ),
306
+ 'currency' => array(
307
+ 'label' => 'Currency',
308
+ 'name' => $currency_name,
309
+ ),
310
+ 'valid_until' => array(
311
+ 'label' => 'Price Valid Until',
312
+ 'name' => $valid_until_name
313
+ ),
314
+ 'availability' => array(
315
+ 'label' => 'Availability',
316
+ 'name' => $availability_name
317
+ ),
318
+ 'url' => array(
319
+ 'label' => 'Url',
320
+ 'name' => $url_name,
321
+ )
322
+ );
323
+
324
+ foreach ($offer_array as $property => $info) {
325
+ if ($property === 'availability') {
326
+ $array_global_availability = array (
327
+ 'Discontinued', 'InStock', 'InStoreOnly', 'LimitedAvailability',
328
+ 'OnlineOnly', 'OutOfStock', 'PreOrder'. 'PreSale', 'SoldOut'
329
+ );
330
+
331
+ $string_input = $this->input->select(
332
+ '', $info['label'], $array_global_availability, $info['name'], '', esc_attr($saved_data[$info['name']])
333
+ );
334
+ }
335
+ else {
336
+ $string_input = $this->input->text(
337
+ '', $info['label'], $info['name'], '', '', esc_attr($saved_data[$info['name']])
338
+ );
339
+ }
340
+ echo $string_input;
341
+ }
342
+ ?>
343
+
344
+ <div class="yasr-itemtype-row-container-description">
345
+ <?php
346
+ echo sprintf(
347
+ __('More info %s here %s', 'yet-another-stars-rating'),
348
+ '<a href="https://schema.org/Offer" target="_blank">','</a>'
349
+ );
350
+ ?>
351
+ </div>
352
+
353
+ </div>
354
+ <?php
355
+ }
356
+
357
+ }
admin/editor/YasrOnSavePost.php CHANGED
@@ -23,7 +23,6 @@ if (!defined('ABSPATH')) {
23
} // Exit if accessed directly
24
25
26
-
27
class YasrOnSavePost {
28
29
private $post_id;
@@ -116,10 +115,10 @@ class YasrOnSavePost {
116
//this mean there we're not in the classic editor
117
if(!isset($_POST['yasr_nonce_review_type'])) {
118
return;
119
- } else {
120
- $nonce = $_POST['yasr_nonce_review_type'];
121
}
122
123
//check nonce
124
if (!wp_verify_nonce($nonce, 'yasr_nonce_review_type_action')) {
125
return;
23
} // Exit if accessed directly
24
25
26
class YasrOnSavePost {
27
28
private $post_id;
115
//this mean there we're not in the classic editor
116
if(!isset($_POST['yasr_nonce_review_type'])) {
117
return;
118
}
119
120
+ $nonce = $_POST['yasr_nonce_review_type'];
121
+
122
//check nonce
123
if (!wp_verify_nonce($nonce, 'yasr_nonce_review_type_action')) {
124
return;
admin/editor/yasr-metabox-schema.php CHANGED
@@ -22,6 +22,8 @@ if (!defined('ABSPATH')) {
22
exit('You\'re not allowed to see this page');
23
} // Exit if accessed directly
24
25
global $post;
26
27
//is post review
@@ -51,9 +53,10 @@ foreach ($array_item_type_info as $item_type) {
51
if(!isset($saved_data[$item_type])) {
52
$saved_data[$item_type] = false;
53
}
54
-
55
}
56
57
?>
58
59
<div>
@@ -82,289 +85,19 @@ foreach ($array_item_type_info as $item_type) {
82
</div>
83
84
<div class="yasr-metabox-info-snippet-container" id="yasr-metabox-info-snippet-container" style="display: none;">
85
- <!--product-->
86
- <div id="yasr-metabox-info-snippet-container-product"
87
- class="yasr-metabox-info-snippet-container-child" style="display: none">
88
-
89
- <div class="yasr-itemtype-row-container-label-input">
90
- <label for="yasr-product-brand">Brand</label>
91
- <input type="text" name="yasr_product_brand" id="yasr-product-brand"
92
- value='<?php echo esc_attr($saved_data['yasr_product_brand']); ?>'
93
- >
94
- </div>
95
- <div class="yasr-itemtype-row-container-description">
96
- <?php _e('The brand of the product.', 'yet-another-stars-rating');?>
97
- </div>
98
-
99
- <div class="yasr-itemtype-row-container-label-input">
100
- <label for="yasr-product-sku">Sku</label>
101
- <input type="text" name="yasr_product_sku" id="yasr-product-sku"
102
- value='<?php echo esc_attr($saved_data['yasr_product_sku']); ?>'
103
- >
104
- </div>
105
- <div class="yasr-itemtype-row-container-description">
106
- <?php _e('Merchant-specific identifier for product.' , 'yet-another-stars-rating'); ?>
107
- </div>
108
-
109
- <div class="yasr-itemtype-row-container-label-input">
110
- <label for="yasr-product-global-identifier-select">Global identifiers</label>
111
- <select name="yasr_product_global_identifier_select" id="yasr-product-global-identifier-select">
112
- <?php
113
- $array_global_identifiers = array ('gtin8', 'gtin13', 'gtin14', 'mpn', 'isbn');
114
- foreach ($array_global_identifiers as $identifier) {
115
- if ($saved_data['yasr_product_global_identifier_select'] === $identifier) {
116
- echo "<option value=$identifier selected>$identifier</option>";
117
- } else {
118
- echo "<option value=$identifier>$identifier</option>";
119
- }
120
- }
121
- ?>
122
- </select>
123
- <label for="yasr-product-global-identifier-value" style="width: auto; margin-left: 10px;">Value</label>
124
- <input type="text" name="yasr_product_global_identifier_value" id="yasr-product-global-identifier-value"
125
- value='<?php echo esc_attr($saved_data['yasr_product_global_identifier_value']); ?>'
126
- >
127
- </div>
128
-
129
- <div class="yasr-itemtype-row-container-description">
130
- <?php
131
- echo sprintf(
132
- __('Select global identifier. More info %s here %s', 'yet-another-stars-rating'),
133
- '<a href="https://schema.org/Product" target="_blank">','</a>'
134
- );
135
- ?>
136
- </div>
137
-
138
- <div style="border: 1px dotted #cacaca; width: max-content; margin: 10px; padding: 5px;">
139
- <div class="yasr-itemtype-row-container-label-input">
140
- <label for="yasr-product-price">Price</label>
141
- <input type="text" name="yasr_product_price" id="yasr-product-price"
142
- value='<?php echo esc_attr($saved_data['yasr_product_price']); ?>'
143
- >
144
- </div>
145
- <div class="yasr-itemtype-row-container-label-input">
146
- <label for="yasr-product-price-currency">Currency</label>
147
- <input type="text" name="yasr_product_price_currency" id="yasr-product-price-currency"
148
- value='<?php echo esc_attr($saved_data['yasr_product_price_currency']); ?>'
149
- >
150
- </div>
151
- <div class="yasr-itemtype-row-container-label-input">
152
- <label for="yasr-product-price-valid-until">Price Valid Until</label>
153
- <input type="text" name="yasr_product_price_valid_until" id="yasr-product-price-valid-until"
154
- value='<?php echo esc_attr($saved_data['yasr_product_price_valid_until']); ?>'
155
- >
156
- </div>
157
- <div class="yasr-itemtype-row-container-label-input">
158
- <label for="yasr-product-price-availability">Availability</label>
159
- <select name="yasr_product_price_availability" id="yasr-product-price-availability">
160
- <?php
161
- $array_global_availability = array (
162
- 'Discontinued', 'InStock', 'InStoreOnly', 'LimitedAvailability',
163
- 'OnlineOnly', 'OutOfStock', 'PreOrder'. 'PreSale', 'SoldOut');
164
- foreach ($array_global_availability as $availability) {
165
- if ($saved_data['yasr_product_price_availability'] === $availability) {
166
- echo "<option value=$availability selected>$availability</option>";
167
- } else {
168
- echo "<option value=$availability>$availability</option>";
169
- }
170
- }
171
- ?>
172
- </select>
173
- </div>
174
- <div class="yasr-itemtype-row-container-label-input">
175
- <label for="yasr-product-price-url">Url</label>
176
- <input type="text" name="yasr_product_price_url" id="yasr-product-price-url"
177
- value='<?php echo esc_attr($saved_data['yasr_product_price_url']); ?>'
178
- >
179
- </div>
180
-
181
- <div class="yasr-itemtype-row-container-description">
182
- <?php
183
- echo sprintf(
184
- __('More info %s here %s', 'yet-another-stars-rating'),
185
- '<a href="https://schema.org/Offer" target="_blank">','</a>'
186
- );
187
- ?>
188
- </div>
189
-
190
- </div>
191
- </div>
192
- <!--End product-->
193
-
194
- <!-- LocalBuisness -->
195
- <div id="yasr-metabox-info-snippet-container-localbusiness"
196
- class="yasr-metabox-info-snippet-container-child" style="display: none">
197
-
198
- <div class="yasr-itemtype-row-container-label-input">
199
- <label for="yasr-localbusiness-address">Address</label>
200
- <input type="text" name="yasr_localbusiness_address" id="yasr-localbusiness-address"
201
- value='<?php echo esc_attr($saved_data['yasr_localbusiness_address']); ?>'
202
- >
203
- </div>
204
- <div class="yasr-itemtype-row-container-description">
205
- <?php _e('The physical location of the business.', 'yet-another-stars-rating');?>
206
- </div>
207
-
208
- <div class="yasr-itemtype-row-container-label-input">
209
- <label for="yasr-localbusiness-pricerange">PriceRange</label>
210
- <input type="text" name="yasr_localbusiness_pricerange" id="yasr-localbusiness-pricerange"
211
- value='<?php echo esc_attr($saved_data['yasr_localbusiness_pricerange']); ?>'
212
- >
213
- </div>
214
- <div class="yasr-itemtype-row-container-description">
215
- <?php _e('The relative price range of a business, commonly specified by either a numerical range
216
- (for example, "$10-15") or a normalized number of currency signs (for example, "$quot;)',
217
- 'yet-another-stars-rating');?>
218
- </div>
219
220
- <div class="yasr-itemtype-row-container-label-input">
221
- <label for="yasr-localbusiness-telephone">Telephone</label>
222
- <input type="text" name="yasr_localbusiness_telephone" id="yasr-localbusiness-telephone"
223
- value='<?php echo esc_attr($saved_data['yasr_localbusiness_telephone']); ?>'
224
- >
225
- </div>
226
- <div class="yasr-itemtype-row-container-description">
227
- <?php _e('A business phone number meant to be the primary contact method for customers.',
228
- 'yet-another-stars-rating');?>
229
- </div>
230
- </div>
231
- <!-- End LocalBuisness -->
232
-
233
- <!-- Recipe -->
234
- <div id="yasr-metabox-info-snippet-container-recipe"
235
- class="yasr-metabox-info-snippet-container-child" style="display: none">
236
-
237
- <div class="yasr-itemtype-row-container-label-input">
238
- <label for="yasr-recipe-cooktime">cookTime</label>
239
- <input type="text" name="yasr_recipe_cooktime" id="yasr-recipe-cooktime"
240
- value='<?php echo esc_attr($saved_data['yasr_recipe_cooktime']); ?>'
241
- >
242
- </div>
243
- <div class="yasr-itemtype-row-container-description">
244
- <?php _e('The time it takes to actually cook the dish in ISO 8601 format. ', 'yet-another-stars-rating');?>
245
- </div>
246
-
247
- <div class="yasr-itemtype-row-container-label-input">
248
- <label for="yasr-recipe-preptime">prepTime</label>
249
- <input type="text" name="yasr_recipe_preptime" id="yasr-recipe-preptime"
250
- value='<?php echo esc_attr($saved_data['yasr_recipe_preptime']); ?>'
251
- >
252
- </div>
253
- <div class="yasr-itemtype-row-container-description">
254
- <?php _e('The length of time it takes to prepare the dish, in ISO 8601 format.',
255
- 'yet-another-stars-rating');?>
256
- </div>
257
-
258
- <div class="yasr-itemtype-row-container-label-input">
259
- <label for="yasr-recipe-description">description</label>
260
- <input type="text" name="yasr_recipe_description" id="yasr-recipe-description"
261
- value='<?php echo esc_attr($saved_data['yasr_recipe_description']); ?>'
262
- >
263
- </div>
264
- <div class="yasr-itemtype-row-container-description">
265
- <?php _e('A short summary describing the dish.','yet-another-stars-rating');?>
266
- </div>
267
-
268
- <div class="yasr-itemtype-row-container-label-input">
269
- <label for="yasr-recipe-keywords">keywords</label>
270
- <input type="text" name="yasr_recipe_keywords" id="yasr-recipe-keywords"
271
- value='<?php echo esc_attr($saved_data['yasr_recipe_keywords']); ?>'
272
- >
273
- </div>
274
- <div class="yasr-itemtype-row-container-description">
275
- <?php _e('Other terms for your recipe',
276
- 'yet-another-stars-rating');?>
277
- </div>
278
-
279
- <div class="yasr-itemtype-row-container-label-input">
280
- <label for="yasr-recipe-nutrition">nutrition</label>
281
- <input type="text" name="yasr_recipe_nutrition" id="yasr-recipe-nutrition"
282
- value='<?php echo esc_attr($saved_data['yasr_recipe_nutrition']); ?>'
283
- >
284
- </div>
285
- <div class="yasr-itemtype-row-container-description">
286
- <?php _e('The number of calories',
287
- 'yet-another-stars-rating');?>
288
- </div>
289
290
- <div class="yasr-itemtype-row-container-label-input">
291
- <label for="yasr-recipe-category">recipeCategory</label>
292
- <input type="text" name="yasr_recipe_recipecategory" id="yasr-recipe-category"
293
- value='<?php echo esc_attr($saved_data['yasr_recipe_recipecategory']); ?>'
294
- >
295
- </div>
296
- <div class="yasr-itemtype-row-container-description">
297
- <?php _e('The type of meal or course your recipe is about',
298
- 'yet-another-stars-rating');?>
299
- </div>
300
301
- <div class="yasr-itemtype-row-container-label-input">
302
- <label for="yasr-recipe-cuisine">recipeCuisine</label>
303
- <input type="text" name="yasr_recipe_recipecuisine" id="yasr-recipe-cuisine"
304
- value='<?php echo esc_attr($saved_data['yasr_recipe_recipecuisine']); ?>'
305
- >
306
- </div>
307
- <div class="yasr-itemtype-row-container-description">
308
- <?php _e('The region associated with your recipe. For example, "Mediterranean", or "American".',
309
- 'yet-another-stars-rating');?>
310
- </div>
311
-
312
- <div class="yasr-itemtype-row-container-label-input">
313
- <label for="yasr-recipe-ingredient" style="vertical-align: top">recipeIngredient</label>
314
- <textarea name="yasr_recipe_recipeingredient" rows="4"
315
- id="yasr-recipe-ingredient"><?php echo esc_textarea($saved_data['yasr_recipe_recipeingredient']); ?></textarea>
316
- </div>
317
- <div class="yasr-itemtype-row-container-description">
318
- <?php
319
- echo sprintf(
320
- __('A single ingredient used in the recipe, e.g. sugar, flour or garlic. %s
321
- Use return %s to separate the ingredients.',
322
- 'yet-another-stars-rating'),
323
- '<br />',
324
- '<strong>(&#8629;)</strong>'
325
- );
326
-
327
- ?>
328
- </div>
329
-
330
- <div class="yasr-itemtype-row-container-label-input">
331
- <label for="yasr-recipe-instructions" style="vertical-align: top">recipeInstructions</label>
332
- <textarea name="yasr_recipe_recipeinstructions" rows="4"
333
- id="yasr-recipe-instructions"><?php echo esc_textarea($saved_data['yasr_recipe_recipeinstructions']); ?></textarea>
334
- </div>
335
- <div class="yasr-itemtype-row-container-description">
336
- <?php
337
- echo sprintf(
338
- __('The steps to make dish. Use return %s to separate the steps.',
339
- 'yet-another-stars-rating'),
340
- '<strong>(&#8629;)</strong>'
341
- );
342
- ?>
343
- </div>
344
-
345
- <div class="yasr-itemtype-row-container-label-input">
346
- <label for="yasr-recipe-video">Video</label>
347
- <input type="text" name="yasr_recipe_video" id="yasr-recipe-video"
348
- value='<?php echo esc_url($saved_data['yasr_recipe_video']); ?>'
349
- >
350
- </div>
351
- <div class="yasr-itemtype-row-container-description">
352
- <?php _e('A video depicting the steps to make the dish (URL)',
353
- 'yet-another-stars-rating');?>
354
- </div>
355
-
356
- <div class="yasr-itemtype-row-container-description">
357
- <?php
358
- echo sprintf(
359
- __('More info %s here %s and %s here %s', 'yet-another-stars-rating'),
360
- '<a href="https://developers.google.com/search/docs/data-types/recipe" target="_blank">','</a>',
361
- '<a href="https://schema.org/Recipe" target="_blank">','</a>'
362
- );
363
- ?>
364
- </div>
365
-
366
- </div>
367
- <!-- End Recipe -->
368
369
</div>
370
22
exit('You\'re not allowed to see this page');
23
} // Exit if accessed directly
24
25
+ require YASR_ABSOLUTE_PATH_ADMIN . '/editor/YasrMetaboxSchemaFields.php';
26
+
27
global $post;
28
29
//is post review
53
if(!isset($saved_data[$item_type])) {
54
$saved_data[$item_type] = false;
55
}
56
}
57
58
+ $itemType_obj = new YasrMetaboxSchemaFields($saved_data);
59
+
60
?>
61
62
<div>
85
</div>
86
87
<div class="yasr-metabox-info-snippet-container" id="yasr-metabox-info-snippet-container" style="display: none;">
88
+ <?php
89
+ //Product
90
+ $itemType_obj->product();
91
92
+ //localbuisness
93
+ $itemType_obj->localBuinsess();
94
95
+ //recipe
96
+ $itemType_obj->recipe();
97
98
+ //softweareApplication
99
+ $itemType_obj->softwareApplication();
100
+ ?>
101
102
</div>
103
admin/js/src/yasr-dashboard.js CHANGED
@@ -75,7 +75,7 @@ jQuery(document).ready(function () {
75
}
76
77
//check if the ajax call is done by yasr with action yasr_change_log_page
78
- isYasrAjaxCall = settings.data.search("action=yasr_change_log_page");
79
80
if (isYasrAjaxCall !== -1) {
81
jQuery('.yasr-user-log-page-num').on('click', function () {
75
}
76
77
//check if the ajax call is done by yasr with action yasr_change_log_page
78
+ isYasrAjaxCall = settings.data.search("action=yasr_change_user_log_page");
79
80
if (isYasrAjaxCall !== -1) {
81
jQuery('.yasr-user-log-page-num').on('click', function () {
admin/js/yasr-admin.js CHANGED
@@ -1 +1,133 @@
1
- !function(e){var t={};function r(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(o,a,function(t){return e[t]}.bind(null,a));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){r(1),r(2),e.exports=r(3)},function(e,t){copyToClipboard=e=>{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="absolute",t.style.left="-9999px",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"})},function(e,t){jQuery(document).ready((function(){jQuery(".yasr-log-pagenum").on("click",(function(){jQuery("#yasr-loader-log-metabox").show();var e={action:"yasr_change_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-loader-log-metabox").hide(),jQuery("#yasr-log-container").html(e)}))})),jQuery(document).ajaxComplete((function(e,t,r){var o=!0;"undefined"!==r.data&&(o=r.data.search("action=yasr_change_log_page")),-1!==o&&jQuery(".yasr-log-pagenum").on("click",(function(){jQuery("#yasr-loader-log-metabox").show();var e={action:"yasr_change_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-log-container").html(e)}))}))}))})),jQuery(document).ready((function(){jQuery(".yasr-user-log-page-num").on("click",(function(){jQuery("#yasr-loader-user-log-metabox").show();var e={action:"yasr_change_user_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-user-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-loader-log-metabox").hide(),jQuery("#yasr-user-log-container").html(e)}))})),jQuery(document).ajaxComplete((function(e,t,r){void 0!==r.data&&-1!==r.data.search("action=yasr_change_log_page")&&jQuery(".yasr-user-log-page-num").on("click",(function(){jQuery("#yasr-loader-user-log-metabox").show();var e={action:"yasr_change_user_log_page",pagenum:jQuery(this).val(),totalpages:jQuery("#yasr-user-log-total-pages").data("yasr-log-total-pages")};jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-user-log-container").html(e)}))}))}))}))},function(e,t){document.addEventListener("DOMContentLoaded",(function(e){if(void 0===document.getElementsByClassName("nav-tab-active")[0])return;let t=document.getElementsByClassName("nav-tab-active")[0].id;if("general_settings"===t){let e=document.getElementById("yasr_auto_insert_switch").checked,t=document.getElementById("yasr-general-options-text-before-stars-switch").checked;!1===e&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),jQuery("#yasr_auto_insert_switch").change((function(){jQuery(this).is(":checked")?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),!1===t&&jQuery(".yasr-general-options-text-before").prop("disabled",!0),jQuery("#yasr-general-options-text-before-stars-switch").change((function(){jQuery(this).is(":checked")?(jQuery(".yasr-general-options-text-before").prop("disabled",!1),jQuery("#yasr-general-options-custom-text-before-overall").val("Our Score"),jQuery("#yasr-general-options-custom-text-before-visitor").val("Click to rate this post!"),jQuery("#yasr-general-options-custom-text-after-visitor").val("[Total: %total_count% Average: %average%]"),jQuery("#yasr-general-options-custom-text-must-sign-in").val("You must sign in to vote"),jQuery("#yasr-general-options-custom-text-already-rated").val("You have already voted for this article")):jQuery(".yasr-general-options-text-before").prop("disabled",!0)})),jQuery("#yasr-doc-custom-text-link").on("click",(function(){return jQuery("#yasr-doc-custom-text-div").toggle("slow"),!1})),jQuery("#yasr-stats-explained-link").on("click",(function(){return jQuery("#yasr-stats-explained").toggle("slow"),!1}))}if("manage_multi"===t){let e=document.getElementById("n-multiset").value;if(jQuery("#yasr-multi-set-doc-link").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),jQuery("#yasr-multi-set-doc-link-hide").on("click",(function(){jQuery("#yasr-multi-set-doc-box").toggle("slow")})),1===e){var r=jQuery("#yasr-edit-form-number-elements").attr("value");r++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(r>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var e=jQuery(document.createElement("tr"));e.html('<td colspan="2">Element #'+r+' <input type="text" name="edit-multi-set-element-'+r+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),r++}))}e>1&&(jQuery("#yasr-button-select-set-edit-form").on("click",(function(){var e={action:"yasr_get_multi_set",set_id:jQuery("#yasr_select_edit_set").val()};return jQuery.post(ajaxurl,e,(function(e){jQuery("#yasr-multi-set-response").show(),jQuery("#yasr-multi-set-response").html(e)})),!1})),jQuery(document).ajaxComplete((function(){var e=jQuery("#yasr-edit-form-number-elements").attr("value");e++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(e>9)return jQuery("#yasr-element-limit").show(),jQuery("#yasr-add-field-edit-multiset").hide(),!1;var t=jQuery(document.createElement("tr"));t.html('<td colspan="2">Element #'+e+' <input type="text" name="edit-multi-set-element-'+e+'" value="" ></td>'),t.appendTo("#yasr-table-form-edit-multi-set"),e++}))})))}"style_options"===t&&(wp.codeEditor.initialize(document.getElementById("yasr_style_options_textarea"),yasr_cm_settings),jQuery("#yasr-color-scheme-preview-link").on("click",(function(){return jQuery("#yasr-color-scheme-preview").toggle("slow"),!1}))),"migration_tools"===t&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_ratemypost",nonce:document.getElementById("yasr-import-rmp-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-ratemypost-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML='<img src="'+yasrCommonDataAdmin.loaderHtml+'"</img>';var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){document.getElementById("yasr-import-mr-answer").innerHTML=e}))})))}))}]);
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // define getter function for harmony exports
37
+ /******/ __webpack_require__.d = function(exports, name, getter) {
38
+ /******/ if(!__webpack_require__.o(exports, name)) {
39
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
+ /******/ }
41
+ /******/ };
42
+ /******/
43
+ /******/ // define __esModule on exports
44
+ /******/ __webpack_require__.r = function(exports) {
45
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
+ /******/ }
48
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
+ /******/ };
50
+ /******/
51
+ /******/ // create a fake namespace object
52
+ /******/ // mode & 1: value is a module id, require it
53
+ /******/ // mode & 2: merge all properties of value into the ns
54
+ /******/ // mode & 4: return value when already ns object
55
+ /******/ // mode & 8|1: behave like require
56
+ /******/ __webpack_require__.t = function(value, mode) {
57
+ /******/ if(mode & 1) value = __webpack_require__(value);
58
+ /******/ if(mode & 8) return value;
59
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
+ /******/ var ns = Object.create(null);
61
+ /******/ __webpack_require__.r(ns);
62
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
+ /******/ return ns;
65
+ /******/ };
66
+ /******/
67
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
68
+ /******/ __webpack_require__.n = function(module) {
69
+ /******/ var getter = module && module.__esModule ?
70
+ /******/ function getDefault() { return module['default']; } :
71
+ /******/ function getModuleExports() { return module; };
72
+ /******/ __webpack_require__.d(getter, 'a', getter);
73
+ /******/ return getter;
74
+ /******/ };
75
+ /******/
76
+ /******/ // Object.prototype.hasOwnProperty.call
77
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
+ /******/
79
+ /******/ // __webpack_public_path__
80
+ /******/ __webpack_require__.p = "";
81
+ /******/
82
+ /******/
83
+ /******/ // Load entry module and return exports
84
+ /******/ return __webpack_require__(__webpack_require__.s = 0);
85
+ /******/ })
86
+ /************************************************************************/
87
+ /******/ ({
88
+
89
+ /***/ "./admin/js/src/yasr-dashboard.js":
90
+ /*!****************************************!*\
91
+ !*** ./admin/js/src/yasr-dashboard.js ***!
92
+ \****************************************/
93
+ /*! no static exports found */
94
+ /***/ (function(module, exports) {
95
+
96
+ eval("//Vote log\njQuery(document).ready(function () {\n\n //Log\n jQuery('.yasr-log-pagenum').on('click', function () {\n\n jQuery('#yasr-loader-log-metabox').show();\n\n var data = {\n action: 'yasr_change_log_page',\n pagenum: jQuery(this).val(),\n totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')\n\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n jQuery('#yasr-loader-log-metabox').hide();\n jQuery('#yasr-log-container').html(response);\n });\n\n });\n\n jQuery(document).ajaxComplete(function (event, xhr, settings) {\n var isYasrAjaxCall = true;\n\n if(settings.data !== 'undefined') {\n //check if the ajax call is done by yasr with action yasr_change_log_page\n isYasrAjaxCall = settings.data.search(\"action=yasr_change_log_page\");\n }\n\n if (isYasrAjaxCall !== -1) {\n jQuery('.yasr-log-pagenum').on('click', function () {\n jQuery('#yasr-loader-log-metabox').show();\n\n var data = {\n action: 'yasr_change_log_page',\n pagenum: jQuery(this).val(),\n totalpages: jQuery('#yasr-log-total-pages').data('yasr-log-total-pages')\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n jQuery('#yasr-log-container').html(response); //This will hide the loader gif too\n });\n });\n }\n\n });\n\n});\n\n\n//Vote user log\njQuery(document).ready(function () {\n\n //Log\n jQuery('.yasr-user-log-page-num').on('click', function () {\n jQuery('#yasr-loader-user-log-metabox').show();\n var data = {\n action: 'yasr_change_user_log_page',\n pagenum: jQuery(this).val(),\n totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-log-total-pages')\n\n };\n jQuery.post(ajaxurl, data, function (response) {\n jQuery('#yasr-loader-log-metabox').hide();\n jQuery('#yasr-user-log-container').html(response);\n });\n });\n\n jQuery(document).ajaxComplete(function (event, xhr, settings) {\n var isYasrAjaxCall = true;\n\n if (typeof settings.data === 'undefined') {\n return;\n }\n\n //check if the ajax call is done by yasr with action yasr_change_log_page\n isYasrAjaxCall = settings.data.search(\"action=yasr_change_user_log_page\");\n\n if (isYasrAjaxCall !== -1) {\n jQuery('.yasr-user-log-page-num').on('click', function () {\n jQuery('#yasr-loader-user-log-metabox').show();\n\n var data = {\n action: 'yasr_change_user_log_page',\n pagenum: jQuery(this).val(),\n totalpages: jQuery('#yasr-user-log-total-pages').data('yasr-log-total-pages')\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n jQuery('#yasr-user-log-container').html(response); //This will hide the loader gif too\n });\n });\n\n }\n\n });\n\n});\n\n//# sourceURL=webpack:///./admin/js/src/yasr-dashboard.js?");
97
+
98
+ /***/ }),
99
+
100
+ /***/ "./admin/js/src/yasr-functions.js":
101
+ /*!****************************************!*\
102
+ !*** ./admin/js/src/yasr-functions.js ***!
103
+ \****************************************/
104
+ /*! no static exports found */
105
+ /***/ (function(module, exports) {
106
+
107
+ eval("copyToClipboard = string => {\n const el = document.createElement('textarea');\n el.value = string;\n el.setAttribute('readonly', '');\n el.style.position = 'absolute';\n el.style.left = '-9999px';\n document.body.appendChild(el);\n el.select();\n document.execCommand('copy');\n document.body.removeChild(el);\n};\n\ntippy(\n document.querySelectorAll('.yasr-copy-shortcode'),\n {\n content: 'Copied! Insert into your post!',\n theme: 'yasr',\n arrow: 'true',\n arrowType: 'round',\n trigger: 'click'\n }\n);\n\n//# sourceURL=webpack:///./admin/js/src/yasr-functions.js?");
108
+
109
+ /***/ }),
110
+
111
+ /***/ "./admin/js/src/yasr-settings-page.js":
112
+ /*!********************************************!*\
113
+ !*** ./admin/js/src/yasr-settings-page.js ***!
114
+ \********************************************/
115
+ /*! no static exports found */
116
+ /***/ (function(module, exports) {
117
+
118
+ eval("/****** Yasr Settings Page ******/\n\ndocument.addEventListener('DOMContentLoaded', function(event) {\n\n if (typeof document.getElementsByClassName('nav-tab-active')[0] === 'undefined') {\n return;\n }\n\n //get active Tab\n let activeTab = document.getElementsByClassName('nav-tab-active')[0].id;\n\n //-------------------General Settings Code---------------------\n if (activeTab === 'general_settings') {\n\n let autoInsertEnabled = document.getElementById('yasr_auto_insert_switch').checked;\n let textBeforeStars = document.getElementById('yasr-general-options-text-before-stars-switch').checked;\n\n if (autoInsertEnabled === false) {\n jQuery('.yasr-auto-insert-options-class').prop('disabled', true);\n }\n\n //First Div, for auto insert\n jQuery('#yasr_auto_insert_switch').change(function () {\n if (jQuery(this).is(':checked')) {\n jQuery('.yasr-auto-insert-options-class').prop('disabled', false);\n } else {\n jQuery('.yasr-auto-insert-options-class').prop('disabled', true);\n }\n });\n\n //for text before stars\n if (textBeforeStars === false) {\n jQuery('.yasr-general-options-text-before').prop('disabled', true);\n }\n\n jQuery('#yasr-general-options-text-before-stars-switch').change(function () {\n if (jQuery(this).is(':checked')) {\n\n jQuery('.yasr-general-options-text-before').prop('disabled', false);\n jQuery('#yasr-general-options-custom-text-before-overall').val('Our Score');\n jQuery('#yasr-general-options-custom-text-before-visitor').val('Click to rate this post!');\n jQuery('#yasr-general-options-custom-text-after-visitor').val('[Total: %total_count% Average: %average%]');\n jQuery('#yasr-general-options-custom-text-must-sign-in').val('You must sign in to vote');\n jQuery('#yasr-general-options-custom-text-already-rated').val('You have already voted for this article');\n\n } else {\n jQuery('.yasr-general-options-text-before').prop('disabled', true);\n }\n\n });\n\n jQuery('#yasr-doc-custom-text-link').on('click', function () {\n jQuery('#yasr-doc-custom-text-div').toggle('slow');\n return false;\n });\n\n jQuery('#yasr-stats-explained-link').on('click', function () {\n jQuery('#yasr-stats-explained').toggle('slow');\n return false;\n });\n\n } //End if general settings\n\n\n //--------------Multi Sets Page ------------------\n if (activeTab === 'manage_multi') {\n\n let nMultiSet = document.getElementById('n-multiset').value;\n\n jQuery('#yasr-multi-set-doc-link').on('click', function () {\n jQuery('#yasr-multi-set-doc-box').toggle(\"slow\");\n });\n\n jQuery('#yasr-multi-set-doc-link-hide').on('click', function () {\n jQuery('#yasr-multi-set-doc-box').toggle(\"slow\");\n });\n\n if (nMultiSet === 1) {\n var counter = jQuery(\"#yasr-edit-form-number-elements\").attr('value');\n\n counter++;\n\n jQuery(\"#yasr-add-field-edit-multiset\").on('click', function () {\n if (counter > 9) {\n jQuery('#yasr-element-limit').show();\n jQuery('#yasr-add-field-edit-multiset').hide();\n return false;\n }\n\n var newTextBoxDiv = jQuery(document.createElement('tr'));\n newTextBoxDiv.html('<td colspan=\"2\">Element #' + counter + ' <input type=\"text\" name=\"edit-multi-set-element-' + counter + '\" value=\"\" ></td>');\n newTextBoxDiv.appendTo(\"#yasr-table-form-edit-multi-set\");\n counter++;\n });\n\n\n } //End if ($n_multi_set == 1)\n\n if (nMultiSet > 1) {\n\n //If more then 1 set is used...\n jQuery('#yasr-button-select-set-edit-form').on(\"click\", function () {\n\n var data = {\n action: 'yasr_get_multi_set',\n set_id: jQuery('#yasr_select_edit_set').val()\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n jQuery('#yasr-multi-set-response').show();\n jQuery('#yasr-multi-set-response').html(response);\n });\n\n return false; // prevent default click action from happening!\n\n });\n\n jQuery(document).ajaxComplete(function () {\n var counter = jQuery(\"#yasr-edit-form-number-elements\").attr('value');\n counter++;\n\n jQuery(\"#yasr-add-field-edit-multiset\").on('click', function () {\n if (counter > 9) {\n jQuery('#yasr-element-limit').show();\n jQuery('#yasr-add-field-edit-multiset').hide();\n return false;\n }\n var newTextBoxDiv = jQuery(document.createElement('tr'));\n newTextBoxDiv.html('<td colspan=\"2\">Element #' + counter + ' <input type=\"text\" name=\"edit-multi-set-element-' + counter + '\" value=\"\" ></td>');\n newTextBoxDiv.appendTo(\"#yasr-table-form-edit-multi-set\");\n counter++;\n });\n\n });\n\n } //End if ($n_multi_set > 1)\n\n } //end if active_tab=='manage_multi'\n\n if (activeTab === 'style_options') {\n wp.codeEditor.initialize(\n document.getElementById('yasr_style_options_textarea'),\n yasr_cm_settings\n );\n\n jQuery('#yasr-color-scheme-preview-link').on('click', function () {\n jQuery('#yasr-color-scheme-preview').toggle('slow');\n return false; // prevent default click action from happening!\n });\n\n }\n\n if (activeTab === 'migration_tools') {\n jQuery('#yasr-import-ratemypost-submit').on('click', function () {\n\n //show loader on click\n document.getElementById('yasr-import-ratemypost-answer').innerHTML = '<img src=\"'\n + yasrCommonDataAdmin.loaderHtml + '\"</img>';\n\n var nonce = document.getElementById('yasr-import-rmp-nonce').value;\n\n var data = {\n action: 'yasr_import_ratemypost',\n nonce: nonce\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n response = JSON.parse(response);\n document.getElementById('yasr-import-ratemypost-answer').innerHTML = response;\n });\n\n });\n\n jQuery('#yasr-import-wppr-submit').on('click', function () {\n\n //show loader on click\n document.getElementById('yasr-import-wppr-answer').innerHTML = '<img src=\"'\n + yasrCommonDataAdmin.loaderHtml + '\"</img>';\n\n var nonce = document.getElementById('yasr-import-wppr-nonce').value;\n\n var data = {\n action: 'yasr_import_wppr',\n nonce: nonce\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n //response = JSON.parse(response);\n document.getElementById('yasr-import-wppr-answer').innerHTML = response;\n });\n\n });\n\n jQuery('#yasr-import-kksr-submit').on('click', function () {\n\n //show loader on click\n document.getElementById('yasr-import-kksr-answer').innerHTML = '<img src=\"'\n + yasrCommonDataAdmin.loaderHtml + '\"</img>';\n\n var nonce = document.getElementById('yasr-import-kksr-nonce').value;\n\n var data = {\n action: 'yasr_import_kksr',\n nonce: nonce\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n //response = JSON.parse(response);\n document.getElementById('yasr-import-kksr-answer').innerHTML = response;\n });\n\n });\n\n //import multi rating\n jQuery('#yasr-import-mr-submit').on('click', function () {\n\n //show loader on click\n document.getElementById('yasr-import-mr-answer').innerHTML = '<img src=\"'\n + yasrCommonDataAdmin.loaderHtml + '\"</img>';\n\n var nonce = document.getElementById('yasr-import-mr-nonce').value;\n\n var data = {\n action: 'yasr_import_mr',\n nonce: nonce\n };\n\n jQuery.post(ajaxurl, data, function (response) {\n //response = JSON.parse(response);\n document.getElementById('yasr-import-mr-answer').innerHTML = response;\n });\n\n });\n }\n});\n\n/****** End Yasr Settings Page ******/\n\n//# sourceURL=webpack:///./admin/js/src/yasr-settings-page.js?");
119
+
120
+ /***/ }),
121
+
122
+ /***/ 0:
123
+ /*!********************************************************************************************************************!*\
124
+ !*** multi ./admin/js/src/yasr-functions.js ./admin/js/src/yasr-dashboard.js ./admin/js/src/yasr-settings-page.js ***!
125
+ \********************************************************************************************************************/
126
+ /*! no static exports found */
127
+ /***/ (function(module, exports, __webpack_require__) {
128
+
129
+ eval("__webpack_require__(/*! ./admin/js/src/yasr-functions.js */\"./admin/js/src/yasr-functions.js\");\n__webpack_require__(/*! ./admin/js/src/yasr-dashboard.js */\"./admin/js/src/yasr-dashboard.js\");\nmodule.exports = __webpack_require__(/*! ./admin/js/src/yasr-settings-page.js */\"./admin/js/src/yasr-settings-page.js\");\n\n\n//# sourceURL=webpack:///multi_./admin/js/src/yasr-functions.js_./admin/js/src/yasr-dashboard.js_./admin/js/src/yasr-settings-page.js?");
130
+
131
+ /***/ })
132
+
133
+ /******/ });
admin/js/yasr-editor-screen.js CHANGED
@@ -97,7 +97,7 @@ function yasrPrintMetaBoxBelowEditor () {
97
98
let selectedItemtype = document.getElementById('yasr-metabox-below-editor-select-schema').value;
99
100
- yasrSwitchItemTypeDiv (selectedItemtype);
101
}
102
103
function yasrSwitchItemTypeDiv (itemType) {
@@ -110,6 +110,7 @@ function yasrSwitchItemTypeDiv (itemType) {
110
//hide all child divs
111
document.getElementById('yasr-metabox-info-snippet-container-localbusiness').style.display = 'none';
112
document.getElementById('yasr-metabox-info-snippet-container-recipe').style.display = 'none';
113
114
//return;
115
}
@@ -121,6 +122,7 @@ function yasrSwitchItemTypeDiv (itemType) {
121
//hide all child
122
document.getElementById('yasr-metabox-info-snippet-container-product').style.display = 'none';
123
document.getElementById('yasr-metabox-info-snippet-container-recipe').style.display = 'none';
124
}
125
else if(itemType === 'Recipe') {
126
//show main div
@@ -130,6 +132,18 @@ function yasrSwitchItemTypeDiv (itemType) {
130
//hide all child
131
document.getElementById('yasr-metabox-info-snippet-container-localbusiness').style.display = 'none';
132
document.getElementById('yasr-metabox-info-snippet-container-product').style.display = 'none';
133
}
134
else {
135
document.getElementById('yasr-metabox-info-snippet-container').style.display = 'none';
97
98
let selectedItemtype = document.getElementById('yasr-metabox-below-editor-select-schema').value;
99
100
+ yasrSwitchItemTypeDiv(selectedItemtype);
101
}
102
103
function yasrSwitchItemTypeDiv (itemType) {
110
//hide all child divs
111
document.getElementById('yasr-metabox-info-snippet-container-localbusiness').style.display = 'none';
112
document.getElementById('yasr-metabox-info-snippet-container-recipe').style.display = 'none';
113
+ document.getElementById('yasr-metabox-info-snippet-container-software').style.display = 'none';
114
115
//return;
116
}
122
//hide all child
123
document.getElementById('yasr-metabox-info-snippet-container-product').style.display = 'none';
124
document.getElementById('yasr-metabox-info-snippet-container-recipe').style.display = 'none';
125
+ document.getElementById('yasr-metabox-info-snippet-container-software').style.display = 'none';
126
}
127
else if(itemType === 'Recipe') {
128
//show main div
132
//hide all child
133
document.getElementById('yasr-metabox-info-snippet-container-localbusiness').style.display = 'none';
134
document.getElementById('yasr-metabox-info-snippet-container-product').style.display = 'none';
135
+ document.getElementById('yasr-metabox-info-snippet-container-software').style.display = 'none';
136
+ }
137
+ else if(itemType === 'SoftwareApplication') {
138
+ //show main div
139
+ document.getElementById('yasr-metabox-info-snippet-container').style.display = '';
140
+ //show Software Application
141
+ document.getElementById('yasr-metabox-info-snippet-container-software').style.display = '';
142
+
143
+ //hide all childs
144
+ document.getElementById('yasr-metabox-info-snippet-container-recipe').style.display = 'none';
145
+ document.getElementById('yasr-metabox-info-snippet-container-localbusiness').style.display = 'none';
146
+ document.getElementById('yasr-metabox-info-snippet-container-product').style.display = 'none';
147
}
148
else {
149
document.getElementById('yasr-metabox-info-snippet-container').style.display = 'none';
changelog.txt CHANGED
@@ -1,3 +1,25 @@
1
= 2.2.2 =
2
* FIXED: links in Recent Ratings dashboard widget (thanks to Fernando Tellado)
3
* Enhancement: Added REST responses. More info in the official site
1
+ = 2.2.5 =
2
+ * FIXED: bug if upgrading from version before than 2.0.9
3
+
4
+ = 2.2.4 =
5
+ * FIXED: Multi Set didn't shows up vote in admin screen
6
+ * FIXED: attribute "readonly" to the yasr_visitor_votes shortcode
7
+ * TWEAKED: minor changes in settings panel
8
+
9
+ = 2.2.3 =
10
+ * NEW FEATURE: Added support for the following structured datas:
11
+ - Course
12
+ - CreativeWorkSeason,
13
+ - CreativeWorkSeries,
14
+ - Episode,
15
+ - Event
16
+ - MediaObject,
17
+ - Movie,
18
+ - MusicPlaylist,
19
+ - MusicRecording.
20
+
21
+ * TWEAKED: Removed transient: since version 2.2.0 are useless.
22
+
23
= 2.2.2 =
24
* FIXED: links in Recent Ratings dashboard widget (thanks to Fernando Tellado)
25
* Enhancement: Added REST responses. More info in the official site
includes/classes/YasrPhpFieldsHelper.php ADDED
@@ -0,0 +1,159 @@
1
+ <?php
2
+
3
+ /**
4
+ * Class based on https://github.com/Dudo1985/phpFieldsHelper
5
+ *
6
+ * Used as helper to create these html element
7
+ *
8
+ * <input type="text">
9
+ * <select>
10
+ * <textarea>
11
+ *
12
+ * Class YasrPhpFieldsHelper
13
+ */
14
+ class YasrPhpFieldsHelper {
15
+
16
+ /**
17
+ * Default class
18
+ *
19
+ * @var string
20
+ */
21
+ public $field_class;
22
+
23
+ public function __construct($field_class=false) {
24
+ if($field_class) {
25
+ $this->field_class = htmlspecialchars($field_class);
26
+ }
27
+ }
28
+
29
+ /**
30
+ * @param bool|string $class
31
+ * @param bool|string|int $label
32
+ * @param bool|string|int $name
33
+ * @param bool|string|int $id
34
+ * @param bool|string|int $placeholder
35
+ * @param bool|string|int $default_value
36
+ *
37
+ * @return string
38
+ */
39
+ public function text($class=false, $label=false, $name=false, $id=false, $placeholder=false, $default_value=false) {
40
+ $attribute = $this->escape_attributes($class, $label, $name, $id, $default_value, $placeholder);
41
+
42
+ $container = "<div class='$attribute[class]'>";
43
+ $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
44
+ $input_text = "<input type='text' name='$attribute[name]' id='$attribute[id]' value='$attribute[value]'
45
+ placeholder='$attribute[placeholder]'>";
46
+ $end_container = "</div>";
47
+
48
+ return($container.$label_string.$input_text.$end_container);
49
+ }
50
+
51
+ /**
52
+ * @param bool|string $class
53
+ * @param bool|string|int $label
54
+ * @param array $options
55
+ * @param bool|string|int $name
56
+ * @param bool|string|int $id
57
+ * @param bool|string|int $default_value
58
+ *
59
+ * @return string
60
+ */
61
+ public function select($class=false, $label=false, $options=[], $name=false, $id=false, $default_value=false) {
62
+ $attribute = $this->escape_attributes($class, $label, $name, $id, $default_value);
63
+ $select_options = $this->escape_array($options);
64
+
65
+ $container = "<div class='$attribute[class]'>";
66
+ $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
67
+ $select = "<select name='$attribute[name]' id='$attribute[id]'>";
68
+ $end_select = "</select>";
69
+ $end_container = "</div>";
70
+
71
+ foreach ($select_options as $key=>$option) {
72
+ if($option === $attribute['value']) {
73
+ $select .= "<option value='$option' selected>$option</option>";
74
+ } else {
75
+ $select .= "<option value='$option'>$option</option>";
76
+ }
77
+ }
78
+
79
+ return($container.$label_string.$select.$end_select.$end_container);
80
+ }
81
+
82
+ /**
83
+ * @param bool|string $class
84
+ * @param bool|string|int $label
85
+ * @param bool|string|int $name
86
+ * @param bool|string|int $id
87
+ * @param bool|string|int $placeholder
88
+ * @param bool|string|int $default_value
89
+ *
90
+ * @return string
91
+ */
92
+ public function textArea($class=false, $label=false, $name=false, $id=false, $placeholder=false, $default_value=false) {
93
+ $attribute = $this->escape_attributes($class, $label, $name, $id, $default_value, $placeholder);
94
+
95
+ $container = "<div class='$attribute[class]'>";
96
+ $label_string = "<label for='$attribute[id]'>$attribute[label]</label>";
97
+ $textarea = "<textarea name='$attribute[name]' id='$attribute[id]' placeholder='$attribute[placeholder]'>";
98
+ $end_textarea = "</textarea>";
99
+ $end_container = "</div>";
100
+
101
+ return($container.$label_string.$textarea.$attribute['value'].$end_textarea.$end_container);
102
+ }
103
+
104
+
105
+ /**
106
+ * @param bool|string $class
107
+ * @param bool|string|int $label
108
+ * @param bool|string|int $name
109
+ * @param bool|string|int $id
110
+ * @param bool|string|int $placeholder
111
+ * @param bool|string|int $default_value
112
+ *
113
+ * @return array
114
+ */
115
+ private function escape_attributes($class=false, $label=false, $name=false, $id=false, $default_value=false, $placeholder=false ) {
116
+ //Use the $this->field_class attribute if $class is false or empty
117
+ if(!$class && $this->field_class) {
118
+ $class = $this->field_class;
119
+ }
120
+
121
+ //if id is not set but name is, id get same value as name
122
+ if(!$id && $name) {
123
+ $id = $name;
124
+ }
125
+ //viceversa
126
+ elseif (!$name && $id) {
127
+ $name = $id;
128
+ }
129
+
130
+ //Use a random string (uniqueid and str_shuffle to add randomness) if id is still empty
131
+ if(!$id) {
132
+ $id = str_shuffle(uniqid('', true));
133
+ }
134
+
135
+ return array(
136
+ 'class' => htmlspecialchars($class, ENT_QUOTES),
137
+ 'id' => htmlspecialchars($id, ENT_QUOTES),
138
+ 'label' => htmlspecialchars($label, ENT_QUOTES),
139
+ 'name' => htmlspecialchars($name, ENT_QUOTES),
140
+ 'placeholder' => htmlspecialchars($placeholder, ENT_QUOTES),
141
+ 'value' => htmlspecialchars($default_value, ENT_QUOTES),
142
+ );
143
+ }
144
+
145
+ private function escape_array($array=[]) {
146
+ $cleaned_array = [];
147
+ if(!is_array($array)) {
148
+ return $cleaned_array;
149
+ }
150
+
151
+ foreach ($array as $key=>$value) {
152
+ $key = htmlspecialchars($key, ENT_QUOTES);
153
+ $cleaned_array[$key] = htmlspecialchars($value, ENT_QUOTES);
154
+ }
155
+
156
+ return $cleaned_array;
157
+ }
158
+
159
+ }
includes/yasr-includes-init.php CHANGED
@@ -50,6 +50,7 @@ function yasr_autoload_includes_classes($class) {
50
if (file_exists($file_name)) {
51
require($file_name);
52
}
53
}
54
55
//AutoLoad Yasr Classes, only when a object is created
@@ -205,8 +206,10 @@ $supported_schema_types = json_encode(
205
'Movie',
206
'MusicPlaylist',
207
'MusicRecording',
208
'Product',
209
- 'Recipe'
210
)
211
);
212
$array_item_type_info = json_encode(
@@ -232,7 +235,14 @@ $array_item_type_info = json_encode(
232
'yasr_recipe_recipecuisine',
233
'yasr_recipe_recipeingredient',
234
'yasr_recipe_recipeinstructions',
235
- 'yasr_recipe_video'
236
)
237
);
238
50
if (file_exists($file_name)) {
51
require($file_name);
52
}
53
+
54
}
55
56
//AutoLoad Yasr Classes, only when a object is created
206
'Movie',
207
'MusicPlaylist',
208
'MusicRecording',
209
+ 'Organization',
210
'Product',
211
+ 'Recipe',
212
+ 'SoftwareApplication'
213
)
214
);
215
$array_item_type_info = json_encode(
235
'yasr_recipe_recipecuisine',
236
'yasr_recipe_recipeingredient',
237
'yasr_recipe_recipeinstructions',
238
+ 'yasr_recipe_video',
239
+ 'yasr_software_application',
240
+ 'yasr_software_os',
241
+ 'yasr_software_price',
242
+ 'yasr_software_price_currency',
243
+ 'yasr_software_price_valid_until',
244
+ 'yasr_software_price_availability',
245
+ 'yasr_software_price_url',
246
)
247
);
248
public/classes/YasrRichSnippetAdditionalFields.php CHANGED
@@ -45,6 +45,10 @@ class YasrRichSnippetAdditionalFields {
45
$more_rich_snippet = $this->recipe($saved_data);
46
}
47
48
return array_merge($rich_snippet, $more_rich_snippet);
49
50
}
@@ -128,4 +132,23 @@ class YasrRichSnippetAdditionalFields {
128
129
return $rich_snippet;
130
}
131
}
45
$more_rich_snippet = $this->recipe($saved_data);
46
}
47
48
+ if($review_choosen === 'SoftwareApplication') {
49
+ $more_rich_snippet = $this->softwareApplication($saved_data);
50
+ }
51
+
52
return array_merge($rich_snippet, $more_rich_snippet);
53
54
}
132
133
return $rich_snippet;
134
}
135
+
136
+ private function softwareApplication($saved_data) {
137
+
138
+ $rich_snippet['applicationCategory'] = $saved_data['yasr_software_application'];
139
+ $rich_snippet['operatingSystem'] = $saved_data['yasr_software_os'];
140
+
141
+ if(!empty($saved_data['yasr_software_price'])) {
142
+ $rich_snippet['offers'] = array(
143
+ '@type' => 'Offer',
144
+ 'price' => $saved_data['yasr_software_price'],
145
+ 'priceCurrency' => $saved_data['yasr_software_price_currency'],
146
+ 'priceValidUntil' => $saved_data['yasr_software_price_valid_until'],
147
+ 'availability' => $saved_data['yasr_software_price_availability'],
148
+ 'url' => $saved_data['yasr_software_price_url'],
149
+ );
150
+
151
+ }
152
+ return $rich_snippet;
153
+ }
154
}
public/yasr-public-filters.php CHANGED
@@ -125,16 +125,12 @@ add_filter('the_content', 'yasr_add_schema');
125
function yasr_add_schema($content) {
126
127
//Add buddypress compatibility
128
- if (function_exists('bp_is_active')) {
129
- //If this is a page, return $content without adding schema.
130
- //If I try to return $content after if (YASR_SNIPPET == 'overall_rating')
131
- //or (YASR_SNIPPET == 'visitor_rating') $content will have only wp content, losing the buddypress one
132
- if (is_page()) {
133
- return $content;
134
- }
135
}
136
137
- if (is_404() || (!is_singular() && is_main_query()) || did_action('get_footer')) {
138
return $content;
139
}
140
@@ -199,6 +195,17 @@ function yasr_add_schema($content) {
199
}
200
201
$rich_snippet['@type'] = $review_choosen;
202
203
if ($review_choosen === 'Place') {
204
$rich_snippet['@type'] = 'LocalBusiness';
@@ -238,21 +245,13 @@ function yasr_add_schema($content) {
238
239
}
240
241
- $rich_snippet['name'] = $review_name;
242
- $rich_snippet['description'] = $review_name;
243
- $rich_snippet['image'] = array(
244
- '@type' => 'ImageObject',
245
- 'url' => $post_image_url,
246
- 'width' => $post_image_size[0],
247
- 'height' => $post_image_size[1]
248
- );
249
-
250
//Do not add rating if blogposting
251
if ($review_choosen !== 'Other' && $review_choosen !== 'BlogPosting') {
252
if ($overall_rating) {
253
$rich_snippet['Review'] = array(
254
'@type' => 'Review',
255
'name' => $review_name,
256
'author' => array(
257
'@type' => 'Person',
258
'name' => $author
125
function yasr_add_schema($content) {
126
127
//Add buddypress compatibility
128
+ //If this is a page, return $content without adding schema.
129
+ if (function_exists('bp_is_active') && is_page()) {
130
+ return $content;
131
}
132
133
+ if (is_404() || did_action('get_footer') || (!is_singular() && is_main_query())) {
134
return $content;
135
}
136
195
}
196
197
$rich_snippet['@type'] = $review_choosen;
198
+ $rich_snippet['name'] = $review_name;
199
+ $cleaned_content = wp_strip_all_tags(strip_shortcodes($content));
200
+
201
+ $rich_snippet['description'] = wp_trim_words( $cleaned_content, 55, '...' );
202
+
203
+ $rich_snippet['image'] = array(
204
+ '@type' => 'ImageObject',
205
+ 'url' => $post_image_url,
206
+ 'width' => $post_image_size[0],
207
+ 'height' => $post_image_size[1]
208
+ );
209
210
if ($review_choosen === 'Place') {
211
$rich_snippet['@type'] = 'LocalBusiness';
245
246
}
247
248
//Do not add rating if blogposting
249
if ($review_choosen !== 'Other' && $review_choosen !== 'BlogPosting') {
250
if ($overall_rating) {
251
$rich_snippet['Review'] = array(
252
'@type' => 'Review',
253
'name' => $review_name,
254
+ 'reviewBody' => $cleaned_content,
255
'author' => array(
256
'@type' => 'Person',
257
'name' => $author
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.9.0
5
Contributors: Dudo
6
Tested up to: 5.5
7
Requires PHP: 5.3
8
- Stable tag: 2.3.3
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
@@ -40,12 +40,31 @@ Multisets give the opportunity to score different aspects for each review: for e
40
You can easily migrate from *WP-PostRatings*, *kk Star Ratings*, *Rate My Post* and *Multi Rating*
41
A tab will appear in the settings if one of these plugin is detected.
42
43
- = Supported Languages =
44
-
45
- Check [here](https://translate.wordpress.org/projects/wp-plugins/yet-another-stars-rating/dev) to see if your translation is up to date.
46
- Write on the [forum](https://wordpress.org/support/plugin/yet-another-stars-rating) to ask to become a validator :)
47
-
48
- In this video I'll show you the "Auto Insert" feature and manual placement of YASR basic shortcodes.
49
[youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
50
51
= Related Link =
@@ -128,6 +147,13 @@ If doesn't, you should work on your seo reputation.
128
129
The full changelog can be found in the plugin's directory. Recent entries:
130
131
= 2.3.3 =
132
* FIXED: "Load results with AJAX" option works with all post types, not the "posts" one
133
* FIXED: CSS fix in settings pages
@@ -193,29 +219,6 @@ fields where reset
193
194
More to come in the next realeses :)
195
196
- = 2.2.5 =
197
- * FIXED: bug if upgrading from version before than 2.0.9
198
-
199
- = 2.2.4 =
200
- * FIXED: Multi Set didn't shows up vote in admin screen
201
- * FIXED: attribute "readonly" to the yasr_visitor_votes shortcode
202
- * TWEAKED: minor changes in settings panel
203
-
204
- = 2.2.3 =
205
- * NEW FEATURE: Added support for the following structured datas:
206
- - Course
207
- - CreativeWorkSeason,
208
- - CreativeWorkSeries,
209
- - Episode,
210
- - Event
211
- - MediaObject,
212
- - Movie,
213
- - MusicPlaylist,
214
- - MusicRecording.
215
-
216
- * TWEAKED: Removed transient: since version 2.2.0 are useless.
217
-
218
-
219
= Additional Info =
220
External Libraries: [Rater](https://github.com/fredolss/rater-js)
221
[tippy](https://atomiks.github.io/tippyjs/)
5
Contributors: Dudo
6
Tested up to: 5.5
7
Requires PHP: 5.3
8
+ Stable tag: 2.3.4
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11
Boost the way people interact with your site with an easy WordPress stars rating system! With schema.org rich snippets YASR will improve your SEO
40
You can easily migrate from *WP-PostRatings*, *kk Star Ratings*, *Rate My Post* and *Multi Rating*
41
A tab will appear in the settings if one of these plugin is detected.
42
43
+ = Supported itemtypes =
44
+ Yasr Support the following schema.org itemtypes:
45
+ BlogPosting ✝,
46
+ Book,
47
+ Course,
48
+ CreativeWorkSeason,
49
+ CreativeWorkSeries,
50
+ Episode,
51
+ Event,
52
+ Game,
53
+ LocalBusiness,
54
+ MediaObject,
55
+ Movie,
56
+ MusicPlaylist,
57
+ MusicRecording,
58
+ Organization,
59
+ Product,
60
+ Recipe,
61
+ SoftwareApplication
62
+
63
+ ✝ BlogPosting itemtype will not show stars in search result.
64
+ More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
65
+
66
+ = Video Tutorial =
67
+ In this video I'll show you the "Auto Insert" feature and manual placement of yasr_visitor_votes and yasr_overall_rating shortcodes
68
[youtube https://www.youtube.com/watch?v=M47xsJMQJ1E]
69
70
= Related Link =
147
148
The full changelog can be found in the plugin's directory. Recent entries:
149
150
+ = 2.3.4 =
151
+ * IMPROVED: added Software Application itemType
152
+ * IMPROVED: added Organization itemType
153
+ * IMPORVED: added reviewBody and description properties
154
+ * FIXED: "Your ratings" widget in admin dashboard
155
+
156
+
157
= 2.3.3 =
158
* FIXED: "Load results with AJAX" option works with all post types, not the "posts" one
159
* FIXED: CSS fix in settings pages
219
220
More to come in the next realeses :)
221
222
= Additional Info =
223
External Libraries: [Rater](https://github.com/fredolss/rater-js)
224
[tippy](https://atomiks.github.io/tippyjs/)
yet-another-stars-rating.php CHANGED
@@ -5,7 +5,7 @@
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and
7
* testimonials to your website posts, pages and CPT, without affecting its speed.
8
- * Version: 2.3.3
9
* Author: Dario Curvino
10
* Author URI: https://dariocurvino.it/
11
* Text Domain: yet-another-stars-rating
@@ -77,7 +77,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
77
yasr_fs();
78
// Signal that SDK was initiated.
79
do_action( 'yasr_fs_loaded' );
80
- define( 'YASR_VERSION_NUM', '2.3.3' );
81
//Plugin absolute path
82
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
83
define( 'YASR_ABSOLUTE_PATH', __DIR__ );
5
* Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
* Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and
7
* testimonials to your website posts, pages and CPT, without affecting its speed.
8
+ * Version: 2.3.4
9
* Author: Dario Curvino
10
* Author URI: https://dariocurvino.it/
11
* Text Domain: yet-another-stars-rating
77
yasr_fs();
78
// Signal that SDK was initiated.
79
do_action( 'yasr_fs_loaded' );
80
+ define( 'YASR_VERSION_NUM', '2.3.4' );
81
//Plugin absolute path
82
//e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
83
define( 'YASR_ABSOLUTE_PATH', __DIR__ );