Yasr – Yet Another Stars Rating - Version 3.0.6

Version Description

  • FIX: translation for rankings shortcodes
  • FIX: in the classic editor, if Multi Set is used, a duplicate query were run
  • FIX: "Insert Multiset" button in shortcode creator didn't work
  • TWEAKED: gutenberg block now works with .block.json files
  • TWEAKED: added yasr_user_rate_history in shortcode creator for classic editor, and as new Gutenberg Block
  • TWEAKED: added new actions
  • TWEAKED: under the hood changes.
Download this release

Release Info

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

Code changes from version 3.0.5 to 3.0.6

Files changed (45) hide show
  1. admin/classes/YasrEditCategory.php +1 -1
  2. admin/editor/YasrEditorHooks.php +320 -560
  3. admin/editor/YasrMetaboxBelowEditor.php +375 -0
  4. admin/editor/YasrMetaboxSchemaFields.php +3 -3
  5. admin/editor/blocks/rankingMostActiveReviewers.block.json +24 -0
  6. admin/editor/blocks/rankingMostActiveUsers.block.json +24 -0
  7. admin/editor/blocks/rankingOverallRating.block.json +22 -0
  8. admin/editor/blocks/rankingVisitorVotes.block.json +23 -0
  9. admin/editor/blocks/yasrOverallRating.block.json +32 -0
  10. admin/editor/blocks/yasrUserRateHistory.block.json +22 -0
  11. admin/editor/blocks/yasrVisitorVotes.block.json +33 -0
  12. admin/editor/yasr-metabox-below-editor.php +0 -59
  13. admin/editor/yasr-metabox-multiple-rating.php +0 -213
  14. admin/js/guten/blocks/noStarsRankings.js +0 -1
  15. admin/js/guten/blocks/overallRating.js +0 -1
  16. admin/js/guten/blocks/rankings.js +0 -1
  17. admin/js/guten/blocks/shortcodes.js +1 -0
  18. admin/js/guten/blocks/visitorVotes.js +0 -1
  19. admin/js/guten/yasr-guten-misc.js +1 -1
  20. admin/js/src/guten/blocks/overallRating.js +0 -1
  21. admin/js/src/guten/blocks/userRateHistory.js +62 -0
  22. admin/js/src/guten/blocks/visitorVotes.js +0 -1
  23. admin/js/src/guten/blocks/yasrGutenUtils.js +5 -1
  24. admin/js/src/yasr-editor-screen.js +17 -19
  25. admin/js/yasr-editor-screen.js +1 -1
  26. admin/js/yasr-settings.js +1 -1
  27. admin/settings/aspect_style/yasr-settings-style-functions.php +1 -1
  28. admin/settings/classes/YasrSettings.php +136 -56
  29. admin/settings/classes/YasrSettingsRankings.php +49 -40
  30. admin/yasr-admin-init.php +0 -10
  31. includes/classes/YasrMultiSetData.php +5 -1
  32. includes/classes/YasrPhpFieldsHelper.php +0 -71
  33. includes/classes/YasrScriptsLoader.php +268 -13
  34. includes/js/catch-inifite-scroll.js +1 -1
  35. includes/js/shortcodes/overall-multiset.js +1 -1
  36. includes/js/shortcodes/rankings.js +1 -1
  37. includes/js/shortcodes/visitorVotes.js +1 -1
  38. includes/js/src/shortcodes/overall-multiset.js +1 -2
  39. includes/js/src/shortcodes/ranking.js +29 -16
  40. includes/js/src/shortcodes/visitorVotes.js +3 -5
  41. includes/shortcodes/classes/YasrVisitorVotes.php +10 -1
  42. includes/yasr-includes-functions.php +81 -15
  43. public/yasr-public-init.php +1 -4
  44. readme.txt +11 -2
  45. yet-another-stars-rating.php +13 -2
admin/classes/YasrEditCategory.php CHANGED
@@ -75,7 +75,7 @@ class YasrEditCategory {
75
  </span>
76
  </th>
77
  <td>
78
- <?php yasr_select_itemtype('yasr-pro-select-itemtype-category', $term_id, $disabled ); ?>
79
  <p></p>
80
  <label for="yasr-pro-checkbox-itemtype-category" class="yasr-indented-answer">
81
  <input type="checkbox"
75
  </span>
76
  </th>
77
  <td>
78
+ <?php yasr_select_itemtype('yasr-pro-select-itemtype-category', false, false, $term_id, $disabled); ?>
79
  <p></p>
80
  <label for="yasr-pro-checkbox-itemtype-category" class="yasr-indented-answer">
81
  <input type="checkbox"
admin/editor/YasrEditorHooks.php CHANGED
@@ -32,35 +32,22 @@ if (!defined('ABSPATH')) {
32
  class YasrEditorHooks {
33
 
34
  private $custom_post_types = null;
 
 
35
 
36
  public function init() {
37
 
38
  //enable attribute "custom-fields" in cpt
39
  add_action('init', array($this, 'enableCptCustomFields'), 100);
40
 
41
- //enqueue gutenberg stuff outside blocks
42
- add_action('enqueue_block_editor_assets', array($this, 'initGutenMisc'));
43
-
44
- add_action('admin_init', array($this, 'initGutenBlocks'));
45
-
46
  //This filter is used to add a new category in gutenberg
47
  add_filter('block_categories_all', array($this, 'addGutenbergCategory'), 10, 2);
48
 
49
- //Add yasr constant in gutenberg
50
- add_action('yasr_add_admin_scripts_end', array($this, 'addJsConstantInGutenberg'));
51
-
52
- //Save auto insert value to yasrConstantGutenberg
53
- add_filter('yasr_gutenberg_constants', array($this, 'yasrGutenbergConstants'));
54
-
55
  // Create 2 metaboxes in post and pages
56
  add_action('add_meta_boxes', array($this, 'addMetaboxes'));
57
 
58
  // Add a media content button
59
- add_action('media_buttons', array($this, 'tinymceButton'), 99);
60
-
61
- // Create the content for the button shortcode in Tinymce
62
- //Add ajax action that will be called from the .js for button in tinymce
63
- add_action('wp_ajax_yasr_create_shortcode', array($this, 'tinymceButtonContent'));
64
 
65
  // Get Set name from post or page and output the set used in yasr-metabox-multiple-rating
66
  add_action('wp_ajax_yasr_send_id_nameset', array($this, 'metaboxOutputMultisets'));
@@ -89,235 +76,6 @@ class YasrEditorHooks {
89
 
90
  }
91
 
92
- //this load guten-block.js, only in admin side
93
- public function initGutenMisc() {
94
- //I need to enqueue this only in post-new.php or post.php
95
- $current_screen = get_current_screen();
96
- if ($current_screen !== null
97
- && (property_exists($current_screen, 'base') && $current_screen->base === 'post')
98
- && ($this->isFseElement($current_screen) === false)
99
- ) {
100
- //Script
101
- wp_enqueue_script(
102
- 'yasr-gutenberg',
103
- YASR_JS_GUTEN . 'yasr-guten-misc.js',
104
- array(
105
- 'wp-blocks',
106
- 'wp-components',
107
- 'wp-editor',
108
- 'wp-edit-post',
109
- 'wp-element',
110
- 'wp-i18n',
111
- 'wp-plugins',
112
- )
113
- );
114
- }
115
- }
116
-
117
- public function initGutenBlocks() {
118
- $this->register_overall_block();
119
- $this->register_vv_block();
120
- $this->register_ranking_block();
121
- $this->register_nostars_rankings();
122
- }
123
-
124
- /**
125
- * @author Dario Curvino <@dudo>
126
- * @since 2.8.4
127
- */
128
- private function register_overall_block() {
129
- wp_register_script(
130
- 'yasr-overall-block',
131
- YASR_JS_GUTEN_BLOCKS . 'overallRating.js',
132
- array(
133
- 'wp-blocks',
134
- 'wp-block-editor',
135
- 'wp-components',
136
- 'wp-element',
137
- 'wp-i18n',
138
- ),
139
- 1
140
- );
141
-
142
- register_block_type(
143
- 'yet-another-stars-rating/overall-rating',
144
- array(
145
- 'api_version' => 2,
146
- 'editor_script' => 'yasr-overall-block',
147
- 'title' => __('Yasr: Overall Rating', 'yet-another-stars-rating'),
148
- 'description' => __('Insert the author rating', 'yet-another-stars-rating'),
149
- 'icon' => 'star-half',
150
- 'category' => 'yet-another-stars-rating',
151
- 'keywords' => array('rating', 'author', 'overall'),
152
- 'attributes' => array(
153
- 'size' => array(
154
- 'type' => 'string',
155
- 'default' => 'large'
156
- ),
157
- 'postId' => array(
158
- 'type' => 'string',
159
- 'default' => false
160
- ),
161
- ),
162
- 'supports' => array(
163
- // Declare support for specific alignment options.
164
- 'align' => array('left', 'center', 'right')
165
- )
166
- )
167
- );
168
- }
169
-
170
- /**
171
- * @author Dario Curvino <@dudo>
172
- * @since 2.8.4
173
- */
174
- private function register_vv_block() {
175
- wp_register_script(
176
- 'yasr-vv-block',
177
- YASR_JS_GUTEN_BLOCKS . 'visitorVotes.js',
178
- array(
179
- 'wp-blocks',
180
- 'wp-block-editor',
181
- 'wp-components',
182
- 'wp-element',
183
- 'wp-i18n',
184
- ),
185
- 1
186
- );
187
-
188
- register_block_type( 'yet-another-stars-rating/visitor-votes',
189
- array(
190
- 'api_version' => 2,
191
- 'editor_script' => 'yasr-vv-block',
192
- 'title' => __('Yasr: Visitor Votes', 'yet-another-stars-rating'),
193
- 'description' => __('Insert the ability for your visitors to vote', 'yet-another-stars-rating'),
194
- 'icon' => 'star-half',
195
- 'category' => 'yet-another-stars-rating',
196
- 'keywords' => array('rating', 'visitor', 'votes'),
197
- 'attributes' => array(
198
- 'size' => array(
199
- 'type' => 'string',
200
- 'default' => 'large'
201
- ),
202
- 'postId' => array(
203
- 'type' => 'string',
204
- 'default' => false
205
- ),
206
- ),
207
- 'supports' => array(
208
- // Declare support for specific alignment options.
209
- 'align' => array('left', 'center', 'right')
210
- )
211
- )
212
- );
213
- }
214
-
215
- /**
216
- * @author Dario Curvino <@dudo>
217
- * @since 2.8.4
218
- */
219
- private function register_ranking_block() {
220
- wp_register_script(
221
- 'yasr-rankings-blocks',
222
- YASR_JS_GUTEN_BLOCKS . 'rankings.js',
223
- array(
224
- 'wp-blocks',
225
- 'wp-block-editor',
226
- 'wp-components',
227
- 'wp-element',
228
- ),
229
- 1
230
- );
231
-
232
- register_block_type( 'yet-another-stars-rating/overall-rating-ranking',
233
- array(
234
- 'api_version' => 2,
235
- 'editor_script' => 'yasr-rankings-blocks',
236
- 'title' => __('Yasr: Ranking by overall rating', 'yet-another-stars-rating'),
237
- 'description' => __('This ranking shows the highest rated posts rated through the overall_rating shortcode.',
238
- 'yet-another-stars-rating'),
239
- 'icon' => 'star-half',
240
- 'category' => 'yet-another-stars-rating',
241
- 'keywords' => array('ranking', 'highest', 'chart'),
242
- 'supports' => array(
243
- // Declare support for specific alignment options.
244
- 'align' => array('left', 'center', 'right')
245
- )
246
- )
247
- );
248
-
249
- register_block_type( 'yet-another-stars-rating/visitor-votes-ranking',
250
- array(
251
- 'api_version' => 2,
252
- 'editor_script' => 'yasr-rankings-blocks',
253
- 'title' => __('Yasr: Ranking by visitors votes', 'yet-another-stars-rating'),
254
- 'description' => __('This ranking shows both the highest and most rated posts rated through the
255
- yasr_visitor_votes shortcode. ' .
256
- 'For an item to appear in this chart, it has to be rated at least twice. ',
257
- 'yet-another-stars-rating'),
258
- 'icon' => 'star-half',
259
- 'category' => 'yet-another-stars-rating',
260
- 'keywords' => array('ranking', 'highest', 'most', 'chart'),
261
- 'supports' => array(
262
- // Declare support for specific alignment options.
263
- 'align' => array('left', 'center', 'right')
264
- )
265
- )
266
- );
267
- }
268
-
269
- /**
270
- * @author Dario Curvino <@dudo>
271
- * @since 2.8.4
272
- */
273
- private function register_nostars_rankings() {
274
- wp_register_script(
275
- 'yasr-nostars-rankings-blocks',
276
- YASR_JS_GUTEN_BLOCKS . 'noStarsRankings.js',
277
- array(
278
- 'wp-blocks',
279
- 'wp-block-editor',
280
- 'wp-components',
281
- 'wp-element',
282
- ),
283
- 1
284
- );
285
-
286
- register_block_type( 'yet-another-stars-rating/most-active-users',
287
- array(
288
- 'api_version' => 2,
289
- 'editor_script' => 'yasr-nostars-rankings-blocks',
290
- 'title' => __('Yasr: Most Active Visitors', 'yet-another-stars-rating'),
291
- 'description' => __('This ranking shows the most active users, displaying the login name if logged in or “Anonymous” if not.',
292
- 'yet-another-stars-rating'),
293
- 'icon' => 'star-half',
294
- 'category' => 'yet-another-stars-rating',
295
- 'keywords' => array('ranking', 'highest', 'most', 'chart', 'visitors'),
296
- 'supports' => array(
297
- // Declare support for specific alignment options.
298
- 'align' => array('left', 'center', 'right')
299
- )
300
- )
301
- );
302
-
303
- register_block_type( 'yet-another-stars-rating/most-active-reviewers',
304
- array(
305
- 'api_version' => 2,
306
- 'editor_script' => 'yasr-nostars-rankings-blocks',
307
- 'title' => __('Yasr: Most Active Authors', 'yet-another-stars-rating'),
308
- 'description' => __('This ranking shows the most active reviewers on your site.',
309
- 'yet-another-stars-rating'),
310
- 'icon' => 'star-half',
311
- 'category' => 'yet-another-stars-rating',
312
- 'keywords' => array('ranking', 'highest', 'most', 'chart', 'authors'),
313
- 'supports' => array(
314
- // Declare support for specific alignment options.
315
- 'align' => array('left', 'center', 'right')
316
- )
317
- )
318
- );
319
- }
320
-
321
  /**
322
  * Adds a category in gutenberg blocks list
323
  *
@@ -338,65 +96,6 @@ class YasrEditorHooks {
338
  );
339
  }
340
 
341
- /**
342
- * @author Dario Curvino <@dudo>
343
- * @since 2.8.4
344
- * @param $hook
345
- */
346
- public function addJsConstantInGutenberg($hook) {
347
- if (($hook === 'post.php' || $hook === 'post-new.php' || $hook === 'appearance_page_gutenberg-edit-site')
348
- && yasr_is_gutenberg_page() ) {
349
-
350
- //create an empty array
351
- //do not add elements here, use yasrGutenbergConstants method instead
352
- $constants_array = array();
353
-
354
- //apply filters to empty array
355
- $constants_array = apply_filters('yasr_gutenberg_constants', $constants_array);
356
-
357
- //sanitize
358
- $constants_array = filter_var_array($constants_array,FILTER_SANITIZE_STRING);
359
-
360
- if(is_array($constants_array) && !empty($constants_array)) {
361
- wp_localize_script(
362
- 'yasradmin', //Where to attacch the object
363
- 'yasrConstantGutenberg',
364
- $constants_array
365
- );
366
- }
367
- }
368
- }
369
-
370
- /**
371
- * Hook into yasr_gutenberg_constants to add constants used in Gutenberg
372
- *
373
- * @author Dario Curvino <@dudo>
374
- * @param $constants_array
375
- *
376
- * @return array
377
- */
378
- public function yasrGutenbergConstants($constants_array) {
379
-
380
- //add after
381
- if (YASR_AUTO_INSERT_ENABLED === 1) {
382
- $auto_insert = YASR_AUTO_INSERT_WHAT;
383
- } else {
384
- $auto_insert = 'disabled';
385
- }
386
-
387
- $auto_insert_array = array (
388
- 'adminurl' => get_admin_url(),
389
- 'autoInsert' => $auto_insert,
390
- 'proVersion' => json_encode(false),
391
- 'lockedClass' => 'dashicons dashicons-lock',
392
- 'lockedText' => esc_html__('This feature is available only in the pro version',
393
- 'yet-another-stars-rating'),
394
- 'isFseElement' => json_encode($this->isFseElement())
395
- );
396
-
397
- return $constants_array + $auto_insert_array;
398
- }
399
-
400
  /**
401
  * Adds two metaboxes
402
  *
@@ -463,7 +162,9 @@ class YasrEditorHooks {
463
  */
464
  public function yasr_metabox_below_editor_metabox_callback() {
465
  if (current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
466
- include(YASR_ABSOLUTE_PATH_ADMIN . '/editor/yasr-metabox-below-editor.php');
 
 
467
  } else {
468
  esc_html_e('You don\'t have enough privileges to insert a Multi Set', 'yet-another-stars-rating');
469
  }
@@ -474,285 +175,368 @@ class YasrEditorHooks {
474
  *
475
  * @author Dario Curvino <@dudo>
476
  */
477
- public function tinymceButton() {
478
  if (is_admin()) {
479
  add_thickbox();
480
- echo '<a href="#TB_inline?width=530&height=600&inlineId=yasr-tinypopup-form"
481
- id="yasr-shortcode-creator"
482
- class="button thickbox">
483
- <span class="dashicons dashicons-star-half" style="vertical-align: middle;"></span> Yasr Shortcode
484
- </a>';
485
-
 
 
486
  }
487
  }
488
 
489
  /**
490
- * Ajax Callback for tinymce button
491
- *
492
  * @author Dario Curvino <@dudo>
 
493
  */
494
- public function tinymceButtonContent() {
495
- if (!isset($_GET['action'])) {
496
- exit();
497
- }
498
  global $wpdb;
499
- $multi_set = YasrMultiSetData::returnMultiSetNames();
500
  $n_multi_set = $wpdb->num_rows;
501
 
502
- ?>
 
503
 
504
- <div id="yasr-tinypopup-form">
 
 
505
  <h2 class="nav-tab-wrapper yasr-underline">
506
- <a href="#" id="yasr-link-tab-main"
507
- class="nav-tab nav-tab-active yasr-nav-tab"><?php esc_html_e("Main", 'yet-another-stars-rating'); ?></a>
508
- <a href="#" id="yasr-link-tab-charts"
509
- class="nav-tab yasr-nav-tab"><?php esc_html_e("Rankings", 'yet-another-stars-rating'); ?></a>
510
- <?php do_action('yasr_add_tabs_on_tinypopupform'); ?>
511
-
512
  <a href="https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen"
513
- target="_blank"
514
- id="yasr-tinypopup-link-doc">
515
  <?php esc_html_e('Read the doc', 'yet-another-stars-rating'); ?>
516
  </a>
517
  </h2>
518
 
519
- <div id="yasr-content-tab-main" class="yasr-content-tab-tinymce">
520
- <table id="yasr-table-tiny-popup-main" class="form-table">
521
- <tr>
522
- <th>
523
- <label for="yasr-overall">
524
- <?php esc_html_e('Overall Rating', 'yet-another-stars-rating'); ?>
525
- </label>
526
- </th>
527
- <td>
528
- <input
529
- type="button"
530
- class="button-primary"
531
- id="yasr-overall"
532
- name="yasr-overall"
533
- value="<?php esc_attr_e('Insert Overall Rating', 'yet-another-stars-rating'); ?>"
534
- />
535
- <br/>
536
- <small>
537
- <?php esc_html_e('Insert the author rating', 'yet-another-stars-rating'); ?>
538
- </small>
539
-
540
- <div id="yasr-overall-choose-size">
541
- <small>
542
- <?php esc_html_e('Choose Size', 'yet-another-stars-rating'); ?>
543
- </small>
544
- <div class="yasr-tinymce-button-size">
545
- <?php
546
- echo self::yasr_tinymce_return_button('yasr_overall_rating');
547
- ?>
548
- </div>
549
- </div>
550
- </td>
551
- </tr>
552
 
553
- <tr>
554
- <th>
555
- <label for="yasr-id">
556
- <?php esc_html_e("Visitor Votes", 'yet-another-stars-rating'); ?>
557
- </label>
558
- </th>
559
- <td>
560
- <input type="button"
561
- class="button-primary"
562
- name="yasr-visitor-votes"
563
- id="yasr-visitor-votes"
564
- value="<?php esc_attr_e("Insert Visitor Votes", 'yet-another-stars-rating'); ?>"/>
565
- <br/>
566
- <small>
567
- <?php esc_html_e('Insert the ability for your visitors to vote', 'yet-another-stars-rating'); ?>
568
- </small>
569
 
570
- <div id="yasr-visitor-choose-size">
571
- <small>
572
- <?php esc_html_e("Choose Size", 'yet-another-stars-rating'); ?>
573
- </small>
574
- <div class="yasr-tinymce-button-size">
575
- <?php
576
- echo self::yasr_tinymce_return_button('yasr_visitor_votes');
577
- ?>
578
- </div>
579
- </div>
580
- </td>
581
- </tr>
582
 
583
- <?php if ($n_multi_set > 0) { //If multiple Set are found ?>
584
- <tr>
585
- <th>
586
- <?php esc_html_e("Insert Multiset:", 'yet-another-stars-rating'); ?>
587
- </th>
588
- <td>
589
- <?php foreach ($multi_set as $name) { ?>
590
- <label>
591
- <input type="radio"
592
- value="<?php echo esc_attr($name->set_id) ?>"
593
- name="yasr_tinymce_pick_set"
594
- class="yasr_tinymce_select_set">
595
- <?php echo esc_attr($name->set_name); ?>
596
- </label>
597
- <br/>
598
- <?php } //End foreach ?>
599
- <small>
600
- <?php esc_html_e('Choose wich set you want to insert.', 'yet-another-stars-rating'); ?>
601
- </small>
602
-
603
- <p>
604
- <label for="yasr-allow-vote-multiset">
605
- <input type="checkbox" id="yasr-allow-vote-multiset">
606
- <?php esc_html_e("Readonly?", 'yet-another-stars-rating'); ?>
607
- </label>
608
- <br/>
609
- </p>
610
-
611
- <small>
612
- <?php esc_html_e('If Readonly is checked, only you can insert the votes (in the box above the editor)',
613
- 'yet-another-stars-rating'); ?>
614
- </small>
615
-
616
- <p>
617
- <label for="yasr-hide-average-multiset">
618
- <input type="checkbox" id="yasr-hide-average-multiset">
619
- <?php esc_html_e("Hide Average?", 'yet-another-stars-rating'); ?>
620
- </label>
621
- <br/>
622
- </p>
623
-
624
- <p>
625
- <input type="button"
626
- class="button-primary"
627
- name="yasr-insert-multiset"
628
- id="yasr-insert-multiset-select"
629
- value="<?php esc_attr_e("Insert Multi Set", 'yet-another-stars-rating') ?>"/
630
- >
631
- <br/>
632
- </p>
633
-
634
- </td>
635
- </tr>
636
- <?php
637
- } //End if
638
- ?>
639
- </table>
640
 
641
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
642
 
643
- <div id="yasr-content-tab-charts" class="yasr-content-tab-tinymce" style="display:none">
 
 
 
 
 
 
 
 
 
 
 
 
 
644
 
645
- <table id="yasr-table-tiny-popup-charts" class="form-table">
646
- <tr>
647
- <th>
648
- <label for="yasr-10-overall">
649
- <?php esc_html_e("Ranking by overall rating", 'yet-another-stars-rating'); ?>
650
- </label>
651
- </th>
652
- <td>
653
- <?php
654
- echo self::yasr_tinymce_return_button(
655
- 'yasr_ov_ranking', 'Insert Ranking reviews'
656
- )
657
- ?>
658
- <br/>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
  <small>
660
- <?php esc_html_e('This ranking shows the highest rated posts rated through the
661
- yasr_overall_rating shortcode',
662
- 'yet-another-stars-rating'); ?>
663
  </small>
664
- </td>
665
- </tr>
666
-
667
- <tr>
668
- <th>
669
- <label for="yasr-10-highest-most-rated">
670
- <?php esc_html_e('Ranking by visitors votes', 'yet-another-stars-rating'); ?>
671
- </label>
672
- </th>
673
- <td>
674
- <?php
675
- echo self::yasr_tinymce_return_button(
676
- 'yasr_most_or_highest_rated_posts', 'Insert Users ranking'
677
- )
678
- ?>
679
- <br/>
 
 
 
 
 
 
 
 
 
 
680
  <small>
681
- <?php esc_html_e(
682
- 'This ranking shows both the highest and most rated posts rated through the
683
- yasr_visitor_votes shortcode. For an item to appear in this chart, it has to be rated at least twice. ',
684
- 'yet-another-stars-rating'); ?>
685
  </small>
686
- </td>
687
- </tr>
688
-
 
 
 
 
 
 
689
  <tr>
690
  <th>
691
- <label for="yasr-5-active-reviewers">
692
- <?php esc_html_e('Most Active Authors', 'yet-another-stars-rating'); ?>
693
- </label>
694
  </th>
695
  <td>
696
- <?php
697
- echo self::yasr_tinymce_return_button(
698
- 'yasr_top_reviewers', 'Insert Most Active Reviewers'
699
- )
700
- ?>
701
- <br/>
 
 
 
 
702
  <small>
703
- <?php
704
- esc_html_e('This ranking shows the most active reviewers on your site.',
705
- 'yet-another-stars-rating'); ?>
706
  </small>
707
- </td>
708
- </tr>
709
 
710
- <tr>
711
- <th>
712
- <label for="yasr-10-active-users">
713
- <?php esc_html_e('Most Active Users', 'yet-another-stars-rating'); ?>
714
- </label>
715
- </th>
716
- <td>
717
- <?php
718
- echo self::yasr_tinymce_return_button(
719
- 'yasr_most_active_users', 'Insert Most Active Reviewers'
720
- )
721
- ?>
722
- <br/>
723
  <small>
724
- <?php esc_html_e('This ranking shows the most active users, displaying the login name if logged in or “Anonymous” if not.',
725
  'yet-another-stars-rating'); ?>
726
  </small>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
727
  </td>
728
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
729
 
730
- </table>
 
 
731
 
732
- <div style="font-size: medium">
733
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
734
  echo(
735
  sprintf(__('%s Click here %s to customize the ranking and see a live preview',
736
  'yet-another-stars-rating'),
737
- '<a href="options-general.php?page=yasr_settings_page&tab=rankings">', '</a>')
738
- );
739
- ?>
740
- </div>
741
-
742
  </div>
743
-
744
- <?php do_action('yasr_add_content_on_tinypopupform'); ?>
745
-
746
  </div>
747
-
748
  <?php
749
-
750
- die();
751
-
752
- } //End callback function
753
 
754
  /**
755
- * returns button to be used in tinymce
756
  *
757
  * @author Dario Curvino <@dudo>
758
  * @since 2.6.5
@@ -762,7 +546,7 @@ class YasrEditorHooks {
762
  *
763
  * @return string
764
  */
765
- public static function yasr_tinymce_return_button($shortcode, $value = false) {
766
  $html_to_return = '';
767
 
768
  if ($value === false) {
@@ -806,7 +590,7 @@ class YasrEditorHooks {
806
  $post_id = (int) $_POST['post_id'];
807
 
808
  //set fields name and ids
809
- $set_fields = YasrMultiSetData::multisetFieldsAndID($set_id);
810
 
811
  //set meta values
812
  $array_to_return = YasrMultiSetData::returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id);
@@ -816,30 +600,6 @@ class YasrEditorHooks {
816
  die();
817
  }
818
 
819
- /**
820
- * Return true if the post type of the current screen base is 'appearance_page_gutenberg-edit-site'
821
- *
822
- * @author Dario Curvino <@dudo>
823
- * @since 2.9.6
824
- *
825
- * @param null $current_screen
826
- *
827
- * @return bool
828
- */
829
- public function isFseElement($current_screen = null) {
830
- if(!$current_screen) {
831
- $current_screen = get_current_screen();
832
- }
833
-
834
- if (property_exists($current_screen, 'base')
835
- && $current_screen->base === 'appearance_page_gutenberg-edit-site'
836
- ) {
837
- return true;
838
- }
839
-
840
- return false;
841
- }
842
-
843
  /**
844
  * Return the value of the attribute $custom_post_type
845
  *
32
  class YasrEditorHooks {
33
 
34
  private $custom_post_types = null;
35
+ public $multi_set = false;
36
+ public $n_multi_set = false;
37
 
38
  public function init() {
39
 
40
  //enable attribute "custom-fields" in cpt
41
  add_action('init', array($this, 'enableCptCustomFields'), 100);
42
 
 
 
 
 
 
43
  //This filter is used to add a new category in gutenberg
44
  add_filter('block_categories_all', array($this, 'addGutenbergCategory'), 10, 2);
45
 
 
 
 
 
 
 
46
  // Create 2 metaboxes in post and pages
47
  add_action('add_meta_boxes', array($this, 'addMetaboxes'));
48
 
49
  // Add a media content button
50
+ add_action('media_buttons', array($this, 'openTinymceButton'), 99);
 
 
 
 
51
 
52
  // Get Set name from post or page and output the set used in yasr-metabox-multiple-rating
53
  add_action('wp_ajax_yasr_send_id_nameset', array($this, 'metaboxOutputMultisets'));
76
 
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  /**
80
  * Adds a category in gutenberg blocks list
81
  *
96
  );
97
  }
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  /**
100
  * Adds two metaboxes
101
  *
162
  */
163
  public function yasr_metabox_below_editor_metabox_callback() {
164
  if (current_user_can(YASR_USER_CAPABILITY_EDIT_POST)) {
165
+ include(YASR_ABSOLUTE_PATH_ADMIN . '/editor/YasrMetaboxBelowEditor.php');
166
+ $metabox = new YasrMetaboxBelowEditor();
167
+ $metabox->printMetabox($this->multi_set, $this->n_multi_set);
168
  } else {
169
  esc_html_e('You don\'t have enough privileges to insert a Multi Set', 'yet-another-stars-rating');
170
  }
175
  *
176
  * @author Dario Curvino <@dudo>
177
  */
178
+ public function openTinymceButton() {
179
  if (is_admin()) {
180
  add_thickbox();
181
+ ?>
182
+ <a
183
+ id="yasr-shortcode-creator"
184
+ class="button">
185
+ <span class="dashicons dashicons-star-half" style="vertical-align: text-bottom;"></span> Yasr Shortcodes
186
+ </a>
187
+ <?php
188
+ $this->tinymcePopupContent();
189
  }
190
  }
191
 
192
  /**
193
+ * TinyMce Button content
194
+ *
195
  * @author Dario Curvino <@dudo>
196
+ * @since 3.0.6
197
  */
198
+ public function tinymcePopupContent () {
 
 
 
199
  global $wpdb;
200
+ $multi_set = YasrMultiSetData::returnMultiSetNames();
201
  $n_multi_set = $wpdb->num_rows;
202
 
203
+ $this->multi_set = $multi_set;
204
+ $this->n_multi_set = $n_multi_set;
205
 
206
+ $this->addTinymcePopupContent();
207
+ ?>
208
+ <div id="yasr-tinypopup-form" style="display: none;">
209
  <h2 class="nav-tab-wrapper yasr-underline">
210
+ <?php
211
+ //Use this action to add tabs inside shortcode creator
212
+ do_action('yasr_add_tabs_on_tinypopupform');
213
+ ?>
 
 
214
  <a href="https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen"
215
+ target="_blank"
216
+ id="yasr-tinypopup-link-doc">
217
  <?php esc_html_e('Read the doc', 'yet-another-stars-rating'); ?>
218
  </a>
219
  </h2>
220
 
221
+ <?php
222
+ //Use this action to add content inside shortcode creator
223
+ do_action('yasr_add_content_on_tinypopupform', $n_multi_set, $multi_set);
224
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
+ <?php
229
+ }
 
 
 
 
 
 
 
 
 
 
230
 
231
+ /**
232
+ * Add Actions for tab and content of Tinymce
233
+ *
234
+ * @author Dario Curvino <@dudo>
235
+ * @since 3.0.6
236
+ */
237
+ public function addTinymcePopupContent() {
238
+ //Add tabs
239
+ add_action('yasr_add_tabs_on_tinypopupform', array($this, 'tinymcePopupMainTab'), 10);
240
+ add_action('yasr_add_tabs_on_tinypopupform', array($this, 'tinymcePopupRankingsTab'), 20);
241
+
242
+ //Tab content
243
+ add_action('yasr_add_content_on_tinypopupform', array($this, 'tinymcePopupMainTabContent'), 10, 2);
244
+ add_action('yasr_add_content_on_tinypopupform', array($this, 'tinymcePopupRankingTabContent'), 20);
245
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
+ /**
248
+ * Adds the tab "Main"
249
+ *
250
+ * @author Dario Curvino <@dudo>
251
+ * @since 3.0.6
252
+ */
253
+ public function tinymcePopupMainTab() {
254
+ ?>
255
+ <a href="#" id="yasr-link-tab-main"
256
+ class="nav-tab nav-tab-active yasr-nav-tab">
257
+ <?php esc_html_e('Main', 'yet-another-stars-rating'); ?>
258
+ </a>
259
+ <?php
260
+ }
261
 
262
+ /**
263
+ * Adds the tab "Rankings"
264
+ *
265
+ * @author Dario Curvino <@dudo>
266
+ * @since 3.0.6
267
+ */
268
+ public function tinymcePopupRankingsTab() {
269
+ ?>
270
+ <a href="#" id="yasr-link-tab-charts"
271
+ class="nav-tab yasr-nav-tab">
272
+ <?php esc_html_e('Rankings', 'yet-another-stars-rating'); ?>
273
+ </a>
274
+ <?php
275
+ }
276
 
277
+ /**
278
+ * Content for the "main" tab in shortcode creator
279
+ *
280
+ * @author Dario Curvino <@dudo>
281
+ * @since 3.0.6
282
+ * @param $n_multi_set
283
+ * @param $multi_set
284
+ */
285
+ public function tinymcePopupMainTabContent ($n_multi_set, $multi_set) {
286
+ ?>
287
+ <div id="yasr-content-tab-main" class="yasr-content-tab-tinymce">
288
+ <table id="yasr-table-tiny-popup-main" class="form-table">
289
+ <tr>
290
+ <th>
291
+ <label for="yasr-overall">
292
+ <?php esc_html_e('Overall Rating', 'yet-another-stars-rating'); ?>
293
+ </label>
294
+ </th>
295
+ <td>
296
+ <input
297
+ type="button"
298
+ class="button-primary"
299
+ id="yasr-overall"
300
+ name="yasr-overall"
301
+ value="<?php esc_attr_e('Insert Overall Rating', 'yet-another-stars-rating'); ?>"
302
+ />
303
+ <br/>
304
+ <small>
305
+ <?php esc_html_e('Insert the author rating', 'yet-another-stars-rating'); ?>
306
+ </small>
307
+
308
+ <div id="yasr-overall-choose-size">
309
  <small>
310
+ <?php esc_html_e('Choose Size', 'yet-another-stars-rating'); ?>
 
 
311
  </small>
312
+ <div class="yasr-tinymce-button-size">
313
+ <?php
314
+ echo yasr_kses($this->tinyMceButtonCreator('yasr_overall_rating'));
315
+ ?>
316
+ </div>
317
+ </div>
318
+ </td>
319
+ </tr>
320
+ <tr>
321
+ <th>
322
+ <label for="yasr-id">
323
+ <?php esc_html_e('Visitor Votes', 'yet-another-stars-rating'); ?>
324
+ </label>
325
+ </th>
326
+ <td>
327
+ <input type="button"
328
+ class="button-primary"
329
+ name="yasr-visitor-votes"
330
+ id="yasr-visitor-votes"
331
+ value="<?php esc_attr_e("Insert Visitor Votes", 'yet-another-stars-rating'); ?>"/>
332
+ <br/>
333
+ <small>
334
+ <?php esc_html_e('Insert the ability for your visitors to vote', 'yet-another-stars-rating'); ?>
335
+ </small>
336
+
337
+ <div id="yasr-visitor-choose-size">
338
  <small>
339
+ <?php esc_html_e('Choose Size', 'yet-another-stars-rating'); ?>
 
 
 
340
  </small>
341
+ <div class="yasr-tinymce-button-size">
342
+ <?php
343
+ echo yasr_kses($this->tinyMceButtonCreator('yasr_visitor_votes'));
344
+ ?>
345
+ </div>
346
+ </div>
347
+ </td>
348
+ </tr>
349
+ <?php if ($n_multi_set > 0) { //If multiple Set are found ?>
350
  <tr>
351
  <th>
352
+ <?php esc_html_e('Insert Multiset:', 'yet-another-stars-rating'); ?>
 
 
353
  </th>
354
  <td>
355
+ <?php foreach ($multi_set as $name) { ?>
356
+ <label>
357
+ <input type="radio"
358
+ value="<?php echo esc_attr($name->set_id) ?>"
359
+ name="yasr_tinymce_pick_set"
360
+ class="yasr_tinymce_select_set">
361
+ <?php echo esc_attr($name->set_name); ?>
362
+ </label>
363
+ <br/>
364
+ <?php } //End foreach ?>
365
  <small>
366
+ <?php esc_html_e('Choose wich set you want to insert.', 'yet-another-stars-rating'); ?>
 
 
367
  </small>
 
 
368
 
369
+ <p>
370
+ <label for="yasr-allow-vote-multiset">
371
+ <input type="checkbox" id="yasr-allow-vote-multiset">
372
+ <?php esc_html_e('Readonly?', 'yet-another-stars-rating'); ?>
373
+ </label>
374
+ <br/>
375
+ </p>
376
+
 
 
 
 
 
377
  <small>
378
+ <?php esc_html_e('If Readonly is checked, only you can insert the votes (in the box above the editor)',
379
  'yet-another-stars-rating'); ?>
380
  </small>
381
+
382
+ <p>
383
+ <label for="yasr-hide-average-multiset">
384
+ <input type="checkbox" id="yasr-hide-average-multiset">
385
+ <?php esc_html_e("Hide Average?", 'yet-another-stars-rating'); ?>
386
+ </label>
387
+ <br/>
388
+ </p>
389
+
390
+ <p>
391
+ <input type="button"
392
+ class="button-primary"
393
+ name="yasr-insert-multiset"
394
+ id="yasr-insert-multiset-select"
395
+ value="<?php esc_attr_e("Insert Multi Set", 'yet-another-stars-rating') ?>"/
396
+ >
397
+ <br/>
398
+ </p>
399
+
400
  </td>
401
  </tr>
402
+ <?php
403
+ } //End if
404
+ ?>
405
+ <tr>
406
+ <th>
407
+ <label for="yasr-user-rate-history">
408
+ <?php esc_html_e('User Rate History', 'yet-another-stars-rating'); ?>
409
+ </label>
410
+ </th>
411
+ <td>
412
+ <?php
413
+ echo yasr_kses(
414
+ $this->tinyMceButtonCreator('yasr_user_rate_history', 'Insert User Rate History')
415
+ );
416
+ ?>
417
+ <br/>
418
+ <small>
419
+ <?php
420
+ esc_html_e('If user is logged in, this shortcode shows a list of all the ratings
421
+ provided by the user on [yasr_visitor_votes] shortcode.', 'yet-another-stars-rating');
422
+ ?>
423
+ </small>
424
+ </td>
425
+ </tr>
426
+ </table>
427
 
428
+ </div>
429
+ <?php
430
+ }
431
 
432
+ /**
433
+ * Content for the "ranking" tab in shortcode creator
434
+ *
435
+ * @author Dario Curvino <@dudo>
436
+ * @since 3.0.6
437
+ */
438
+ public function tinymcePopupRankingTabContent () {
439
+ ?>
440
+ <div id="yasr-content-tab-charts" class="yasr-content-tab-tinymce" style="display:none">
441
+ <table id="yasr-table-tiny-popup-charts" class="form-table">
442
+ <tr>
443
+ <th>
444
+ <label for="yasr-10-overall">
445
+ <?php esc_html_e('Ranking by overall rating', 'yet-another-stars-rating'); ?>
446
+ </label>
447
+ </th>
448
+ <td>
449
+ <?php
450
+ echo yasr_kses($this->tinyMceButtonCreator(
451
+ 'yasr_ov_ranking', 'Insert Ranking reviews'
452
+ ));
453
+ ?>
454
+ <br/>
455
+ <small>
456
+ <?php esc_html_e('This ranking shows the highest rated posts rated through the
457
+ yasr_overall_rating shortcode',
458
+ 'yet-another-stars-rating'); ?>
459
+ </small>
460
+ </td>
461
+ </tr>
462
+ <tr>
463
+ <th>
464
+ <label for="yasr-10-highest-most-rated">
465
+ <?php esc_html_e('Ranking by visitors votes', 'yet-another-stars-rating'); ?>
466
+ </label>
467
+ </th>
468
+ <td>
469
+ <?php
470
+ echo yasr_kses($this->tinyMceButtonCreator(
471
+ 'yasr_most_or_highest_rated_posts', 'Insert Users ranking'
472
+ ));
473
+ ?>
474
+ <br/>
475
+ <small>
476
+ <?php esc_html_e(
477
+ 'This ranking shows both the highest and most rated posts rated through the
478
+ yasr_visitor_votes shortcode. For an item to appear in this chart, it has to be rated at least twice. ',
479
+ 'yet-another-stars-rating'); ?>
480
+ </small>
481
+ </td>
482
+ </tr>
483
+ <tr>
484
+ <th>
485
+ <label for="yasr-5-active-reviewers">
486
+ <?php esc_html_e('Most Active Authors', 'yet-another-stars-rating'); ?>
487
+ </label>
488
+ </th>
489
+ <td>
490
+ <?php
491
+ echo yasr_kses($this->tinyMceButtonCreator(
492
+ 'yasr_top_reviewers', 'Insert Most Active Reviewers'
493
+ ));
494
+ ?>
495
+ <br/>
496
+ <small>
497
+ <?php
498
+ esc_html_e('This ranking shows the most active reviewers on your site.',
499
+ 'yet-another-stars-rating'); ?>
500
+ </small>
501
+ </td>
502
+ </tr>
503
+ <tr>
504
+ <th>
505
+ <label for="yasr-10-active-users">
506
+ <?php esc_html_e('Most Active Users', 'yet-another-stars-rating'); ?>
507
+ </label>
508
+ </th>
509
+ <td>
510
+ <?php
511
+ echo yasr_kses($this->tinyMceButtonCreator(
512
+ 'yasr_most_active_users', 'Insert Most Active Reviewers'
513
+ ));
514
+ ?>
515
+ <br/>
516
+ <small>
517
+ <?php esc_html_e('This ranking shows the most active users, displaying the login name if logged in or “Anonymous” if not.',
518
+ 'yet-another-stars-rating'); ?>
519
+ </small>
520
+ </td>
521
+ </tr>
522
+ </table>
523
+
524
+ <div style="font-size: medium">
525
+ <?php
526
  echo(
527
  sprintf(__('%s Click here %s to customize the ranking and see a live preview',
528
  'yet-another-stars-rating'),
529
+ '<a href="options-general.php?page=yasr_settings_page&tab=rankings">', '</a>'
530
+ )
531
+ );
532
+ ?>
 
533
  </div>
 
 
 
534
  </div>
 
535
  <?php
536
+ }
 
 
 
537
 
538
  /**
539
+ * Returns button to be used in tinymce
540
  *
541
  * @author Dario Curvino <@dudo>
542
  * @since 2.6.5
546
  *
547
  * @return string
548
  */
549
+ public function tinyMceButtonCreator($shortcode, $value = false) {
550
  $html_to_return = '';
551
 
552
  if ($value === false) {
590
  $post_id = (int) $_POST['post_id'];
591
 
592
  //set fields name and ids
593
+ $set_fields = YasrMultiSetData::multisetFieldsAndID($set_id);
594
 
595
  //set meta values
596
  $array_to_return = YasrMultiSetData::returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id);
600
  die();
601
  }
602
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  /**
604
  * Return the value of the attribute $custom_post_type
605
  *
admin/editor/YasrMetaboxBelowEditor.php ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ * Return the html to print the metabox below the editor
27
+ *
28
+ * @author Dario Curvino <@dudo>
29
+ * @since 3.0.6
30
+ * Class YasrMetaboxBelowEditor
31
+ */
32
+ class YasrMetaboxBelowEditor {
33
+
34
+ /**
35
+ * @author Dario Curvino <@dudo>
36
+ * @since 3.0.6
37
+ * @param $multi_set bool|array|object|\stdClass[]|null
38
+ * @param $n_multi_set bool|int
39
+ */
40
+ public function printMetabox ($multi_set = false, $n_multi_set = false) {
41
+ global $post;
42
+ $post_id = $post->ID;
43
+
44
+ if($multi_set === false || $n_multi_set === false) {
45
+ global $wpdb;
46
+
47
+ $multi_set = YasrMultiSetData::returnMultiSetNames();
48
+ $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the count number of rows of the last query
49
+ }
50
+
51
+ $this->addMetaboxContent($post_id, $multi_set);
52
+
53
+ ?>
54
+ <div>
55
+ <div style="display: table">
56
+ <?php
57
+ //use this hook to add new tabs
58
+ do_action('yasr_metabox_below_editor_add_tab');
59
+ ?>
60
+ </div>
61
+
62
+ <?php
63
+ //Use this hook to add new content
64
+ do_action('yasr_metabox_below_editor_content', $post_id, $multi_set, $n_multi_set);
65
+ ?>
66
+
67
+ </div>
68
+ <?php
69
+ }
70
+
71
+ /**
72
+ * Add action for schema and multiset tab and acontent
73
+ *
74
+ * @author Dario Curvino <@dudo>
75
+ * @since 3.0.6
76
+ * @param $post_id
77
+ * @param $multi_set
78
+ */
79
+ public function addMetaboxContent($post_id, $multi_set) {
80
+ // Add "Structured Data" tab
81
+ add_action('yasr_metabox_below_editor_add_tab', array($this, 'addSchemaTab'),10);
82
+
83
+ //add the content
84
+ add_action('yasr_metabox_below_editor_content', array($this, 'metaboxSchema'), 10);
85
+
86
+ //if multiset are used...
87
+ if ($multi_set) {
88
+ //add the tab
89
+ add_action('yasr_metabox_below_editor_add_tab', array($this, 'addMultisetTab'), 20);
90
+
91
+ //add the content
92
+ add_action('yasr_metabox_below_editor_content', array($this, 'metaboxMultiset'),20, 3);
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Html code for schema tab
98
+ *
99
+ * @author Dario Curvino <@dudo>
100
+ * @since 3.0.6
101
+ */
102
+ public function addSchemaTab() {
103
+ ?>
104
+ <a href="#" id="yasr-metabox-below-editor-structured-data-tab" class="nav-tab nav-tab-active yasr-nav-tab">
105
+ <?php esc_html_e('Structured Data', 'yet-another-stars-rating'); ?>
106
+ </a>
107
+ <?php
108
+ }
109
+
110
+ /**
111
+ * Hook into yasr_metabox_below_editor_content and add multiset content
112
+ *
113
+ * @author Dario Curvino <@dudo>
114
+ * @since 3.0.6
115
+ */
116
+ public function metaboxSchema() {
117
+ ?>
118
+ <div id="yasr-metabox-below-editor-structured-data" class="yasr-metabox-below-editor-content">
119
+ <?php include(YASR_ABSOLUTE_PATH_ADMIN . '/editor/yasr-metabox-schema.php'); ?>
120
+ </div>
121
+ <?php
122
+ }
123
+
124
+ /**
125
+ * Html code for multiset tab
126
+ *
127
+ * @author Dario Curvino <@dudo>
128
+ * @since 3.0.6
129
+ */
130
+ public function addMultisetTab() {
131
+ ?>
132
+ <a href="#" id="yasr-metabox-below-editor-multiset-tab" class="nav-tab yasr-nav-tab">
133
+ <?php esc_html_e('Multi Sets', 'yet-another-stars-rating'); ?>
134
+ </a>
135
+ <?php
136
+ }
137
+
138
+ /**
139
+ * Hook into yasr_metabox_below_editor_content and add multiset content
140
+ *
141
+ * @author Dario Curvino <@dudo>
142
+ * @since 3.0.6
143
+ * @param $post_id
144
+ * @param $multi_set
145
+ */
146
+ public function metaboxMultiset($post_id, $multi_set, $n_multi_set) {
147
+ wp_nonce_field('yasr_nonce_save_multi_values_action', 'yasr_nonce_save_multi_values');
148
+ wp_nonce_field('yasr_nonce_multiset_review_enabled_action','yasr_nonce_multiset_review_enabled');
149
+
150
+ //this is always the first set id
151
+ $set_id = $multi_set[0]->set_id;
152
+ $set_id = (int)$set_id;
153
+
154
+ ?>
155
+ <div id="yasr-metabox-below-editor-multiset" class="yasr-metabox-below-editor-content" style="display:none">
156
+ <?php
157
+ if ($n_multi_set > 1) {
158
+ $this->printSelectMultiset($multi_set);
159
+ } //End if ($n_multi_set>1)
160
+
161
+ $this->printMultisetDiv($n_multi_set, $set_id, $post_id);
162
+ $this->printMultisetProFeatures($post_id, $set_id);
163
+ ?>
164
+ </div>
165
+
166
+ <?php
167
+ }
168
+
169
+ /**
170
+ * Print HTML Select
171
+ *
172
+ * @author Dario Curvino <@dudo>
173
+ * @since 3.0.6
174
+ * @param $multi_set
175
+ */
176
+ private function printSelectMultiset($multi_set) {
177
+ ?>
178
+ <div style="margin-bottom: 15px">
179
+ <?php esc_html_e("Choose which set you want to use", 'yet-another-stars-rating'); ?>
180
+ <br />
181
+ <label for="yasr_select_set">
182
+ <select id="yasr_select_set" autocomplete="off">
183
+ <?php
184
+ foreach ($multi_set as $name) {
185
+ echo "<option value='".esc_attr($name->set_id)."'>".esc_attr($name->set_name)."</option>";
186
+ } //End foreach
187
+ ?>
188
+ </select>
189
+ </label>
190
+
191
+ <span id="yasr-loader-select-multi-set" style="display:none;" >&nbsp;
192
+ <img src="<?php echo esc_url(YASR_IMG_DIR . "/loader.gif") ?>" alt="yasr-loader">
193
+ </span>
194
+ </div>
195
+
196
+ <?php
197
+ }
198
+
199
+ /**
200
+ * Print the content of the Multiset Div
201
+ *
202
+ * @author Dario Curvino <@dudo>
203
+ * @since 3.0.6
204
+ * @param $n_multi_set
205
+ * @param $set_id
206
+ * @param $post_id
207
+ */
208
+ private function printMultisetDiv($n_multi_set, $set_id, $post_id) {
209
+ ?>
210
+ <div class="yasr-settings-row-48" style="justify-content: left;">
211
+ <div id="yasr-editor-multiset-container"
212
+ data-nmultiset="<?php echo esc_attr($n_multi_set) ?>"
213
+ data-setid="<?php echo esc_attr($set_id) ?>"
214
+ data-postid="<?php echo esc_attr($post_id) ?>">
215
+
216
+ <?php do_action('yasr_add_content_multiset_tab_top', $post_id, $set_id); ?>
217
+
218
+ <input type="hidden" name="yasr_multiset_author_votes" id="yasr-multiset-author-votes" value="">
219
+ <input type="hidden" name="yasr_multiset_id" id="yasr-multiset-id" value="<?php echo esc_attr($set_id) ?>">
220
+
221
+ <table class="yasr_table_multi_set_admin" id="yasr-table-multi-set-admin">
222
+ </table>
223
+
224
+ <div class="yasr-multi-set-admin-explain">
225
+ <div>
226
+ <?php
227
+ $span = '<span title="'.esc_attr__('Copy Shortcode', 'yet-another-stars-rating').'">
228
+ <code id="yasr-editor-copy-readonly-multiset"
229
+ class="yasr-copy-shortcode">[yasr_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
230
+ </span>';
231
+
232
+ $text_multiset = sprintf(esc_html__( 'Rate each element, and copy this shortcode %s where you want to display this rating.',
233
+ 'yet-another-stars-rating'), $span);
234
+
235
+ echo wp_kses_post($text_multiset);
236
+ ?>
237
+ </div>
238
+ </div>
239
+
240
+ </div>
241
+
242
+ <div id="yasr-visitor-multiset-container">
243
+ <table class="yasr_table_multi_set_admin" id="yasr-table-multi-set-admin-visitor">
244
+ </table>
245
+
246
+ <div class="yasr-multi-set-admin-explain">
247
+ <?php
248
+ esc_html_e( 'If, you want allow your visitor to vote on this multiset, use this shortcode',
249
+ 'yet-another-stars-rating' );
250
+ ?>
251
+ <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
252
+ <code id="yasr-editor-copy-visitor-multiset"
253
+ class="yasr-copy-shortcode">[yasr_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
254
+ </span>
255
+
256
+ <br />
257
+ <?php esc_html_e('This is just a preview, you can\'t vote here.', 'yet-another-stars-rating');?>
258
+ </div>
259
+ </div>
260
+
261
+ </div>
262
+
263
+ <p></p>
264
+
265
+ <?php
266
+ }
267
+
268
+ /**
269
+ * Print the box below the multiset
270
+ *
271
+ * @author Dario Curvino <@dudo>
272
+ * @since 3.0.6
273
+ * @param $post_id
274
+ * @param $set_id
275
+ */
276
+ private function printMultisetProFeatures($post_id, $set_id) {
277
+ global $post;
278
+ ?>
279
+ <div style="width: 98%">
280
+ <div class="yasr-metabox-editor-pro-only-box-padding">
281
+ <div class="yasr-metabox-editor-title-pro-only">
282
+ <?php
283
+ esc_html_e('Pro Only features', 'yet-another-stars-rating');
284
+ echo '&nbsp;'.YASR_LOCKED_FEATURE;
285
+ ?>
286
+ </div>
287
+
288
+ <div class="yasr-settings-row">
289
+ <div class="yasr-settings-col-30">
290
+ <?php do_action('yasr_add_content_multiset_tab_pro', $post_id, $set_id); ?>
291
+
292
+ <div class="yasr-metabox-editor-title">
293
+ <?php
294
+ esc_html_e('Insert this Multi Set in the comment form?', 'yet-another-stars-rating');
295
+ ?>
296
+ </div>
297
+ <div class="yasr-onoffswitch-big" id="yasr-pro-multiset-review-switcher-container">
298
+ <input type="checkbox"
299
+ name="yasr_pro_multiset_review_enabled"
300
+ class="yasr-onoffswitch-checkbox"
301
+ value='yes'
302
+ id="yasr-pro-multiset-review-switcher"
303
+ <?php
304
+ //required to check !== otherwise setid=0 is checked even if not enabled
305
+ if ($post->yasr_pro_review_setid !== '' && (int)$post->yasr_pro_review_setid === $set_id) {
306
+ echo " checked='checked' ";
307
+ }
308
+ echo YASR_LOCKED_FEATURE_HTML_ATTRIBUTE;
309
+ ?>
310
+ >
311
+ <label class="yasr-onoffswitch-label" for="yasr-pro-multiset-review-switcher">
312
+ <span class="yasr-onoffswitch-inner"></span>
313
+ <span class="yasr-onoffswitch-switch"></span>
314
+ </label>
315
+ </div>
316
+ <div class="yasr-element-row-container-description">
317
+ <?php
318
+ esc_html_e('By enabling this, all ratings fields will be mandatory.',
319
+ 'yet-another-stars-rating')
320
+ ?>
321
+ </div>
322
+ </div>
323
+
324
+ <div class="yasr-settings-col-65">
325
+ <div class="yasr-metabox-editor-title">
326
+ <?php esc_html_e('Shortcodes', 'yet-another-stars-rating'); ?>
327
+ </div>
328
+
329
+ <div>
330
+ <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
331
+ <code id="yasr-editor-copy-average-multiset" class="yasr-copy-shortcode">
332
+ [yasr_pro_average_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
333
+ </span>
334
+
335
+ <span>
336
+ <?php esc_html_e('Use this shortcode to print only the average of '); ?>
337
+ [yasr_multiset setid=<span class="yasr-editor-multiset-id"></span>]
338
+ </span>
339
+ </div>
340
+
341
+ <p></p>
342
+
343
+ <div>
344
+ <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
345
+ <code id="yasr-editor-copy-average-vvmultiset" class="yasr-copy-shortcode">
346
+ [yasr_pro_average_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
347
+ </span>
348
+
349
+ <span>
350
+ <?php esc_html_e('Use this shortcode to print only the average of '); ?>
351
+ [yasr_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]
352
+ </span>
353
+ </div>
354
+
355
+ <p></p>
356
+
357
+ <div>
358
+ <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
359
+ <code id="yasr-editor-copy-comments-multiset" class="yasr-copy-shortcode">
360
+ [yasr_pro_average_comments_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
361
+ </span>
362
+
363
+ <span>
364
+ <?php esc_html_e('This shortcode will print a Multi Set with all the ratings given through the comment form '); ?>
365
+ </span>
366
+ </div>
367
+ </div>
368
+ </div>
369
+
370
+ </div>
371
+
372
+ </div>
373
+ <?php
374
+ }
375
+ }
admin/editor/YasrMetaboxSchemaFields.php CHANGED
@@ -377,12 +377,12 @@ class YasrMetaboxSchemaFields {
377
  );
378
  }
379
 
380
- echo $string_input;
381
 
382
  if(isset($property['description'] ) && $property['description'] !== '') {
383
- echo '<div class="yasr-element-row-container-description">'
384
  . $property['description'] .
385
- '</div>';
386
  }
387
 
388
  }
377
  );
378
  }
379
 
380
+ echo yasr_kses($string_input);
381
 
382
  if(isset($property['description'] ) && $property['description'] !== '') {
383
+ echo yasr_kses('<div class="yasr-element-row-container-description">'
384
  . $property['description'] .
385
+ '</div>');
386
  }
387
 
388
  }
admin/editor/blocks/rankingMostActiveReviewers.block.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: Most Active Authors",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/most-active-reviewers",
6
+ "description": "This ranking shows the most active reviewers on your site.",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "ranking",
11
+ "highest",
12
+ "most",
13
+ "chart",
14
+ "authors"
15
+ ],
16
+ "supports": {
17
+ "align": [
18
+ "left",
19
+ "center",
20
+ "right"
21
+ ]
22
+ },
23
+ "editorScript": "yasr-shortcodes-blocks"
24
+ }
admin/editor/blocks/rankingMostActiveUsers.block.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: Most Active Visitors",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/most-active-users",
6
+ "description": "This ranking shows the most active users, displaying the login name if logged in or \"Anonymous\" if not",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "ranking",
11
+ "highest",
12
+ "most",
13
+ "chart",
14
+ "visitors"
15
+ ],
16
+ "supports": {
17
+ "align": [
18
+ "left",
19
+ "center",
20
+ "right"
21
+ ]
22
+ },
23
+ "editorScript": "yasr-shortcodes-blocks"
24
+ }
admin/editor/blocks/rankingOverallRating.block.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: Ranking by overall rating",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/overall-rating-ranking",
6
+ "description": "This ranking shows the highest rated posts rated through the overall_rating shortcode.",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "ranking",
11
+ "highest",
12
+ "chart"
13
+ ],
14
+ "supports": {
15
+ "align": [
16
+ "left",
17
+ "center",
18
+ "right"
19
+ ]
20
+ },
21
+ "editorScript": "yasr-shortcodes-blocks"
22
+ }
admin/editor/blocks/rankingVisitorVotes.block.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: Ranking by visitors votes",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/visitor-votes-ranking",
6
+ "description": "This ranking shows both the highest and most rated posts rated through the yasr_visitor_votes shortcode. For an item to appear in this chart, it has to be rated at least twice.",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "ranking",
11
+ "highest",
12
+ "most",
13
+ "chart"
14
+ ],
15
+ "supports": {
16
+ "align": [
17
+ "left",
18
+ "center",
19
+ "right"
20
+ ]
21
+ },
22
+ "editorScript": "yasr-shortcodes-blocks"
23
+ }
admin/editor/blocks/yasrOverallRating.block.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: Overall Rating",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/overall-rating",
6
+ "description": "Insert the author rating.",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "rating",
11
+ "author",
12
+ "overall"
13
+ ],
14
+ "attributes": {
15
+ "size": {
16
+ "type": "string",
17
+ "default": "large"
18
+ },
19
+ "postId": {
20
+ "type": "string",
21
+ "default": false
22
+ }
23
+ },
24
+ "supports": {
25
+ "align": [
26
+ "left",
27
+ "center",
28
+ "right"
29
+ ]
30
+ },
31
+ "editorScript": "yasr-shortcodes-blocks"
32
+ }
admin/editor/blocks/yasrUserRateHistory.block.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: User Rate History",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/user-rate-history",
6
+ "description": "If user is logged in, this shortcode shows a list of all the ratings provided by the user on [yasr_visitor_votes] shortcode",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "ratings",
11
+ "list",
12
+ "history"
13
+ ],
14
+ "supports": {
15
+ "align": [
16
+ "left",
17
+ "center",
18
+ "right"
19
+ ]
20
+ },
21
+ "editorScript": "yasr-shortcodes-blocks"
22
+ }
admin/editor/blocks/yasrVisitorVotes.block.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "title": "Yasr: Visitor Votes",
3
+ "$schema": "https://schemas.wp.org/trunk/block.json",
4
+ "apiVersion": 2,
5
+ "name": "yet-another-stars-rating/visitor-votes",
6
+ "description": "Insert the ability for your visitors to vote.",
7
+ "icon": "star-half",
8
+ "category": "yet-another-stars-rating",
9
+ "keywords": [
10
+ "rating",
11
+ "visitor",
12
+ "votes",
13
+ "stars"
14
+ ],
15
+ "attributes": {
16
+ "size": {
17
+ "type": "string",
18
+ "default": "large"
19
+ },
20
+ "postId": {
21
+ "type": "string",
22
+ "default": false
23
+ }
24
+ },
25
+ "supports": {
26
+ "align": [
27
+ "left",
28
+ "center",
29
+ "right"
30
+ ]
31
+ },
32
+ "editorScript": "yasr-shortcodes-blocks"
33
+ }
admin/editor/yasr-metabox-below-editor.php DELETED
@@ -1,59 +0,0 @@
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
- $multi_set = YasrMultiSetData::returnMultiSetNames();
26
-
27
- ?>
28
-
29
- <div>
30
- <div style="display: table">
31
- <a href="#" id="yasr-metabox-below-editor-structured-data-tab"
32
- class="nav-tab nav-tab-active yasr-nav-tab"><?php esc_html_e("Structured Data", 'yet-another-stars-rating'); ?></a>
33
- <?php if ($multi_set) {
34
- ?>
35
- <a href="#" id="yasr-metabox-below-editor-multiset-tab"
36
- class="nav-tab yasr-nav-tab"><?php esc_html_e("Multi Sets", 'yet-another-stars-rating'); ?></a>
37
- <?php
38
- }
39
- ?>
40
-
41
- </div>
42
-
43
- <div id="yasr-metabox-below-editor-structured-data" class="yasr-metabox-below-editor-content">
44
- <?php include(YASR_ABSOLUTE_PATH_ADMIN . '/editor/yasr-metabox-schema.php'); ?>
45
- </div>
46
-
47
- <?php
48
-
49
- //If multiset are used then add the second metabox
50
- if ($multi_set) {
51
- ?>
52
- <div id="yasr-metabox-below-editor-multiset" class="yasr-metabox-below-editor-content" style="display:none">
53
- <?php include(YASR_ABSOLUTE_PATH_ADMIN . '/editor/yasr-metabox-multiple-rating.php'); ?>
54
- </div>
55
- <?php
56
- }
57
- ?>
58
-
59
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/editor/yasr-metabox-multiple-rating.php DELETED
@@ -1,213 +0,0 @@
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
- $multi_set = YasrMultiSetData::returnMultiSetNames();
26
- $post_id = $post->ID;
27
- wp_nonce_field('yasr_nonce_save_multi_values_action', 'yasr_nonce_save_multi_values');
28
- wp_nonce_field('yasr_nonce_multiset_review_enabled_action','yasr_nonce_multiset_review_enabled');
29
-
30
- global $wpdb;
31
-
32
- $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the count number of rows of the last query
33
-
34
- //this is always the first set id
35
- $set_id = $multi_set[0]->set_id;
36
- $set_id = (int)$set_id;
37
-
38
- if ($n_multi_set > 1) {
39
- ?>
40
- <div style="margin-bottom: 15px">
41
- <?php esc_html_e("Choose which set you want to use", 'yet-another-stars-rating'); ?>
42
- <br />
43
- <label for="yasr_select_set">
44
- <select id="yasr_select_set" autocomplete="off">
45
- <?php
46
- foreach ($multi_set as $name) {
47
- echo "<option value='".esc_attr($name->set_id)."'>".esc_attr($name->set_name)."</option>";
48
- } //End foreach
49
- ?>
50
- </select>
51
- </label>
52
-
53
- <span id="yasr-loader-select-multi-set" style="display:none;" >&nbsp;
54
- <img src="<?php echo esc_url(YASR_IMG_DIR . "/loader.gif") ?>" alt="yasr-loader">
55
- </span>
56
- </div>
57
-
58
- <?php
59
-
60
- } //End if ($n_multi_set>1)
61
-
62
- ?>
63
-
64
- <div class="yasr-settings-row-48" style="justify-content: left;">
65
- <div id="yasr-editor-multiset-container"
66
- data-nmultiset="<?php echo esc_attr($n_multi_set) ?>"
67
- data-setid="<?php echo esc_attr($set_id) ?>"
68
- data-postid="<?php echo esc_attr($post_id) ?>">
69
-
70
- <?php do_action('yasr_add_content_multiset_tab_top', $post_id, $set_id); ?>
71
-
72
- <input type="hidden" name="yasr_multiset_author_votes" id="yasr-multiset-author-votes" value="">
73
- <input type="hidden" name="yasr_multiset_id" id="yasr-multiset-id" value="<?php echo esc_attr($set_id) ?>">
74
-
75
- <table class="yasr_table_multi_set_admin" id="yasr-table-multi-set-admin">
76
- </table>
77
-
78
- <div class="yasr-multi-set-admin-explain">
79
- <div>
80
- <?php
81
- $span = '<span title="'.esc_attr__('Copy Shortcode', 'yet-another-stars-rating').'">
82
- <code id="yasr-editor-copy-readonly-multiset"
83
- class="yasr-copy-shortcode">[yasr_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
84
- </span>';
85
-
86
- $text_multiset = sprintf(esc_html__( 'Rate each element, and copy this shortcode %s where you want to display this rating.',
87
- 'yet-another-stars-rating'), $span);
88
-
89
- echo wp_kses_post($text_multiset);
90
- ?>
91
- </div>
92
- </div>
93
-
94
- </div>
95
-
96
- <div id="yasr-visitor-multiset-container">
97
- <table class="yasr_table_multi_set_admin" id="yasr-table-multi-set-admin-visitor">
98
- </table>
99
-
100
- <div class="yasr-multi-set-admin-explain">
101
- <?php
102
- esc_html_e( 'If, you want allow your visitor to vote on this multiset, use this shortcode',
103
- 'yet-another-stars-rating' );
104
- ?>
105
- <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
106
- <code id="yasr-editor-copy-visitor-multiset"
107
- class="yasr-copy-shortcode">[yasr_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
108
- </span>
109
-
110
- <br />
111
- <?php esc_html_e('This is just a preview, you can\'t vote here.', 'yet-another-stars-rating');?>
112
- </div>
113
- </div>
114
-
115
- </div>
116
-
117
- <p></p>
118
-
119
- <div style="width: 98%">
120
- <div class="yasr-metabox-editor-pro-only-box-padding">
121
- <div class="yasr-metabox-editor-title-pro-only">
122
- <?php
123
- esc_html_e('Pro Only features', 'yet-another-stars-rating');
124
- echo '&nbsp;'.YASR_LOCKED_FEATURE;
125
- ?>
126
- </div>
127
-
128
- <div class="yasr-settings-row">
129
- <div class="yasr-settings-col-30">
130
-
131
- <?php do_action('yasr_add_content_multiset_tab_pro', $post_id, $set_id); ?>
132
-
133
- <div class="yasr-metabox-editor-title">
134
- <?php
135
- esc_html_e('Insert this Multi Set in the comment form?', 'yet-another-stars-rating');
136
- ?>
137
- </div>
138
- <div class="yasr-onoffswitch-big" id="yasr-pro-multiset-review-switcher-container">
139
- <input type="checkbox"
140
- name="yasr_pro_multiset_review_enabled"
141
- class="yasr-onoffswitch-checkbox"
142
- value='yes'
143
- id="yasr-pro-multiset-review-switcher"
144
- <?php
145
- //required to check !== otherwise setid=0 is checked even if not enabled
146
- if ($post->yasr_pro_review_setid !== '' && (int)$post->yasr_pro_review_setid === $set_id) {
147
- echo " checked='checked' ";
148
- }
149
- echo YASR_LOCKED_FEATURE_HTML_ATTRIBUTE;
150
- ?>
151
- >
152
- <label class="yasr-onoffswitch-label" for="yasr-pro-multiset-review-switcher">
153
- <span class="yasr-onoffswitch-inner"></span>
154
- <span class="yasr-onoffswitch-switch"></span>
155
- </label>
156
- </div>
157
- <div class="yasr-element-row-container-description">
158
- <?php
159
- esc_html_e('By enabling this, all ratings fields will be mandatory.',
160
- 'yet-another-stars-rating')
161
- ?>
162
- </div>
163
- </div>
164
-
165
- <div class="yasr-settings-col-65">
166
- <div class="yasr-metabox-editor-title">
167
- <?php esc_html_e('Shortcodes', 'yet-another-stars-rating'); ?>
168
- </div>
169
-
170
- <div>
171
- <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
172
- <code id="yasr-editor-copy-average-multiset" class="yasr-copy-shortcode">
173
- [yasr_pro_average_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
174
- </span>
175
-
176
- <span>
177
- <?php esc_html_e('Use this shortcode to print only the average of '); ?>
178
- [yasr_multiset setid=<span class="yasr-editor-multiset-id"></span>]
179
- </span>
180
- </div>
181
-
182
- <p></p>
183
-
184
- <div>
185
- <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
186
- <code id="yasr-editor-copy-average-vvmultiset" class="yasr-copy-shortcode">
187
- [yasr_pro_average_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
188
- </span>
189
-
190
- <span>
191
- <?php esc_html_e('Use this shortcode to print only the average of '); ?>
192
- [yasr_visitor_multiset setid=<span class="yasr-editor-multiset-id"></span>]
193
- </span>
194
- </div>
195
-
196
- <p></p>
197
-
198
- <div>
199
- <span title="<?php esc_attr_e('Copy Shortcode', 'yet-another-stars-rating') ?>">
200
- <code id="yasr-editor-copy-comments-multiset" class="yasr-copy-shortcode">
201
- [yasr_pro_average_comments_multiset setid=<span class="yasr-editor-multiset-id"></span>]</code>
202
- </span>
203
-
204
- <span>
205
- <?php esc_html_e('This shortcode will print a Multi Set with all the ratings given through the comment form '); ?>
206
- </span>
207
- </div>
208
- </div>
209
- </div>
210
-
211
- </div>
212
-
213
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/js/guten/blocks/noStarsRankings.js DELETED
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,t,a,r,n,s,l,c={534:(e,t,a)=>{a.r(t),a.d(t,{YasrBlocksPanel:()=>b,YasrDivRatingOverall:()=>S,YasrNoSettingsPanel:()=>h,YasrPrintInputId:()=>R,YasrPrintSelectSize:()=>d,YasrProText:()=>E,yasrLabelSelectSize:()=>o,yasrLeaveThisBlankText:()=>y,yasrOptionalText:()=>c,yasrOverallDescription:()=>v,yasrSelectSizeChoose:()=>i,yasrSelectSizeLarge:()=>p,yasrSelectSizeMedium:()=>m,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>g});var r=a(534),n=wp.i18n.__,s=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,c=n("All these settings are optional","yet-another-stars-rating"),o=n("Choose Size","yet-another-stars-rating"),i=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),m=n("Medium","yet-another-stars-rating"),p=n("Large","yet-another-stars-rating"),y=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),v=n("Remember: only the post author can rate here.","yet-another-stars-rating"),g=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function d(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function R(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function E(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function h(e){return React.createElement("div",null,React.createElement(E,null))}function b(e){var t;return"visitors"===e.block&&(t=g),"overall"===e.block&&(t=v),React.createElement(l,null,"overall"===e.block&&React.createElement(S,null),React.createElement(s,{title:"Settings"},React.createElement("h3",null,c),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,o),React.createElement("div",null,React.createElement(d,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(R,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},y)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function S(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,a,r)}}))}}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var a=o[e]={exports:{}};return c[e](a,a.exports,i),a.exports}i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e=i(534),t=wp.blocks.registerBlockType,a=wp.components.PanelBody,r=wp.element.Fragment,n=wp.blockEditor,s=n.useBlockProps,l=n.InspectorControls,t("yet-another-stars-rating/most-active-users",{edit:function(t){var n=s({className:"yasr-active-users-block"}),c=[React.createElement(e.YasrNoSettingsPanel,{key:0})];function o(e){return React.createElement(l,null,React.createElement(a,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,c))))}return wp.hooks.doAction("yasr_top_visitor_setting",c),React.createElement(r,null,React.createElement(o,null),React.createElement("div",n,"[yasr_most_active_users]"))},save:function(e){var t=s.save({className:"yasr-active-users-block"});return React.createElement("div",t,"[yasr_most_active_users]")}}),t("yet-another-stars-rating/most-active-reviewers",{edit:function(t){var n=s({className:"yasr-reviewers-block"}),c=[React.createElement(e.YasrNoSettingsPanel,{key:0})];function o(e){return React.createElement(l,null,React.createElement(a,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,c))))}return wp.hooks.doAction("yasr_top_reviewers_setting",c),React.createElement(r,null,React.createElement(o,null),React.createElement("div",n,"[yasr_top_reviewers]"))},save:function(e){var t=s.save({className:"yasr-reviewers-block"});return React.createElement("div",t,"[yasr_top_reviewers]")}})})();
 
admin/js/guten/blocks/overallRating.js DELETED
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,t,a,r,n={534:(e,t,a)=>{a.r(t),a.d(t,{YasrBlocksPanel:()=>E,YasrDivRatingOverall:()=>S,YasrNoSettingsPanel:()=>R,YasrPrintInputId:()=>b,YasrPrintSelectSize:()=>v,YasrProText:()=>h,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>y,yasrOptionalText:()=>o,yasrOverallDescription:()=>g,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>p,yasrSelectSizeMedium:()=>m,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>d});var r=a(534),n=wp.i18n.__,l=wp.components.PanelBody,s=wp.blockEditor.InspectorControls,o=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),m=n("Medium","yet-another-stars-rating"),p=n("Large","yet-another-stars-rating"),y=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),g=n("Remember: only the post author can rate here.","yet-another-stars-rating"),d=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function v(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function b(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function h(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function R(e){return React.createElement("div",null,React.createElement(h,null))}function E(e){var t;return"visitors"===e.block&&(t=d),"overall"===e.block&&(t=g),React.createElement(s,null,"overall"===e.block&&React.createElement(S,null),React.createElement(l,{title:"Settings"},React.createElement("h3",null,o),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(v,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(b,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},y)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function S(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,a,r)}}))}}},l={};function s(e){var t=l[e];if(void 0!==t)return t.exports;var a=l[e]={exports:{}};return n[e](a,a.exports,s),a.exports}s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e=s(534),wp.i18n.__,t=wp.blocks.registerBlockType,a=wp.element.Fragment,r=wp.blockEditor.useBlockProps,t("yet-another-stars-rating/overall-rating",{edit:function(t){var n=r({className:"yasr-overall-block"}),l=t.attributes,s=l.size,o=l.postId,i=t.setAttributes,c=t.isSelected,u=null,m=null;return"large"!==s&&(u=' size="'+s+'"'),!0===/^\d+$/.test(o)&&(m=' postid="'+o+'"'),React.createElement(a,null,c&&React.createElement(e.YasrBlocksPanel,{block:"overall",size:s,postId:o,setAttributes:i}),React.createElement("div",n,"[yasr_overall_rating",u,m,"]",c&&React.createElement(e.YasrPrintSelectSize,{size:s,setAttributes:i})))},save:function(e){var t=r.save({className:"yasr-overall-block"}),a=e.attributes,n=a.size,l=a.postId,s="";return n&&(s+='size="'+n+'"'),l&&(s+=' postid="'+l+'"'),React.createElement("div",t,"[yasr_overall_rating ",s,"]")}})})();
 
admin/js/guten/blocks/rankings.js DELETED
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,t,a,r,n,l,s,o={534:(e,t,a)=>{a.r(t),a.d(t,{YasrBlocksPanel:()=>b,YasrDivRatingOverall:()=>k,YasrNoSettingsPanel:()=>E,YasrPrintInputId:()=>h,YasrPrintSelectSize:()=>d,YasrProText:()=>R,yasrLabelSelectSize:()=>c,yasrLeaveThisBlankText:()=>y,yasrOptionalText:()=>o,yasrOverallDescription:()=>p,yasrSelectSizeChoose:()=>i,yasrSelectSizeLarge:()=>g,yasrSelectSizeMedium:()=>m,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>v});var r=a(534),n=wp.i18n.__,l=wp.components.PanelBody,s=wp.blockEditor.InspectorControls,o=n("All these settings are optional","yet-another-stars-rating"),c=n("Choose Size","yet-another-stars-rating"),i=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),m=n("Medium","yet-another-stars-rating"),g=n("Large","yet-another-stars-rating"),y=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),p=n("Remember: only the post author can rate here.","yet-another-stars-rating"),v=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function d(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function h(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function R(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function E(e){return React.createElement("div",null,React.createElement(R,null))}function b(e){var t;return"visitors"===e.block&&(t=v),"overall"===e.block&&(t=p),React.createElement(s,null,"overall"===e.block&&React.createElement(k,null),React.createElement(l,{title:"Settings"},React.createElement("h3",null,o),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,c),React.createElement("div",null,React.createElement(d,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(h,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},y)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function k(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,a,r)}}))}}},c={};function i(e){var t=c[e];if(void 0!==t)return t.exports;var a=c[e]={exports:{}};return o[e](a,a.exports,i),a.exports}i.d=(e,t)=>{for(var a in t)i.o(t,a)&&!i.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e=i(534),t=wp.blocks.registerBlockType,a=wp.components.PanelBody,r=wp.element.Fragment,n=wp.blockEditor,l=n.useBlockProps,s=n.InspectorControls,t("yet-another-stars-rating/overall-rating-ranking",{edit:function(t){var n=l({className:"yasr-ov-ranking-block"}),o=[React.createElement(e.YasrNoSettingsPanel,{key:0})];function c(e){return React.createElement(s,null,React.createElement(a,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,o))))}return wp.hooks.doAction("yasr_overall_rating_rankings",o),React.createElement(r,null,React.createElement(c,null),React.createElement("div",n,"[yasr_ov_ranking]"))},save:function(e){var t=l.save({className:"yasr-ov-ranking-block"});return React.createElement("div",t,"[yasr_ov_ranking]")}}),t("yet-another-stars-rating/visitor-votes-ranking",{edit:function(t){var n=l({className:"yasr-vv-ranking-block"}),o=[React.createElement(e.YasrNoSettingsPanel,{key:0})];function c(e){return React.createElement(s,null,React.createElement(a,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,o))))}return wp.hooks.doAction("yasr_visitor_votes_rankings",o),React.createElement(r,null,React.createElement(c,null),React.createElement("div",n,"[yasr_most_or_highest_rated_posts]"))},save:function(e){var t=l.save({className:"yasr-vv-ranking-block"});return React.createElement("div",t,"[yasr_most_or_highest_rated_posts]")}})})();
 
admin/js/guten/blocks/shortcodes.js ADDED
@@ -0,0 +1 @@
 
1
+ (()=>{"use strict";var e={161:(e,t,a)=>{var r=a(534),n=wp.blocks.registerBlockType,s=wp.components.PanelBody,l=wp.element.Fragment,c=wp.blockEditor,o=c.useBlockProps,i=c.InspectorControls;n("yet-another-stars-rating/most-active-users",{edit:function(e){var t=o({className:"yasr-active-users-block"}),a=[React.createElement(r.YasrNoSettingsPanel,{key:0})];function n(e){return React.createElement(i,null,React.createElement(s,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,a))))}return wp.hooks.doAction("yasr_top_visitor_setting",a),React.createElement(l,null,React.createElement(n,null),React.createElement("div",t,"[yasr_most_active_users]"))},save:function(e){var t=o.save({className:"yasr-active-users-block"});return React.createElement("div",t,"[yasr_most_active_users]")}}),n("yet-another-stars-rating/most-active-reviewers",{edit:function(e){var t=o({className:"yasr-reviewers-block"}),a=[React.createElement(r.YasrNoSettingsPanel,{key:0})];function n(e){return React.createElement(i,null,React.createElement(s,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,a))))}return wp.hooks.doAction("yasr_top_reviewers_setting",a),React.createElement(l,null,React.createElement(n,null),React.createElement("div",t,"[yasr_top_reviewers]"))},save:function(e){var t=o.save({className:"yasr-reviewers-block"});return React.createElement("div",t,"[yasr_top_reviewers]")}})},972:(e,t,a)=>{var r=a(534),n=wp.blocks.registerBlockType,s=wp.element.Fragment,l=wp.blockEditor.useBlockProps;n("yet-another-stars-rating/overall-rating",{edit:function(e){var t=l({className:"yasr-overall-block"}),a=e.attributes,n=a.size,c=a.postId,o=e.setAttributes,i=e.isSelected,u=null,m=null;return"large"!==n&&(u=' size="'+n+'"'),!0===/^\d+$/.test(c)&&(m=' postid="'+c+'"'),React.createElement(s,null,i&&React.createElement(r.YasrBlocksPanel,{block:"overall",size:n,postId:c,setAttributes:o}),React.createElement("div",t,"[yasr_overall_rating",u,m,"]",i&&React.createElement(r.YasrPrintSelectSize,{size:n,setAttributes:o})))},save:function(e){var t=l.save({className:"yasr-overall-block"}),a=e.attributes,r=a.size,n=a.postId,s="";return r&&(s+='size="'+r+'"'),n&&(s+=' postid="'+n+'"'),React.createElement("div",t,"[yasr_overall_rating ",s,"]")}})},982:(e,t,a)=>{var r=a(534),n=wp.blocks.registerBlockType,s=wp.components.PanelBody,l=wp.element.Fragment,c=wp.blockEditor,o=c.useBlockProps,i=c.InspectorControls;n("yet-another-stars-rating/overall-rating-ranking",{edit:function(e){var t=o({className:"yasr-ov-ranking-block"}),a=[React.createElement(r.YasrNoSettingsPanel,{key:0})];function n(e){return React.createElement(i,null,React.createElement(s,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,a))))}return wp.hooks.doAction("yasr_overall_rating_rankings",a),React.createElement(l,null,React.createElement(n,null),React.createElement("div",t,"[yasr_ov_ranking]"))},save:function(e){var t=o.save({className:"yasr-ov-ranking-block"});return React.createElement("div",t,"[yasr_ov_ranking]")}}),n("yet-another-stars-rating/visitor-votes-ranking",{edit:function(e){var t=o({className:"yasr-vv-ranking-block"}),a=[React.createElement(r.YasrNoSettingsPanel,{key:0})];function n(e){return React.createElement(i,null,React.createElement(s,{title:"Settings"},React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("div",null,a))))}return wp.hooks.doAction("yasr_visitor_votes_rankings",a),React.createElement(l,null,React.createElement(n,null),React.createElement("div",t,"[yasr_most_or_highest_rated_posts]"))},save:function(e){var t=o.save({className:"yasr-vv-ranking-block"});return React.createElement("div",t,"[yasr_most_or_highest_rated_posts]")}})},835:(e,t,a)=>{var r=a(534),n=wp.blocks.registerBlockType,s=(wp.components.PanelBody,wp.element.Fragment),l=wp.blockEditor,c=l.useBlockProps;l.InspectorControls,n("yet-another-stars-rating/user-rate-history",{edit:function(e){var t=c({className:"yasr-user-rate-history"}),a=[React.createElement(r.YasrNoSettingsPanel,{key:0})];return wp.hooks.doAction("yasr_user_rate_history_settings",a),React.createElement(s,null,React.createElement("div",t,"[yasr_user_rate_history]"))},save:function(e){var t=c.save({className:"yasr-user-rate-history"});return React.createElement("div",t,"[yasr_user_rate_history]")}})},466:(e,t,a)=>{var r=a(534),n=wp.blocks.registerBlockType,s=wp.element.Fragment,l=wp.blockEditor.useBlockProps;n("yet-another-stars-rating/visitor-votes",{edit:function(e){var t=l({className:"yasr-vv-block"}),a=e.attributes,n=a.size,c=a.postId,o=e.setAttributes,i=e.isSelected,u=null,m=null;return"large"!==n&&(u=' size="'+n+'"'),!0===/^\d+$/.test(c)&&(m=' postid="'+c+'"'),React.createElement(s,null,React.createElement(r.YasrBlocksPanel,{block:"visitors",size:n,setAttributes:o,postId:c}),React.createElement("div",t,"[yasr_visitor_votes",u,m,"]",i&&React.createElement(r.YasrPrintSelectSize,{size:n,setAttributes:o})))},save:function(e){var t=l.save({className:"yasr-vv-block"}),a=e.attributes,r=a.size,n=a.postId,s="";return r&&(s+='size="'+r+'"'),n&&(s+=' postid="'+n+'"'),React.createElement("div",t,"[yasr_visitor_votes ",s,"]")}})},534:(e,t,a)=>{a.r(t),a.d(t,{YasrBlocksPanel:()=>b,YasrDivRatingOverall:()=>_,YasrNoSettingsPanel:()=>k,YasrPrintInputId:()=>E,YasrPrintSelectSize:()=>g,YasrProText:()=>R,yasrLabelSelectSize:()=>o,yasrLeaveThisBlankText:()=>p,yasrOptionalText:()=>c,yasrOverallDescription:()=>y,yasrSelectSizeChoose:()=>i,yasrSelectSizeLarge:()=>v,yasrSelectSizeMedium:()=>m,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>d});var r=a(534),n=wp.i18n.__,s=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,c=n("All these settings are optional","yet-another-stars-rating"),o=n("Choose Size","yet-another-stars-rating"),i=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),m=n("Medium","yet-another-stars-rating"),v=n("Large","yet-another-stars-rating"),p=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),y=n("Remember: only the post author can rate here.","yet-another-stars-rating"),d=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function E(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function R(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function k(e){return React.createElement("div",null,React.createElement(R,null))}function b(e){var t;return"visitors"===e.block&&(t=d),"overall"===e.block&&(t=y),React.createElement(l,null,"overall"===e.block&&React.createElement(_,null),React.createElement(s,{title:"Settings"},React.createElement("h3",null,c),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,o),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(E,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},"Use return (↵) to save."),React.createElement("p",null,p)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function _(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,a,r)}}))}}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,a),s.exports}a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a(534),a(972),a(466),a(982),a(161),a(835)})();
admin/js/guten/blocks/visitorVotes.js DELETED
@@ -1 +0,0 @@
1
- (()=>{"use strict";var e,t,a,r,n={534:(e,t,a)=>{a.r(t),a.d(t,{YasrBlocksPanel:()=>E,YasrDivRatingOverall:()=>S,YasrNoSettingsPanel:()=>R,YasrPrintInputId:()=>b,YasrPrintSelectSize:()=>v,YasrProText:()=>h,yasrLabelSelectSize:()=>o,yasrLeaveThisBlankText:()=>y,yasrOptionalText:()=>i,yasrOverallDescription:()=>d,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>p,yasrSelectSizeMedium:()=>m,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>g});var r=a(534),n=wp.i18n.__,s=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,i=n("All these settings are optional","yet-another-stars-rating"),o=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),m=n("Medium","yet-another-stars-rating"),p=n("Large","yet-another-stars-rating"),y=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),d=n("Remember: only the post author can rate here.","yet-another-stars-rating"),g=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function v(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(a=t).target.querySelector("option:checked").value}),void a.preventDefault();var a}},React.createElement("option",{value:"--"},r.yasrSelectSizeChoose),React.createElement("option",{value:"small"},r.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},r.yasrSelectSizeMedium),React.createElement("option",{value:"large"},r.yasrSelectSizeLarge)))}function b(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var a=t.target.value;!0!==/^\d+$/.test(a)&&""!==a||e({postId:a}),t.preventDefault()}}(e.setAttributes,t)}}))}function h(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function R(e){return React.createElement("div",null,React.createElement(h,null))}function E(e){var t;return"visitors"===e.block&&(t=g),"overall"===e.block&&(t=d),React.createElement(l,null,"overall"===e.block&&React.createElement(S,null),React.createElement(s,{title:"Settings"},React.createElement("h3",null,i),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,o),React.createElement("div",null,React.createElement(v,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(b,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},y)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function S(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),a=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,r=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,a,r)}}))}}},s={};function l(e){var t=s[e];if(void 0!==t)return t.exports;var a=s[e]={exports:{}};return n[e](a,a.exports,l),a.exports}l.d=(e,t)=>{for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e=l(534),wp.i18n.__,t=wp.blocks.registerBlockType,a=wp.element.Fragment,r=wp.blockEditor.useBlockProps,t("yet-another-stars-rating/visitor-votes",{edit:function(t){var n=r({className:"yasr-vv-block"}),s=t.attributes,l=s.size,i=s.postId,o=t.setAttributes,c=t.isSelected,u=null,m=null;return"large"!==l&&(u=' size="'+l+'"'),!0===/^\d+$/.test(i)&&(m=' postid="'+i+'"'),React.createElement(a,null,React.createElement(e.YasrBlocksPanel,{block:"visitors",size:l,setAttributes:o,postId:i}),React.createElement("div",n,"[yasr_visitor_votes",u,m,"]",c&&React.createElement(e.YasrPrintSelectSize,{size:l,setAttributes:o})))},save:function(e){var t=r.save({className:"yasr-vv-block"}),a=e.attributes,n=a.size,s=a.postId,l="";return n&&(l+='size="'+n+'"'),s&&(l+=' postid="'+s+'"'),React.createElement("div",t,"[yasr_visitor_votes ",l,"]")}})})();
 
admin/js/guten/yasr-guten-misc.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e={534:(e,t,r)=>{"use strict";r.r(t),r.d(t,{YasrBlocksPanel:()=>R,YasrDivRatingOverall:()=>E,YasrNoSettingsPanel:()=>b,YasrPrintInputId:()=>h,YasrPrintSelectSize:()=>g,YasrProText:()=>v,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>m,yasrOptionalText:()=>s,yasrOverallDescription:()=>d,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>p,yasrSelectSizeMedium:()=>y,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>f});var a=r(534),n=wp.i18n.__,o=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,s=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),y=n("Medium","yet-another-stars-rating"),p=n("Large","yet-another-stars-rating"),m=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),d=n("Remember: only the post author can rate here.","yet-another-stars-rating"),f=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(r=t).target.querySelector("option:checked").value}),void r.preventDefault();var r}},React.createElement("option",{value:"--"},a.yasrSelectSizeChoose),React.createElement("option",{value:"small"},a.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},a.yasrSelectSizeMedium),React.createElement("option",{value:"large"},a.yasrSelectSizeLarge)))}function h(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var r=t.target.value;!0!==/^\d+$/.test(r)&&""!==r||e({postId:r}),t.preventDefault()}}(e.setAttributes,t)}}))}function v(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function b(e){return React.createElement("div",null,React.createElement(v,null))}function R(e){var t;return"visitors"===e.block&&(t=f),"overall"===e.block&&(t=d),React.createElement(l,null,"overall"===e.block&&React.createElement(E,null),React.createElement(o,{title:"Settings"},React.createElement("h3",null,s),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(h,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},m)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function E(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),r=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,a=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,r,a)}}))}}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}function a(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var o=wp.i18n.__,l=wp.blocks.registerBlockType,s=wp.components,i=s.PanelBody,c=(s.PanelRow,wp.element.Fragment),u=wp.editor,y=(u.BlockControls,u.InspectorControls),p=o("All these settings are optional","yet-another-stars-rating"),m=o("Choose Size","yet-another-stars-rating"),d=o("Choose stars size","yet-another-stars-rating"),f=o("Small","yet-another-stars-rating"),g=o("Medium","yet-another-stars-rating"),h=o("Large","yet-another-stars-rating"),v=o("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),b=o("Remember: only the post author can rate here.","yet-another-stars-rating"),R=o("This is the star set where your users will be able to vote","yet-another-stars-rating"),E=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Overall Rating" again.',"yet-another-stars-rating"),w=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Visitors Votes" again.',"yet-another-stars-rating");l("yet-another-stars-rating/yasr-overall-rating",{title:o("[DEPRECATED]Yasr: Overall Rating","yet-another-stars-rating"),description:E,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("author","yet-another-stars-rating"),o("overall","yet-another-stars-rating")],attributes:{overallRatingMeta:{type:"number",source:"meta",meta:"yasr_overall_rating"},size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var l,s=e.attributes,u=s.overallRatingMeta,R=s.size,E=s.postId,w=e.setAttributes,k=e.isSelected,_=u,S=null,P=null;"--"!==R&&(S=' size="'+R+'"'),l=/^\d+$/.test(E),"--"!==E&&!0===l&&(P=' postid="'+E+'"');var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(y,React.Component);var l,s,i,c,u=(i=y,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=n(i);if(c){var r=n(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return a(this,e)});function y(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,y),(t=u.call(this,e)).yasrOverallRateThis=o("Rate this article / item","yet-another-stars-rating"),t}return l=y,(s=[{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,React.createElement("div",{id:"overall-rater",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:_,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),w({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(l.prototype,s),Object.defineProperty(l,"prototype",{writable:!1}),y}();function z(){return React.createElement("form",null,React.createElement("select",{value:R,onChange:I},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function I(e){var t=e.target.querySelector("option:checked");w({size:t.value}),e.preventDefault()}function C(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:T}))}function T(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||w({postId:t}),e.preventDefault()}}function N(e){return React.createElement(y,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(i,{title:"Settings"},React.createElement("h3",null,p),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(z,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(C,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return React.createElement(c,null,React.createElement(N,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",S,P,"]",k&&React.createElement(z,null)))},save:function(e){var t=e.attributes,r=t.size,a=t.postId,n="",o=a;return r&&(n+='size="'+r+'"'),a&&("--"===a&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_overall_rating ",n,"]")}}),l("yet-another-stars-rating/yasr-visitor-votes",{title:o("[DEPRECATED]Yasr: Visitor Votes","yet-another-stars-rating"),description:w,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("visitor","yet-another-stars-rating"),o("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,r=e.attributes,a=r.size,n=r.postId,o=e.setAttributes,l=e.isSelected,s=null,u=null;function b(){return React.createElement("form",null,React.createElement("select",{value:a,onChange:E},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function E(e){var t=e.target.querySelector("option:checked");o({size:t.value}),e.preventDefault()}function w(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:k}))}function k(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||o({postId:t}),e.preventDefault()}}function _(e){return React.createElement(y,null,React.createElement(i,{title:"Settings"},React.createElement("h3",null,p),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(b,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(w,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return t=/^\d+$/.test(n),"--"!==a&&(s=' size="'+a+'"'),"--"!==n&&!0===t&&(u=' postid="'+n+'"'),React.createElement(c,null,React.createElement(_,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",s,u,"]",l&&React.createElement(b,null)))},save:function(e){var t=e.attributes,r=t.size,a=t.postId,n="",o=a;return r&&(n+='size="'+r+'"'),a&&("--"===a&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_visitor_votes ",n,"]")}}),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-overall-rating"),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-visitor-votes")})(),(()=>{"use strict";var e=r(534);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function i(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=y(e);if(t){var n=y(this).constructor;r=Reflect.construct(a,arguments,n)}else r=a.apply(this,arguments);return c(this,r)}}function c(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=wp.i18n.__,m=wp.plugins.registerPlugin,d=wp.editPost,f=d.PluginSidebar,g=d.PluginSidebarMoreMenuItem,h=wp.components.PanelBody,v=wp.element.Fragment,b=function(){return React.createElement("div",null)},R=function(e){l(r,React.Component);var t=i(r);function r(e){var n;a(this,r),n=t.call(this,e);var o=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(o=!0),n.state={postExcluded:o},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(u(n)),n}return o(r,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,r="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:r}),!0===r?wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"yes"}}):wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"no"}})}},{key:"render",value:function(){return React.createElement("div",{className:"yasr-guten-block-panel-center"},React.createElement("hr",null),React.createElement("label",null,React.createElement("span",null,p("Disable auto insert for this post or page?","yet-another-stars-rating"))),React.createElement("div",{className:"yasr-onoffswitch-big yasr-onoffswitch-big-center",id:"yasr-switcher-disable-auto-insert"},React.createElement("input",{type:"checkbox",name:"yasr_auto_insert_disabled",className:"yasr-onoffswitch-checkbox",value:"yes",id:"yasr-auto-insert-disabled-switch",defaultChecked:this.state.postExcluded,onChange:this.yasrUpdatePostMetaAutoInsert}),React.createElement("label",{className:"yasr-onoffswitch-label",htmlFor:"yasr-auto-insert-disabled-switch"},React.createElement("span",{className:"yasr-onoffswitch-inner"}),React.createElement("span",{className:"yasr-onoffswitch-switch"}))))}}]),r}(),E=function(t){l(n,React.Component);var r=i(n);function n(e){var t;a(this,n),t=r.call(this,e);var o=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(o=!0),t.state={yasrAutoInsertEnabled:o},t}return o(n,[{key:"render",value:function(){var t=[React.createElement(b,{key:0})];return wp.hooks.doAction("yasr_below_panel",t),React.createElement(v,null,React.createElement(g,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},p("YASR post settings","yet-another-stars-rating")),React.createElement(f,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(h,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(e.YasrDivRatingOverall,null),React.createElement("div",null,p('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating")),this.state.yasrAutoInsertEnabled&&React.createElement(R,null),t))))}}]),n}();m("yasr-sidebar",{icon:"star-half",title:p("Yasr: Settings","yet-another-stars-rating"),render:E})})()})();
1
+ (()=>{var e={534:(e,t,r)=>{"use strict";r.r(t),r.d(t,{YasrBlocksPanel:()=>R,YasrDivRatingOverall:()=>E,YasrNoSettingsPanel:()=>b,YasrPrintInputId:()=>h,YasrPrintSelectSize:()=>g,YasrProText:()=>v,yasrLabelSelectSize:()=>i,yasrLeaveThisBlankText:()=>m,yasrOptionalText:()=>s,yasrOverallDescription:()=>d,yasrSelectSizeChoose:()=>c,yasrSelectSizeLarge:()=>y,yasrSelectSizeMedium:()=>p,yasrSelectSizeSmall:()=>u,yasrVisitorVotesDescription:()=>f});var a=r(534),n=wp.i18n.__,o=wp.components.PanelBody,l=wp.blockEditor.InspectorControls,s=n("All these settings are optional","yet-another-stars-rating"),i=n("Choose Size","yet-another-stars-rating"),c=n("Choose stars size","yet-another-stars-rating"),u=n("Small","yet-another-stars-rating"),p=n("Medium","yet-another-stars-rating"),y=n("Large","yet-another-stars-rating"),m=n("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),d=n("Remember: only the post author can rate here.","yet-another-stars-rating"),f=n("This is the star set where your users will be able to vote","yet-another-stars-rating");function g(e){return React.createElement("form",null,React.createElement("select",{value:e.size,onChange:function(t){return(0,e.setAttributes)({size:(r=t).target.querySelector("option:checked").value}),void r.preventDefault();var r}},React.createElement("option",{value:"--"},a.yasrSelectSizeChoose),React.createElement("option",{value:"small"},a.yasrSelectSizeSmall),React.createElement("option",{value:"medium"},a.yasrSelectSizeMedium),React.createElement("option",{value:"large"},a.yasrSelectSizeLarge)))}function h(e){var t;return!1!==e.postId&&(t=e.postId),React.createElement("div",null,React.createElement("input",{type:"text",size:"4",defaultValue:t,onKeyPress:function(t){return function(e,t){if("Enter"===t.key){var r=t.target.value;!0!==/^\d+$/.test(r)&&""!==r||e({postId:r}),t.preventDefault()}}(e.setAttributes,t)}}))}function v(){var e=n("To be able to customize this ranking, you need","yet-another-stars-rating"),t=n("You can buy the plugin, including support, updates and upgrades, on","yet-another-stars-rating");return React.createElement("h3",null,e," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings#yasr-pro"},"Yasr Pro."),React.createElement("br",null),t," ",React.createElement("a",{href:"https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=gutenberg_panel&utm_campaign=yasr_editor_screen&utm_content=rankings"},"yetanotherstarsrating.com"))}function b(e){return React.createElement("div",null,React.createElement(v,null))}function R(e){var t;return"visitors"===e.block&&(t=f),"overall"===e.block&&(t=d),React.createElement(l,null,"overall"===e.block&&React.createElement(E,null),React.createElement(o,{title:"Settings"},React.createElement("h3",null,s),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,i),React.createElement("div",null,React.createElement(g,{size:e.size,setAttributes:e.setAttributes}))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(h,{postId:e.postId,setAttributes:e.setAttributes}),React.createElement("div",{className:"yasr-guten-block-explain"},"Use return (↵) to save."),React.createElement("p",null,m)),React.createElement("div",{className:"yasr-guten-block-panel"},t)))}function E(e){if(!0===JSON.parse(yasrConstantGutenberg.isFseElement))return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement("div",null,n("This is a template file, you can't rate here. You need to insert the rating inside the single post or page","yet-another-stars-rating")),React.createElement("br",null));var t=n("Rate this article / item","yet-another-stars-rating"),r=wp.data.select("core/editor").getCurrentPost().meta.yasr_overall_rating,a=function(e,t){e=e.toFixed(1),e=parseFloat(e),wp.data.dispatch("core/editor").editPost({meta:{yasr_overall_rating:e}}),this.setRating(e),t()};return React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},t,React.createElement("div",{id:"overall-rater",ref:function(){return yasrSetRaterValue(32,"overall-rater",!1,.1,!1,r,a)}}))}}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,r),o.exports}r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e,t){return r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(e,t)}function a(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(t)}function n(e){return n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(e)}var o=wp.i18n.__,l=wp.blocks.registerBlockType,s=wp.components,i=s.PanelBody,c=(s.PanelRow,wp.element.Fragment),u=wp.editor,p=(u.BlockControls,u.InspectorControls),y=o("All these settings are optional","yet-another-stars-rating"),m=o("Choose Size","yet-another-stars-rating"),d=o("Choose stars size","yet-another-stars-rating"),f=o("Small","yet-another-stars-rating"),g=o("Medium","yet-another-stars-rating"),h=o("Large","yet-another-stars-rating"),v=o("Leave this blank if you don't know what you're doing.","yet-another-stars-rating"),b=o("Remember: only the post author can rate here.","yet-another-stars-rating"),R=o("This is the star set where your users will be able to vote","yet-another-stars-rating"),E=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Overall Rating" again.',"yet-another-stars-rating"),w=o('This block is now deprecated. It will still work, but I suggest to replace it with the new one by simply removing it and adding "Yasr Visitors Votes" again.',"yet-another-stars-rating");l("yet-another-stars-rating/yasr-overall-rating",{title:o("[DEPRECATED]Yasr: Overall Rating","yet-another-stars-rating"),description:E,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("author","yet-another-stars-rating"),o("overall","yet-another-stars-rating")],attributes:{overallRatingMeta:{type:"number",source:"meta",meta:"yasr_overall_rating"},size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var l,s=e.attributes,u=s.overallRatingMeta,R=s.size,E=s.postId,w=e.setAttributes,k=e.isSelected,_=u,S=null,P=null;"--"!==R&&(S=' size="'+R+'"'),l=/^\d+$/.test(E),"--"!==E&&!0===l&&(P=' postid="'+E+'"');var O=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&r(e,t)}(p,React.Component);var l,s,i,c,u=(i=p,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=n(i);if(c){var r=n(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return a(this,e)});function p(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(t=u.call(this,e)).yasrOverallRateThis=o("Rate this article / item","yet-another-stars-rating"),t}return l=p,(s=[{key:"render",value:function(){return React.createElement("div",null,this.yasrOverallRateThis,React.createElement("div",null,React.createElement("div",{id:"overall-rater",ref:function(){return raterJs({starSize:32,step:.1,showToolTip:!1,rating:_,readOnly:!1,element:document.querySelector("#overall-rater"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),w({overallRatingMeta:e}),this.setRating(e),t()}})}})))}}])&&t(l.prototype,s),Object.defineProperty(l,"prototype",{writable:!1}),p}();function z(){return React.createElement("form",null,React.createElement("select",{value:R,onChange:I},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function I(e){var t=e.target.querySelector("option:checked");w({size:t.value}),e.preventDefault()}function C(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:T}))}function T(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||w({postId:t}),e.preventDefault()}}function N(e){return React.createElement(p,null,React.createElement("div",{class:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(O,null)),React.createElement(i,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(z,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(C,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},b)))}return React.createElement(c,null,React.createElement(N,null),React.createElement("div",{className:e.className},"[yasr_overall_rating",S,P,"]",k&&React.createElement(z,null)))},save:function(e){var t=e.attributes,r=t.size,a=t.postId,n="",o=a;return r&&(n+='size="'+r+'"'),a&&("--"===a&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_overall_rating ",n,"]")}}),l("yet-another-stars-rating/yasr-visitor-votes",{title:o("[DEPRECATED]Yasr: Visitor Votes","yet-another-stars-rating"),description:w,icon:"star-half",keywords:[o("rating","yet-another-stars-rating"),o("visitor","yet-another-stars-rating"),o("votes","yet-another-stars-rating")],attributes:{size:{type:"string",default:"--"},postId:{type:"string",default:"--"}},edit:function(e){var t,r=e.attributes,a=r.size,n=r.postId,o=e.setAttributes,l=e.isSelected,s=null,u=null;function b(){return React.createElement("form",null,React.createElement("select",{value:a,onChange:E},React.createElement("option",{value:"--"},d),React.createElement("option",{value:"small"},f),React.createElement("option",{value:"medium"},g),React.createElement("option",{value:"large"},h)))}function E(e){var t=e.target.querySelector("option:checked");o({size:t.value}),e.preventDefault()}function w(){return React.createElement("div",null,React.createElement("input",{type:"text",size:"4",onKeyPress:k}))}function k(e){if("Enter"===e.key){var t=e.target.value;!0!==/^\d+$/.test(t)&&""!==t||o({postId:t}),e.preventDefault()}}function _(e){return React.createElement(p,null,React.createElement(i,{title:"Settings"},React.createElement("h3",null,y),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,m),React.createElement("div",null,React.createElement(b,null))),React.createElement("div",{className:"yasr-guten-block-panel"},React.createElement("label",null,"Post ID"),React.createElement(w,null),React.createElement("div",{className:"yasr-guten-block-explain"},v)),React.createElement("div",{className:"yasr-guten-block-panel"},R)))}return t=/^\d+$/.test(n),"--"!==a&&(s=' size="'+a+'"'),"--"!==n&&!0===t&&(u=' postid="'+n+'"'),React.createElement(c,null,React.createElement(_,null),React.createElement("div",{className:e.className},"[yasr_visitor_votes",s,u,"]",l&&React.createElement(b,null)))},save:function(e){var t=e.attributes,r=t.size,a=t.postId,n="",o=a;return r&&(n+='size="'+r+'"'),a&&("--"===a&&(o=wp.data.select("core/editor").getCurrentPostId()),n+=' postid="'+o+'"'),React.createElement("div",null,"[yasr_visitor_votes ",n,"]")}}),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-overall-rating"),wp.data.dispatch("core/edit-post").hideBlockTypes("yet-another-stars-rating/yasr-visitor-votes")})(),(()=>{"use strict";var e=r(534);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function i(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,a=p(e);if(t){var n=p(this).constructor;r=Reflect.construct(a,arguments,n)}else r=a.apply(this,arguments);return c(this,r)}}function c(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}var y=wp.i18n.__,m=wp.plugins.registerPlugin,d=wp.editPost,f=d.PluginSidebar,g=d.PluginSidebarMoreMenuItem,h=wp.components.PanelBody,v=wp.element.Fragment,b=function(){return React.createElement("div",null)},R=function(e){l(r,React.Component);var t=i(r);function r(e){var n;a(this,r),n=t.call(this,e);var o=!1;return"yes"===wp.data.select("core/editor").getCurrentPost().meta.yasr_auto_insert_disabled&&(o=!0),n.state={postExcluded:o},n.yasrUpdatePostMetaAutoInsert=n.yasrUpdatePostMetaAutoInsert.bind(u(n)),n}return o(r,[{key:"yasrUpdatePostMetaAutoInsert",value:function(e){var t=e.target,r="checkbox"===t.type?t.checked:t.value;this.setState({postExcluded:r}),!0===r?wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"yes"}}):wp.data.dispatch("core/editor").editPost({meta:{yasr_auto_insert_disabled:"no"}})}},{key:"render",value:function(){return React.createElement("div",{className:"yasr-guten-block-panel-center"},React.createElement("hr",null),React.createElement("label",null,React.createElement("span",null,y("Disable auto insert for this post or page?","yet-another-stars-rating"))),React.createElement("div",{className:"yasr-onoffswitch-big yasr-onoffswitch-big-center",id:"yasr-switcher-disable-auto-insert"},React.createElement("input",{type:"checkbox",name:"yasr_auto_insert_disabled",className:"yasr-onoffswitch-checkbox",value:"yes",id:"yasr-auto-insert-disabled-switch",defaultChecked:this.state.postExcluded,onChange:this.yasrUpdatePostMetaAutoInsert}),React.createElement("label",{className:"yasr-onoffswitch-label",htmlFor:"yasr-auto-insert-disabled-switch"},React.createElement("span",{className:"yasr-onoffswitch-inner"}),React.createElement("span",{className:"yasr-onoffswitch-switch"}))))}}]),r}(),E=function(t){l(n,React.Component);var r=i(n);function n(e){var t;a(this,n),t=r.call(this,e);var o=!1;return"disabled"!==yasrConstantGutenberg.autoInsert&&(o=!0),t.state={yasrAutoInsertEnabled:o},t}return o(n,[{key:"render",value:function(){var t=[React.createElement(b,{key:0})];return wp.hooks.doAction("yasr_below_panel",t),React.createElement(v,null,React.createElement(g,{name:"yasr-sidebar",type:"sidebar",target:"yasr-guten-sidebar"},y("YASR post settings","yet-another-stars-rating")),React.createElement(f,{name:"yasr-guten-sidebar",title:"YASR Settings"},React.createElement(h,null,React.createElement("div",{className:"yasr-guten-block-panel yasr-guten-block-panel-center"},React.createElement(e.YasrDivRatingOverall,null),React.createElement("div",null,y('This is the same value that you find the "Yasr: Overall Rating" block.',"yet-another-stars-rating")),this.state.yasrAutoInsertEnabled&&React.createElement(R,null),t))))}}]),n}();m("yasr-sidebar",{icon:"star-half",title:y("Yasr: Settings","yet-another-stars-rating"),render:E})})()})();
admin/js/src/guten/blocks/overallRating.js CHANGED
@@ -1,4 +1,3 @@
1
- const { __ } = wp.i18n; // Import __() from wp.i18n
2
  const {registerBlockType} = wp.blocks; // Import from wp.blocks
3
  const {Fragment} = wp.element;
4
  const {useBlockProps} = wp.blockEditor;
 
1
  const {registerBlockType} = wp.blocks; // Import from wp.blocks
2
  const {Fragment} = wp.element;
3
  const {useBlockProps} = wp.blockEditor;
admin/js/src/guten/blocks/userRateHistory.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const {registerBlockType} = wp.blocks; // Import from wp.blocks
2
+ const {PanelBody} = wp.components;
3
+ const {Fragment} = wp.element;
4
+ const {useBlockProps, InspectorControls} = wp.blockEditor;
5
+
6
+ import {YasrNoSettingsPanel} from "yasrGutenUtils";
7
+
8
+ //Most active users
9
+ registerBlockType(
10
+ 'yet-another-stars-rating/user-rate-history', {
11
+ edit:
12
+ function(props) {
13
+ const blockProps = useBlockProps( {
14
+ className: 'yasr-user-rate-history'
15
+ } );
16
+
17
+ let YasrUserRateHisotrySettings = [<YasrNoSettingsPanel key={0}/>];
18
+ {wp.hooks.doAction('yasr_user_rate_history_settings', YasrUserRateHisotrySettings)}
19
+
20
+ function YasrUserRateHistoryPanel (props) {
21
+ return (
22
+ <InspectorControls>
23
+ <PanelBody title='Settings'>
24
+ <div className="yasr-guten-block-panel">
25
+ <div>
26
+ {YasrUserRateHisotrySettings}
27
+ </div>
28
+ </div>
29
+ </PanelBody>
30
+ </InspectorControls>
31
+ );
32
+ }
33
+
34
+ return (
35
+ <Fragment>
36
+ <div {...blockProps}>
37
+ [yasr_user_rate_history]
38
+ </div>
39
+ </Fragment>
40
+ );
41
+ },
42
+
43
+ /**
44
+ * The save function defines the way in which the different attributes should be combined
45
+ * into the final markup, which is then serialized by Gutenberg into post_content.
46
+ *
47
+ * The "save" property must be specified and must be a valid function.
48
+ *
49
+ * @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
50
+ */
51
+ save:
52
+ function(props) {
53
+ const blockProps = useBlockProps.save( {
54
+ className: 'yasr-user-rate-history'
55
+ } );
56
+ return (
57
+ <div {...blockProps}>[yasr_user_rate_history]</div>
58
+ );
59
+ },
60
+
61
+ }
62
+ );
admin/js/src/guten/blocks/visitorVotes.js CHANGED
@@ -1,6 +1,5 @@
1
  import {YasrBlocksPanel, YasrPrintSelectSize} from "./yasrGutenUtils";
2
 
3
- const { __ } = wp.i18n; // Import __() from wp.i18n
4
  const {registerBlockType} = wp.blocks; // Import from wp.blocks
5
  const {Fragment} = wp.element;
6
  const {useBlockProps} = wp.blockEditor;
1
  import {YasrBlocksPanel, YasrPrintSelectSize} from "./yasrGutenUtils";
2
 
 
3
  const {registerBlockType} = wp.blocks; // Import from wp.blocks
4
  const {Fragment} = wp.element;
5
  const {useBlockProps} = wp.blockEditor;
admin/js/src/guten/blocks/yasrGutenUtils.js CHANGED
@@ -130,8 +130,12 @@ export function YasrBlocksPanel (props) {
130
  <label>Post ID</label>
131
  <YasrPrintInputId postId={props.postId} setAttributes={props.setAttributes}/>
132
  <div className="yasr-guten-block-explain">
133
- {yasrLeaveThisBlankText}
134
  </div>
 
 
 
 
135
  </div>
136
 
137
  <div className="yasr-guten-block-panel">
130
  <label>Post ID</label>
131
  <YasrPrintInputId postId={props.postId} setAttributes={props.setAttributes}/>
132
  <div className="yasr-guten-block-explain">
133
+ Use return (&#8629;) to save.
134
  </div>
135
+ <p>
136
+ {yasrLeaveThisBlankText}
137
+ </p>
138
+
139
  </div>
140
 
141
  <div className="yasr-guten-block-panel">
admin/js/src/yasr-editor-screen.js CHANGED
@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function(event) {
13
  yasrPrintMetaBoxOverall();
14
 
15
  //run shortcode creator
16
- shortcodeCreator();
17
  }
18
 
19
  //always show snippet or multi set
@@ -468,22 +468,21 @@ function yasrSetRaterAdminMulti(authorMultiset=true) {
468
 
469
  /****** End Yasr Metabox Multple Rating ******/
470
 
471
- function shortcodeCreator () {
472
- var data = {
473
- action: 'yasr_create_shortcode'
474
- };
475
-
476
- jQuery.get(ajaxurl, data, function (button_content) {
477
- jQuery(button_content).appendTo('body').hide();
478
- yasrShortcodeCreator();
479
- });
480
- }
481
-
482
  /****** Yasr Ajax Page ******/
483
  // When click on chart hide tab-main and show tab-charts
484
 
485
  function yasrShortcodeCreator() {
486
 
 
 
 
 
 
 
 
 
 
 
487
  let nMultiSet = false
488
 
489
  if(document.getElementById('yasr-editor-multiset-container') !== null) {
@@ -500,7 +499,7 @@ function yasrShortcodeCreator() {
500
  jQuery('.yasr-content-tab-tinymce').hide();
501
  jQuery('#yasr-content-tab-main').show();
502
 
503
- linkDoc.setAttribute('href', 'https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen');
504
  });
505
 
506
  jQuery('#yasr-link-tab-charts').on("click", function () {
@@ -511,8 +510,7 @@ function yasrShortcodeCreator() {
511
  jQuery('.yasr-content-tab-tinymce').hide();
512
  jQuery('#yasr-content-tab-charts').show();
513
 
514
- linkDoc.setAttribute('href', 'https://yetanotherstarsrating.com/yasr-rankings/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen');
515
-
516
  });
517
 
518
  // Add shortcode for overall rating
@@ -544,10 +542,10 @@ function yasrShortcodeCreator() {
544
 
545
  if (nMultiSet === true) {
546
  //Add shortcode for multiple set
547
- jQuery('#yasr-insert-multiset-select').on("change", function () {
548
- var setType = jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();
549
- var visitorSet = jQuery("#yasr-allow-vote-multiset").is(':checked');
550
- var showAverage = jQuery("#yasr-hide-average-multiset").is(':checked');
551
  let shortcode;
552
 
553
  if (!visitorSet) {
13
  yasrPrintMetaBoxOverall();
14
 
15
  //run shortcode creator
16
+ yasrShortcodeCreator();
17
  }
18
 
19
  //always show snippet or multi set
468
 
469
  /****** End Yasr Metabox Multple Rating ******/
470
 
 
 
 
 
 
 
 
 
 
 
 
471
  /****** Yasr Ajax Page ******/
472
  // When click on chart hide tab-main and show tab-charts
473
 
474
  function yasrShortcodeCreator() {
475
 
476
+ jQuery('#yasr-shortcode-creator').on("click", function () {
477
+ tb_show( 'Ranking Creator', '#TB_inline?width=770&height=700&inlineId=yasr-tinypopup-form' );
478
+ jQuery("#TB_window").css({width: '800px'});
479
+ });
480
+
481
+ jQuery('#yasr-builder-copy-shortcode').on("click", function () {
482
+ // close
483
+ tb_remove();
484
+ });
485
+
486
  let nMultiSet = false
487
 
488
  if(document.getElementById('yasr-editor-multiset-container') !== null) {
499
  jQuery('.yasr-content-tab-tinymce').hide();
500
  jQuery('#yasr-content-tab-main').show();
501
 
502
+ linkDoc.setAttribute('href', 'https://yetanotherstarsrating.com/yasr-shortcodes?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen');
503
  });
504
 
505
  jQuery('#yasr-link-tab-charts').on("click", function () {
510
  jQuery('.yasr-content-tab-tinymce').hide();
511
  jQuery('#yasr-content-tab-charts').show();
512
 
513
+ linkDoc.setAttribute('href', 'https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen#yasr-rankings-shortcodes');
 
514
  });
515
 
516
  // Add shortcode for overall rating
542
 
543
  if (nMultiSet === true) {
544
  //Add shortcode for multiple set
545
+ jQuery('#yasr-insert-multiset-select').on("click", function () {
546
+ let setType = jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();
547
+ let visitorSet = jQuery("#yasr-allow-vote-multiset").is(':checked');
548
+ let showAverage = jQuery("#yasr-hide-average-multiset").is(':checked');
549
  let shortcode;
550
 
551
  if (!visitorSet) {
admin/js/yasr-editor-screen.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={607:(e,t,n)=>{n.d(t,{v:()=>o});const o=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"})}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e,t=n(607),o=new Uint8Array(16);function a(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}const i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&i.test(e)};for(var r=[],l=0;l<256;++l)r.push((l+256).toString(16).substr(1));const d=function(e,t,n){var o=(e=e||{}).random||(e.rng||a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n}(o)};function y(e){"Product"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"LocalBusiness"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Recipe"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"SoftwareApplication"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Book"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Movie"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none"):document.getElementById("yasr-metabox-info-snippet-container").style.display="none"}function c(e,t,n){const o={action:"yasr_send_id_nameset",set_id:e,post_id:t};return jQuery.post(ajaxurl,o,(function(t){n>1&&(document.getElementById("yasr-loader-select-multi-set").style.display="none");let o=JSON.parse(t),a=document.getElementById("yasr-table-multi-set-admin"),i=document.getElementById("yasr-table-multi-set-admin-visitor");m(o,a),m(o,i,!1),u(),u(!1);let s=document.getElementsByClassName("yasr-editor-multiset-id");for(let t=0;t<s.length;t++)s[t].innerText=e})),!1}function m(e,t,n=!0){let o="",a="yasr-multiset-admin";for(let t=0;t<e.length;t++){let i=e[t].name,s=0,r=!0;!1!==n&&(s=e[t].average_rating,r=!1,a="yasr-multiset-admin-author");let l=e[t].id;o+="<tr>",o+="<td>"+i+"</td>",o+="<td><div class="+a+' id="yasr-multiset-admin-'+d()+'" data-rating="'+s+'" data-multi-idfield="'+l+'" data-readonly="'+r+'"></div>',o+="</td>",o+="</tr>"}!1===n&&(o+='<tr><td colspan="2"><input type="submit" class="button button-primary" value="Submit!" disabled></td></tr>'),t.innerHTML=o}function u(e=!0){let t;t=!1!==e?"yasr-multiset-admin-author":"yasr-multiset-admin";const n=document.getElementsByClassName(t);let o=[],a=!1;for(let e=0;e<n.length;e++)!function(e){let t=n.item(e).id,i=document.getElementById(t),s=parseInt(i.getAttribute("data-multi-idfield")),r=parseInt(i.getAttribute("data-rating")),l="true"===i.getAttribute("data-readonly"),d={field:s,rating:r};o.push(d),yasrSetRaterValue(32,t,!1,.5,l,!1,(function(e,t){e=e.toFixed(1),e=parseFloat(e),this.setRating(e);for(let t=0;t<o.length;t++)o[t].field===s&&(o[t].rating=e);a=JSON.stringify(o),document.getElementById("yasr-multiset-author-votes").value=a,t()}))}(e)}document.addEventListener("DOMContentLoaded",(function(e){var n;!0!==document.body.classList.contains("block-editor-page")&&(function(){let e=parseFloat(document.getElementById("yasr-overall-rating-value").value);const n=document.getElementById("yasr-editor-copy-overall");null!==n&&(n.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())}),raterJs({starSize:32,step:.1,showToolTip:!1,rating:e,readOnly:!1,element:document.getElementById("yasr-rater-overall"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),document.getElementById("yasr-overall-rating-value").value=e,this.setRating(e);document.getElementById("yasr_overall_text").textContent="You've rated "+e,t()}})}(),n={action:"yasr_create_shortcode"},jQuery.get(ajaxurl,n,(function(e){jQuery(e).appendTo("body").hide(),function(){let e=!1;null!==document.getElementById("yasr-editor-multiset-container")&&(e=!0);const t=document.getElementById("yasr-tinypopup-link-doc");jQuery("#yasr-link-tab-main").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-main").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-main").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-link-tab-charts").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-charts").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-charts").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-rankings/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-overall").on("click",(function(){jQuery("#yasr-overall-choose-size").toggle("slow")})),jQuery("#yasr-visitor-votes").on("click",(function(){jQuery("#yasr-visitor-choose-size").toggle("slow")})),jQuery(".yasr-tinymce-shortcode-buttons").on("click",(function(){let e=this.getAttribute("data-shortcode");null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()})),!0===e&&jQuery("#yasr-insert-multiset-select").on("change",(function(){var e=jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();let t;t=jQuery("#yasr-allow-vote-multiset").is(":checked")?"[yasr_multiset setid=":"[yasr_visitor_multiset setid=",t+=e,jQuery("#yasr-hide-average-multiset").is(":checked")&&(t+=" show_average='no'"),t+="]",null==tinyMCE.activeEditor?jQuery("#content").append(t):tinyMCE.activeEditor.execCommand("mceInsertContent",0,t),tb_remove()}))}()}))),function(){jQuery("#yasr-metabox-below-editor-structured-data-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-structured-data-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-structured-data").show()})),jQuery("#yasr-metabox-below-editor-multiset-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-multiset-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-multiset").show()}));let e=document.getElementById("yasr-metabox-below-editor-select-schema").value;null!==document.getElementById("yasr-editor-multiset-container")&&function(){let e=document.getElementById("yasr-editor-multiset-container"),n=parseInt(e.getAttribute("data-nmultiset")),o=parseInt(e.getAttribute("data-setid")),a=parseInt(e.getAttribute("data-postid"));const i=document.getElementById("yasr-pro-review-setid"),s=document.getElementById("yasr-editor-copy-readonly-multiset"),r=document.getElementById("yasr-editor-copy-visitor-multiset"),l=document.getElementById("yasr-editor-copy-average-multiset"),d=document.getElementById("yasr-editor-copy-average-vvmultiset"),y=document.getElementById("yasr-editor-copy-comments-multiset"),m=document.getElementById("yasr-pro-comments-enabled-yes"),u=document.getElementById("yasr-pro-multiset-review-switcher");c(o,a,n),s.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},r.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},l.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},d.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},y.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},null!==u&&(null!==m&&m.addEventListener("change",(e=>{e.currentTarget.checked||(u.checked=!1)})),u.addEventListener("change",(e=>{!0===e.currentTarget.checked?(null!==m?m.checked=!0:document.getElementById("yasr-comment-reviews-disabled-switch").checked=!0,null!==i&&(i.value=o)):null!==i&&(i.value="")}))),n>1&&jQuery("#yasr_select_set").on("change",(function(){return o=jQuery("#yasr_select_set").val(),jQuery("#yasr-loader-select-multi-set").show(),c(o,a,n),document.getElementById("yasr-multiset-id").value=o,null!==i&&""!==i&&(i.value===o?u.checked=!0:u.checked=!1),!1}))}(),y(e)}()})),document.getElementById("yasr-metabox-below-editor-select-schema").addEventListener("change",(function(){y(this.value)}))})()})();
1
+ (()=>{"use strict";var e={607:(e,t,n)=>{n.d(t,{v:()=>o});const o=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"})}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e,t=n(607),o=new Uint8Array(16);function a(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(o)}const i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&i.test(e)};for(var r=[],l=0;l<256;++l)r.push((l+256).toString(16).substr(1));const d=function(e,t,n){var o=(e=e||{}).random||(e.rng||a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=o[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(r[e[t+0]]+r[e[t+1]]+r[e[t+2]]+r[e[t+3]]+"-"+r[e[t+4]]+r[e[t+5]]+"-"+r[e[t+6]]+r[e[t+7]]+"-"+r[e[t+8]]+r[e[t+9]]+"-"+r[e[t+10]]+r[e[t+11]]+r[e[t+12]]+r[e[t+13]]+r[e[t+14]]+r[e[t+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n}(o)};function y(e){"Product"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"LocalBusiness"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Recipe"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"SoftwareApplication"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Book"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="none"):"Movie"===e?(document.getElementById("yasr-metabox-info-snippet-container").style.display="",document.getElementById("yasr-metabox-info-snippet-container-movie").style.display="",document.getElementById("yasr-metabox-info-snippet-container-recipe").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-localbusiness").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-product").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-software").style.display="none",document.getElementById("yasr-metabox-info-snippet-container-book").style.display="none"):document.getElementById("yasr-metabox-info-snippet-container").style.display="none"}function c(e,t,n){const o={action:"yasr_send_id_nameset",set_id:e,post_id:t};return jQuery.post(ajaxurl,o,(function(t){n>1&&(document.getElementById("yasr-loader-select-multi-set").style.display="none");let o=JSON.parse(t),a=document.getElementById("yasr-table-multi-set-admin"),i=document.getElementById("yasr-table-multi-set-admin-visitor");m(o,a),m(o,i,!1),u(),u(!1);let s=document.getElementsByClassName("yasr-editor-multiset-id");for(let t=0;t<s.length;t++)s[t].innerText=e})),!1}function m(e,t,n=!0){let o="",a="yasr-multiset-admin";for(let t=0;t<e.length;t++){let i=e[t].name,s=0,r=!0;!1!==n&&(s=e[t].average_rating,r=!1,a="yasr-multiset-admin-author");let l=e[t].id;o+="<tr>",o+="<td>"+i+"</td>",o+="<td><div class="+a+' id="yasr-multiset-admin-'+d()+'" data-rating="'+s+'" data-multi-idfield="'+l+'" data-readonly="'+r+'"></div>',o+="</td>",o+="</tr>"}!1===n&&(o+='<tr><td colspan="2"><input type="submit" class="button button-primary" value="Submit!" disabled></td></tr>'),t.innerHTML=o}function u(e=!0){let t;t=!1!==e?"yasr-multiset-admin-author":"yasr-multiset-admin";const n=document.getElementsByClassName(t);let o=[],a=!1;for(let e=0;e<n.length;e++)!function(e){let t=n.item(e).id,i=document.getElementById(t),s=parseInt(i.getAttribute("data-multi-idfield")),r=parseInt(i.getAttribute("data-rating")),l="true"===i.getAttribute("data-readonly"),d={field:s,rating:r};o.push(d),yasrSetRaterValue(32,t,!1,.5,l,!1,(function(e,t){e=e.toFixed(1),e=parseFloat(e),this.setRating(e);for(let t=0;t<o.length;t++)o[t].field===s&&(o[t].rating=e);a=JSON.stringify(o),document.getElementById("yasr-multiset-author-votes").value=a,t()}))}(e)}document.addEventListener("DOMContentLoaded",(function(e){!0!==document.body.classList.contains("block-editor-page")&&(function(){let e=parseFloat(document.getElementById("yasr-overall-rating-value").value);const n=document.getElementById("yasr-editor-copy-overall");null!==n&&(n.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())}),raterJs({starSize:32,step:.1,showToolTip:!1,rating:e,readOnly:!1,element:document.getElementById("yasr-rater-overall"),rateCallback:function(e,t){e=e.toFixed(1),e=parseFloat(e),document.getElementById("yasr-overall-rating-value").value=e,this.setRating(e);document.getElementById("yasr_overall_text").textContent="You've rated "+e,t()}})}(),function(){jQuery("#yasr-shortcode-creator").on("click",(function(){tb_show("Ranking Creator","#TB_inline?width=770&height=700&inlineId=yasr-tinypopup-form"),jQuery("#TB_window").css({width:"800px"})})),jQuery("#yasr-builder-copy-shortcode").on("click",(function(){tb_remove()}));let e=!1;null!==document.getElementById("yasr-editor-multiset-container")&&(e=!0);const t=document.getElementById("yasr-tinypopup-link-doc");jQuery("#yasr-link-tab-main").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-main").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-main").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-shortcodes?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen")})),jQuery("#yasr-link-tab-charts").on("click",(function(){jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-link-tab-charts").addClass("nav-tab-active"),jQuery(".yasr-content-tab-tinymce").hide(),jQuery("#yasr-content-tab-charts").show(),t.setAttribute("href","https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen#yasr-rankings-shortcodes")})),jQuery("#yasr-overall").on("click",(function(){jQuery("#yasr-overall-choose-size").toggle("slow")})),jQuery("#yasr-visitor-votes").on("click",(function(){jQuery("#yasr-visitor-choose-size").toggle("slow")})),jQuery(".yasr-tinymce-shortcode-buttons").on("click",(function(){let e=this.getAttribute("data-shortcode");null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()})),!0===e&&jQuery("#yasr-insert-multiset-select").on("click",(function(){let e,t=jQuery("input:radio[name=yasr_tinymce_pick_set]:checked").val();e=jQuery("#yasr-allow-vote-multiset").is(":checked")?"[yasr_multiset setid=":"[yasr_visitor_multiset setid=",e+=t,jQuery("#yasr-hide-average-multiset").is(":checked")&&(e+=" show_average='no'"),e+="]",null==tinyMCE.activeEditor?jQuery("#content").append(e):tinyMCE.activeEditor.execCommand("mceInsertContent",0,e),tb_remove()}))}()),function(){jQuery("#yasr-metabox-below-editor-structured-data-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-structured-data-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-structured-data").show()})),jQuery("#yasr-metabox-below-editor-multiset-tab").on("click",(function(e){e.preventDefault(),jQuery(".yasr-nav-tab").removeClass("nav-tab-active"),jQuery("#yasr-metabox-below-editor-multiset-tab").addClass("nav-tab-active"),jQuery(".yasr-metabox-below-editor-content").hide(),jQuery("#yasr-metabox-below-editor-multiset").show()}));let e=document.getElementById("yasr-metabox-below-editor-select-schema").value;null!==document.getElementById("yasr-editor-multiset-container")&&function(){let e=document.getElementById("yasr-editor-multiset-container"),n=parseInt(e.getAttribute("data-nmultiset")),o=parseInt(e.getAttribute("data-setid")),a=parseInt(e.getAttribute("data-postid"));const i=document.getElementById("yasr-pro-review-setid"),s=document.getElementById("yasr-editor-copy-readonly-multiset"),r=document.getElementById("yasr-editor-copy-visitor-multiset"),l=document.getElementById("yasr-editor-copy-average-multiset"),d=document.getElementById("yasr-editor-copy-average-vvmultiset"),y=document.getElementById("yasr-editor-copy-comments-multiset"),m=document.getElementById("yasr-pro-comments-enabled-yes"),u=document.getElementById("yasr-pro-multiset-review-switcher");c(o,a,n),s.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},r.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},l.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},d.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},y.onclick=function(e){let n=document.getElementById(e.target.id);(0,t.v)(n.textContent.trim())},null!==u&&(null!==m&&m.addEventListener("change",(e=>{e.currentTarget.checked||(u.checked=!1)})),u.addEventListener("change",(e=>{!0===e.currentTarget.checked?(null!==m?m.checked=!0:document.getElementById("yasr-comment-reviews-disabled-switch").checked=!0,null!==i&&(i.value=o)):null!==i&&(i.value="")}))),n>1&&jQuery("#yasr_select_set").on("change",(function(){return o=jQuery("#yasr_select_set").val(),jQuery("#yasr-loader-select-multi-set").show(),c(o,a,n),document.getElementById("yasr-multiset-id").value=o,null!==i&&""!==i&&(i.value===o?u.checked=!0:u.checked=!1),!1}))}(),y(e)}()})),document.getElementById("yasr-metabox-below-editor-select-schema").addEventListener("change",(function(){y(this.value)}))})()})();
admin/js/yasr-settings.js CHANGED
@@ -1 +1 @@
1
- (()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,a=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===a&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(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})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var r=parseInt(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===r){var n=jQuery("#yasr-edit-form-number-elements").attr("value");n++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(n>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 #'+n+' <input type="text" name="edit-multi-set-element-'+n+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),n++}))}else r>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++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";let e;var t,a=new Uint8Array(16);function r(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&n.test(e)};for(var o=[],i=0;i<256;++i)o.push((i+256).toString(16).substr(1));const l=function(e,t,a){var n=(e=e||{}).random||(e.rng||r)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){a=a||0;for(var i=0;i<16;++i)t[a+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(n)};function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function c(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function y(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}var p=wp.i18n.__,g=wp.element.render;function h(e){var t="yasr-ranking-element-"+l(),a=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return yasrSetRaterValue(a,t,!1,.1,!0,e.rating)}})}function f(e){if(void 0!==e.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",p("Total:","yet-another-stars-rating")," ",e.post.number_of_votes,"  ",p("Average:","yet-another-stars-rating")," ",e.post.rating,"]");var t=e.text;return React.createElement("span",{className:"yasr-highest-rated-text"},t," ",e.post.rating)}function v(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const a=e.textContent;return e.innerHTML="",a}(t.post.title)))}function _(e){var t="after",a=p("Rating:","yet-another-stars-rating"),r=new URLSearchParams(e.rankingParams);return null!==r.get("text_position")&&(t=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(f,{post:e.post,tableId:e.tableId,text:a}),React.createElement(h,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(h,{rating:e.post.rating,tableId:e.tableId}),React.createElement(f,{post:e.post,tableId:e.tableId,text:a}))}function b(e){var t="",a="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(v,{colClass:t,post:e.post}),React.createElement(_,{colClass:a,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function E(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,a){var r="yasr-rankings-td-colored";return"author_ranking"===e.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===e.source&&(r="yasr-rankings-td-colored")),React.createElement(b,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:r})})))}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}(o,React.Component);var t,a,r,n,s=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=m(r);if(n){var a=m(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return y(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=s.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=o,a=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrWindowVar.ajaxEnabled)console.info("Ajax Disabled, getting data from source"),this.setState({isLoaded:!0,data:t});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(e){"KO"===e?a=t:"overall_rating"===e.source||"author_multi"===e.source?a="overall_rating"===e.source?e.data_overall:e.data_mv:a[e.show]=e.data_vv})).catch((function(e){a=t,console.info(e)}))}))).then((function(t){e.setState({isLoaded:!0,data:a})})).catch((function(t){console.info(t),e.setState({isLoaded:!0,data:a})}))}else this.setState({error:"Invalid Data Source"})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==t&&!1!==t){var s=new URLSearchParams(t);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)e=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==t){var l=new URLSearchParams(t);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}e=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return e}},{key:"rankingTableHead",value:function(e,t){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==e){var s=React.createElement("span",null,React.createElement("span",{id:r},p("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},p("Highest Rated","yet-another-stars-rating")));return"highest"===t&&(s=React.createElement("span",null,React.createElement("span",{id:n},p("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},p("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,p("Post","yet-another-stars-rating")),React.createElement("th",null,p("Order By","yet-another-stars-rating"),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,a=e.source,r=e.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=t.most,s=t.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(r);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(d=i,c=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:d,source:a}),React.createElement(E,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}))}},{key:"render",value:function(){var e=this.state,t=e.error,a=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,p("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}],a&&c(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),o}();function w(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var a=e.item(t).id,r=JSON.parse(e.item(t).dataset.rankingSource),n=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(a);g(React.createElement(k,{source:r,tableId:a,params:n,nonce:s}),o)}}w(),tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var I,B=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(I=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===I){var R,j=function(e){var t=A.value,a=document.getElementById("yasr-builder-shortcode").textContent,r=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];r=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",r),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+a).then((function(e){return!0===e.ok?e.json():(console.info(B("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,M.childNodes.length>0?M.replaceChild(t,M.childNodes[0]):M.appendChild(t)}})).then((function(e){r.forEach((function(e){t===e&&w()}))}))},x=function(e,t,a,r,n,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",a.style.display="none",r.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},Q=function(e,t,a,r,n,s,o,i,l){a.style.display="",r.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},C=function(e,t,a,r,n,s,o,i,l){n.style.display="",l.style.display="none",e.style.display="none",a.style.display="none",r.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},L=function(e,t,a,r,n,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(q.className="",q.classList.add("yasr-settings-row-24"),a.style.display="",r.style.display="",e.style.display="none"):(a.style.display="none",r.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},T=".yasr-builder-elements-parents",S=".yasr-builder-elements-childs";jQuery(T).prop("disabled",!0),jQuery(S).prop("disabled",!0),jQuery(T).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",T,S);var P=[],O={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};R=O.name,document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]");var N=document.getElementById("yasr-builder-button-preview"),H=document.getElementById("yasr-builder-copy-shortcode"),M=document.getElementById("yasr-builder-preview"),A=document.getElementById("yasr-ranking-source"),V=document.getElementById("yasr-ranking-multiset-select"),U=document.getElementById("yasr-builder-datepicker-start"),D=document.getElementById("yasr-builder-datepicker-end"),q=document.getElementById("yasr-builder-params-container"),F=document.getElementById("builder-vv-default-view"),W=document.getElementById("builder-vv-required-votes"),z=document.getElementById("builder-stars-size"),J=document.getElementById("builder-overall-text"),K=document.getElementById("builder-username-options"),Y=document.getElementById("builder-category"),G=document.getElementById("builder-cpt"),$=document.getElementById("yasr-ranking-multiset"),X=document.getElementById("yasr-builder-datepicker"),Z=A.value,ee=!1;U.value="",D.value="","yasr_ov_ranking"===Z?x(J,z,F,W,K,Y,G,$,X):"yasr_most_active_users"===Z||"yasr_top_reviewers"===Z?C(J,z,F,W,K,Y,G,$,X):"yasr_multi_set_ranking"===Z?L(J,z,F,W,K,Y,G,$,!1,X):"yasr_visitor_multi_set_ranking"===Z?L(J,z,F,W,K,Y,G,$,!0,X):Q(J,z,F,W,K,Y,G,$,X),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)q.className="",q.classList.add("yasr-settings-row-33"),M.innerHTML="",U.value="",D.value="",O={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?x(J,z,F,W,K,Y,G,$,X):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?C(J,z,F,W,K,Y,G,$,X):"yasr_multi_set_ranking"===e.target.value?(L(J,z,F,W,K,Y,G,$,!1,X),O.setid=" setid="+V[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(L(J,z,F,W,K,Y,G,$,!0,X),O.setid=" setid="+V[0].value):Q(J,z,F,W,K,Y,G,$,X),O.name=e.target.value,R=O.name+O.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(O.setid=" setid="+e.target.value),P=wp.hooks.applyFilters("yasrBuilderFilterShortcode",O);for(var t=2;O.length;t++)P.hasOwnProperty(O[t])&&(O[t]=P[t]);R=O.name+O.setid+O.rows+O.view+O.minvotesmost+O.minvoteshg+O.size+O.txtPosition+O.txt+O.display+O.start_date+O.end_date+O.category+O.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+R+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+R+"]"),!0===ee&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&j()})),H.onclick=function(e){var t,a;t=document.getElementById(e.target.id).getAttribute("data-shortcode"),(a=document.createElement("textarea")).value=t,a.setAttribute("readonly",""),a.style.position="absolute",a.style.left="-9999px",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)},N.onclick=function(e){j(),ee=!0}}})();
1
+ (()=>{var e={726:function(e,t,r){"use strict";var a;!function(n){if("function"!=typeof s){var s=function(e){return e};s.nonNative=!0}const o=s("plaintext"),i=s("html"),l=s("comment"),d=/<(\w*)>/g,c=/<\/?([^\s\/>]+)/;function u(e,t,r){return m(e=e||"",y(t=t||[],r=r||""))}function y(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=d.exec(e);)t.add(r[1])}else s.nonNative||"function"!=typeof e[s.iterator]?"function"==typeof e.forEach&&e.forEach(t.add,t):t=new Set(e);return t}(e),tag_replacement:t,state:o,tag_buffer:"",depth:0,in_quote_char:""}}function m(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,a=t.tag_replacement,n=t.state,s=t.tag_buffer,d=t.depth,c=t.in_quote_char,u="";for(let t=0,y=e.length;t<y;t++){let y=e[t];if(n===o)"<"===y?(n=i,s+=y):u+=y;else if(n===i)switch(y){case"<":if(c)break;d++;break;case">":if(c)break;if(d){d--;break}c="",n=o,s+=">",r.has(p(s))?u+=s:u+=a,s="";break;case'"':case"'":c=y===c?"":c||y,s+=y;break;case"-":"<!-"===s&&(n=l),s+=y;break;case" ":case"\n":if("<"===s){n=o,u+="< ",s="";break}s+=y;break;default:s+=y}else n===l&&(">"===y?("--"==s.slice(-2)&&(n=o),s=""):s+=y)}return t.state=n,t.tag_buffer=s,t.depth=d,t.in_quote_char=c,u}function p(e){let t=c.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=y(e=e||[],t=t||"");return function(e){return m(e||"",r)}},void 0===(a=function(){return u}.call(t,r,t,e))||(e.exports=a)}()}},t={};function r(a){var n=t[a];if(void 0!==n)return n.exports;var s=t[a]={exports:{}};return e[a].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;if(document.getElementsByClassName("nav-tab-active").length>0&&(e=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===e){var t=document.getElementById("yasr_auto_insert_switch").checked,r=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===t&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===r&&jQuery(".yasr-stars-title-options-class").prop("disabled",!0),document.getElementById("yasr_auto_insert_switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-auto-insert-options-class").prop("disabled",!1):jQuery(".yasr-auto-insert-options-class").prop("disabled",!0)})),document.getElementById("yasr-general-options-stars-title-switch").addEventListener("change",(function(){this.checked?jQuery(".yasr-stars-title-options-class").prop("disabled",!1):jQuery(".yasr-stars-title-options-class").prop("disabled",!0)})),document.getElementById("yasr-settings-custom-texts").addEventListener("click",(function(){document.getElementById("yasr-settings-custom-text-before-overall").value="Our Score",document.getElementById("yasr-settings-custom-text-before-visitor").value="Click to rate this post!",document.getElementById("yasr-settings-custom-text-after-visitor").value="[Total: %total_count% Average: %average%]",document.getElementById("yasr-settings-custom-text-rating-saved").value="Rating saved!",document.getElementById("yasr-settings-custom-text-rating-updated").value="Rating updated!",document.getElementById("yasr-settings-custom-text-must-sign-in").value="You must sign in to vote",document.getElementById("yasr-settings-custom-text-already-rated").value="You have already voted for this article with %rating%"}))}if("style_options"===e&&(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})),wp.hooks.doAction("yasrStyleOptions")),"manage_multi"===e){var a=parseInt(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===a){var n=jQuery("#yasr-edit-form-number-elements").attr("value");n++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(n>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 #'+n+' <input type="text" name="edit-multi-set-element-'+n+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),n++}))}else a>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++}))})))}"migration_tools"===e&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML='<img src="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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="'+yasrWindowVar.loaderUrl+'" alt="yasr-loader" width="16" height="16">';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}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===e&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{"use strict";let e;var t,a=new Uint8Array(16);function n(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(a)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,o=function(e){return"string"==typeof e&&s.test(e)};for(var i=[],l=0;l<256;++l)i.push((l+256).toString(16).substr(1));const d=function(e,t,r){var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){r=r||0;for(var s=0;s<16;++s)t[r+s]=a[s];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase();if(!o(r))throw TypeError("Stringified UUID is invalid");return r}(a)};var c=r(726),u=r.n(c);function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function m(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function g(e,t){if(t&&("object"===y(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}var h=wp.element.render;function v(e){return React.createElement("div",{dangerouslySetInnerHTML:{__html:u()(e.html,"<strong><p>")}})}function _(e){var t="yasr-ranking-element-"+d(),r=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return yasrSetRaterValue(r,t,!1,.1,!0,e.rating)}})}function b(e){if(void 0!==e.post.number_of_votes){var t=JSON.parse(yasrWindowVar.textAfterVr);return t=(t=t.replace("%total_count%",e.post.number_of_votes)).replace("%average%",e.post.rating),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(v,{html:t}))}var r=e.text;return React.createElement("div",{className:"yasr-highest-rated-text"},r," ",e.post.rating)}function E(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const r=e.textContent;return e.innerHTML="",r}(t.post.title)))}function k(e){var t="after",r=JSON.parse(yasrWindowVar.textRating),a=new URLSearchParams(e.rankingParams);return null!==a.get("text_position")&&(t=a.get("text_position")),null!==a.get("custom_txt")&&(r=a.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(b,{post:e.post,tableId:e.tableId,text:r}),React.createElement(_,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(_,{rating:e.post.rating,tableId:e.tableId}),React.createElement(b,{post:e.post,tableId:e.tableId,text:r}))}function w(e){var t="",r="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",r="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",r="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(E,{colClass:t,post:e.post}),React.createElement(k,{colClass:r,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function I(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,r){var a="yasr-rankings-td-colored";return"author_ranking"===e.source&&(a="yasr-rankings-td-white"),r%2==0&&(a="yasr-rankings-td-white","author_ranking"===e.source&&(a="yasr-rankings-td-colored")),React.createElement(w,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:a})})))}var B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(o,React.Component);var t,r,a,n,s=(a=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=f(a);if(n){var r=f(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return g(this,e)});function o(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(t=s.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=o,r=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),r={};if("yes"!==yasrWindowVar.ajaxEnabled)console.info("Ajax Disabled, getting data from source"),this.setState({isLoaded:!0,data:t});else if(this.state.source){var a=this.returnRestUrl();Promise.all(a.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(e){"KO"===e?r=t:"overall_rating"===e.source||"author_multi"===e.source?r="overall_rating"===e.source?e.data_overall:e.data_mv:r[e.show]=e.data_vv})).catch((function(e){r=t,console.info(e)}))}))).then((function(t){e.setState({isLoaded:!0,data:r})})).catch((function(t){console.info(t),e.setState({isLoaded:!0,data:r})}))}else this.setState({error:"Invalid Data Source"})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",r=this.state.source,a="&nonce_rankings="+this.state.nonce,n="";if(""!==t&&!1!==t){var s=new URLSearchParams(t);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==r&&"author_multi"!==r||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===r||"author_multi"===r)e=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+r+n+a];else{var o="",i="";if(""!==t){var l=new URLSearchParams(t);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}e=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+r+n+o+a,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+r+n+i+a]}return e}},{key:"rankingTableHead",value:function(e,t){var r=this.state.tableId,a="link-most-rated-posts-"+r,n="link-highest-rated-posts-"+r;if("author_ranking"!==e){var s=React.createElement("span",null,React.createElement("span",{id:a},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===t&&(s=React.createElement("span",null,React.createElement("span",{id:n},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:a,onClick:this.switchTBody.bind(this)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,r=this.state.tableId,a="link-most-rated-posts-"+r,n="link-highest-rated-posts-"+r,s="most-rated-posts-"+r,o="highest-rated-posts-"+r,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===a&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(a),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,r=e.source,a=e.rankingParams;if("overall_rating"===r||"author_multi"===r)return React.createElement(I,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:a,show:"table-row-group",source:r});var n=t.most,s=t.highest,o="table-row-group",i="none",l="most",d=o,c=i,u=new URLSearchParams(a);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(d=i,c=o),React.createElement(React.Fragment,null,this.rankingTableHead(r,l),React.createElement(I,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:a,show:d,source:r}),React.createElement(I,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:a,show:c,source:r}))}},{key:"render",value:function(){var e=this.state,t=e.error,r=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===r?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking)))):React.createElement(React.Fragment,null,this.rankingTableBody())}}],r&&m(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),o}();function x(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var r=e.item(t).id,a=JSON.parse(e.item(t).dataset.rankingSource),n=JSON.parse(e.item(t).dataset.rankingParams),s=JSON.parse(e.item(t).dataset.rankingNonce),o=document.getElementById(r);h(React.createElement(B,{source:a,tableId:r,params:n,nonce:s}),o)}}x(),tippy(document.querySelectorAll(".yasr-copy-shortcode"),{content:"Copied! Insert into your post!",theme:"yasr",arrow:"true",arrowType:"round",trigger:"click"});var R,j=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(R=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===R){var S,C=function(e){var t=J.value,r=document.getElementById("yasr-builder-shortcode").textContent,a=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];a=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",a),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(j("Ajax Call Failed. Shortcode preview can't be done","yet-another-stars-rating")),"KO")})).catch((function(e){console.info(e)})).then((function(e){if("KO"!==e){var t=document.createElement("div");t.innerHTML=e,A.childNodes.length>0?A.replaceChild(t,A.childNodes[0]):A.appendChild(t)}})).then((function(e){a.forEach((function(e){t===e&&x()}))}))},L=function(e,t,r,a,n,s,o,i,l){e.style.display="",t.style.display="",s.style.display="",l.style.display="",r.style.display="none",a.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},Q=function(e,t,r,a,n,s,o,i,l){r.style.display="",a.style.display="",t.style.display="",s.style.display="",l.style.display="",e.style.display="none",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="none")},O=function(e,t,r,a,n,s,o,i,l){n.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",a.style.display="none",t.style.display="none",s.style.display="none",null!==o&&(o.style.display="none"),null!==i&&(i.style.display="none")},T=function(e,t,r,a,n,s,o,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],d=arguments.length>9?arguments[9]:void 0;!0===l?(F.className="",F.classList.add("yasr-settings-row-24"),r.style.display="",a.style.display="",e.style.display="none"):(r.style.display="none",a.style.display="none",e.style.display=""),s.style.display="",t.style.display="",d.style.display="",n.style.display="none",null!==o&&(o.style.display=""),null!==i&&(i.style.display="")},N=".yasr-builder-elements-parents",P=".yasr-builder-elements-childs";jQuery(N).prop("disabled",!0),jQuery(P).prop("disabled",!0),jQuery(N).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",N,P);var H=[],M={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};S=M.name,document.getElementById("yasr-builder-shortcode").textContent="["+S+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+S+"]");var V=document.getElementById("yasr-builder-button-preview"),W=document.getElementById("yasr-builder-copy-shortcode"),A=document.getElementById("yasr-builder-preview"),J=document.getElementById("yasr-ranking-source"),U=document.getElementById("yasr-ranking-multiset-select"),q=document.getElementById("yasr-builder-datepicker-start"),D=document.getElementById("yasr-builder-datepicker-end"),F=document.getElementById("yasr-builder-params-container"),z=document.getElementById("builder-vv-default-view"),K=document.getElementById("builder-vv-required-votes"),Y=document.getElementById("builder-stars-size"),G=document.getElementById("builder-overall-text"),$=document.getElementById("builder-username-options"),X=document.getElementById("builder-category"),Z=document.getElementById("builder-cpt"),ee=document.getElementById("yasr-ranking-multiset"),te=document.getElementById("yasr-builder-datepicker"),re=J.value,ae=!1;q.value="",D.value="","yasr_ov_ranking"===re?L(G,Y,z,K,$,X,Z,ee,te):"yasr_most_active_users"===re||"yasr_top_reviewers"===re?O(G,Y,z,K,$,X,Z,ee,te):"yasr_multi_set_ranking"===re?T(G,Y,z,K,$,X,Z,ee,!1,te):"yasr_visitor_multi_set_ranking"===re?T(G,Y,z,K,$,X,Z,ee,!0,te):Q(G,Y,z,K,$,X,Z,ee,te),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)F.className="",F.classList.add("yasr-settings-row-33"),A.innerHTML="",q.value="",D.value="",M={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""},"yasr_ov_ranking"===e.target.value?L(G,Y,z,K,$,X,Z,ee,te):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?O(G,Y,z,K,$,X,Z,ee,te):"yasr_multi_set_ranking"===e.target.value?(T(G,Y,z,K,$,X,Z,ee,!1,te),M.setid=" setid="+U[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(T(G,Y,z,K,$,X,Z,ee,!0,te),M.setid=" setid="+U[0].value):Q(G,Y,z,K,$,X,Z,ee,te),M.name=e.target.value,S=M.name+M.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(M.setid=" setid="+e.target.value),H=wp.hooks.applyFilters("yasrBuilderFilterShortcode",M);for(var t=2;M.length;t++)H.hasOwnProperty(M[t])&&(M[t]=H[t]);S=M.name+M.setid+M.rows+M.view+M.minvotesmost+M.minvoteshg+M.size+M.txtPosition+M.txt+M.display+M.start_date+M.end_date+M.category+M.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+S+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+S+"]"),!0===ae&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&C()})),W.onclick=function(e){var t,r;t=document.getElementById(e.target.id).getAttribute("data-shortcode"),(r=document.createElement("textarea")).value=t,r.setAttribute("readonly",""),r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r)},V.onclick=function(e){C(),ae=!0}}})()})();
admin/settings/aspect_style/yasr-settings-style-functions.php CHANGED
@@ -87,7 +87,7 @@ function yasr_color_scheme_multiset_callback($style_options) {
87
  $class = 'yasr-general-options-scheme-color';
88
  $id = 'yasr-style-options-color-scheme';
89
 
90
- echo YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id);
91
  ?>
92
 
93
  <br/>
87
  $class = 'yasr-general-options-scheme-color';
88
  $id = 'yasr-style-options-color-scheme';
89
 
90
+ echo yasr_kses(YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id));
91
  ?>
92
 
93
  <br/>
admin/settings/classes/YasrSettings.php CHANGED
@@ -183,37 +183,43 @@ class YasrSettings {
183
  $name = 'yasr_general_options[auto_insert_what]';
184
  $class = 'yasr-auto-insert-options-class';
185
 
186
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
187
  ?>
188
  </div>
189
  <div>
190
  <?php
191
- $option_title = __('Where?', 'yet-another-stars-rating');
192
- $array_options = array (
193
- 'top' => __('Before the content', 'yet-another-stars-rating'),
194
- 'bottom' => __('After the content', 'yet-another-stars-rating'),
195
- 'both' => __('Both', 'yet-another-stars-rating')
196
- );
197
- $default = $option['auto_insert_where'];
198
- $name = 'yasr_general_options[auto_insert_where]';
199
- $class = 'yasr-auto-insert-options-class';
200
 
201
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
202
  ?>
203
  </div>
204
  <div>
205
  <?php
206
- $option_title = __('Align', 'yet-another-stars-rating');
207
- $array_options = array (
208
- 'left' => __('Left', 'yet-another-stars-rating'),
209
- 'center' => __('Center', 'yet-another-stars-rating'),
210
- 'right' => __('Right', 'yet-another-stars-rating')
211
- );
212
- $default = $option['auto_insert_align'];
213
- $name = 'yasr_general_options[auto_insert_align]';
214
- $class = 'yasr-auto-insert-options-class';
215
 
216
- echo YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default);
 
 
217
  ?>
218
  </div>
219
  <div>
@@ -225,7 +231,9 @@ class YasrSettings {
225
  $class = 'yasr-auto-insert-options-class';
226
  $id = 'yasr-auto-insert-options-stars-size-';
227
 
228
- YasrPhpFieldsHelper::radioSelectSize($name, $class, $option['auto_insert_size'], $id);
 
 
229
  ?>
230
  </div>
231
  <div>
@@ -239,7 +247,9 @@ class YasrSettings {
239
  $name = 'yasr_general_options[auto_insert_exclude_pages]';
240
  $class = 'yasr-auto-insert-options-class';
241
 
242
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
243
  ?>
244
  </div>
245
  <?php
@@ -255,7 +265,9 @@ class YasrSettings {
255
  $name = 'yasr_general_options[auto_insert_custom_post_only]';
256
  $class = 'yasr-auto-insert-options-class';
257
 
258
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
259
  ?>
260
  <div>
261
  <?php
@@ -310,7 +322,9 @@ class YasrSettings {
310
  $name = 'yasr_general_options[stars_title_what]';
311
  $class = 'yasr-stars-title-options-class';
312
 
313
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
314
  ?>
315
  </div>
316
  <div>
@@ -324,7 +338,9 @@ class YasrSettings {
324
  $name = 'yasr_general_options[stars_title_exclude_pages]';
325
  $class = 'yasr-stars-title-options-class';
326
 
327
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
328
  ?>
329
  </div>
330
  <div style="flex: 0 0 50%">
@@ -339,7 +355,9 @@ class YasrSettings {
339
  $name = 'yasr_general_options[stars_title_where]';
340
  $class = 'yasr-stars-title-options-class';
341
 
342
- echo YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default );
 
 
343
  ?>
344
  </div>
345
  </div>
@@ -468,7 +486,9 @@ class YasrSettings {
468
  $name = 'yasr_general_options[allowed_user]';
469
  $class = 'yasr_auto_insert_loggedonly';
470
 
471
- echo YasrPhpFieldsHelper::radio( false, $class, $array_options, $name, $default );
 
 
472
  ?>
473
  <br />
474
  <div class="yasr-indented-answer">
@@ -500,33 +520,12 @@ class YasrSettings {
500
  </strong>
501
  <div>
502
  <?php
503
- $review_types = YASR_SUPPORTED_SCHEMA_TYPES;
504
- sort($review_types);
 
 
505
  ?>
506
- <label for="yasr-choose-reviews-types-list">
507
- <select name="yasr_general_options[snippet_itemtype]" id="yasr-choose-reviews-types-list">
508
- <?php
509
- foreach ($review_types as $type) {
510
- $type = trim($type);
511
- $type_option = $type;
512
- //to keep compatibility with version <2.2.3
513
- if($type === 'Place') {
514
- $type_option='LocalBusiness';
515
- }
516
- //to keep compatibility with version <2.2.3
517
- if($type === 'Other') {
518
- $type_option='BlogPosting';
519
- }
520
-
521
- if ($option['snippet_itemtype'] === $type) {
522
- echo "<option value=\"$type\" selected>$type_option</option>";
523
- } else {
524
- echo "<option value=\"$type\">$type_option</option>";
525
- }
526
- }
527
- ?>
528
- </select>
529
- </label>
530
  <div class="yasr-element-row-container-description">
531
  <?php
532
  esc_html_e('You can always change itemType in the single post or page.',
@@ -544,7 +543,9 @@ class YasrSettings {
544
  $name = 'yasr_general_options[publisher]';
545
  $id = 'yasr-general-options-publisher';
546
 
547
- echo YasrPhpFieldsHelper::radio( $option_title, 'none', $array_options, $name, $default, $id );
 
 
548
  ?>
549
  <br/>
550
  <input type='text' name='yasr_general_options[publisher_name]'
@@ -941,9 +942,88 @@ class YasrSettings {
941
  $string_input .= '</div>';
942
  }
943
 
944
- echo htmlspecialchars_decode($string_input);
945
 
946
  }
947
  }
948
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
949
  }
183
  $name = 'yasr_general_options[auto_insert_what]';
184
  $class = 'yasr-auto-insert-options-class';
185
 
186
+ echo yasr_kses(
187
+ YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default)
188
+ );
189
  ?>
190
  </div>
191
  <div>
192
  <?php
193
+ $option_title = __('Where?', 'yet-another-stars-rating');
194
+ $array_options = array (
195
+ 'top' => __('Before the content', 'yet-another-stars-rating'),
196
+ 'bottom' => __('After the content', 'yet-another-stars-rating'),
197
+ 'both' => __('Both', 'yet-another-stars-rating')
198
+ );
199
+ $default = $option['auto_insert_where'];
200
+ $name = 'yasr_general_options[auto_insert_where]';
201
+ $class = 'yasr-auto-insert-options-class';
202
 
203
+ echo yasr_kses(
204
+ YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
205
+ );
206
  ?>
207
  </div>
208
  <div>
209
  <?php
210
+ $option_title = __('Align', 'yet-another-stars-rating');
211
+ $array_options = array (
212
+ 'left' => __('Left', 'yet-another-stars-rating'),
213
+ 'center' => __('Center', 'yet-another-stars-rating'),
214
+ 'right' => __('Right', 'yet-another-stars-rating')
215
+ );
216
+ $default = $option['auto_insert_align'];
217
+ $name = 'yasr_general_options[auto_insert_align]';
218
+ $class = 'yasr-auto-insert-options-class';
219
 
220
+ echo yasr_kses(
221
+ YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default)
222
+ );
223
  ?>
224
  </div>
225
  <div>
231
  $class = 'yasr-auto-insert-options-class';
232
  $id = 'yasr-auto-insert-options-stars-size-';
233
 
234
+ echo yasr_kses(
235
+ self::radioSelectSize($name, $class, $option['auto_insert_size'], $id)
236
+ );
237
  ?>
238
  </div>
239
  <div>
247
  $name = 'yasr_general_options[auto_insert_exclude_pages]';
248
  $class = 'yasr-auto-insert-options-class';
249
 
250
+ echo yasr_kses(
251
+ YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
252
+ );
253
  ?>
254
  </div>
255
  <?php
265
  $name = 'yasr_general_options[auto_insert_custom_post_only]';
266
  $class = 'yasr-auto-insert-options-class';
267
 
268
+ echo yasr_kses(
269
+ YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
270
+ );
271
  ?>
272
  <div>
273
  <?php
322
  $name = 'yasr_general_options[stars_title_what]';
323
  $class = 'yasr-stars-title-options-class';
324
 
325
+ echo yasr_kses(
326
+ YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
327
+ );
328
  ?>
329
  </div>
330
  <div>
338
  $name = 'yasr_general_options[stars_title_exclude_pages]';
339
  $class = 'yasr-stars-title-options-class';
340
 
341
+ echo yasr_kses(
342
+ YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
343
+ );
344
  ?>
345
  </div>
346
  <div style="flex: 0 0 50%">
355
  $name = 'yasr_general_options[stars_title_where]';
356
  $class = 'yasr-stars-title-options-class';
357
 
358
+ echo yasr_kses(
359
+ YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
360
+ );
361
  ?>
362
  </div>
363
  </div>
486
  $name = 'yasr_general_options[allowed_user]';
487
  $class = 'yasr_auto_insert_loggedonly';
488
 
489
+ echo yasr_kses(
490
+ YasrPhpFieldsHelper::radio( false, $class, $array_options, $name, $default )
491
+ );
492
  ?>
493
  <br />
494
  <div class="yasr-indented-answer">
520
  </strong>
521
  <div>
522
  <?php
523
+ yasr_select_itemtype(
524
+ 'yasr-choose-reviews-types-list', 'yasr_general_options[snippet_itemtype]',
525
+ $option['snippet_itemtype']
526
+ );
527
  ?>
528
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  <div class="yasr-element-row-container-description">
530
  <?php
531
  esc_html_e('You can always change itemType in the single post or page.',
543
  $name = 'yasr_general_options[publisher]';
544
  $id = 'yasr-general-options-publisher';
545
 
546
+ echo yasr_kses(
547
+ YasrPhpFieldsHelper::radio( $option_title, 'none', $array_options, $name, $default, $id )
548
+ );
549
  ?>
550
  <br/>
551
  <input type='text' name='yasr_general_options[publisher_name]'
942
  $string_input .= '</div>';
943
  }
944
 
945
+ echo yasr_kses($string_input);
946
 
947
  }
948
  }
949
 
950
+ /**
951
+ * Returns the radio buttons that allow to select stars size
952
+ *
953
+ * @param $name
954
+ * @param $class
955
+ * @param bool $db_value
956
+ * @param bool $id
957
+ * @param bool $txt_label
958
+ * @param bool $newline
959
+ * return string
960
+ *
961
+ * @since 2.3.3
962
+ * @return string
963
+ */
964
+ public static function radioSelectSize($name, $class, $db_value=false, $id=false, $txt_label=true, $newline=false) {
965
+ $array_size = array('small', 'medium', 'large');
966
+ $span_label = '';
967
+ $html_to_return = '';
968
+
969
+ foreach ($array_size as $size) {
970
+ $id_string = $id . $size;
971
+
972
+ //must be inside for each, or when loop arrive to last element
973
+ //checked is defined
974
+ $checked = '';
975
+
976
+ //If db_value === false, there is no need to check for db value
977
+ //so checked is the medium star (i.e. ranking page)
978
+ if ($db_value === false) {
979
+ if ($size === 'medium') {
980
+ $checked = 'checked';
981
+ }
982
+ }
983
+ else if ($db_value === $size) {
984
+ $checked = 'checked';
985
+ }
986
+
987
+ if($txt_label !== false) {
988
+ $span_label =
989
+ '<span class="yasr-text-options-size">'.
990
+ __(ucwords($size), 'yet-another-stars-rating').
991
+ '</span>';
992
+ if($newline !== false) {
993
+ $span_label = '<br />' . $span_label;
994
+ }
995
+ }
996
+ $src = YASR_IMG_DIR . 'yasr-stars-'.$size.'.png';
997
+
998
+ $html_to_return .= sprintf(
999
+ '<div class="yasr-option-div">
1000
+ <label for="%s">
1001
+ <input type="radio"
1002
+ name="%s"
1003
+ value="%s"
1004
+ class="%s"
1005
+ id="%s"
1006
+ %s
1007
+ >
1008
+ <img src="%s"
1009
+ class="yasr-img-option-size" alt=%s>
1010
+ %s
1011
+ </label>
1012
+ </div>',
1013
+ $id_string,
1014
+ $name,
1015
+ $size,
1016
+ $class,
1017
+ $id_string,
1018
+ $checked,
1019
+ $src,
1020
+ $size,
1021
+ $span_label
1022
+ );
1023
+
1024
+ } //end foreach
1025
+
1026
+ return $html_to_return;
1027
+ }
1028
+
1029
  }
admin/settings/classes/YasrSettingsRankings.php CHANGED
@@ -46,32 +46,27 @@ class YasrSettingsRankings {
46
  </strong>
47
  <br/>
48
  <?php
49
- $source_array = array(
50
- 'yasr_most_or_highest_rated_posts',
51
- 'yasr_ov_ranking',
52
- 'yasr_most_active_users',
53
- 'yasr_top_reviewers'
54
- );
55
 
56
- if($this->n_multi_set > 0) {
57
- $source_array[] = 'yasr_multi_set_ranking';
58
- $source_array[] = 'yasr_visitor_multi_set_ranking';
59
- }
60
 
61
- //Use this filter to add (or remove) new elements
62
- $select_array = apply_filters('yasr_settings_select_ranking', $source_array);
63
 
64
- $name = 'yasr-ranking-source';
65
- $id = 'yasr-ranking-source';
66
 
67
- echo YasrPhpFieldsHelper::select(
68
- '',
69
- '',
70
- $select_array,
71
- $name,
72
- $id,
73
- 'yasr_visitor_votes'
74
- );
75
  ?>
76
  </div>
77
  <?php
@@ -123,7 +118,9 @@ class YasrSettingsRankings {
123
  $class = 'yasr-builder-size yasr-builder-elements-parents';
124
  $id = 'yasr-builder-size-';
125
 
126
- YasrPhpFieldsHelper::radioSelectSize($name, $class, 'medium', $id, false);
 
 
127
  ?>
128
  </div>
129
  <?php
@@ -145,7 +142,9 @@ class YasrSettingsRankings {
145
  $id = 'yasr-default-view';
146
 
147
  echo wp_kses_post($option_title.YASR_LOCKED_FEATURE);
148
- echo YasrPhpFieldsHelper::radio( '', $class, $array_options, $name, $default, $id );
 
 
149
  ?>
150
  </div>
151
  <?php
@@ -223,7 +222,9 @@ class YasrSettingsRankings {
223
  $id = 'yasr-builder-ov-radio-text';
224
 
225
  echo wp_kses_post('<strong>'.$option_title.'</strong>'.YASR_LOCKED_FEATURE);
226
- echo YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id);
 
 
227
  ?>
228
  <br />
229
  <strong>
@@ -257,21 +258,23 @@ class YasrSettingsRankings {
257
  <?php
258
  $name_id = 'yasr-builder-datepicker-start';
259
  echo wp_kses_post('<strong>'.__('Start Date', 'yet-another-stars-rating').'</strong>' . YASR_LOCKED_FEATURE);
260
- echo YasrPhpFieldsHelper::text(
261
- 'yasr-option-div yasr-builder-elements-parents',
262
- '',
263
- $name_id,
264
- $name_id
265
- );
 
266
 
267
  $name_id = 'yasr-builder-datepicker-end';
268
  echo wp_kses_post('<strong>'.__('End Date', 'yet-another-stars-rating').'</strong>' . YASR_LOCKED_FEATURE);
269
- echo YasrPhpFieldsHelper::text(
270
- 'yasr-option-div yasr-builder-elements-parents',
271
- '',
272
- $name_id,
273
- $name_id
274
- );
 
275
  ?>
276
  </div>
277
  <?php
@@ -299,7 +302,9 @@ class YasrSettingsRankings {
299
  $id = 'yasr-builder-rankings-category';
300
 
301
  echo wp_kses_post($option_title.YASR_LOCKED_FEATURE);
302
- echo YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id);
 
 
303
 
304
  ?>
305
 
@@ -366,7 +371,9 @@ class YasrSettingsRankings {
366
  $id = 'yasr-builder-enable-cpt-radio';
367
 
368
  echo wp_kses_post($option_title.YASR_LOCKED_FEATURE);
369
- echo YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id);
 
 
370
 
371
  echo '<br />';
372
 
@@ -404,7 +411,9 @@ class YasrSettingsRankings {
404
  $class = 'yasr-builder-user-option yasr-builder-elements-parents';
405
  $id = 'yasr-builder-user-option';
406
 
407
- echo YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default, $id);
 
 
408
  ?>
409
 
410
  </div>
46
  </strong>
47
  <br/>
48
  <?php
49
+ $source_array = array(
50
+ 'yasr_most_or_highest_rated_posts',
51
+ 'yasr_ov_ranking',
52
+ 'yasr_most_active_users',
53
+ 'yasr_top_reviewers'
54
+ );
55
 
56
+ if($this->n_multi_set > 0) {
57
+ $source_array[] = 'yasr_multi_set_ranking';
58
+ $source_array[] = 'yasr_visitor_multi_set_ranking';
59
+ }
60
 
61
+ //Use this filter to add (or remove) new elements
62
+ $select_array = apply_filters('yasr_settings_select_ranking', $source_array);
63
 
64
+ $name = 'yasr-ranking-source';
65
+ $id = 'yasr-ranking-source';
66
 
67
+ echo yasr_kses(
68
+ YasrPhpFieldsHelper::select('','', $select_array, $name, $id, 'yasr_visitor_votes')
69
+ );
 
 
 
 
 
70
  ?>
71
  </div>
72
  <?php
118
  $class = 'yasr-builder-size yasr-builder-elements-parents';
119
  $id = 'yasr-builder-size-';
120
 
121
+ echo yasr_kses(
122
+ YasrSettings::radioSelectSize($name, $class, 'medium', $id, false)
123
+ );
124
  ?>
125
  </div>
126
  <?php
142
  $id = 'yasr-default-view';
143
 
144
  echo wp_kses_post($option_title.YASR_LOCKED_FEATURE);
145
+ echo yasr_kses(
146
+ YasrPhpFieldsHelper::radio( '', $class, $array_options, $name, $default, $id )
147
+ );
148
  ?>
149
  </div>
150
  <?php
222
  $id = 'yasr-builder-ov-radio-text';
223
 
224
  echo wp_kses_post('<strong>'.$option_title.'</strong>'.YASR_LOCKED_FEATURE);
225
+ echo yasr_kses(
226
+ YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id)
227
+ );
228
  ?>
229
  <br />
230
  <strong>
258
  <?php
259
  $name_id = 'yasr-builder-datepicker-start';
260
  echo wp_kses_post('<strong>'.__('Start Date', 'yet-another-stars-rating').'</strong>' . YASR_LOCKED_FEATURE);
261
+ echo yasr_kses(
262
+ YasrPhpFieldsHelper::text(
263
+ 'yasr-option-div yasr-builder-elements-parents',
264
+ '',
265
+ $name_id,
266
+ $name_id
267
+ ));
268
 
269
  $name_id = 'yasr-builder-datepicker-end';
270
  echo wp_kses_post('<strong>'.__('End Date', 'yet-another-stars-rating').'</strong>' . YASR_LOCKED_FEATURE);
271
+ echo yasr_kses(
272
+ YasrPhpFieldsHelper::text(
273
+ 'yasr-option-div yasr-builder-elements-parents',
274
+ '',
275
+ $name_id,
276
+ $name_id
277
+ ));
278
  ?>
279
  </div>
280
  <?php
302
  $id = 'yasr-builder-rankings-category';
303
 
304
  echo wp_kses_post($option_title.YASR_LOCKED_FEATURE);
305
+ echo yasr_kses(
306
+ YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id)
307
+ );
308
 
309
  ?>
310
 
371
  $id = 'yasr-builder-enable-cpt-radio';
372
 
373
  echo wp_kses_post($option_title.YASR_LOCKED_FEATURE);
374
+ echo yasr_kses(
375
+ YasrPhpFieldsHelper::radio('', $class, $array_options, $name, $default, $id)
376
+ );
377
 
378
  echo '<br />';
379
 
411
  $class = 'yasr-builder-user-option yasr-builder-elements-parents';
412
  $id = 'yasr-builder-user-option';
413
 
414
+ echo yasr_kses(
415
+ YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default, $id)
416
+ );
417
  ?>
418
 
419
  </div>
admin/yasr-admin-init.php CHANGED
@@ -26,16 +26,6 @@ if(!is_admin()) {
26
  return;
27
  }
28
 
29
- //e.g. http://localhost/plugin_development/wp-content/plugins/yet-another-stars-rating/admin/js/
30
- define('YASR_JS_DIR_ADMIN', plugins_url() . '/' . YASR_RELATIVE_PATH_ADMIN . '/js/');
31
-
32
- //define gutenberg paths
33
- define('YASR_JS_GUTEN', plugins_url() . '/' . YASR_RELATIVE_PATH_ADMIN . '/js/guten/');
34
- define('YASR_JS_GUTEN_BLOCKS', YASR_JS_GUTEN . 'blocks/');
35
-
36
- //CSS directory absolute URL
37
- define('YASR_CSS_DIR_ADMIN', plugins_url() . '/' . YASR_RELATIVE_PATH_ADMIN . '/css/');
38
-
39
  //this define must triggered after the active theme's functions.php file is loaded
40
  add_action('init', function (){
41
 
26
  return;
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
29
  //this define must triggered after the active theme's functions.php file is loaded
30
  add_action('init', function (){
31
 
includes/classes/YasrMultiSetData.php CHANGED
@@ -29,7 +29,11 @@ if (!defined('ABSPATH')) {
29
  */
30
  class YasrMultiSetData {
31
 
32
- /****** Get multi set name ******/
 
 
 
 
33
  public static function returnMultiSetNames() {
34
  global $wpdb;
35
 
29
  */
30
  class YasrMultiSetData {
31
 
32
+ /**
33
+ * @author Dario Curvino <@dudo>
34
+ * @since
35
+ * @return array|object|\stdClass[]|null
36
+ */
37
  public static function returnMultiSetNames() {
38
  global $wpdb;
39
 
includes/classes/YasrPhpFieldsHelper.php CHANGED
@@ -337,78 +337,7 @@ if (!class_exists('YasrPhpFieldsHelper') ) {
337
  return $cleaned_array;
338
  }
339
 
340
- /**
341
- * @param $name
342
- * @param $class
343
- * @param bool $db_value
344
- * @param bool $id
345
- * @param bool $txt_label
346
- * @param bool $newline
347
- *
348
- * return void
349
- * @since 2.3.3
350
- */
351
- public static function radioSelectSize($name, $class, $db_value=false, $id=false, $txt_label=true, $newline=false) {
352
- $array_size = array('small', 'medium', 'large');
353
- $span_label = '';
354
-
355
- foreach ($array_size as $size) {
356
- $id_string = $id . $size;
357
 
358
- //must be inside for each, or when loop arrive to last element
359
- //checked is defined
360
- $checked = '';
361
-
362
- //If db_value === false, there is no need to check for db value
363
- //so checked is the medium star (i.e. ranking page)
364
- if ($db_value === false) {
365
- if ($size === 'medium') {
366
- $checked = 'checked';
367
- }
368
- }
369
- else if ($db_value === $size) {
370
- $checked = 'checked';
371
- }
372
-
373
- if($txt_label !== false) {
374
- $span_label =
375
- '<span class="yasr-text-options-size">'.
376
- __(ucwords($size), 'yet-another-stars-rating').
377
- '</span>';
378
- if($newline !== false) {
379
- $span_label = '<br />' . $span_label;
380
- }
381
- }
382
- $src = YASR_IMG_DIR . 'yasr-stars-'.$size.'.png';
383
-
384
- printf(
385
- '<div class="yasr-option-div">
386
- <label for="%s">
387
- <input type="radio"
388
- name="%s"
389
- value="%s"
390
- class="%s"
391
- id="%s"
392
- %s
393
- >
394
- <img src="%s"
395
- class="yasr-img-option-size" alt=%s>
396
- %s
397
- </label>
398
- </div>',
399
- esc_attr($id_string),
400
- esc_attr($name),
401
- esc_attr($size),
402
- esc_attr($class),
403
- esc_attr($id_string),
404
- esc_attr($checked),
405
- esc_url($src),
406
- esc_attr($size),
407
- wp_kses_post($span_label)
408
- );
409
-
410
- } //end foreach
411
- }
412
  }
413
 
414
  }
337
  return $cleaned_array;
338
  }
339
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
341
  }
342
 
343
  }
includes/classes/YasrScriptsLoader.php CHANGED
@@ -29,6 +29,16 @@ class YasrScriptsLoader {
29
  ***/
30
  add_action('yasr_add_front_script_css', array($this, 'loadCssStarsSet'));
31
  add_action('yasr_add_admin_scripts_end', array($this, 'loadCssStarsSet'));
 
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  /**
@@ -51,15 +61,25 @@ class YasrScriptsLoader {
51
 
52
 
53
  $yasr_window_var = array(
54
- 'siteUrl' => site_url(),
55
- 'adminUrl' => admin_url(), //keep this for pricing page
56
- 'ajaxurl' => admin_url('admin-ajax.php'),
57
- 'visitorStatsEnabled' => YASR_VISITORS_STATS,
58
- 'ajaxEnabled' => YASR_ENABLE_AJAX,
59
- 'loaderHtml' => $yasr_visitor_votes_loader,
60
- 'loaderUrl' => esc_url(YASR_IMG_DIR . 'loader.gif'),
61
- 'isUserLoggedIn' => json_encode(is_user_logged_in()),
62
- 'isRtl' => json_encode(is_rtl())
 
 
 
 
 
 
 
 
 
 
63
  );
64
 
65
  //check if wp_localize_script has already run before
@@ -120,7 +140,7 @@ class YasrScriptsLoader {
120
  );
121
 
122
  if (defined('YASR_CATCH_INFINITE_SCROLL_INSTALLED') && YASR_CATCH_INFINITE_SCROLL_INSTALLED === true) {
123
- $array_dep = array('jquery', 'yasr-global-functions', 'wp-i18n', 'yasr-window-var', 'wp-element');
124
 
125
  //laod tippy only if the shortcode has loaded it
126
  $tippy_loaded = wp_script_is('tippy');
@@ -200,7 +220,7 @@ class YasrScriptsLoader {
200
  * @since 2.8.5
201
  */
202
  public static function loadVVJs() {
203
- $array_dep = array('jquery', 'yasr-global-functions', 'wp-i18n', 'yasr-window-var');
204
  $tippy_loaded = wp_script_is('tippy');
205
 
206
  if ($tippy_loaded) {
@@ -226,7 +246,7 @@ class YasrScriptsLoader {
226
  wp_enqueue_script(
227
  'yasr-ov-multi',
228
  YASR_JS_DIR_INCLUDES . 'shortcodes/overall-multiset.js',
229
- array('jquery', 'yasr-global-functions', 'wp-i18n', 'yasr-window-var'),
230
  YASR_VERSION_NUM,
231
  true
232
  );
@@ -242,7 +262,7 @@ class YasrScriptsLoader {
242
  wp_enqueue_script(
243
  'yasr-rankings',
244
  YASR_JS_DIR_INCLUDES . 'shortcodes/rankings.js',
245
- array('jquery', 'yasr-global-functions', 'wp-i18n', 'wp-element', 'yasr-window-var'),
246
  YASR_VERSION_NUM,
247
  true
248
  );
@@ -357,4 +377,239 @@ class YasrScriptsLoader {
357
  );
358
  }
359
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  }
29
  ***/
30
  add_action('yasr_add_front_script_css', array($this, 'loadCssStarsSet'));
31
  add_action('yasr_add_admin_scripts_end', array($this, 'loadCssStarsSet'));
32
+
33
+ //enqueue gutenberg stuff outside blocks
34
+ add_action('enqueue_block_editor_assets', array($this, 'initGutenMisc'));
35
+ add_action('init', array($this, 'initGutenBlocks'));
36
+
37
+ //Add yasr constant in gutenberg
38
+ add_action('yasr_add_admin_scripts_end', array($this, 'addJsConstantInGutenberg'));
39
+
40
+ //Save auto insert value to yasrConstantGutenberg
41
+ add_filter('yasr_gutenberg_constants', array($this, 'yasrGutenbergConstants'));
42
  }
43
 
44
  /**
61
 
62
 
63
  $yasr_window_var = array(
64
+ 'siteUrl' => site_url(),
65
+ 'adminUrl' => admin_url(), //keep this for pricing page
66
+ 'ajaxurl' => admin_url('admin-ajax.php'),
67
+ 'visitorStatsEnabled' => YASR_VISITORS_STATS,
68
+ 'ajaxEnabled' => YASR_ENABLE_AJAX,
69
+ 'loaderHtml' => $yasr_visitor_votes_loader,
70
+ 'loaderUrl' => esc_url(YASR_IMG_DIR . 'loader.gif'),
71
+ 'isUserLoggedIn' => json_encode(is_user_logged_in()),
72
+ 'isRtl' => json_encode(is_rtl()),
73
+ 'starSingleForm' => json_encode(esc_html__('star', 'yet-another-stars-rating')),
74
+ 'starsPluralForm' => json_encode(esc_html__('stars', 'yet-another-stars-rating')),
75
+ 'textAfterVr' => json_encode(YASR_TEXT_AFTER_VR),
76
+ 'textRating' => json_encode(esc_html__('Rating', 'yet-another-stars-rating')),
77
+ 'textLoadRanking' => json_encode(esc_html__('Loading, please wait', 'yet-another-stars-rating')),
78
+ 'textVvStats' => json_encode(esc_html__('out of 5 stars', 'yet-another-stars-rating')),
79
+ 'textOrderBy' => json_encode(esc_html__('Order by', 'yet-another-stars-rating')),
80
+ 'textMostRated' => json_encode(esc_html__('Most Rated', 'yet-another-stars-rating')),
81
+ 'textHighestRated' => json_encode(esc_html__('Highest Rated', 'yet-another-stars-rating')),
82
+ 'textLeftColumnHeader' => json_encode(esc_html__('Post', 'yet-another-stars-rating'))
83
  );
84
 
85
  //check if wp_localize_script has already run before
140
  );
141
 
142
  if (defined('YASR_CATCH_INFINITE_SCROLL_INSTALLED') && YASR_CATCH_INFINITE_SCROLL_INSTALLED === true) {
143
+ $array_dep = array('jquery', 'yasr-global-functions', 'yasr-window-var', 'wp-element');
144
 
145
  //laod tippy only if the shortcode has loaded it
146
  $tippy_loaded = wp_script_is('tippy');
220
  * @since 2.8.5
221
  */
222
  public static function loadVVJs() {
223
+ $array_dep = array('jquery', 'yasr-global-functions', 'yasr-window-var');
224
  $tippy_loaded = wp_script_is('tippy');
225
 
226
  if ($tippy_loaded) {
246
  wp_enqueue_script(
247
  'yasr-ov-multi',
248
  YASR_JS_DIR_INCLUDES . 'shortcodes/overall-multiset.js',
249
+ array('jquery', 'yasr-global-functions', 'yasr-window-var'),
250
  YASR_VERSION_NUM,
251
  true
252
  );
262
  wp_enqueue_script(
263
  'yasr-rankings',
264
  YASR_JS_DIR_INCLUDES . 'shortcodes/rankings.js',
265
+ array('jquery', 'yasr-global-functions', 'wp-element', 'yasr-window-var'),
266
  YASR_VERSION_NUM,
267
  true
268
  );
377
  );
378
  }
379
 
380
+ //this load guten-block.js, only in admin side
381
+ public function initGutenMisc() {
382
+ //I need to enqueue this only in post-new.php or post.php
383
+ $current_screen = get_current_screen();
384
+ if ($current_screen !== null
385
+ && (property_exists($current_screen, 'base') && $current_screen->base === 'post')
386
+ && ($this->isFseElement($current_screen) === false)
387
+ ) {
388
+ //Script
389
+ wp_enqueue_script(
390
+ 'yasr-gutenberg',
391
+ YASR_JS_GUTEN . 'yasr-guten-misc.js',
392
+ array(
393
+ 'wp-blocks',
394
+ 'wp-components',
395
+ 'wp-editor',
396
+ 'wp-edit-post',
397
+ 'wp-element',
398
+ 'wp-i18n',
399
+ 'wp-plugins',
400
+ )
401
+ );
402
+ }
403
+ }
404
+
405
+ /**
406
+ * Call all the methods
407
+ *
408
+ * @author Dario Curvino <@dudo>
409
+ * @since 2.8.4
410
+ */
411
+ public function initGutenBlocks() {
412
+ wp_register_script(
413
+ 'yasr-shortcodes-blocks',
414
+ YASR_JS_GUTEN_BLOCKS . 'shortcodes.js',
415
+ array(
416
+ 'wp-blocks',
417
+ 'wp-block-editor',
418
+ 'wp-components',
419
+ 'wp-element',
420
+ 'wp-i18n',
421
+ ),
422
+ 1
423
+ );
424
+
425
+ global $wp_version;
426
+
427
+ $use_register_block_type_from_metadata = true;
428
+ if(version_compare($wp_version, '5.8.0') >= 0) {
429
+ $use_register_block_type_from_metadata = false;
430
+ }
431
+
432
+ $this->register_overall_block($use_register_block_type_from_metadata);
433
+ $this->register_vv_block($use_register_block_type_from_metadata);
434
+ $this->register_ranking_block($use_register_block_type_from_metadata);
435
+ $this->register_nostars_rankings($use_register_block_type_from_metadata);
436
+ $this->register_user_rate_history($use_register_block_type_from_metadata);
437
+ }
438
+
439
+ /**
440
+ * @author Dario Curvino <@dudo>
441
+ * @since 2.8.4
442
+ * @param bool $use_register_block_type_from_metadata
443
+ */
444
+ private function register_overall_block($use_register_block_type_from_metadata = true) {
445
+ if($use_register_block_type_from_metadata === false) {
446
+ register_block_type(YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/yasrOverallRating.block.json');
447
+ }
448
+ else {
449
+ register_block_type_from_metadata(YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/yasrOverallRating.block.json');
450
+ }
451
+ }
452
+
453
+ /**
454
+ * @author Dario Curvino <@dudo>
455
+ * @since 2.8.4
456
+ * @param bool $use_register_block_type_from_metadata
457
+ */
458
+ private function register_vv_block($use_register_block_type_from_metadata = true) {
459
+ if($use_register_block_type_from_metadata === false) {
460
+ register_block_type(YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/yasrVisitorVotes.block.json');
461
+ }
462
+ else {
463
+ register_block_type_from_metadata(YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/yasrVisitorVotes.block.json');
464
+ }
465
+ }
466
+
467
+ /**
468
+ * @author Dario Curvino <@dudo>
469
+ * @since 2.8.4
470
+ * @param bool $use_register_block_type_from_metadata
471
+ */
472
+ private function register_ranking_block($use_register_block_type_from_metadata = true) {
473
+ if($use_register_block_type_from_metadata === false) {
474
+ register_block_type(
475
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingOverallRating.block.json'
476
+ );
477
+ register_block_type(
478
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingVisitorVotes.block.json'
479
+ );
480
+ }
481
+ else {
482
+ register_block_type_from_metadata(
483
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingOverallRating.block.json'
484
+ );
485
+ register_block_type_from_metadata(
486
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingVisitorVotes.block.json'
487
+ );
488
+ }
489
+ }
490
+
491
+ /**
492
+ * @author Dario Curvino <@dudo>
493
+ * @since 2.8.4
494
+ * @param bool $use_register_block_type_from_metadata
495
+ */
496
+ private function register_nostars_rankings($use_register_block_type_from_metadata = true) {
497
+ if($use_register_block_type_from_metadata === false) {
498
+ register_block_type(
499
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingMostActiveUsers.block.json'
500
+ );
501
+ register_block_type(
502
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingMostActiveReviewers.block.json'
503
+ );
504
+ }
505
+ else {
506
+ register_block_type_from_metadata(
507
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingMostActiveUsers.block.json'
508
+ );
509
+ register_block_type_from_metadata(
510
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/rankingMostActiveReviewers.block.json'
511
+ );
512
+ }
513
+ }
514
+
515
+ /**
516
+ * @author Dario Curvino <@dudo>
517
+ * @since 2.8.4
518
+ * @param bool $use_register_block_type_from_metadata
519
+ */
520
+ private function register_user_rate_history($use_register_block_type_from_metadata = true) {
521
+ if($use_register_block_type_from_metadata === false) {
522
+ register_block_type(
523
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/yasrUserRateHistory.block.json'
524
+ );
525
+ }
526
+ else {
527
+ register_block_type_from_metadata(
528
+ YASR_ABSOLUTE_PATH_ADMIN . '/editor/blocks/yasrUserRateHistory.block.json'
529
+ );
530
+ }
531
+ }
532
+
533
+ /**
534
+ * @author Dario Curvino <@dudo>
535
+ * @since 2.8.4
536
+ * @param $hook
537
+ */
538
+ public function addJsConstantInGutenberg($hook) {
539
+ if (($hook === 'post.php' || $hook === 'post-new.php' || $hook === 'appearance_page_gutenberg-edit-site')
540
+ && yasr_is_gutenberg_page() ) {
541
+
542
+ //create an empty array
543
+ //do not add elements here, use yasrGutenbergConstants method instead
544
+ $constants_array = array();
545
+
546
+ //apply filters to empty array
547
+ $constants_array = apply_filters('yasr_gutenberg_constants', $constants_array);
548
+
549
+ //sanitize
550
+ $constants_array = filter_var_array($constants_array,FILTER_SANITIZE_STRING);
551
+
552
+ if(is_array($constants_array) && !empty($constants_array)) {
553
+ wp_localize_script(
554
+ 'yasradmin', //Where to attacch the object
555
+ 'yasrConstantGutenberg',
556
+ $constants_array
557
+ );
558
+ }
559
+ }
560
+ }
561
+
562
+ /**
563
+ * Hook into yasr_gutenberg_constants to add constants used in Gutenberg
564
+ *
565
+ * @author Dario Curvino <@dudo>
566
+ * @param $constants_array
567
+ *
568
+ * @return array
569
+ */
570
+ public function yasrGutenbergConstants($constants_array) {
571
+
572
+ //add after
573
+ if (YASR_AUTO_INSERT_ENABLED === 1) {
574
+ $auto_insert = YASR_AUTO_INSERT_WHAT;
575
+ } else {
576
+ $auto_insert = 'disabled';
577
+ }
578
+
579
+ $auto_insert_array = array (
580
+ 'adminurl' => get_admin_url(),
581
+ 'autoInsert' => $auto_insert,
582
+ 'proVersion' => json_encode(false),
583
+ 'lockedClass' => 'dashicons dashicons-lock',
584
+ 'lockedText' => esc_html__('This feature is available only in the pro version',
585
+ 'yet-another-stars-rating'),
586
+ 'isFseElement' => json_encode($this->isFseElement())
587
+ );
588
+
589
+ return $constants_array + $auto_insert_array;
590
+ }
591
+
592
+ /**
593
+ * Return true if the post type of the current screen base is 'appearance_page_gutenberg-edit-site'
594
+ *
595
+ * @author Dario Curvino <@dudo>
596
+ * @since 2.9.6
597
+ *
598
+ * @param null $current_screen
599
+ *
600
+ * @return bool
601
+ */
602
+ public function isFseElement($current_screen = null) {
603
+ if(!$current_screen) {
604
+ $current_screen = get_current_screen();
605
+ }
606
+
607
+ if (property_exists($current_screen, 'base')
608
+ && $current_screen->base === 'appearance_page_gutenberg-edit-site'
609
+ ) {
610
+ return true;
611
+ }
612
+
613
+ return false;
614
+ }
615
  }
includes/js/catch-inifite-scroll.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var t={593:(t,e,a)=>{let r;var n;a.d(e,{N:()=>x});var s=new Uint8Array(16);function o(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(s)}const i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,l=function(t){return"string"==typeof t&&i.test(t)};for(var c=[],d=0;d<256;++d)c.push((d+256).toString(16).substr(1));const u=function(t,e,a){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var n=0;n<16;++n)e[a+n]=r[n];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]).toLowerCase();if(!l(a))throw TypeError("Stringified UUID is invalid");return a}(r)};function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}function m(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function g(t,e){return g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},g(t,e)}function f(t,e){if(e&&("object"===y(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}var p=wp.i18n.__,h=wp.element.render;function b(t){var e="yasr-ranking-element-"+u(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return yasrSetRaterValue(a,e,!1,.1,!0,t.rating)}})}function _(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",p("Total:","yet-another-stars-rating")," ",t.post.number_of_votes,"  ",p("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function E(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===r&&(r=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),r.innerHTML=t;const e=r.textContent;return r.innerHTML="",e}(t.post.title)))}function R(t){var e="after",a=p("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(_,{post:t.post,tableId:t.tableId,text:a}),React.createElement(b,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(b,{rating:t.post.rating,tableId:t.tableId}),React.createElement(_,{post:t.post,tableId:t.tableId,text:a}))}function w(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(E,{colClass:e,post:t.post}),React.createElement(R,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function k(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(w,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var I=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(o,React.Component);var e,a,r,n,s=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=v(r);if(n){var a=v(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return f(this,t)});function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=s.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=o,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrWindowVar.ajaxEnabled)console.info("Ajax Disabled, getting data from source"),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(t)}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(e),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:"Invalid Data Source"})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},p("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},p("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},p("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},p("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,p("Post","yet-another-stars-rating")),React.createElement("th",null,p("Order By","yet-another-stars-rating"),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(k,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="table-row-group",i="none",l="most",c=o,d=i,u=new URLSearchParams(r);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(c=i,d=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(k,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(k,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:d,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,p("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&m(e.prototype,a),Object.defineProperty(e,"prototype",{writable:!1}),o}();function x(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);h(React.createElement(I,{source:r,tableId:a,params:n,nonce:s}),o)}}x()}},e={};function a(r){var n=e[r];if(void 0!==n)return n.exports;var s=e[r]={exports:{}};return t[r](s,s.exports,a),s.exports}a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{for(var t=wp.i18n.__,e=["yasr-rater-stars","yasr-multiset-visitors-rater"],r=0;r<e.length;r++)n(e[r]);function n(e){var a=document.getElementsByClassName(e);a.length>0&&("yasr-rater-stars"===e&&function(t){for(var e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.id,n=a.getAttribute("data-rater-starsize");yasrSetRaterValue(n,r,a)}}(a),"yasr-multiset-visitors-rater"===e&&function(e){for(var a="",r=[],n=document.getElementById("yasr-pro-multiset-review-rating"),s=0;s<e.length;s++)!function(t){if(!1===e.item(t).classList.contains("yasr-star-rating")){var s=e.item(t),o=s.id,i=s.getAttribute("data-rater-readonly"),l=s.getAttribute("data-rater-starsize");l||(l=16),i=yasrTrueFalseStringConvertion(i);yasrSetRaterValue(l,o,s,1,i,!1,(function(t,e){var o=s.getAttribute("data-rater-postid"),i=s.getAttribute("data-rater-setid"),l=s.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var c=parseInt(t);this.setRating(c),a={postid:o,setid:i,field:l,rating:c},r.push(a),n&&(n.value=JSON.stringify(r)),e()}))}}(s);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var e=this.getAttribute("data-postid"),a=this.getAttribute("data-setid"),n=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+e+"-"+a).hide(),jQuery("#yasr-loader-multiset-visitor-"+e+"-"+a).show();var s=JSON.parse(yasrWindowVar.isUserLoggedIn),o={action:"yasr_visitor_multiset_field_vote",post_id:e,rating:r,set_id:a};!0===s&&Object.assign(o,{nonce:n}),jQuery.post(yasrWindowVar.ajaxurl,o).done((function(t){var r;r=(t=JSON.parse(t)).text,jQuery("#yasr-loader-multiset-visitor-"+e+"-"+a).text(r)})).fail((function(e,a,r,n){console.error(t("YASR ajax call failed. Can't save data","yet-another-stars-rating")),console.log(e)}))}))}(a))}var s=wp.i18n.__;function o(t){if(t.length>0&&(function(t){for(var e=0;e<t.length;e++)!function(e){if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.getAttribute("data-rater-postid"),n=a.id,s=n.replace("yasr-visitor-votes-rater-",""),o=document.getElementById("yasr_visitor_votes_"+s),d=parseInt(a.getAttribute("data-rater-starsize")),u=a.getAttribute("data-rater-nonce"),y=a.getAttribute("data-issingular"),m="yasr-vv-votes-number-container-"+s,g="yasr-vv-average-container-"+s,f="yasr-vv-bottom-container-"+s,v="yasr-vv-loader-"+s,p=document.getElementById(m),h=document.getElementById(g),b=document.getElementById(f),_=document.getElementById(v),E=a.getAttribute("data-rating"),R=a.getAttribute("data-readonly-attribute"),w=a.getAttribute("data-rater-readonly");if(null===R&&(R=!1),R=yasrTrueFalseStringConvertion(R),w=yasrTrueFalseStringConvertion(w),!0===R&&(w=!0),"yes"===yasrWindowVar.ajaxEnabled){c(_);var k={action:"yasr_load_vv",post_id:r};jQuery.get(yasrWindowVar.ajaxurl,k).done((function(t){var e,a=yasrValidJson(t);if(!1===a){return c(_,!1),void l(o,"Not a valid Json Element")}if(e=!0===R||a.yasr_visitor_votes.stars_attributes.read_only,E=(E=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),E=parseFloat(E),i(d,E,r,e,n,0,u,y,p,h,_,b),!0!==R&&(l(p,a.yasr_visitor_votes.number_of_votes),l(h,E),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom)){var s=a.yasr_visitor_votes.stars_attributes.span_bottom;l(b,s)}})).fail((function(t,e,a,s){console.info("YASR ajax call failed. Showing ratings from html"),i(d,E,r,w,n,0,u,y,p,h,_,b),!0!==R&&(b.style.display="")}))}else i(d,E,r,w,n,0,u,y,p,h,_,b)}}(e)}(t),"yes"===yasrWindowVar.visitorStatsEnabled)){var e=document.getElementsByClassName("yasr-dashicons-visitor-stats");e&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};"function"==typeof tippy&&tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrWindowVar.ajaxurl,i,(function(e){if(!1!==(e=yasrValidJson(e)))return"error"===e.status?(console.error(e.text),void t.setContent(e.text)):void t.setContent(d(e));t.setContent("Error!")})).fail((function(e,a,r,n){console.log(e),t.setContent("YASR ajax call failed.")}))},onHidden:function(){r=s}})}(n)}(e)}}function i(t,e,a,r,n,s,o,i,d,u,y,m){e=parseFloat(e),r=yasrTrueFalseStringConvertion(r);var g=document.getElementById(n),f=JSON.parse(yasrWindowVar.isUserLoggedIn);c(y,!1),yasrSetRaterValue(t,n,g,1,r,e,(function(t,e){c(y,!0);var r={action:"yasr_send_visitor_rating",rating:t,post_id:a,is_singular:i};!0===f&&Object.assign(r,{nonce_visitor:o}),this.setRating(t),this.disable(),jQuery.post(yasrWindowVar.ajaxurl,r).done((function(t){if(!1===(t=yasrValidJson(t)))return c(y,!1),void l(m,"<span>Not a valid Json Element, rating can't be saved.</span>");var a,r="yasr-vote-".concat(t.status);"success"===t.status&&(l(d,t.number_of_votes),l(u,t.average_rating)),a='<span class="yasr-small-block-bold" id="'.concat(r,'"> ').concat(t.text," </span>"),l(m,a),c(y,!1),e()})).fail((function(t,e,a,r){console.error("YASR ajax call failed. Can't save data"),console.log(t)}))}))}function l(t,e){null!==t&&(t.innerHTML=e,t.style.display="")}function c(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a="";!0===e&&(a=yasrWindowVar.loaderHtml),l(t,a)}function d(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,o="5%";n<=3&&(o="5%"),n>3&&n<=5&&(o="10%"),n>5&&(o="15%");var i='<div class="yasr-visitors-stats-tooltip">';i+='<span id="yasr-medium-rating-tooltip">'+e+" "+s("out of 5 stars","yet-another-stars-rating")+"</span>",i+='<div class="yasr-progress-bars-container">';for(var l=s("stars","yet-another-stars-rating"),c=0,d=0,u=5;u>0;u--)1===u&&(l=s("star","yet-another-stars-rating")),void 0!==t[u]&&(c=t[u].progressbar,d=t[u].n_of_votes),i+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(u," ").concat(l,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(c,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(o,' ">').concat(d,"</div>\n </div>");return i+"</div></div>"}o(document.getElementsByClassName("yasr-rater-stars-vv"));var u=a(593);jQuery(document).ajaxComplete((function(t,e,a){var r=yasrWindowVar.siteUrl+"/page/";a.url.includes(r)&&(function(){for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)n(t[e])}(),o(document.getElementsByClassName("yasr-rater-stars-vv")),(0,u.N)())}))})()})();
1
+ (()=>{"use strict";var t={593:(t,e,a)=>{let r;var n;a.d(e,{N:()=>N});var s=new Uint8Array(16);function o(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(s)}const i=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,l=function(t){return"string"==typeof t&&i.test(t)};for(var c=[],d=0;d<256;++d)c.push((d+256).toString(16).substr(1));const u=function(t,e,a){var r=(t=t||{}).random||(t.rng||o)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){a=a||0;for(var n=0;n<16;++n)e[a+n]=r[n];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(c[t[e+0]]+c[t[e+1]]+c[t[e+2]]+c[t[e+3]]+"-"+c[t[e+4]]+c[t[e+5]]+"-"+c[t[e+6]]+c[t[e+7]]+"-"+c[t[e+8]]+c[t[e+9]]+"-"+c[t[e+10]]+c[t[e+11]]+c[t[e+12]]+c[t[e+13]]+c[t[e+14]]+c[t[e+15]]).toLowerCase();if(!l(a))throw TypeError("Stringified UUID is invalid");return a}(r)};var m=a(726),y=a.n(m);function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function g(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t,e){return v=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},v(t,e)}function p(t,e){if(e&&("object"===f(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}var b=wp.element.render;function _(t){return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t.html,"<strong><p>")}})}function w(t){var e="yasr-ranking-element-"+u(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return yasrSetRaterValue(a,e,!1,.1,!0,t.rating)}})}function E(t){if(void 0!==t.post.number_of_votes){var e=JSON.parse(yasrWindowVar.textAfterVr);return e=(e=e.replace("%total_count%",t.post.number_of_votes)).replace("%average%",t.post.rating),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(_,{html:e}))}var a=t.text;return React.createElement("div",{className:"yasr-highest-rated-text"},a," ",t.post.rating)}function R(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===r&&(r=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),r.innerHTML=t;const e=r.textContent;return r.innerHTML="",e}(t.post.title)))}function k(t){var e="after",a=JSON.parse(yasrWindowVar.textRating),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(E,{post:t.post,tableId:t.tableId,text:a}),React.createElement(w,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(w,{rating:t.post.rating,tableId:t.tableId}),React.createElement(E,{post:t.post,tableId:t.tableId,text:a}))}function S(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(R,{colClass:e,post:t.post}),React.createElement(k,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function x(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(S,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var I=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(o,React.Component);var e,a,r,n,s=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=h(r);if(n){var a=h(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return p(this,t)});function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=s.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=o,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrWindowVar.ajaxEnabled)console.info("Ajax Disabled, getting data from source"),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(t)}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(e),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:"Invalid Data Source"})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var s=new URLSearchParams(e);null!==s.get("order_by")&&(n+="order_by="+s.get("order_by")),null!==s.get("limit")&&(n+="&limit="+s.get("limit")),null!==s.get("start_date")&&"0"!==s.get("start_date")&&(n+="&start_date="+s.get("start_date")),null!==s.get("end_date")&&"0"!==s.get("end_date")&&(n+="&end_date="+s.get("end_date")),null!==s.get("ctg")?n+="&ctg="+s.get("ctg"):null!==s.get("cpt")&&(n+="&cpt="+s.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==s.get("setid")&&(n+="&setid="+s.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var o="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(o="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+o+r,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var s=React.createElement("span",null,React.createElement("span",{id:r},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===e&&(s=React.createElement("span",null,React.createElement("span",{id:n},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),":  ",s)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,s="most-rated-posts-"+a,o="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(x,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,s=e.highest,o="table-row-group",i="none",l="most",c=o,d=i,u=new URLSearchParams(r);return null!==u.get("view")&&(l=u.get("view")),"highest"===l&&(c=i,d=o),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(x,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(x,{data:s,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:d,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking)))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&g(e.prototype,a),Object.defineProperty(e,"prototype",{writable:!1}),o}();function N(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),s=JSON.parse(t.item(e).dataset.rankingNonce),o=document.getElementById(a);b(React.createElement(I,{source:r,tableId:a,params:n,nonce:s}),o)}}N()},726:function(t,e,a){var r;!function(n){if("function"!=typeof s){var s=function(t){return t};s.nonNative=!0}const o=s("plaintext"),i=s("html"),l=s("comment"),c=/<(\w*)>/g,d=/<\/?([^\s\/>]+)/;function u(t,e,a){return y(t=t||"",m(e=e||[],a=a||""))}function m(t,e){return{allowable_tags:t=function(t){let e=new Set;if("string"==typeof t){let a;for(;a=c.exec(t);)e.add(a[1])}else s.nonNative||"function"!=typeof t[s.iterator]?"function"==typeof t.forEach&&t.forEach(e.add,e):e=new Set(t);return e}(t),tag_replacement:e,state:o,tag_buffer:"",depth:0,in_quote_char:""}}function y(t,e){if("string"!=typeof t)throw new TypeError("'html' parameter must be a string");let a=e.allowable_tags,r=e.tag_replacement,n=e.state,s=e.tag_buffer,c=e.depth,d=e.in_quote_char,u="";for(let e=0,m=t.length;e<m;e++){let m=t[e];if(n===o)"<"===m?(n=i,s+=m):u+=m;else if(n===i)switch(m){case"<":if(d)break;c++;break;case">":if(d)break;if(c){c--;break}d="",n=o,s+=">",a.has(f(s))?u+=s:u+=r,s="";break;case'"':case"'":d=m===d?"":d||m,s+=m;break;case"-":"<!-"===s&&(n=l),s+=m;break;case" ":case"\n":if("<"===s){n=o,u+="< ",s="";break}s+=m;break;default:s+=m}else n===l&&(">"===m?("--"==s.slice(-2)&&(n=o),s=""):s+=m)}return e.state=n,e.tag_buffer=s,e.depth=c,e.in_quote_char=d,u}function f(t){let e=d.exec(t);return e?e[1].toLowerCase():null}u.init_streaming_mode=function(t,e){let a=m(t=t||[],e=e||"");return function(t){return y(t||"",a)}},void 0===(r=function(){return u}.call(e,a,e,t))||(t.exports=r)}()}},e={};function a(r){var n=e[r];if(void 0!==n)return n.exports;var s=e[r]={exports:{}};return t[r].call(s.exports,s,s.exports,a),s.exports}a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)r(t[e]);function r(t){var e=document.getElementsByClassName(t);e.length>0&&("yasr-rater-stars"===t&&function(t){for(var e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.id,n=a.getAttribute("data-rater-starsize");yasrSetRaterValue(n,r,a)}}(e),"yasr-multiset-visitors-rater"===t&&function(t){for(var e="",a=[],r=document.getElementById("yasr-pro-multiset-review-rating"),n=0;n<t.length;n++)!function(n){if(!1===t.item(n).classList.contains("yasr-star-rating")){var s=t.item(n),o=s.id,i=s.getAttribute("data-rater-readonly"),l=s.getAttribute("data-rater-starsize");l||(l=16),i=yasrTrueFalseStringConvertion(i);yasrSetRaterValue(l,o,s,1,i,!1,(function(t,n){var o=s.getAttribute("data-rater-postid"),i=s.getAttribute("data-rater-setid"),l=s.getAttribute("data-rater-set-field-id");t=t.toFixed(1);var c=parseInt(t);this.setRating(c),e={postid:o,setid:i,field:l,rating:c},a.push(e),r&&(r.value=JSON.stringify(a)),n()}))}}(n);jQuery(".yasr-send-visitor-multiset").on("click",(function(){var t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),r=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();var n=JSON.parse(yasrWindowVar.isUserLoggedIn),s={action:"yasr_visitor_multiset_field_vote",post_id:t,rating:a,set_id:e};!0===n&&Object.assign(s,{nonce:r}),jQuery.post(yasrWindowVar.ajaxurl,s).done((function(a){var r;r=(a=JSON.parse(a)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(r)})).fail((function(t,e,a,r){console.error("YASR ajax call failed. Can't save data"),console.log(t)}))}))}(e))}function n(t){if(t.length>0&&(function(t){for(var e=0;e<t.length;e++)!function(e){if(!1===t.item(e).classList.contains("yasr-star-rating")){var a=t.item(e),r=a.getAttribute("data-rater-postid"),n=a.id,l=n.replace("yasr-visitor-votes-rater-",""),c=document.getElementById("yasr_visitor_votes_"+l),d=parseInt(a.getAttribute("data-rater-starsize")),u=a.getAttribute("data-rater-nonce"),m=a.getAttribute("data-issingular"),y="yasr-vv-votes-number-container-"+l,f="yasr-vv-average-container-"+l,g="yasr-vv-bottom-container-"+l,v="yasr-vv-loader-"+l,p=document.getElementById(y),h=document.getElementById(f),b=document.getElementById(g),_=document.getElementById(v),w=a.getAttribute("data-rating"),E=a.getAttribute("data-readonly-attribute"),R=a.getAttribute("data-rater-readonly");if(null===E&&(E=!1),E=yasrTrueFalseStringConvertion(E),R=yasrTrueFalseStringConvertion(R),!0===E&&(R=!0),"yes"===yasrWindowVar.ajaxEnabled){i(_);var k={action:"yasr_load_vv",post_id:r};jQuery.get(yasrWindowVar.ajaxurl,k).done((function(t){var e,a=yasrValidJson(t);if(!1===a){return i(_,!1),void o(c,"Not a valid Json Element")}if(e=!0===E||a.yasr_visitor_votes.stars_attributes.read_only,w=(w=a.yasr_visitor_votes.number_of_votes>0?a.yasr_visitor_votes.sum_votes/a.yasr_visitor_votes.number_of_votes:0).toFixed(1),w=parseFloat(w),s(d,w,r,e,n,0,u,m,p,h,_,b),!0!==E&&(o(p,a.yasr_visitor_votes.number_of_votes),o(h,w),!1!==a.yasr_visitor_votes.stars_attributes.span_bottom)){var l=a.yasr_visitor_votes.stars_attributes.span_bottom;o(b,l)}})).fail((function(t,e,a,o){console.info("YASR ajax call failed. Showing ratings from html"),s(d,w,r,R,n,0,u,m,p,h,_,b),!0!==E&&(b.style.display="")}))}else s(d,w,r,R,n,0,u,m,p,h,_,b)}}(e)}(t),"yes"===yasrWindowVar.visitorStatsEnabled)){var e=document.getElementsByClassName("yasr-dashicons-visitor-stats");e&&function(t){for(var e,a,r=!1,n=0;n<t.length;n++)!function(n){var s="#"+t.item(n).id,o=t.item(n).getAttribute("data-postid");0===n&&null!==(e=document.getElementsByClassName("yasr-vv-text-container"))&&(a=window.getComputedStyle(e[0],null).getPropertyValue("color")),a&&(document.getElementById(t.item(n).id).style.fill=a);var i={action:"yasr_stats_visitors_votes",post_id:o};"function"==typeof tippy&&tippy(s,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){s!==r&&jQuery.post(yasrWindowVar.ajaxurl,i,(function(e){if(!1!==(e=yasrValidJson(e)))return"error"===e.status?(console.error(e.text),void t.setContent(e.text)):void t.setContent(l(e));t.setContent("Error!")})).fail((function(e,a,r,n){console.log(e),t.setContent("YASR ajax call failed.")}))},onHidden:function(){r=s}})}(n)}(e)}}function s(t,e,a,r,n,s,l,c,d,u,m,y){e=parseFloat(e),r=yasrTrueFalseStringConvertion(r);var f=document.getElementById(n),g=JSON.parse(yasrWindowVar.isUserLoggedIn);i(m,!1),yasrSetRaterValue(t,n,f,1,r,e,(function(t,e){i(m,!0);var r={action:"yasr_send_visitor_rating",rating:t,post_id:a,is_singular:c};!0===g&&Object.assign(r,{nonce_visitor:l}),this.setRating(t),this.disable(),jQuery.post(yasrWindowVar.ajaxurl,r).done((function(t){if(!1===(t=yasrValidJson(t)))return i(m,!1),void o(y,"<span>Not a valid Json Element, rating can't be saved.</span>");var a,r="yasr-vote-".concat(t.status);"success"===t.status&&(o(d,t.number_of_votes),o(u,t.average_rating)),a='<span class="yasr-small-block-bold" id="'.concat(r,'"> ').concat(t.text," </span>"),o(y,a),i(m,!1),e()})).fail((function(t,e,a,r){console.error("YASR ajax call failed. Can't save data"),console.log(t)}))}))}function o(t,e){null!==t&&(t.innerHTML=e,t.style.display="")}function i(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a="";!0===e&&(a=yasrWindowVar.loaderHtml),o(t,a)}function l(t){var e=t.medium_rating;delete t.medium_rating;for(var a=0,r=1;r<=5;r++)(1===r||t[r].n_of_votes>a)&&(a=t[r].n_of_votes);var n=Math.log(a)*Math.LOG10E+1|0,s="5%";n<=3&&(s="5%"),n>3&&n<=5&&(s="10%"),n>5&&(s="15%");var o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+e+" "+JSON.parse(yasrWindowVar.textVvStats)+"</span>",o+='<div class="yasr-progress-bars-container">';for(var i=JSON.parse(yasrWindowVar.starsPluralForm),l=0,c=0,d=5;d>0;d--)1===d&&(i=JSON.parse(yasrWindowVar.starSingleForm)),void 0!==t[d]&&(l=t[d].progressbar,c=t[d].n_of_votes),o+="<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>".concat(d," ").concat(i,"</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:").concat(l,"'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style=\"flex-basis:").concat(s,' ">').concat(c,"</div>\n </div>");return o+"</div></div>"}n(document.getElementsByClassName("yasr-rater-stars-vv"));var c=a(593);jQuery(document).ajaxComplete((function(t,e,a){var s=yasrWindowVar.siteUrl+"/page/";a.url.includes(s)&&(function(){for(var t=["yasr-rater-stars","yasr-multiset-visitors-rater"],e=0;e<t.length;e++)r(t[e])}(),n(document.getElementsByClassName("yasr-rater-stars-vv")),(0,c.N)())}))})()})();
includes/js/shortcodes/overall-multiset.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";const{__:t}=wp.i18n,e=["yasr-rater-stars","yasr-multiset-visitors-rater"];for(let t=0;t<e.length;t++)r(e[t]);function r(e){const r=document.getElementsByClassName(e);r.length>0&&("yasr-rater-stars"===e&&function(t){for(let e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){const r=t.item(e),s=r.id,a=r.getAttribute("data-rater-starsize");yasrSetRaterValue(a,s,r)}}(r),"yasr-multiset-visitors-rater"===e&&function(e){var r="",s=[];const a=document.getElementById("yasr-pro-multiset-review-rating");for(let t=0;t<e.length;t++)!function(t){if(!1!==e.item(t).classList.contains("yasr-star-rating"))return;let i=e.item(t),n=i.id,o=i.getAttribute("data-rater-readonly"),l=i.getAttribute("data-rater-starsize");l||(l=16),o=yasrTrueFalseStringConvertion(o);yasrSetRaterValue(l,n,i,1,o,!1,(function(t,e){const n=i.getAttribute("data-rater-postid"),o=i.getAttribute("data-rater-setid"),l=i.getAttribute("data-rater-set-field-id");t=t.toFixed(1);const u=parseInt(t);this.setRating(u),r={postid:n,setid:o,field:l,rating:u},s.push(r),a&&(a.value=JSON.stringify(s)),e()}))}(t);jQuery(".yasr-send-visitor-multiset").on("click",(function(){const e=this.getAttribute("data-postid"),r=this.getAttribute("data-setid"),a=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+e+"-"+r).hide(),jQuery("#yasr-loader-multiset-visitor-"+e+"-"+r).show();const i=JSON.parse(yasrWindowVar.isUserLoggedIn),n={action:"yasr_visitor_multiset_field_vote",post_id:e,rating:s,set_id:r};!0===i&&Object.assign(n,{nonce:a}),jQuery.post(yasrWindowVar.ajaxurl,n).done((function(t){let s;s=(t=JSON.parse(t)).text,jQuery("#yasr-loader-multiset-visitor-"+e+"-"+r).text(s)})).fail((function(e,r,s,a){console.error(t("YASR ajax call failed. Can't save data","yet-another-stars-rating")),console.log(e)}))}))}(r))}})();
1
+ (()=>{"use strict";const t=["yasr-rater-stars","yasr-multiset-visitors-rater"];for(let r=0;r<t.length;r++)e(t[r]);function e(t){const e=document.getElementsByClassName(t);e.length>0&&("yasr-rater-stars"===t&&function(t){for(let e=0;e<t.length;e++)if(!1===t.item(e).classList.contains("yasr-star-rating")){const r=t.item(e),s=r.id,a=r.getAttribute("data-rater-starsize");yasrSetRaterValue(a,s,r)}}(e),"yasr-multiset-visitors-rater"===t&&function(t){var e="",r=[];const s=document.getElementById("yasr-pro-multiset-review-rating");for(let a=0;a<t.length;a++)!function(a){if(!1!==t.item(a).classList.contains("yasr-star-rating"))return;let i=t.item(a),n=i.id,o=i.getAttribute("data-rater-readonly"),l=i.getAttribute("data-rater-starsize");l||(l=16),o=yasrTrueFalseStringConvertion(o);yasrSetRaterValue(l,n,i,1,o,!1,(function(t,a){const n=i.getAttribute("data-rater-postid"),o=i.getAttribute("data-rater-setid"),l=i.getAttribute("data-rater-set-field-id");t=t.toFixed(1);const u=parseInt(t);this.setRating(u),e={postid:n,setid:o,field:l,rating:u},r.push(e),s&&(s.value=JSON.stringify(r)),a()}))}(a);jQuery(".yasr-send-visitor-multiset").on("click",(function(){const t=this.getAttribute("data-postid"),e=this.getAttribute("data-setid"),s=this.getAttribute("data-nonce");jQuery("#yasr-send-visitor-multiset-"+t+"-"+e).hide(),jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).show();const a=JSON.parse(yasrWindowVar.isUserLoggedIn),i={action:"yasr_visitor_multiset_field_vote",post_id:t,rating:r,set_id:e};!0===a&&Object.assign(i,{nonce:s}),jQuery.post(yasrWindowVar.ajaxurl,i).done((function(r){let s;s=(r=JSON.parse(r)).text,jQuery("#yasr-loader-multiset-visitor-"+t+"-"+e).text(s)})).fail((function(t,e,r,s){console.error("YASR ajax call failed. Can't save data"),console.log(t)}))}))}(e))}})();
includes/js/shortcodes/rankings.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";let t;var e,a=new Uint8Array(16);function r(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(a)}const n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,o=function(t){return"string"==typeof t&&n.test(t)};for(var s=[],i=0;i<256;++i)s.push((i+256).toString(16).substr(1));const l=function(t,e,a){var n=(t=t||{}).random||(t.rng||r)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){a=a||0;for(var i=0;i<16;++i)e[a+i]=n[i];return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(s[t[e+0]]+s[t[e+1]]+s[t[e+2]]+s[t[e+3]]+"-"+s[t[e+4]]+s[t[e+5]]+"-"+s[t[e+6]]+s[t[e+7]]+"-"+s[t[e+8]]+s[t[e+9]]+"-"+s[t[e+10]]+s[t[e+11]]+s[t[e+12]]+s[t[e+13]]+s[t[e+14]]+s[t[e+15]]).toLowerCase();if(!o(a))throw TypeError("Stringified UUID is invalid");return a}(n)};function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t,e){for(var a=0;a<e.length;a++){var r=e[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},d(t,e)}function m(t,e){if(e&&("object"===c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}var f=wp.i18n.__,p=wp.element.render;function h(t){var e="yasr-ranking-element-"+l(),a=document.getElementById(t.tableId).dataset.rankingSize;return React.createElement("div",{id:e,ref:function(){return yasrSetRaterValue(a,e,!1,.1,!0,t.rating)}})}function y(t){if(void 0!==t.post.number_of_votes)return React.createElement("span",{className:"yasr-most-rated-text"},"[",f("Total:","yet-another-stars-rating")," ",t.post.number_of_votes,"  ",f("Average:","yet-another-stars-rating")," ",t.post.rating,"]");var e=t.text;return React.createElement("span",{className:"yasr-highest-rated-text"},e," ",t.post.rating)}function b(e){return React.createElement("td",{className:e.colClass},React.createElement("a",{href:e.post.link},function(e){if("string"!=typeof e||-1===e.indexOf("&"))return e;void 0===t&&(t=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),t.innerHTML=e;const a=t.textContent;return t.innerHTML="",a}(e.post.title)))}function v(t){var e="after",a=f("Rating:","yet-another-stars-rating"),r=new URLSearchParams(t.rankingParams);return null!==r.get("text_position")&&(e=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===e?React.createElement("td",{className:t.colClass},React.createElement(y,{post:t.post,tableId:t.tableId,text:a}),React.createElement(h,{rating:t.post.rating,tableId:t.tableId})):React.createElement("td",{className:t.colClass},React.createElement(h,{rating:t.post.rating,tableId:t.tableId}),React.createElement(y,{post:t.post,tableId:t.tableId,text:a}))}function R(t){var e="",a="";return"author_ranking"===t.source?(e="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===t.source&&(e="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:t.trClass},React.createElement(b,{colClass:e,post:t.post}),React.createElement(v,{colClass:a,post:t.post,tableId:t.tableId,rankingParams:t.rankingParams}))}function E(t){return React.createElement("tbody",{id:t.tBodyId,style:{display:t.show}},t.data.map((function(e,a){var r="yasr-rankings-td-colored";return"author_ranking"===t.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===t.source&&(r="yasr-rankings-td-colored")),React.createElement(R,{key:e.post_id,source:t.source,tableId:t.tableId,rankingParams:t.rankingParams,post:e,trClass:r})})))}var _=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(s,React.Component);var e,a,r,n,o=(r=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=g(r);if(n){var a=g(this).constructor;t=Reflect.construct(e,arguments,a)}else t=e.apply(this,arguments);return m(this,t)});function s(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),(e=o.call(this,t)).state={error:null,isLoaded:!1,data:[],tableId:t.tableId,source:t.source,rankingParams:t.params,nonce:t.nonce},e}return e=s,(a=[{key:"componentDidMount",value:function(){var t=this,e=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrWindowVar.ajaxEnabled)console.info("Ajax Disabled, getting data from source"),this.setState({isLoaded:!0,data:e});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(t){return fetch(t).then((function(t){return!0===t.ok?t.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?a=e:"overall_rating"===t.source||"author_multi"===t.source?a="overall_rating"===t.source?t.data_overall:t.data_mv:a[t.show]=t.data_vv})).catch((function(t){a=e,console.info(t)}))}))).then((function(e){t.setState({isLoaded:!0,data:a})})).catch((function(e){console.info(e),t.setState({isLoaded:!0,data:a})}))}else this.setState({error:"Invalid Data Source"})}},{key:"returnRestUrl",value:function(){var t,e=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==e&&!1!==e){var o=new URLSearchParams(e);null!==o.get("order_by")&&(n+="order_by="+o.get("order_by")),null!==o.get("limit")&&(n+="&limit="+o.get("limit")),null!==o.get("start_date")&&"0"!==o.get("start_date")&&(n+="&start_date="+o.get("start_date")),null!==o.get("end_date")&&"0"!==o.get("end_date")&&(n+="&end_date="+o.get("end_date")),null!==o.get("ctg")?n+="&ctg="+o.get("ctg"):null!==o.get("cpt")&&(n+="&cpt="+o.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==o.get("setid")&&(n+="&setid="+o.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)t=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var s="",i="";if(""!==e){var l=new URLSearchParams(e);null!==l.get("required_votes[most]")&&(s="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}t=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+s+r,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return t}},{key:"rankingTableHead",value:function(t,e){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==t){var o=React.createElement("span",null,React.createElement("span",{id:r},f("Most Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},f("Highest Rated","yet-another-stars-rating")));return"highest"===e&&(o=React.createElement("span",null,React.createElement("span",{id:n},f("Highest Rated","yet-another-stars-rating"))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},f("Most Rated","yet-another-stars-rating")))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,f("Post","yet-another-stars-rating")),React.createElement("th",null,f("Order By","yet-another-stars-rating"),":  ",o)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(t){t.preventDefault();var e=t.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,o="most-rated-posts-"+a,s="highest-rated-posts-"+a,i=document.getElementById(e),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),e===r&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),e===n&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var t=this.state,e=t.data,a=t.source,r=t.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(E,{data:e,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=e.most,o=e.highest,s="table-row-group",i="none",l="most",c=s,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=s),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(E,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(E,{data:o,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:u,source:a}))}},{key:"render",value:function(){var t=this.state,e=t.error,a=t.isLoaded;return e?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(e),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,f("Loading Charts","yet-another-stars-rating")))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&u(e.prototype,a),Object.defineProperty(e,"prototype",{writable:!1}),s}();!function(){var t=document.getElementsByClassName("yasr-stars-rankings");if(t.length>0)for(var e=0;e<t.length;e++){var a=t.item(e).id,r=JSON.parse(t.item(e).dataset.rankingSource),n=JSON.parse(t.item(e).dataset.rankingParams),o=JSON.parse(t.item(e).dataset.rankingNonce),s=document.getElementById(a);p(React.createElement(_,{source:r,tableId:a,params:n,nonce:o}),s)}}()})();
1
+ (()=>{"use strict";var e={726:function(e,t,a){var r;!function(n){if("function"!=typeof o){var o=function(e){return e};o.nonNative=!0}const s=o("plaintext"),i=o("html"),l=o("comment"),c=/<(\w*)>/g,u=/<\/?([^\s\/>]+)/;function d(e,t,a){return f(e=e||"",m(t=t||[],a=a||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let a;for(;a=c.exec(e);)t.add(a[1])}else o.nonNative||"function"!=typeof e[o.iterator]?"function"==typeof e.forEach&&e.forEach(t.add,t):t=new Set(e);return t}(e),tag_replacement:t,state:s,tag_buffer:"",depth:0,in_quote_char:""}}function f(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let a=t.allowable_tags,r=t.tag_replacement,n=t.state,o=t.tag_buffer,c=t.depth,u=t.in_quote_char,d="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(n===s)"<"===m?(n=i,o+=m):d+=m;else if(n===i)switch(m){case"<":if(u)break;c++;break;case">":if(u)break;if(c){c--;break}u="",n=s,o+=">",a.has(p(o))?d+=o:d+=r,o="";break;case'"':case"'":u=m===u?"":u||m,o+=m;break;case"-":"<!-"===o&&(n=l),o+=m;break;case" ":case"\n":if("<"===o){n=s,d+="< ",o="";break}o+=m;break;default:o+=m}else n===l&&(">"===m?("--"==o.slice(-2)&&(n=s),o=""):o+=m)}return t.state=n,t.tag_buffer=o,t.depth=c,t.in_quote_char=u,d}function p(e){let t=u.exec(e);return t?t[1].toLowerCase():null}d.init_streaming_mode=function(e,t){let a=m(e=e||[],t=t||"");return function(e){return f(e||"",a)}},void 0===(r=function(){return d}.call(t,a,t,e))||(e.exports=r)}()}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,a),o.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{let e;var t,r=new Uint8Array(16);function n(){if(!t&&!(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(r)}const o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,s=function(e){return"string"==typeof e&&o.test(e)};for(var i=[],l=0;l<256;++l)i.push((l+256).toString(16).substr(1));const c=function(e,t,a){var r=(e=e||{}).random||(e.rng||n)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){a=a||0;for(var o=0;o<16;++o)t[a+o]=r[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+"-"+i[e[t+4]]+i[e[t+5]]+"-"+i[e[t+6]]+i[e[t+7]]+"-"+i[e[t+8]]+i[e[t+9]]+"-"+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase();if(!s(a))throw TypeError("Stringified UUID is invalid");return a}(r)};var u=a(726),d=a.n(u);function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function f(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(e,t)}function g(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var h=wp.element.render;function b(e){return React.createElement("div",{dangerouslySetInnerHTML:{__html:d()(e.html,"<strong><p>")}})}function v(e){var t="yasr-ranking-element-"+c(),a=document.getElementById(e.tableId).dataset.rankingSize;return React.createElement("div",{id:t,ref:function(){return yasrSetRaterValue(a,t,!1,.1,!0,e.rating)}})}function _(e){if(void 0!==e.post.number_of_votes){var t=JSON.parse(yasrWindowVar.textAfterVr);return t=(t=t.replace("%total_count%",e.post.number_of_votes)).replace("%average%",e.post.rating),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(b,{html:t}))}var a=e.text;return React.createElement("div",{className:"yasr-highest-rated-text"},a," ",e.post.rating)}function R(t){return React.createElement("td",{className:t.colClass},React.createElement("a",{href:t.post.link},function(t){if("string"!=typeof t||-1===t.indexOf("&"))return t;void 0===e&&(e=document.implementation&&document.implementation.createHTMLDocument?document.implementation.createHTMLDocument("").createElement("textarea"):document.createElement("textarea")),e.innerHTML=t;const a=e.textContent;return e.innerHTML="",a}(t.post.title)))}function E(e){var t="after",a=JSON.parse(yasrWindowVar.textRating),r=new URLSearchParams(e.rankingParams);return null!==r.get("text_position")&&(t=r.get("text_position")),null!==r.get("custom_txt")&&(a=r.get("custom_txt")),"before"===t?React.createElement("td",{className:e.colClass},React.createElement(_,{post:e.post,tableId:e.tableId,text:a}),React.createElement(v,{rating:e.post.rating,tableId:e.tableId})):React.createElement("td",{className:e.colClass},React.createElement(v,{rating:e.post.rating,tableId:e.tableId}),React.createElement(_,{post:e.post,tableId:e.tableId,text:a}))}function k(e){var t="",a="";return"author_ranking"===e.source?(t="yasr-top-10-overall-left",a="yasr-top-10-overall-right"):"visitor_votes"===e.source&&(t="yasr-top-10-most-highest-left",a="yasr-top-10-most-highest-right"),React.createElement("tr",{className:e.trClass},React.createElement(R,{colClass:t,post:e.post}),React.createElement(E,{colClass:a,post:e.post,tableId:e.tableId,rankingParams:e.rankingParams}))}function w(e){return React.createElement("tbody",{id:e.tBodyId,style:{display:e.show}},e.data.map((function(t,a){var r="yasr-rankings-td-colored";return"author_ranking"===e.source&&(r="yasr-rankings-td-white"),a%2==0&&(r="yasr-rankings-td-white","author_ranking"===e.source&&(r="yasr-rankings-td-colored")),React.createElement(k,{key:t.post_id,source:e.source,tableId:e.tableId,rankingParams:e.rankingParams,post:t,trClass:r})})))}var I=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(s,React.Component);var t,a,r,n,o=(r=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(r);if(n){var a=y(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return g(this,e)});function s(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=o.call(this,e)).state={error:null,isLoaded:!1,data:[],tableId:e.tableId,source:e.source,rankingParams:e.params,nonce:e.nonce},t}return t=s,(a=[{key:"componentDidMount",value:function(){var e=this,t=JSON.parse(document.getElementById(this.state.tableId).dataset.rankingData),a={};if("yes"!==yasrWindowVar.ajaxEnabled)console.info("Ajax Disabled, getting data from source"),this.setState({isLoaded:!0,data:t});else if(this.state.source){var r=this.returnRestUrl();Promise.all(r.map((function(e){return fetch(e).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(e){"KO"===e?a=t:"overall_rating"===e.source||"author_multi"===e.source?a="overall_rating"===e.source?e.data_overall:e.data_mv:a[e.show]=e.data_vv})).catch((function(e){a=t,console.info(e)}))}))).then((function(t){e.setState({isLoaded:!0,data:a})})).catch((function(t){console.info(t),e.setState({isLoaded:!0,data:a})}))}else this.setState({error:"Invalid Data Source"})}},{key:"returnRestUrl",value:function(){var e,t=""!==this.state.rankingParams?this.state.rankingParams:"",a=this.state.source,r="&nonce_rankings="+this.state.nonce,n="";if(""!==t&&!1!==t){var o=new URLSearchParams(t);null!==o.get("order_by")&&(n+="order_by="+o.get("order_by")),null!==o.get("limit")&&(n+="&limit="+o.get("limit")),null!==o.get("start_date")&&"0"!==o.get("start_date")&&(n+="&start_date="+o.get("start_date")),null!==o.get("end_date")&&"0"!==o.get("end_date")&&(n+="&end_date="+o.get("end_date")),null!==o.get("ctg")?n+="&ctg="+o.get("ctg"):null!==o.get("cpt")&&(n+="&cpt="+o.get("cpt")),""!==n&&(n="&"+(n=n.replace(/\s+/g,""))),"visitor_multi"!==a&&"author_multi"!==a||null!==o.get("setid")&&(n+="&setid="+o.get("setid"))}else n="";if("author_ranking"===a||"author_multi"===a)e=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+a+n+r];else{var s="",i="";if(""!==t){var l=new URLSearchParams(t);null!==l.get("required_votes[most]")&&(s="&required_votes="+l.get("required_votes[most]")),null!==l.get("required_votes[highest]")&&(i="&required_votes="+l.get("required_votes[highest]"))}e=[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+a+n+s+r,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+a+n+i+r]}return e}},{key:"rankingTableHead",value:function(e,t){var a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a;if("author_ranking"!==e){var o=React.createElement("span",null,React.createElement("span",{id:r},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:n,onClick:this.switchTBody.bind(this)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===t&&(o=React.createElement("span",null,React.createElement("span",{id:n},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:r,onClick:this.switchTBody.bind(this)},JSON.parse(yasrWindowVar.textMostRated)))),React.createElement("thead",null,React.createElement("tr",{className:"yasr-rankings-td-colored yasr-rankings-heading"},React.createElement("th",null,JSON.parse(yasrWindowVar.textLeftColumnHeader)),React.createElement("th",null,JSON.parse(yasrWindowVar.textOrderBy),":  ",o)))}return React.createElement(React.Fragment,null)}},{key:"switchTBody",value:function(e){e.preventDefault();var t=e.target.id,a=this.state.tableId,r="link-most-rated-posts-"+a,n="link-highest-rated-posts-"+a,o="most-rated-posts-"+a,s="highest-rated-posts-"+a,i=document.getElementById(t),l=document.createElement("span");l.innerHTML=i.innerHTML,l.id=i.id,i.parentNode.replaceChild(l,i),t===r&&(document.getElementById(s).style.display="none",document.getElementById(o).style.display="",l=document.getElementById(n),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l)),t===n&&(document.getElementById(o).style.display="none",document.getElementById(s).style.display="",l=document.getElementById(r),i.innerHTML=l.innerHTML,i.id=l.id,l.parentNode.replaceChild(i,l))}},{key:"rankingTableBody",value:function(){var e=this.state,t=e.data,a=e.source,r=e.rankingParams;if("overall_rating"===a||"author_multi"===a)return React.createElement(w,{data:t,tableId:this.state.tableId,tBodyId:"overall_"+this.state.tableId,rankingParams:r,show:"table-row-group",source:a});var n=t.most,o=t.highest,s="table-row-group",i="none",l="most",c=s,u=i,d=new URLSearchParams(r);return null!==d.get("view")&&(l=d.get("view")),"highest"===l&&(c=i,u=s),React.createElement(React.Fragment,null,this.rankingTableHead(a,l),React.createElement(w,{data:n,tableId:this.state.tableId,tBodyId:"most-rated-posts-"+this.state.tableId,rankingParams:r,show:c,source:a}),React.createElement(w,{data:o,tableId:this.state.tableId,tBodyId:"highest-rated-posts-"+this.state.tableId,rankingParams:r,show:u,source:a}))}},{key:"render",value:function(){var e=this.state,t=e.error,a=e.isLoaded;return t?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error"))):!1===a?React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking)))):React.createElement(React.Fragment,null,this.rankingTableBody())}}])&&f(t.prototype,a),Object.defineProperty(t,"prototype",{writable:!1}),s}();!function(){var e=document.getElementsByClassName("yasr-stars-rankings");if(e.length>0)for(var t=0;t<e.length;t++){var a=e.item(t).id,r=JSON.parse(e.item(t).dataset.rankingSource),n=JSON.parse(e.item(t).dataset.rankingParams),o=JSON.parse(e.item(t).dataset.rankingNonce),s=document.getElementById(a);h(React.createElement(I,{source:r,tableId:a,params:n,nonce:o}),s)}}()})()})();
includes/js/shortcodes/visitorVotes.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";const{__:t}=wp.i18n;function e(t,e,r,n,o,i,l,d,y,u,v,c){e=parseFloat(e),n=yasrTrueFalseStringConvertion(n);const g=document.getElementById(o),_=JSON.parse(yasrWindowVar.isUserLoggedIn);a(v,!1),yasrSetRaterValue(t,o,g,1,n,e,(function(t,e){a(v,!0);let n={action:"yasr_send_visitor_rating",rating:t,post_id:r,is_singular:d};!0===_&&Object.assign(n,{nonce_visitor:l}),this.setRating(t),this.disable(),jQuery.post(yasrWindowVar.ajaxurl,n).done((function(t){if(!1===(t=yasrValidJson(t)))return a(v,!1),void s(c,"<span>Not a valid Json Element, rating can't be saved.</span>");let r,n=`yasr-vote-${t.status}`;"success"===t.status&&(s(y,t.number_of_votes),s(u,t.average_rating)),r=`<span class="yasr-small-block-bold" id="${n}"> ${t.text} </span>`,s(c,r),a(v,!1),e()})).fail((function(t,e,s,a){console.error("YASR ajax call failed. Can't save data"),console.log(t)}))}))}function s(t,e){null!==t&&(t.innerHTML=e,t.style.display="")}function a(t,e=!0){let a="";!0===e&&(a=yasrWindowVar.loaderHtml),s(t,a)}function r(e){const s=e.medium_rating;delete e.medium_rating;let a=0;for(let t=1;t<=5;t++)(1===t||e[t].n_of_votes>a)&&(a=e[t].n_of_votes);let r=Math.log(a)*Math.LOG10E+1|0,n="5%";r<=3&&(n="5%"),r>3&&r<=5&&(n="10%"),r>5&&(n="15%");let o='<div class="yasr-visitors-stats-tooltip">';o+='<span id="yasr-medium-rating-tooltip">'+s+" "+t("out of 5 stars","yet-another-stars-rating")+"</span>",o+='<div class="yasr-progress-bars-container">';let i=t("stars","yet-another-stars-rating"),l=0,d=0;for(let s=5;s>0;s--)1===s&&(i=t("star","yet-another-stars-rating")),void 0!==e[s]&&(l=e[s].progressbar,d=e[s].n_of_votes),o+=`<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>${s} ${i}</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:${l}'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style="flex-basis:${n} ">${d}</div>\n </div>`;return o+="</div></div>",o}!function(t){if(t.length>0&&(function(t){for(let r=0;r<t.length;r++)!function(r){if(!1!==t.item(r).classList.contains("yasr-star-rating"))return;const n=t.item(r),o=n.getAttribute("data-rater-postid"),i=n.id,l=i.replace("yasr-visitor-votes-rater-",""),d=document.getElementById("yasr_visitor_votes_"+l),y=parseInt(n.getAttribute("data-rater-starsize")),u=n.getAttribute("data-rater-nonce"),v=n.getAttribute("data-issingular"),c="yasr-vv-votes-number-container-"+l,g="yasr-vv-average-container-"+l,_="yasr-vv-bottom-container-"+l,m="yasr-vv-loader-"+l,f=document.getElementById(c),p=document.getElementById(g),b=document.getElementById(_),w=document.getElementById(m);let h=n.getAttribute("data-rating"),E=n.getAttribute("data-readonly-attribute"),x=n.getAttribute("data-rater-readonly");if(null===E&&(E=!1),E=yasrTrueFalseStringConvertion(E),x=yasrTrueFalseStringConvertion(x),!0===E&&(x=!0),"yes"===yasrWindowVar.ajaxEnabled){a(w);let t={action:"yasr_load_vv",post_id:o};jQuery.get(yasrWindowVar.ajaxurl,t).done((function(t){let r,n=yasrValidJson(t);if(!1===n){let t="Not a valid Json Element";return a(w,!1),void s(d,t)}if(r=!0===E||n.yasr_visitor_votes.stars_attributes.read_only,h=n.yasr_visitor_votes.number_of_votes>0?n.yasr_visitor_votes.sum_votes/n.yasr_visitor_votes.number_of_votes:0,h=h.toFixed(1),h=parseFloat(h),e(y,h,o,r,i,0,u,v,f,p,w,b),!0!==E&&(s(f,n.yasr_visitor_votes.number_of_votes),s(p,h),!1!==n.yasr_visitor_votes.stars_attributes.span_bottom)){let t=n.yasr_visitor_votes.stars_attributes.span_bottom;s(b,t)}})).fail((function(t,s,a,r){console.info("YASR ajax call failed. Showing ratings from html"),e(y,h,o,x,i,0,u,v,f,p,w,b),!0!==E&&(b.style.display="")}))}else e(y,h,o,x,i,0,u,v,f,p,w,b)}(r)}(t),"yes"===yasrWindowVar.visitorStatsEnabled)){let t=document.getElementsByClassName("yasr-dashicons-visitor-stats");t&&function(t){let e,s,a=!1;for(let n=0;n<t.length;n++)!function(n){let o="#"+t.item(n).id,i=t.item(n).getAttribute("data-postid");0===n&&(e=document.getElementsByClassName("yasr-vv-text-container"),null!==e&&(s=window.getComputedStyle(e[0],null).getPropertyValue("color"))),s&&(document.getElementById(t.item(n).id).style.fill=s);let l={action:"yasr_stats_visitors_votes",post_id:i};"function"==typeof tippy&&tippy(o,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){o!==a&&jQuery.post(yasrWindowVar.ajaxurl,l,(function(e){if(!1!==(e=yasrValidJson(e)))return"error"===e.status?(console.error(e.text),void t.setContent(e.text)):void t.setContent(r(e));t.setContent("Error!")})).fail((function(e,s,a,r){console.log(e),t.setContent("YASR ajax call failed.")}))},onHidden:function(){a=o}})}(n)}(t)}}(document.getElementsByClassName("yasr-rater-stars-vv"))})();
1
+ (()=>{"use strict";function t(t,a,r,n,o,i,l,d,y,u,v,c){a=parseFloat(a),n=yasrTrueFalseStringConvertion(n);const g=document.getElementById(o),m=JSON.parse(yasrWindowVar.isUserLoggedIn);s(v,!1),yasrSetRaterValue(t,o,g,1,n,a,(function(t,a){s(v,!0);let n={action:"yasr_send_visitor_rating",rating:t,post_id:r,is_singular:d};!0===m&&Object.assign(n,{nonce_visitor:l}),this.setRating(t),this.disable(),jQuery.post(yasrWindowVar.ajaxurl,n).done((function(t){if(!1===(t=yasrValidJson(t)))return s(v,!1),void e(c,"<span>Not a valid Json Element, rating can't be saved.</span>");let r,n=`yasr-vote-${t.status}`;"success"===t.status&&(e(y,t.number_of_votes),e(u,t.average_rating)),r=`<span class="yasr-small-block-bold" id="${n}"> ${t.text} </span>`,e(c,r),s(v,!1),a()})).fail((function(t,e,s,a){console.error("YASR ajax call failed. Can't save data"),console.log(t)}))}))}function e(t,e){null!==t&&(t.innerHTML=e,t.style.display="")}function s(t,s=!0){let a="";!0===s&&(a=yasrWindowVar.loaderHtml),e(t,a)}function a(t){const e=t.medium_rating;delete t.medium_rating;let s=0;for(let e=1;e<=5;e++)(1===e||t[e].n_of_votes>s)&&(s=t[e].n_of_votes);let a=Math.log(s)*Math.LOG10E+1|0,r="5%";a<=3&&(r="5%"),a>3&&a<=5&&(r="10%"),a>5&&(r="15%");let n='<div class="yasr-visitors-stats-tooltip">';n+='<span id="yasr-medium-rating-tooltip">'+e+" "+JSON.parse(yasrWindowVar.textVvStats)+"</span>",n+='<div class="yasr-progress-bars-container">';let o=JSON.parse(yasrWindowVar.starsPluralForm),i=0,l=0;for(let e=5;e>0;e--)1===e&&(o=JSON.parse(yasrWindowVar.starSingleForm)),void 0!==t[e]&&(i=t[e].progressbar,l=t[e].n_of_votes),n+=`<div class='yasr-progress-bar-row-container yasr-w3-container'>\n <div class='yasr-progress-bar-name'>${e} ${o}</div> \n <div class='yasr-single-progress-bar-container'> \n <div class='yasr-w3-border'> \n <div class='yasr-w3-amber' style='height:17px;width:${i}'></div> \n </div>\n </div> \n <div class='yasr-progress-bar-votes-count' style="flex-basis:${r} ">${l}</div>\n </div>`;return n+="</div></div>",n}!function(r){if(r.length>0&&(function(a){for(let r=0;r<a.length;r++)!function(r){if(!1!==a.item(r).classList.contains("yasr-star-rating"))return;const n=a.item(r),o=n.getAttribute("data-rater-postid"),i=n.id,l=i.replace("yasr-visitor-votes-rater-",""),d=document.getElementById("yasr_visitor_votes_"+l),y=parseInt(n.getAttribute("data-rater-starsize")),u=n.getAttribute("data-rater-nonce"),v=n.getAttribute("data-issingular"),c="yasr-vv-votes-number-container-"+l,g="yasr-vv-average-container-"+l,m="yasr-vv-bottom-container-"+l,_="yasr-vv-loader-"+l,f=document.getElementById(c),p=document.getElementById(g),b=document.getElementById(m),w=document.getElementById(_);let S=n.getAttribute("data-rating"),E=n.getAttribute("data-readonly-attribute"),V=n.getAttribute("data-rater-readonly");if(null===E&&(E=!1),E=yasrTrueFalseStringConvertion(E),V=yasrTrueFalseStringConvertion(V),!0===E&&(V=!0),"yes"===yasrWindowVar.ajaxEnabled){s(w);let a={action:"yasr_load_vv",post_id:o};jQuery.get(yasrWindowVar.ajaxurl,a).done((function(a){let r,n=yasrValidJson(a);if(!1===n){let t="Not a valid Json Element";return s(w,!1),void e(d,t)}if(r=!0===E||n.yasr_visitor_votes.stars_attributes.read_only,S=n.yasr_visitor_votes.number_of_votes>0?n.yasr_visitor_votes.sum_votes/n.yasr_visitor_votes.number_of_votes:0,S=S.toFixed(1),S=parseFloat(S),t(y,S,o,r,i,0,u,v,f,p,w,b),!0!==E&&(e(f,n.yasr_visitor_votes.number_of_votes),e(p,S),!1!==n.yasr_visitor_votes.stars_attributes.span_bottom)){let t=n.yasr_visitor_votes.stars_attributes.span_bottom;e(b,t)}})).fail((function(e,s,a,r){console.info("YASR ajax call failed. Showing ratings from html"),t(y,S,o,V,i,0,u,v,f,p,w,b),!0!==E&&(b.style.display="")}))}else t(y,S,o,V,i,0,u,v,f,p,w,b)}(r)}(r),"yes"===yasrWindowVar.visitorStatsEnabled)){let t=document.getElementsByClassName("yasr-dashicons-visitor-stats");t&&function(t){let e,s,r=!1;for(let n=0;n<t.length;n++)!function(n){let o="#"+t.item(n).id,i=t.item(n).getAttribute("data-postid");0===n&&(e=document.getElementsByClassName("yasr-vv-text-container"),null!==e&&(s=window.getComputedStyle(e[0],null).getPropertyValue("color"))),s&&(document.getElementById(t.item(n).id).style.fill=s);let l={action:"yasr_stats_visitors_votes",post_id:i};"function"==typeof tippy&&tippy(o,{allowHTML:!0,content:'<span style="color: #0a0a0a">Loading...</span>',theme:"yasr",arrow:!0,arrowType:"round",onShow:function(t){o!==r&&jQuery.post(yasrWindowVar.ajaxurl,l,(function(e){if(!1!==(e=yasrValidJson(e)))return"error"===e.status?(console.error(e.text),void t.setContent(e.text)):void t.setContent(a(e));t.setContent("Error!")})).fail((function(e,s,a,r){console.log(e),t.setContent("YASR ajax call failed.")}))},onHidden:function(){r=o}})}(n)}(t)}}(document.getElementsByClassName("yasr-rater-stars-vv"))})();
includes/js/src/shortcodes/overall-multiset.js CHANGED
@@ -1,4 +1,3 @@
1
- const { __ } = wp.i18n; // Import __() from wp.i181n
2
  const arrayClasses = ['yasr-rater-stars', 'yasr-multiset-visitors-rater'];
3
 
4
  /*** Constant used by yasr
@@ -140,7 +139,7 @@ function yasrRaterVisitorsMultiSet (yasrMultiSetVisitorInDom) {
140
  jQuery('#yasr-loader-multiset-visitor-' + multiSetPostId + '-' + multiSetId).text(responseText);
141
  }).fail(
142
  function(e, x, settings, exception) {
143
- console.error(__('YASR ajax call failed. Can\'t save data', 'yet-another-stars-rating'));
144
  console.log(e);
145
  });
146
 
 
1
  const arrayClasses = ['yasr-rater-stars', 'yasr-multiset-visitors-rater'];
2
 
3
  /*** Constant used by yasr
139
  jQuery('#yasr-loader-multiset-visitor-' + multiSetPostId + '-' + multiSetId).text(responseText);
140
  }).fail(
141
  function(e, x, settings, exception) {
142
+ console.error('YASR ajax call failed. Can\'t save data');
143
  console.log(e);
144
  });
145
 
includes/js/src/shortcodes/ranking.js CHANGED
@@ -1,9 +1,21 @@
1
  import {decodeEntities} from "@wordpress/html-entities";
2
  import {v4 as uuidv4} from 'uuid';
 
3
 
4
- const { __ } = wp.i18n; // Import __() from wp.i18n
5
  const {render} = wp.element;
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  /*
8
  * Print the stars using RaterJs
9
  */
@@ -37,20 +49,21 @@ function YasrCallRaterJs (props) {
37
  function YasrTextAfterStars (props) {
38
  //If number_of_votes exists
39
  if(typeof props.post.number_of_votes !== "undefined") {
 
 
 
40
  return (
41
- <span className='yasr-most-rated-text'>
42
- [{__('Total:', 'yet-another-stars-rating')} {props.post.number_of_votes}
43
- &nbsp;&nbsp;
44
- {__('Average:', 'yet-another-stars-rating')} {props.post.rating}]
45
- </span>
46
  )
47
  }
48
  let text = props.text;
49
 
50
  return (
51
- <span className='yasr-highest-rated-text'>
52
  {text} {props.post.rating}
53
- </span>
54
  );
55
  }
56
 
@@ -89,7 +102,7 @@ function YasrRankingTableLeftColumn (props) {
89
  function YasrRankingTableRightColumn (props) {
90
 
91
  let txtPosition = 'after';
92
- let cstText = __('Rating:' , 'yet-another-stars-rating');
93
 
94
  let params = new URLSearchParams(props.rankingParams);
95
  if(params.get('text_position') !== null) {
@@ -396,20 +409,20 @@ class YasrRanking extends React.Component {
396
  if(source !== 'author_ranking') {
397
  let containerLink = <span>
398
  <span id={idLinkMost}>
399
- {__('Most Rated', 'yet-another-stars-rating')}
400
  </span>&nbsp;|&nbsp;
401
  <a href='#' id={idLinkHighest} onClick={this.switchTBody.bind(this)}>
402
- {__('Highest Rated', 'yet-another-stars-rating')}
403
  </a>
404
  </span>
405
 
406
  if(defaultView === 'highest') {
407
  containerLink = <span>
408
  <span id={idLinkHighest} >
409
- {__('Highest Rated', 'yet-another-stars-rating')}
410
  </span>&nbsp;|&nbsp;
411
  <a href='#' id={idLinkMost} onClick={this.switchTBody.bind(this)}>
412
- {__('Most Rated', 'yet-another-stars-rating')}
413
  </a>
414
  </span>
415
  }
@@ -417,9 +430,9 @@ class YasrRanking extends React.Component {
417
  return (
418
  <thead>
419
  <tr className='yasr-rankings-td-colored yasr-rankings-heading'>
420
- <th>{__('Post', 'yet-another-stars-rating')}</th>
421
  <th>
422
- {__('Order By', 'yet-another-stars-rating')}:&nbsp;&nbsp;
423
  {containerLink}
424
  </th>
425
  </tr>
@@ -573,7 +586,7 @@ class YasrRanking extends React.Component {
573
  <tbody>
574
  <tr>
575
  <td>
576
- {__('Loading Charts', 'yet-another-stars-rating')}
577
  </td>
578
  </tr>
579
  </tbody>
1
  import {decodeEntities} from "@wordpress/html-entities";
2
  import {v4 as uuidv4} from 'uuid';
3
+ import striptags from "striptags";
4
 
 
5
  const {render} = wp.element;
6
 
7
+ /**
8
+ * Strip a string to only allow <strong> and <p> tag (no XSS possible), and return it inside a span
9
+ *
10
+ * @param props
11
+ * @returns {JSX.Element}
12
+ */
13
+ function YasrSetInnerHTML (props) {
14
+ return (
15
+ <div dangerouslySetInnerHTML={{__html: striptags(props.html, '<strong><p>')} }></div>
16
+ );
17
+ }
18
+
19
  /*
20
  * Print the stars using RaterJs
21
  */
49
  function YasrTextAfterStars (props) {
50
  //If number_of_votes exists
51
  if(typeof props.post.number_of_votes !== "undefined") {
52
+ let text = JSON.parse(yasrWindowVar.textAfterVr);
53
+ text = text.replace('%total_count%', props.post.number_of_votes);
54
+ text = text.replace('%average%', props.post.rating);
55
  return (
56
+ <div className='yasr-most-rated-text'>
57
+ <YasrSetInnerHTML html={text}></YasrSetInnerHTML>
58
+ </div>
 
 
59
  )
60
  }
61
  let text = props.text;
62
 
63
  return (
64
+ <div className='yasr-highest-rated-text'>
65
  {text} {props.post.rating}
66
+ </div>
67
  );
68
  }
69
 
102
  function YasrRankingTableRightColumn (props) {
103
 
104
  let txtPosition = 'after';
105
+ let cstText = JSON.parse(yasrWindowVar.textRating)
106
 
107
  let params = new URLSearchParams(props.rankingParams);
108
  if(params.get('text_position') !== null) {
409
  if(source !== 'author_ranking') {
410
  let containerLink = <span>
411
  <span id={idLinkMost}>
412
+ {JSON.parse(yasrWindowVar.textMostRated)}
413
  </span>&nbsp;|&nbsp;
414
  <a href='#' id={idLinkHighest} onClick={this.switchTBody.bind(this)}>
415
+ {JSON.parse(yasrWindowVar.textHighestRated)}
416
  </a>
417
  </span>
418
 
419
  if(defaultView === 'highest') {
420
  containerLink = <span>
421
  <span id={idLinkHighest} >
422
+ {JSON.parse(yasrWindowVar.textHighestRated)}
423
  </span>&nbsp;|&nbsp;
424
  <a href='#' id={idLinkMost} onClick={this.switchTBody.bind(this)}>
425
+ {JSON.parse(yasrWindowVar.textMostRated)}
426
  </a>
427
  </span>
428
  }
430
  return (
431
  <thead>
432
  <tr className='yasr-rankings-td-colored yasr-rankings-heading'>
433
+ <th>{JSON.parse(yasrWindowVar.textLeftColumnHeader)}</th>
434
  <th>
435
+ {JSON.parse(yasrWindowVar.textOrderBy)}:&nbsp;&nbsp;
436
  {containerLink}
437
  </th>
438
  </tr>
586
  <tbody>
587
  <tr>
588
  <td>
589
+ {JSON.parse(yasrWindowVar.textLoadRanking)}
590
  </td>
591
  </tr>
592
  </tbody>
includes/js/src/shortcodes/visitorVotes.js CHANGED
@@ -1,5 +1,3 @@
1
- const { __ } = wp.i18n; // Import __() from wp.i181n
2
-
3
  const yasrRaterInDom = document.getElementsByClassName('yasr-rater-stars-vv');
4
 
5
  yasrSearchVVInDom(yasrRaterInDom);
@@ -422,18 +420,18 @@ function yasrReturnToolbarStats (ratings) {
422
  html_to_return += '<span id="yasr-medium-rating-tooltip">'
423
  + mediumRating
424
  + ' '
425
- + __('out of 5 stars', 'yet-another-stars-rating')
426
  + '</span>';
427
  html_to_return += '<div class="yasr-progress-bars-container">';
428
 
429
- let stars_text = __('stars', 'yet-another-stars-rating'); //default is plural
430
  let progressbar = 0; //default value for progressbar
431
  let n_votes = 0; //default n_votes
432
 
433
  //Do a for with 5 rows
434
  for (let i = 5; i > 0; i--) {
435
  if (i === 1) {
436
- stars_text = __('star', 'yet-another-stars-rating'); //single form
437
  }
438
 
439
  //should never happen, just to be sage
 
 
1
  const yasrRaterInDom = document.getElementsByClassName('yasr-rater-stars-vv');
2
 
3
  yasrSearchVVInDom(yasrRaterInDom);
420
  html_to_return += '<span id="yasr-medium-rating-tooltip">'
421
  + mediumRating
422
  + ' '
423
+ + JSON.parse(yasrWindowVar.textVvStats)
424
  + '</span>';
425
  html_to_return += '<div class="yasr-progress-bars-container">';
426
 
427
+ let stars_text = JSON.parse(yasrWindowVar.starsPluralForm) //default is plural
428
  let progressbar = 0; //default value for progressbar
429
  let n_votes = 0; //default n_votes
430
 
431
  //Do a for with 5 rows
432
  for (let i = 5; i > 0; i--) {
433
  if (i === 1) {
434
+ stars_text = JSON.parse(yasrWindowVar.starSingleForm) //single form
435
  }
436
 
437
  //should never happen, just to be sage
includes/shortcodes/classes/YasrVisitorVotes.php CHANGED
@@ -375,7 +375,16 @@ class YasrVisitorVotes extends YasrShortcode {
375
  //close yasr-vv-second-row-container-$this->unique_id'
376
  $shortcode_html .= '</div>';
377
 
378
- $shortcode_html = apply_filters('yasr_vv_shortcode', $shortcode_html, $stored_votes);
 
 
 
 
 
 
 
 
 
379
 
380
  $shortcode_html .= $this->bottomContainer($cookie_value, $this->post_id);
381
 
375
  //close yasr-vv-second-row-container-$this->unique_id'
376
  $shortcode_html .= '</div>';
377
 
378
+ $shortcode_html = apply_filters(
379
+ 'yasr_vv_shortcode',
380
+ $shortcode_html,
381
+ $stored_votes,
382
+ $this->post_id,
383
+ $this->starSize(),
384
+ $this->readonly,
385
+ $this->ajax_nonce_visitor,
386
+ $this->is_singular
387
+ );
388
 
389
  $shortcode_html .= $this->bottomContainer($cookie_value, $this->post_id);
390
 
includes/yasr-includes-functions.php CHANGED
@@ -33,19 +33,29 @@ function yasr_translate() {
33
  * Create a select menu to choose the rich snippet itemtype
34
  *
35
  * @param bool|string $html_id the id of the select name
36
- * @param bool|int $term_id
37
- * @param bool $disabled
 
 
38
  */
39
 
40
- function yasr_select_itemtype($html_id=false, $term_id=false, $disabled=false) {
41
  if($html_id === false) {
42
  $html_id = 'yasr-choose-reviews-types-list';
43
  }
44
- $itemtypes_array = YASR_SUPPORTED_SCHEMA_TYPES;
45
 
 
 
 
 
 
46
  sort($itemtypes_array);
47
 
48
- $review_type_choosen = yasr_get_itemType($term_id);
 
 
 
 
49
 
50
  $disabled_attribute = '';
51
 
@@ -55,18 +65,18 @@ function yasr_select_itemtype($html_id=false, $term_id=false, $disabled=false) {
55
  ?>
56
 
57
  <label for="<?php echo esc_attr($html_id) ?>"></label>
58
- <select name="yasr-review-type" id="<?php echo esc_attr($html_id) ?>">
59
  <?php
60
  foreach ($itemtypes_array as $itemType) {
61
  $itemType = trim($itemType);
62
  if ($itemType === $review_type_choosen) {
63
- echo "<option value='".esc_attr($itemType)."' selected >
64
- ".esc_html($itemType)."
65
- </option>";
66
  } else {
67
- echo "<option value='".esc_attr($itemType)."' ".esc_attr($disabled_attribute).">
68
- ".esc_html($itemType)."
69
- </option>";
70
  }
71
  }
72
  ?>
@@ -169,11 +179,10 @@ function yasr_get_ip() {
169
  Taken value: array to search, key
170
  */
171
  function yasr_unique_multidim_array($array, $key) {
172
-
173
  $temp_array = array();
174
  $i = 0;
175
 
176
- //creo un array vuoto che conterrà solo gli indici
177
  $key_array = array();
178
 
179
  foreach ($array as $val) {
@@ -257,7 +266,6 @@ function yasr_check_valid_url($url) {
257
  *
258
  * @since 2.1.5
259
  */
260
-
261
  function yasr_is_supported_schema ($item_type) {
262
  $supported_schema_array = YASR_SUPPORTED_SCHEMA_TYPES;
263
 
@@ -279,3 +287,61 @@ function yasr_is_catch_infinite_sroll_installed () {
279
  }
280
  return false;
281
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  * Create a select menu to choose the rich snippet itemtype
34
  *
35
  * @param bool|string $html_id the id of the select name
36
+ * @param bool|string $name
37
+ * @param bool|string $default_option
38
+ * @param bool|int $term_id
39
+ * @param bool $disabled
40
  */
41
 
42
+ function yasr_select_itemtype($html_id=false, $name=false, $default_option=false, $term_id=false, $disabled=false) {
43
  if($html_id === false) {
44
  $html_id = 'yasr-choose-reviews-types-list';
45
  }
 
46
 
47
+ if($name === false) {
48
+ $name = 'yasr-review-type';
49
+ }
50
+
51
+ $itemtypes_array = YASR_SUPPORTED_SCHEMA_TYPES;
52
  sort($itemtypes_array);
53
 
54
+ if($default_option === false) {
55
+ $review_type_choosen = yasr_get_itemType($term_id);
56
+ } else {
57
+ $review_type_choosen = $default_option;
58
+ }
59
 
60
  $disabled_attribute = '';
61
 
65
  ?>
66
 
67
  <label for="<?php echo esc_attr($html_id) ?>"></label>
68
+ <select name="<?php echo esc_attr($name) ?>" id="<?php echo esc_attr($html_id) ?>">
69
  <?php
70
  foreach ($itemtypes_array as $itemType) {
71
  $itemType = trim($itemType);
72
  if ($itemType === $review_type_choosen) {
73
+ echo '<option value="'.esc_attr($itemType).'" selected >
74
+ '.esc_html($itemType).'
75
+ </option>';
76
  } else {
77
+ echo '<option value="'.esc_attr($itemType).'" '.esc_attr($disabled_attribute).'>
78
+ '.esc_html($itemType).'
79
+ </option>';
80
  }
81
  }
82
  ?>
179
  Taken value: array to search, key
180
  */
181
  function yasr_unique_multidim_array($array, $key) {
 
182
  $temp_array = array();
183
  $i = 0;
184
 
185
+ //this array will contain only indexes
186
  $key_array = array();
187
 
188
  foreach ($array as $val) {
266
  *
267
  * @since 2.1.5
268
  */
 
269
  function yasr_is_supported_schema ($item_type) {
270
  $supported_schema_array = YASR_SUPPORTED_SCHEMA_TYPES;
271
 
287
  }
288
  return false;
289
  }
290
+
291
+ /**
292
+ * Wrapper function for wp_kses that adds allowed HTML
293
+ *
294
+ * @author Dario Curvino <@dudo>
295
+ * @since 3.0.6
296
+ * @param $string
297
+ *
298
+ * @return string
299
+ */
300
+ function yasr_kses($string) {
301
+ $allowed_html = array(
302
+ 'div' => array(
303
+ 'class' => array(),
304
+ ),
305
+ 'span' => array(
306
+ 'class' => array(),
307
+ ),
308
+ 'label' => array (
309
+ 'for' => array(),
310
+ ),
311
+ 'select' => array(
312
+ 'name' => array(),
313
+ 'id' => array(),
314
+ 'autocomplete' => array(),
315
+ ),
316
+ 'option' => array(
317
+ 'value' => array(),
318
+ 'selected' => array()
319
+ ),
320
+ 'textarea' => array(
321
+ 'name' => array(),
322
+ 'id' => array(),
323
+ 'placeholder' => array(),
324
+ 'autocomplete' => array(),
325
+ ),
326
+ 'input' => array(
327
+ 'type' => array(),
328
+ 'name' => array(),
329
+ 'id' => array(),
330
+ 'class' => array(),
331
+ 'value' => array(),
332
+ 'placeholder' => array(),
333
+ 'autocomplete' => array(),
334
+ 'checked' => array(),
335
+ 'data-shortcode' => array(),
336
+ ),
337
+ 'img' => array (
338
+ 'src' => array(),
339
+ 'class' => array(),
340
+ 'alt' => array()
341
+ ),
342
+ 'br' => array(),
343
+ 'strong' =>array()
344
+ );
345
+
346
+ return wp_kses($string, $allowed_html);
347
+ }
public/yasr-public-init.php CHANGED
@@ -21,10 +21,7 @@ if (!defined('ABSPATH')) {
21
  exit('You\'re not allowed to see this page');
22
  } // Exit if accessed directly
23
 
24
- //e.g. http://localhost/plugin_development/wp-content/plugins/yet-another-stars-rating/includes/js/
25
- define('YASR_JS_DIR_PUBLIC', plugins_url() . '/' . YASR_RELATIVE_PATH_PUBLIC . '/js/');
26
- //CSS directory absolute URL
27
- define('YASR_CSS_DIR_PUBLIC', plugins_url() . '/' . YASR_RELATIVE_PATH_PUBLIC . '/css/');
28
 
29
  require YASR_ABSOLUTE_PATH_PUBLIC . '/yasr-public-actions.php';
30
 
21
  exit('You\'re not allowed to see this page');
22
  } // Exit if accessed directly
23
 
24
+
 
 
 
25
 
26
  require YASR_ABSOLUTE_PATH_PUBLIC . '/yasr-public-actions.php';
27
 
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Yasr - Yet Another Stars Rating ===
2
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
3
- Tags: rating, rate post, rate page, star rating, google rating, votes
4
  Requires at least: 5.0
5
  Contributors: Dudo
6
  Tested up to: 6.0
7
- Stable tag: 3.0.5
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  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
@@ -203,6 +203,15 @@ Yes, YASR is 100% fully compatible with PHP 8
203
 
204
  The full changelog can be found in the plugin's directory. Recent entries:
205
 
 
 
 
 
 
 
 
 
 
206
  = 3.0.5 =
207
  * FIX: set_id parameter didn't work in shortcodes yasr_multi_set_ranking and yasr_visitor_multi_set_ranking
208
  * FIX: rankings didn't show up when post title contains quotation marks ( " )
1
  === Yasr - Yet Another Stars Rating ===
2
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AXE284FYMNWDC
3
+ Tags: rating, rate post, star rating, google rating, block
4
  Requires at least: 5.0
5
  Contributors: Dudo
6
  Tested up to: 6.0
7
+ Stable tag: 3.0.6
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  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
203
 
204
  The full changelog can be found in the plugin's directory. Recent entries:
205
 
206
+ = 3.0.6 =
207
+ * FIX: translation for rankings shortcodes
208
+ * FIX: in the classic editor, if Multi Set is used, a duplicate query were run
209
+ * FIX: "Insert Multiset" button in shortcode creator didn't work
210
+ * TWEAKED: gutenberg block now works with .block.json files
211
+ * TWEAKED: added yasr_user_rate_history in shortcode creator for classic editor, and as new Gutenberg Block
212
+ * TWEAKED: added new actions
213
+ * TWEAKED: under the hood changes.
214
+
215
  = 3.0.5 =
216
  * FIX: set_id parameter didn't work in shortcodes yasr_multi_set_ranking and yasr_visitor_multi_set_ranking
217
  * FIX: rankings didn't show up when post title contains quotation marks ( " )
yet-another-stars-rating.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: 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
7
- * Version: 3.0.5
8
  * Requires at least: 5.6
9
  * Requires PHP: 5.4
10
  * Author: Dario Curvino
@@ -78,7 +78,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
78
  yasr_fs();
79
  // Signal that SDK was initiated.
80
  do_action( 'yasr_fs_loaded' );
81
- define( 'YASR_VERSION_NUM', '3.0.5' );
82
  //Plugin absolute path
83
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
84
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );
@@ -104,6 +104,17 @@ if ( !function_exists( 'yasr_fs' ) ) {
104
  //Plugin language directory: here I've to use relative path
105
  //because load_plugin_textdomain wants relative and not absolute path
106
  define( 'YASR_LANG_DIR', YASR_RELATIVE_PATH . '/languages/' );
 
 
 
 
 
 
 
 
 
 
 
107
  // Include function file both sides
108
  require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-init.php';
109
  //only admin files
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: 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
7
+ * Version: 3.0.6
8
  * Requires at least: 5.6
9
  * Requires PHP: 5.4
10
  * Author: Dario Curvino
78
  yasr_fs();
79
  // Signal that SDK was initiated.
80
  do_action( 'yasr_fs_loaded' );
81
+ define( 'YASR_VERSION_NUM', '3.0.6' );
82
  //Plugin absolute path
83
  //e.g. /var/www/html/plugin_development/wp-content/plugins/yet-another-stars-rating
84
  define( 'YASR_ABSOLUTE_PATH', __DIR__ );
104
  //Plugin language directory: here I've to use relative path
105
  //because load_plugin_textdomain wants relative and not absolute path
106
  define( 'YASR_LANG_DIR', YASR_RELATIVE_PATH . '/languages/' );
107
+ //e.g. http://localhost/plugin_development/wp-content/plugins/yet-another-stars-rating/admin/js/
108
+ define( 'YASR_JS_DIR_ADMIN', plugins_url() . '/' . YASR_RELATIVE_PATH_ADMIN . '/js/' );
109
+ //define gutenberg paths
110
+ define( 'YASR_JS_GUTEN', plugins_url() . '/' . YASR_RELATIVE_PATH_ADMIN . '/js/guten/' );
111
+ define( 'YASR_JS_GUTEN_BLOCKS', YASR_JS_GUTEN . 'blocks/' );
112
+ //CSS directory absolute URL
113
+ define( 'YASR_CSS_DIR_ADMIN', plugins_url() . '/' . YASR_RELATIVE_PATH_ADMIN . '/css/' );
114
+ //e.g. http://localhost/plugin_development/wp-content/plugins/yet-another-stars-rating/includes/js/
115
+ define( 'YASR_JS_DIR_PUBLIC', plugins_url() . '/' . YASR_RELATIVE_PATH_PUBLIC . '/js/' );
116
+ //CSS directory absolute URL
117
+ define( 'YASR_CSS_DIR_PUBLIC', plugins_url() . '/' . YASR_RELATIVE_PATH_PUBLIC . '/css/' );
118
  // Include function file both sides
119
  require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-init.php';
120
  //only admin files