Yasr – Yet Another Stars Rating - Version 3.1.6

Version Description

  • FIXED: removed warning returned if PHP 8.1 is used when a rating plugin is imported
  • TWEAKED: classes YasrDatabaseRatings, YasrRankingData and YasrMultiSetData have been deprecated, all the method moved into YasrDB
  • TWEAKED: function yasr_get_itemType has been moved into YasrDB, file yasr-includes-db-functions.php has been deleted
  • TWEAKED: added docs' dir, which contains all the hooks used by YASR
  • TWEAKED: removed dashicons from submenu page name, added links "Contact Us" and "Support"
  • TWEAKED: updated Freemius SDK to version 2.5.3
Download this release

Release Info

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

Code changes from version 3.1.5 to 3.1.6

Files changed (77) hide show
  1. admin/css/yasr-admin.css +1 -0
  2. admin/editor/YasrEditorHooks.php +14 -6
  3. admin/editor/YasrMetaboxBelowEditor.php +25 -7
  4. admin/editor/YasrOnSavePost.php +12 -3
  5. admin/editor/yasr-metabox-top-right.php +5 -1
  6. admin/js/src/yasr-settings-page.js +3 -3
  7. admin/js/yasr-settings.js +1 -1
  8. admin/settings/classes/YasrImportRatingPlugins.php +693 -24
  9. admin/settings/classes/YasrSettings.php +1148 -547
  10. admin/settings/classes/YasrSettingsMultiset.php +69 -6
  11. admin/settings/classes/YasrSettingsRankings.php +1 -1
  12. admin/settings/classes/YasrStats.php +3 -3
  13. admin/settings/migrations/yasr-settings-migration-functions.php +0 -303
  14. admin/settings/migrations/yasr-settings-migration-page.php +0 -265
  15. admin/settings/multiset/yasr-settings-functions-multiset-page.php +1 -1
  16. admin/settings/multiset/yasr-settings-functions-multiset.php +1 -1
  17. admin/settings/{yasr-pricing-page.php → yasr-pricing-page.html} +2 -27
  18. admin/settings/yasr-settings-functions-misc.php +0 -576
  19. admin/settings/yasr-settings-migration-page.php +62 -0
  20. admin/settings/yasr-settings-page.php +3 -3
  21. admin/settings/yasr-stats-page.php +1 -1
  22. admin/yasr-admin-actions-ajax.php +2 -3
  23. admin/yasr-admin-filters.php +20 -0
  24. admin/yasr-admin-functions.php +13 -14
  25. admin/yasr-admin-init.php +0 -1
  26. changelog.txt +1 -1
  27. docs/readme.txt +2 -0
  28. docs/yasr_hooks.md +897 -0
  29. includes/classes/YasrDB.php +909 -0
  30. includes/classes/YasrDatabaseRatings.php +18 -0
  31. includes/classes/YasrDefineOptions.php +2 -2
  32. includes/classes/{YasrLogDashboardWidget.php → YasrLastRatingsWidget.php} +9 -9
  33. includes/classes/YasrMultiSetData.php +23 -0
  34. includes/classes/YasrPhpFieldsHelper.php +1 -1
  35. includes/classes/YasrRankingData.php +20 -0
  36. includes/classes/YasrScriptsLoader.php +2 -2
  37. includes/img/cnrt.png +0 -0
  38. includes/img/movie_helper.svg +0 -1
  39. includes/rest/classes/YasrCustomEndpoint.php +3 -3
  40. includes/shortcodes/classes/YasrMultiSet.php +6 -4
  41. includes/shortcodes/classes/YasrNoStarsRankings.php +2 -2
  42. includes/shortcodes/classes/YasrOverallRating.php +3 -4
  43. includes/shortcodes/classes/YasrRankings.php +9 -10
  44. includes/shortcodes/classes/YasrShortcodesAjax.php +7 -11
  45. includes/shortcodes/classes/YasrVisitorMultiSet.php +1 -1
  46. includes/shortcodes/classes/YasrVisitorVotes.php +4 -4
  47. includes/shortcodes/yasr-shortcode-functions.php +1 -1
  48. includes/yasr-includes-db-functions.php +0 -75
  49. includes/yasr-includes-functions.php +16 -1
  50. includes/yasr-includes-init.php +0 -1
  51. public/classes/YasrPublicFilters.php +3 -3
  52. public/classes/YasrRichSnippets.php +2 -2
  53. readme.txt +11 -3
  54. vendor/freemius/wordpress-sdk/assets/css/admin/add-ons.css +1 -1
  55. vendor/freemius/wordpress-sdk/includes/class-freemius.php +6 -6
  56. vendor/freemius/wordpress-sdk/includes/class-fs-plugin-updater.php +32 -11
  57. vendor/freemius/wordpress-sdk/includes/entities/class-fs-plugin-tag.php +4 -0
  58. vendor/freemius/wordpress-sdk/includes/fs-plugin-info-dialog.php +54 -3
  59. vendor/freemius/wordpress-sdk/languages/freemius-cs_CZ.mo +0 -0
  60. vendor/freemius/wordpress-sdk/languages/freemius-da_DK.mo +0 -0
  61. vendor/freemius/wordpress-sdk/languages/freemius-de_DE.mo +0 -0
  62. vendor/freemius/wordpress-sdk/languages/freemius-en.mo +0 -0
  63. vendor/freemius/wordpress-sdk/languages/freemius-es_ES.mo +0 -0
  64. vendor/freemius/wordpress-sdk/languages/freemius-fr_FR.mo +0 -0
  65. vendor/freemius/wordpress-sdk/languages/freemius-he_IL.mo +0 -0
  66. vendor/freemius/wordpress-sdk/languages/freemius-hu_HU.mo +0 -0
  67. vendor/freemius/wordpress-sdk/languages/freemius-it_IT.mo +0 -0
  68. vendor/freemius/wordpress-sdk/languages/freemius-ja.mo +0 -0
  69. vendor/freemius/wordpress-sdk/languages/freemius-nl_NL.mo +0 -0
  70. vendor/freemius/wordpress-sdk/languages/freemius-ru_RU.mo +0 -0
  71. vendor/freemius/wordpress-sdk/languages/freemius-ta.mo +0 -0
  72. vendor/freemius/wordpress-sdk/languages/freemius-zh_CN.mo +0 -0
  73. vendor/freemius/wordpress-sdk/languages/freemius.pot +116 -104
  74. vendor/freemius/wordpress-sdk/start.php +1 -1
  75. vendor/freemius/wordpress-sdk/templates/connect.php +2 -2
  76. vendor/freemius/wordpress-sdk/templates/plugin-info/description.php +1 -1
  77. yet-another-stars-rating.php +6 -6
admin/css/yasr-admin.css CHANGED
@@ -897,6 +897,7 @@ div.yasr-select-img-container input {
897
  font-size: 18px;
898
  font-weight: bold;
899
  color: #2ca02c;
 
900
  }
901
 
902
  .title-noplugin-found{
897
  font-size: 18px;
898
  font-weight: bold;
899
  color: #2ca02c;
900
+ margin-top: 10px;
901
  }
902
 
903
  .title-noplugin-found{
admin/editor/YasrEditorHooks.php CHANGED
@@ -132,7 +132,7 @@ class YasrEditorHooks {
132
  foreach ($post_type_where_display_metabox as $post_type) {
133
  add_meta_box(
134
  'yasr_metabox_below_editor',
135
- __('Yet Another Stars Rating', 'yet-another-stars-rating'),
136
  array($this, 'yasr_metabox_below_editor_callback'),
137
  $post_type,
138
  'normal',
@@ -197,7 +197,7 @@ class YasrEditorHooks {
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;
@@ -208,7 +208,10 @@ class YasrEditorHooks {
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"
@@ -219,7 +222,12 @@ class YasrEditorHooks {
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
 
@@ -590,10 +598,10 @@ class YasrEditorHooks {
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);
597
 
598
  echo json_encode($array_to_return);
599
 
132
  foreach ($post_type_where_display_metabox as $post_type) {
133
  add_meta_box(
134
  'yasr_metabox_below_editor',
135
+ 'Yet Another Stars Rating',
136
  array($this, 'yasr_metabox_below_editor_callback'),
137
  $post_type,
138
  'normal',
197
  */
198
  public function tinymcePopupContent () {
199
  global $wpdb;
200
+ $multi_set = YasrDB::returnMultiSetNames();
201
  $n_multi_set = $wpdb->num_rows;
202
 
203
  $this->multi_set = $multi_set;
208
  <div id="yasr-tinypopup-form" style="display: none;">
209
  <h2 class="nav-tab-wrapper yasr-underline">
210
  <?php
211
+
212
+ /**
213
+ * Use this action to add tabs inside shortcode creator for tinymce
214
+ */
215
  do_action('yasr_add_tabs_on_tinypopupform');
216
  ?>
217
  <a href="https://yetanotherstarsrating.com/yasr-basics-shortcode/?utm_source=wp-plugin&utm_medium=tinymce-popup&utm_campaign=yasr_editor_screen"
222
  </h2>
223
 
224
  <?php
225
+ /**
226
+ * Use this action to add content inside shortcode creator
227
+ *
228
+ * @param $n_multi_set int
229
+ * @param $multi_set string the multiset name
230
+ */
231
  do_action('yasr_add_content_on_tinypopupform', $n_multi_set, $multi_set);
232
  ?>
233
 
598
  $post_id = (int) $_POST['post_id'];
599
 
600
  //set fields name and ids
601
+ $set_fields = YasrDB::multisetFieldsAndID($set_id);
602
 
603
  //set meta values
604
+ $array_to_return = YasrDB::returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id);
605
 
606
  echo json_encode($array_to_return);
607
 
admin/editor/YasrMetaboxBelowEditor.php CHANGED
@@ -44,7 +44,7 @@ class YasrMetaboxBelowEditor {
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
 
@@ -54,13 +54,15 @@ class YasrMetaboxBelowEditor {
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
 
@@ -221,7 +223,15 @@ class YasrMetaboxBelowEditor {
221
  data-setid="<?php echo esc_attr($set_id) ?>"
222
  data-postid="<?php echo esc_attr($post_id) ?>">
223
 
224
- <?php do_action('yasr_add_content_multiset_tab_top', $post_id, $set_id); ?>
 
 
 
 
 
 
 
 
225
 
226
  <input type="hidden" name="yasr_multiset_author_votes" id="yasr-multiset-author-votes" value="">
227
  <input type="hidden" name="yasr_multiset_id" id="yasr-multiset-id" value="<?php echo esc_attr($set_id) ?>">
@@ -289,14 +299,22 @@ class YasrMetaboxBelowEditor {
289
  <div class="yasr-metabox-editor-pro-only-box-padding">
290
  <div class="yasr-metabox-editor-title-pro-only">
291
  <?php
292
- esc_html_e('Pro Only features', 'yet-another-stars-rating');
293
- echo '&nbsp;'.YASR_LOCKED_FEATURE;
294
  ?>
295
  </div>
296
 
297
  <div class="yasr-settings-row">
298
  <div class="yasr-settings-col-30">
299
- <?php do_action('yasr_add_content_multiset_tab_pro', $post_id, $set_id); ?>
 
 
 
 
 
 
 
 
300
 
301
  <div class="yasr-metabox-editor-title">
302
  <?php
44
  if($multi_set === false || $n_multi_set === false) {
45
  global $wpdb;
46
 
47
+ $multi_set = YasrDB::returnMultiSetNames();
48
  $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the count number of rows of the last query
49
  }
50
 
54
  <div>
55
  <div style="display: table">
56
  <?php
57
+ /**
58
+ * Use this hook to add new tabs into the metabox below the editor
59
+ */
60
  do_action('yasr_metabox_below_editor_add_tab');
61
  ?>
62
  </div>
63
 
64
  <?php
65
+ /** */
66
  do_action('yasr_metabox_below_editor_content', $post_id, $multi_set, $n_multi_set);
67
  ?>
68
 
223
  data-setid="<?php echo esc_attr($set_id) ?>"
224
  data-postid="<?php echo esc_attr($post_id) ?>">
225
 
226
+ <?php
227
+ /**
228
+ * Hook here to add new content at the beginning of the div
229
+ *
230
+ * @param $post_id int
231
+ * @param $set_id int
232
+ */
233
+ do_action('yasr_add_content_multiset_tab_top', $post_id, $set_id);
234
+ ?>
235
 
236
  <input type="hidden" name="yasr_multiset_author_votes" id="yasr-multiset-author-votes" value="">
237
  <input type="hidden" name="yasr_multiset_id" id="yasr-multiset-id" value="<?php echo esc_attr($set_id) ?>">
299
  <div class="yasr-metabox-editor-pro-only-box-padding">
300
  <div class="yasr-metabox-editor-title-pro-only">
301
  <?php
302
+ esc_html_e('Pro Only features', 'yet-another-stars-rating');
303
+ echo '&nbsp;'.YASR_LOCKED_FEATURE;
304
  ?>
305
  </div>
306
 
307
  <div class="yasr-settings-row">
308
  <div class="yasr-settings-col-30">
309
+ <?php
310
+ /**
311
+ * Hook here to add new content
312
+ *
313
+ * @param $post_id int
314
+ * @param $set_id int
315
+ */
316
+ do_action('yasr_add_content_multiset_tab_pro', $post_id, $set_id);
317
+ ?>
318
 
319
  <div class="yasr-metabox-editor-title">
320
  <?php
admin/editor/YasrOnSavePost.php CHANGED
@@ -53,11 +53,16 @@ class YasrOnSavePost {
53
  $this->excludeAutoInsert();
54
  }
55
 
 
 
 
 
 
56
  do_action('yasr_on_save_post', $this->post_id);
57
  }
58
 
59
  /**
60
- * Save Overall Rating post_meta, is yasr_overall_rating isset
61
  *
62
  * @author Dario Curvino <@dudo>
63
  */
@@ -92,11 +97,15 @@ class YasrOnSavePost {
92
  return;
93
  }
94
 
95
- //Put an action to hook into
 
 
 
 
 
96
  do_action('yasr_action_on_overall_rating', $this->post_id, $rating);
97
 
98
  update_post_meta($this->post_id, 'yasr_overall_rating', $rating);
99
-
100
  }
101
 
102
  /**
53
  $this->excludeAutoInsert();
54
  }
55
 
56
+ /**
57
+ * Hook here to add actions when YASR save data on save_post
58
+ *
59
+ * @param $post_id int
60
+ */
61
  do_action('yasr_on_save_post', $this->post_id);
62
  }
63
 
64
  /**
65
+ * Save Overall Rating post_meta, if yasr_overall_rating isset, works only with classic editor
66
  *
67
  * @author Dario Curvino <@dudo>
68
  */
97
  return;
98
  }
99
 
100
+ /**
101
+ * Do action before overall rating is saved, works only in classic editor
102
+ *
103
+ * @param $post_id int
104
+ * @param $rating float
105
+ */
106
  do_action('yasr_action_on_overall_rating', $this->post_id, $rating);
107
 
108
  update_post_meta($this->post_id, 'yasr_overall_rating', $rating);
 
109
  }
110
 
111
  /**
admin/editor/yasr-metabox-top-right.php CHANGED
@@ -42,7 +42,6 @@ wp_nonce_field('yasr_nonce_is_post_review_action', 'yasr_nonce_is_post_review');
42
  wp_nonce_field('yasr_nonce_comment_review_enabled_action', 'yasr_nonce_comment_review_enabled');
43
  wp_nonce_field('yasr_pro_nonce_fake_ratings_action', 'yasr_pro_nonce_fake_ratings');
44
 
45
-
46
  ?>
47
 
48
  <div id="yasr-matabox-top-right">
@@ -114,6 +113,11 @@ wp_nonce_field('yasr_pro_nonce_fake_ratings_action', 'yasr_pro_nonce_fake_rating
114
 
115
  } //End if auto insert enabled
116
 
 
 
 
 
 
117
  do_action( 'yasr_add_content_bottom_topright_metabox', $post_id ); ?>
118
 
119
  </div>
42
  wp_nonce_field('yasr_nonce_comment_review_enabled_action', 'yasr_nonce_comment_review_enabled');
43
  wp_nonce_field('yasr_pro_nonce_fake_ratings_action', 'yasr_pro_nonce_fake_ratings');
44
 
 
45
  ?>
46
 
47
  <div id="yasr-matabox-top-right">
113
 
114
  } //End if auto insert enabled
115
 
116
+ /**
117
+ * Hook here to add content at the bottom of the metabox
118
+ *
119
+ * @param $post_id int
120
+ */
121
  do_action( 'yasr_add_content_bottom_topright_metabox', $post_id ); ?>
122
 
123
  </div>
admin/js/src/yasr-settings-page.js CHANGED
@@ -152,10 +152,10 @@ if (activeTab === 'manage_multi') {
152
  } //end if active_tab=='manage_multi'
153
 
154
  if (activeTab === 'migration_tools') {
155
- jQuery('#yasr-import-ratemypost-submit').on('click', function () {
156
 
157
  //show loader on click
158
- document.getElementById('yasr-import-ratemypost-answer').innerHTML = yasrWindowVar.loaderHtml;
159
 
160
  var nonce = document.getElementById('yasr-import-rmp-nonce').value;
161
 
@@ -166,7 +166,7 @@ if (activeTab === 'migration_tools') {
166
 
167
  jQuery.post(ajaxurl, data, function (response) {
168
  response = JSON.parse(response);
169
- document.getElementById('yasr-import-ratemypost-answer').innerHTML = response;
170
  });
171
 
172
  });
152
  } //end if active_tab=='manage_multi'
153
 
154
  if (activeTab === 'migration_tools') {
155
+ jQuery('#yasr-import-rmp-submit').on('click', function () {
156
 
157
  //show loader on click
158
+ document.getElementById('yasr-import-rmp-answer').innerHTML = yasrWindowVar.loaderHtml;
159
 
160
  var nonce = document.getElementById('yasr-import-rmp-nonce').value;
161
 
166
 
167
  jQuery.post(ajaxurl, data, function (response) {
168
  response = JSON.parse(response);
169
+ document.getElementById('yasr-import-rmp-answer').innerHTML = response;
170
  });
171
 
172
  });
admin/js/yasr-settings.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var e={268:(e,t,r)=>{r.d(t,{v:()=>n});var n=function(e){var 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"})},726:function(e,t,r){var n;!function(a){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,d=/<\/?([^\s\/>]+)/;function u(e,t,r){return y(e=e||"",m(t=t||[],r=r||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=c.exec(e);)t.add(r[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 y(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,n=t.tag_replacement,a=t.state,o=t.tag_buffer,c=t.depth,d=t.in_quote_char,u="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(a===s)if("<"===m)a=i,o+=m;else u+=m;else if(a===i)switch(m){case"<":if(d)break;c++;break;case">":if(d)break;if(c){c--;break}d="",a=s,o+=">",r.has(p(o))?u+=o:u+=n,o="";break;case'"':case"'":d=m===d?"":d||m,o+=m;break;case"-":"<!-"===o&&(a=l),o+=m;break;case" ":case"\n":if("<"===o){a=s,u+="< ",o="";break}o+=m;break;default:o+=m}else if(a===l)if(">"===m)"--"==o.slice(-2)&&(a=s),o="";else o+=m}return t.state=a,t.tag_buffer=o,t.depth=c,t.in_quote_char=d,u}function p(e){let t=d.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=m(e=e||[],t=t||"");return function(e){return y(e||"",r)}},void 0===(n=function(){return u}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.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 n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{r(268);function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var n,a=function(){var e=document.getElementById("new-set-criteria-container");document.getElementById("new-criteria-button").onclick=function(t){t.preventDefault();var r,n=s("removable-criteria"),a=i(n);if(!((r=!1!==a?a:n.length+1)<3||r>9)){var d=l(r);c(a,r,e,d),o()}}},o=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=s("removable-criteria").length,r=function(e){var t=document.getElementById("remove-criteria-".concat(e));null!==t&&(t.onclick=function(e){var r=t.dataset.idCriteria;document.getElementById(r).remove()})},n=e;n<=t;n++)r(n);a()},s=function(t){return e(document.getElementsByClassName(t)).map((function(e){return parseInt(e.attributes.value.value)}))},i=function(e){var t=!1;e.sort();for(var r=1;r<=e.length;r++)if(-1===e.indexOf(r)){t=r;break}return t},l=function(e){var t=document.createElement("div");return t.id="criteria-row-container-".concat(e),t.className="criteria-row removable-criteria",t.setAttribute("value",e),t.innerHTML='\n <label for="multi-set-name-element-'.concat(e,'">\n </label>\n <input type="text"\n name="multi-set-name-element-').concat(e,'"\n id="multi-set-name-element-').concat(e,'"\n class="input-text-multi-set"\n placeholder="New Criteria"\n />\n <span \n class="dashicons dashicons-remove yasr-multiset-info-delete criteria-delete" \n id="remove-criteria-').concat(e,'"\n data-id-criteria="').concat(t.id,'"\n > \n </span>'),t},c=function(e,t,r,n){if(!1!==e)for(var a=1,o=3;o<9;o++){var s="criteria-row-container-".concat(t+a);if(!0==!!document.getElementById(s)){var i=document.getElementById(s);r.insertBefore(n,i);break}a++}else document.getElementById("new-set-criteria-container").appendChild(n)};if(document.getElementsByClassName("nav-tab-active").length>0&&(n=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===n){var d=document.getElementById("yasr_auto_insert_switch").checked,u=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===d&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===u&&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"===n&&(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"===n){var m=parseInt(document.getElementById("n-multiset").value);if(a(),o(),1===m){var y=jQuery("#yasr-edit-form-number-elements").attr("value");y++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(y>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 #'+y+' <input type="text" name="edit-multi-set-element-'+y+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),y++}))}else m>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"===n&&(jQuery("#yasr-import-ratemypost-submit").on("click",(function(){document.getElementById("yasr-import-ratemypost-answer").innerHTML=yasrWindowVar.loaderHtml;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=yasrWindowVar.loaderHtml;var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===n&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{let e;var t,n=function(t){var r=t.colClass,n=t.post,a=n.link,o=n.title;return React.createElement("td",{className:r},React.createElement("a",{href:a},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}(o)))},a=new Uint8Array(16);function o(){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;const i=function(e){return"string"==typeof e&&s.test(e)};for(var l=[],c=0;c<256;++c)l.push((c+256).toString(16).substr(1));const d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!i(r))throw TypeError("Stringified UUID is invalid");return r};const u=function(e,t,r){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return d(n)};var m=r(726),y=r.n(m),p=function(e){var t=e.html;return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t,"<strong><p>")}})},g=function(e){var t=e.post,r=t.number_of_votes,n=t.rating,a=e.text;if(void 0!==r){var o=JSON.parse(yasrWindowVar.textAfterVr);return o=(o=o.replace("%total_count%",r)).replace("%average%",n),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(p,{html:o}))}return React.createElement("span",null,a," ",n)},f=function(e){var t=e.size,r=e.htmlId,n=e.element,a=e.step,o=e.readonly,s=e.rating;return React.createElement("div",{id:r,ref:function(){return yasrSetRaterValue(t,r,n,a,o,s)}})},v=function(e){var t=e.rankingParams,r=e.tableId,n=e.colClass,a=e.post,o="after",s=JSON.parse(yasrWindowVar.textRating),i=new URLSearchParams(t);null!==i.get("text_position")&&(o=i.get("text_position")),null!==i.get("custom_txt")&&(s=i.get("custom_txt"));var l={rating:a.rating,htmlId:"yasr-ranking-element-"+u(),size:document.getElementById(r).dataset.rankingSize};return"before"===o?React.createElement("td",{className:n},React.createElement(g,{post:a,text:s}),React.createElement(f,l)):React.createElement("td",{className:n},React.createElement(f,l),React.createElement(g,{post:a,text:s}))},h=function(e){var t={colClass:e.leftClass,post:e.post},r={rankingParams:e.rankingParams,tableId:e.tableId,colClass:e.rightClass,post:e.post};return React.createElement("tr",{className:e.trClass},React.createElement(n,t),React.createElement(v,r))},_=function(e){var t=e.tBodyId,r=e.show,n=e.data,a=e.source,o=e.rankingParams,s=e.tableId;return React.createElement("tbody",{id:t,style:{display:r}},n.map((function(e,t){var r="yasr-rankings-td-colored",n="yasr-top-10-most-highest-left",i="yasr-top-10-most-highest-right";return"author_ranking"===a&&(r="yasr-rankings-td-white",n="yasr-top-10-overall-left",i="yasr-top-10-overall-right"),t%2==0&&(r="yasr-rankings-td-white","author_ranking"===a&&(r="yasr-rankings-td-colored")),React.createElement(h,{key:e.post_id,source:a,tableId:s,rankingParams:o,post:e,trClass:r,leftClass:n,rightClass:i})})))},E=function(e){return function(t){t.preventDefault();var r=t.target.id,n=e.tableId,a="link-most-rated-posts-"+n,o="link-highest-rated-posts-"+n,s="most-rated-posts-"+n,i="highest-rated-posts-"+n,l=document.getElementById(r),c=document.createElement("span");c.innerHTML=l.innerHTML,c.id=l.id,l.parentNode.replaceChild(c,l),r===a&&(document.getElementById(i).style.display="none",document.getElementById(s).style.display="",c=document.getElementById(o),l.innerHTML=c.innerHTML,l.id=c.id,c.parentNode.replaceChild(l,c)),r===o&&(document.getElementById(s).style.display="none",document.getElementById(i).style.display="",c=document.getElementById(a),l.innerHTML=c.innerHTML,l.id=c.id,c.parentNode.replaceChild(l,c))}},b=function(e){var t=e.tableId,r=e.source,n=e.defaultView,a="link-most-rated-posts-"+t,o="link-highest-rated-posts-"+t;if("author_ranking"!==r){var s=React.createElement("span",null,React.createElement("span",{id:a},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:o,onClick:E(e)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===n&&(s=React.createElement("span",null,React.createElement("span",{id:o},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:a,onClick:E(e)},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)},w=function(e){var t=e.error,r=e.isLoaded,n=e.data,a=e.source,o=e.rankingParams,s=e.tableId;if(t)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error")));if(!1===r)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking))));if("overall_rating"===a||"author_multi"===a)return React.createElement(_,{data:n,tableId:s,tBodyId:"overall_"+s,rankingParams:o,show:"table-row-group",source:a});var i=n.most,l=n.highest,c="table-row-group",d="none",u="most",m=c,y=d,p=new URLSearchParams(o);return null!==p.get("view")&&(u=p.get("view")),"highest"===u&&(m=d,y=c),React.createElement(React.Fragment,null,React.createElement(b,{tableId:s,source:a,defaultView:u}),React.createElement(_,{data:i,tableId:s,tBodyId:"most-rated-posts-"+s,rankingParams:o,show:m,source:a}),React.createElement(_,{data:l,tableId:s,tBodyId:"highest-rated-posts-"+s,rankingParams:o,show:y,source:a}))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=wp.element,j=x.useState,R=x.useEffect,C=function(e,t,r){var n=t,a="&nonce_rankings="+r,o=function(e,t){var r="";if(""!==e&&!1!==e){var n=new URLSearchParams(e);null!==n.get("order_by")&&(r+="order_by="+n.get("order_by")),null!==n.get("limit")&&(r+="&limit="+n.get("limit")),null!==n.get("start_date")&&"0"!==n.get("start_date")&&(r+="&start_date="+n.get("start_date")),null!==n.get("end_date")&&"0"!==n.get("end_date")&&(r+="&end_date="+n.get("end_date")),null!==n.get("ctg")?r+="&ctg="+n.get("ctg"):null!==n.get("cpt")&&(r+="&cpt="+n.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==t&&"author_multi"!==t||null!==n.get("setid")&&(r+="&setid="+n.get("setid")),"visitor_votes"===t&&(null!==n.get("required_votes[most]")&&(r="&required_votes="+n.get("required_votes[most]")),null!==n.get("required_votes[highest]")&&(r="&required_votes="+n.get("required_votes[highest]")))}return r}(""!==e?e:"",n);return"author_ranking"===n||"author_multi"===n||"overall_rating"===n?[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+n+o+a]:[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+n+o+a,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+n+o+a]},S=function(e){var t=e.tableId,r=e.source,n=e.params,a=e.nonce,o={tableId:t,source:r,rankingParams:n},s=I(j(null),2),i=s[0],l=s[1],c=I(j(!1),2),d=c[0],u=c[1],m=I(j([]),2),y=m[0],p=m[1],g=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=JSON.parse(document.getElementById(t).dataset.rankingData);!0===e&&console.info("Ajax Disabled, getting data from source"),p(r)};return R((function(){var e,t;"yes"!==yasrWindowVar.ajaxEnabled?(g(!0),u(!0)):r?(e=[],t=C(n,r,a),Promise.all(t.map((function(t){return fetch(t).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?g():("overall_rating"===t.source||"author_multi"===t.source?e="overall_rating"===t.source?t.data_overall:t.data_mv:e[t.show]=t.data_vv,p(e))})).catch((function(e){g(),console.info(e)}))}))).then((function(e){u(!0)})).catch((function(e){g(),console.info(e)}))):l("Invalid Data Source")}),[]),React.createElement(React.Fragment,null,React.createElement(w,k({error:i,isLoaded:d,data:y},o)))},N=wp.element.render,O=function(){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,n=JSON.parse(e.item(t).dataset.rankingSource),a=JSON.parse(e.item(t).dataset.rankingParams),o=JSON.parse(e.item(t).dataset.rankingNonce),s=document.getElementById(r);N(React.createElement(S,{source:n,tableId:r,params:a,nonce:o}),s)}};O();var L,Q=r(268),T=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(L=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===L){var A,H=function(e){var t=$.value,r=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(T("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,K.childNodes.length>0?K.replaceChild(t,K.childNodes[0]):K.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&O()}))}))},M=function(e,t,r,n,a,o,s,i,l){e.style.display="",t.style.display="",o.style.display="",l.style.display="",r.style.display="none",n.style.display="none",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="none")},V=function(e,t,r,n,a,o,s,i,l){r.style.display="",n.style.display="",t.style.display="",o.style.display="",l.style.display="",e.style.display="none",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="none")},P=function(e,t,r,n,a,o,s,i,l){a.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",n.style.display="none",t.style.display="none",o.style.display="none",null!==s&&(s.style.display="none"),null!==i&&(i.style.display="none")},J=function(e,t,r,n,a,o,s,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=arguments.length>9?arguments[9]:void 0;!0===l?(Z.className="",Z.classList.add("yasr-settings-row-24"),r.style.display="",n.style.display="",e.style.display="none"):(r.style.display="none",n.style.display="none",e.style.display=""),o.style.display="",t.style.display="",c.style.display="",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="")},W=".yasr-builder-elements-parents",q=".yasr-builder-elements-childs";jQuery(W).prop("disabled",!0),jQuery(q).prop("disabled",!0),jQuery(W).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",W,q);var D=[],z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};A=z.name,document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]");var F=document.getElementById("yasr-builder-button-preview"),U=document.getElementById("yasr-builder-copy-shortcode"),K=document.getElementById("yasr-builder-preview"),$=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),G=document.getElementById("yasr-builder-datepicker-start"),X=document.getElementById("yasr-builder-datepicker-end"),Z=document.getElementById("yasr-builder-params-container"),ee=document.getElementById("builder-vv-default-view"),te=document.getElementById("builder-vv-required-votes"),re=document.getElementById("builder-stars-size"),ne=document.getElementById("builder-overall-text"),ae=document.getElementById("builder-username-options"),oe=document.getElementById("builder-category"),se=document.getElementById("builder-cpt"),ie=document.getElementById("yasr-ranking-multiset"),le=document.getElementById("yasr-builder-datepicker"),ce=$.value,de=!1;G.value="",X.value="","yasr_ov_ranking"===ce?M(ne,re,ee,te,ae,oe,se,ie,le):"yasr_most_active_users"===ce||"yasr_top_reviewers"===ce?P(ne,re,ee,te,ae,oe,se,ie,le):"yasr_multi_set_ranking"===ce?J(ne,re,ee,te,ae,oe,se,ie,!1,le):"yasr_visitor_multi_set_ranking"===ce?J(ne,re,ee,te,ae,oe,se,ie,!0,le):V(ne,re,ee,te,ae,oe,se,ie,le),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)Z.className="",Z.classList.add("yasr-settings-row-33"),K.innerHTML="",G.value="",X.value="",z={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?M(ne,re,ee,te,ae,oe,se,ie,le):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?P(ne,re,ee,te,ae,oe,se,ie,le):"yasr_multi_set_ranking"===e.target.value?(J(ne,re,ee,te,ae,oe,se,ie,!1,le),z.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(J(ne,re,ee,te,ae,oe,se,ie,!0,le),z.setid=" setid="+Y[0].value):V(ne,re,ee,te,ae,oe,se,ie,le),z.name=e.target.value,A=z.name+z.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(z.setid=" setid="+e.target.value),D=wp.hooks.applyFilters("yasrBuilderFilterShortcode",z);for(var t=2;z.length;t++)D.hasOwnProperty(z[t])&&(z[t]=D[t]);A=z.name+z.setid+z.rows+z.view+z.minvotesmost+z.minvoteshg+z.size+z.txtPosition+z.txt+z.display+z.start_date+z.end_date+z.category+z.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]"),!0===de&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&H()})),U.onclick=function(e){var t=document.getElementById(e.target.id);(0,Q.v)(t.getAttribute("data-shortcode"))},F.onclick=function(e){H(),de=!0}}})()})();
1
+ (()=>{"use strict";var e={268:(e,t,r)=>{r.d(t,{v:()=>n});var n=function(e){var 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"})},726:function(e,t,r){var n;!function(a){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,d=/<\/?([^\s\/>]+)/;function u(e,t,r){return y(e=e||"",m(t=t||[],r=r||""))}function m(e,t){return{allowable_tags:e=function(e){let t=new Set;if("string"==typeof e){let r;for(;r=c.exec(e);)t.add(r[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 y(e,t){if("string"!=typeof e)throw new TypeError("'html' parameter must be a string");let r=t.allowable_tags,n=t.tag_replacement,a=t.state,o=t.tag_buffer,c=t.depth,d=t.in_quote_char,u="";for(let t=0,m=e.length;t<m;t++){let m=e[t];if(a===s)if("<"===m)a=i,o+=m;else u+=m;else if(a===i)switch(m){case"<":if(d)break;c++;break;case">":if(d)break;if(c){c--;break}d="",a=s,o+=">",r.has(p(o))?u+=o:u+=n,o="";break;case'"':case"'":d=m===d?"":d||m,o+=m;break;case"-":"<!-"===o&&(a=l),o+=m;break;case" ":case"\n":if("<"===o){a=s,u+="< ",o="";break}o+=m;break;default:o+=m}else if(a===l)if(">"===m)"--"==o.slice(-2)&&(a=s),o="";else o+=m}return t.state=a,t.tag_buffer=o,t.depth=c,t.in_quote_char=d,u}function p(e){let t=d.exec(e);return t?t[1].toLowerCase():null}u.init_streaming_mode=function(e,t){let r=m(e=e||[],t=t||"");return function(e){return y(e||"",r)}},void 0===(n=function(){return u}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.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 n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{r(268);function e(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var n,a=function(){var e=document.getElementById("new-set-criteria-container");document.getElementById("new-criteria-button").onclick=function(t){t.preventDefault();var r,n=s("removable-criteria"),a=i(n);if(!((r=!1!==a?a:n.length+1)<3||r>9)){var d=l(r);c(a,r,e,d),o()}}},o=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=s("removable-criteria").length,r=function(e){var t=document.getElementById("remove-criteria-".concat(e));null!==t&&(t.onclick=function(e){var r=t.dataset.idCriteria;document.getElementById(r).remove()})},n=e;n<=t;n++)r(n);a()},s=function(t){return e(document.getElementsByClassName(t)).map((function(e){return parseInt(e.attributes.value.value)}))},i=function(e){var t=!1;e.sort();for(var r=1;r<=e.length;r++)if(-1===e.indexOf(r)){t=r;break}return t},l=function(e){var t=document.createElement("div");return t.id="criteria-row-container-".concat(e),t.className="criteria-row removable-criteria",t.setAttribute("value",e),t.innerHTML='\n <label for="multi-set-name-element-'.concat(e,'">\n </label>\n <input type="text"\n name="multi-set-name-element-').concat(e,'"\n id="multi-set-name-element-').concat(e,'"\n class="input-text-multi-set"\n placeholder="New Criteria"\n />\n <span \n class="dashicons dashicons-remove yasr-multiset-info-delete criteria-delete" \n id="remove-criteria-').concat(e,'"\n data-id-criteria="').concat(t.id,'"\n > \n </span>'),t},c=function(e,t,r,n){if(!1!==e)for(var a=1,o=3;o<9;o++){var s="criteria-row-container-".concat(t+a);if(!0==!!document.getElementById(s)){var i=document.getElementById(s);r.insertBefore(n,i);break}a++}else document.getElementById("new-set-criteria-container").appendChild(n)};if(document.getElementsByClassName("nav-tab-active").length>0&&(n=document.getElementsByClassName("nav-tab-active")[0].id),"general_settings"===n){var d=document.getElementById("yasr_auto_insert_switch").checked,u=document.getElementById("yasr-general-options-stars-title-switch").checked;!1===d&&jQuery(".yasr-auto-insert-options-class").prop("disabled",!0),!1===u&&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"===n&&(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"===n){var m=parseInt(document.getElementById("n-multiset").value);if(a(),o(),1===m){var y=jQuery("#yasr-edit-form-number-elements").attr("value");y++,jQuery("#yasr-add-field-edit-multiset").on("click",(function(){if(y>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 #'+y+' <input type="text" name="edit-multi-set-element-'+y+'" value="" ></td>'),e.appendTo("#yasr-table-form-edit-multi-set"),y++}))}else m>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"===n&&(jQuery("#yasr-import-rmp-submit").on("click",(function(){document.getElementById("yasr-import-rmp-answer").innerHTML=yasrWindowVar.loaderHtml;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-rmp-answer").innerHTML=e}))})),jQuery("#yasr-import-wppr-submit").on("click",(function(){document.getElementById("yasr-import-wppr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_wppr",nonce:document.getElementById("yasr-import-wppr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-wppr-answer").innerHTML=e}))})),jQuery("#yasr-import-kksr-submit").on("click",(function(){document.getElementById("yasr-import-kksr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_kksr",nonce:document.getElementById("yasr-import-kksr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-kksr-answer").innerHTML=e}))})),jQuery("#yasr-import-mr-submit").on("click",(function(){document.getElementById("yasr-import-mr-answer").innerHTML=yasrWindowVar.loaderHtml;var e={action:"yasr_import_mr",nonce:document.getElementById("yasr-import-mr-nonce").value};jQuery.post(ajaxurl,e,(function(e){e=JSON.parse(e),document.getElementById("yasr-import-mr-answer").innerHTML=e}))})),wp.hooks.doAction("yasr_migration_page_bottom")),"rankings"===n&&wp.hooks.doAction("yasr_ranking_page_top")})(),(()=>{let e;var t,n=function(t){var r=t.colClass,n=t.post,a=n.link,o=n.title;return React.createElement("td",{className:r},React.createElement("a",{href:a},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}(o)))},a=new Uint8Array(16);function o(){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;const i=function(e){return"string"==typeof e&&s.test(e)};for(var l=[],c=0;c<256;++c)l.push((c+256).toString(16).substr(1));const d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(l[e[t+0]]+l[e[t+1]]+l[e[t+2]]+l[e[t+3]]+"-"+l[e[t+4]]+l[e[t+5]]+"-"+l[e[t+6]]+l[e[t+7]]+"-"+l[e[t+8]]+l[e[t+9]]+"-"+l[e[t+10]]+l[e[t+11]]+l[e[t+12]]+l[e[t+13]]+l[e[t+14]]+l[e[t+15]]).toLowerCase();if(!i(r))throw TypeError("Stringified UUID is invalid");return r};const u=function(e,t,r){var n=(e=e||{}).random||(e.rng||o)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var a=0;a<16;++a)t[r+a]=n[a];return t}return d(n)};var m=r(726),y=r.n(m),p=function(e){var t=e.html;return React.createElement("div",{dangerouslySetInnerHTML:{__html:y()(t,"<strong><p>")}})},g=function(e){var t=e.post,r=t.number_of_votes,n=t.rating,a=e.text;if(void 0!==r){var o=JSON.parse(yasrWindowVar.textAfterVr);return o=(o=o.replace("%total_count%",r)).replace("%average%",n),React.createElement("div",{className:"yasr-most-rated-text"},React.createElement(p,{html:o}))}return React.createElement("span",null,a," ",n)},f=function(e){var t=e.size,r=e.htmlId,n=e.element,a=e.step,o=e.readonly,s=e.rating;return React.createElement("div",{id:r,ref:function(){return yasrSetRaterValue(t,r,n,a,o,s)}})},v=function(e){var t=e.rankingParams,r=e.tableId,n=e.colClass,a=e.post,o="after",s=JSON.parse(yasrWindowVar.textRating),i=new URLSearchParams(t);null!==i.get("text_position")&&(o=i.get("text_position")),null!==i.get("custom_txt")&&(s=i.get("custom_txt"));var l={rating:a.rating,htmlId:"yasr-ranking-element-"+u(),size:document.getElementById(r).dataset.rankingSize};return"before"===o?React.createElement("td",{className:n},React.createElement(g,{post:a,text:s}),React.createElement(f,l)):React.createElement("td",{className:n},React.createElement(f,l),React.createElement(g,{post:a,text:s}))},h=function(e){var t={colClass:e.leftClass,post:e.post},r={rankingParams:e.rankingParams,tableId:e.tableId,colClass:e.rightClass,post:e.post};return React.createElement("tr",{className:e.trClass},React.createElement(n,t),React.createElement(v,r))},_=function(e){var t=e.tBodyId,r=e.show,n=e.data,a=e.source,o=e.rankingParams,s=e.tableId;return React.createElement("tbody",{id:t,style:{display:r}},n.map((function(e,t){var r="yasr-rankings-td-colored",n="yasr-top-10-most-highest-left",i="yasr-top-10-most-highest-right";return"author_ranking"===a&&(r="yasr-rankings-td-white",n="yasr-top-10-overall-left",i="yasr-top-10-overall-right"),t%2==0&&(r="yasr-rankings-td-white","author_ranking"===a&&(r="yasr-rankings-td-colored")),React.createElement(h,{key:e.post_id,source:a,tableId:s,rankingParams:o,post:e,trClass:r,leftClass:n,rightClass:i})})))},E=function(e){return function(t){t.preventDefault();var r=t.target.id,n=e.tableId,a="link-most-rated-posts-"+n,o="link-highest-rated-posts-"+n,s="most-rated-posts-"+n,i="highest-rated-posts-"+n,l=document.getElementById(r),c=document.createElement("span");c.innerHTML=l.innerHTML,c.id=l.id,l.parentNode.replaceChild(c,l),r===a&&(document.getElementById(i).style.display="none",document.getElementById(s).style.display="",c=document.getElementById(o),l.innerHTML=c.innerHTML,l.id=c.id,c.parentNode.replaceChild(l,c)),r===o&&(document.getElementById(s).style.display="none",document.getElementById(i).style.display="",c=document.getElementById(a),l.innerHTML=c.innerHTML,l.id=c.id,c.parentNode.replaceChild(l,c))}},b=function(e){var t=e.tableId,r=e.source,n=e.defaultView,a="link-most-rated-posts-"+t,o="link-highest-rated-posts-"+t;if("author_ranking"!==r){var s=React.createElement("span",null,React.createElement("span",{id:a},JSON.parse(yasrWindowVar.textMostRated))," | ",React.createElement("a",{href:"#",id:o,onClick:E(e)},JSON.parse(yasrWindowVar.textHighestRated)));return"highest"===n&&(s=React.createElement("span",null,React.createElement("span",{id:o},JSON.parse(yasrWindowVar.textHighestRated))," | ",React.createElement("a",{href:"#",id:a,onClick:E(e)},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)},w=function(e){var t=e.error,r=e.isLoaded,n=e.data,a=e.source,o=e.rankingParams,s=e.tableId;if(t)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,console.log(t),"Error")));if(!1===r)return React.createElement("tbody",null,React.createElement("tr",null,React.createElement("td",null,JSON.parse(yasrWindowVar.textLoadRanking))));if("overall_rating"===a||"author_multi"===a)return React.createElement(_,{data:n,tableId:s,tBodyId:"overall_"+s,rankingParams:o,show:"table-row-group",source:a});var i=n.most,l=n.highest,c="table-row-group",d="none",u="most",m=c,y=d,p=new URLSearchParams(o);return null!==p.get("view")&&(u=p.get("view")),"highest"===u&&(m=d,y=c),React.createElement(React.Fragment,null,React.createElement(b,{tableId:s,source:a,defaultView:u}),React.createElement(_,{data:i,tableId:s,tBodyId:"most-rated-posts-"+s,rankingParams:o,show:m,source:a}),React.createElement(_,{data:l,tableId:s,tBodyId:"highest-rated-posts-"+s,rankingParams:o,show:y,source:a}))};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},k.apply(this,arguments)}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,a,o=[],s=!0,i=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){i=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return B(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=wp.element,j=x.useState,R=x.useEffect,C=function(e,t,r){var n=t,a="&nonce_rankings="+r,o=function(e,t){var r="";if(""!==e&&!1!==e){var n=new URLSearchParams(e);null!==n.get("order_by")&&(r+="order_by="+n.get("order_by")),null!==n.get("limit")&&(r+="&limit="+n.get("limit")),null!==n.get("start_date")&&"0"!==n.get("start_date")&&(r+="&start_date="+n.get("start_date")),null!==n.get("end_date")&&"0"!==n.get("end_date")&&(r+="&end_date="+n.get("end_date")),null!==n.get("ctg")?r+="&ctg="+n.get("ctg"):null!==n.get("cpt")&&(r+="&cpt="+n.get("cpt")),""!==r&&(r="&"+(r=r.replace(/\s+/g,""))),"visitor_multi"!==t&&"author_multi"!==t||null!==n.get("setid")&&(r+="&setid="+n.get("setid")),"visitor_votes"===t&&(null!==n.get("required_votes[most]")&&(r="&required_votes="+n.get("required_votes[most]")),null!==n.get("required_votes[highest]")&&(r="&required_votes="+n.get("required_votes[highest]")))}return r}(""!==e?e:"",n);return"author_ranking"===n||"author_multi"===n||"overall_rating"===n?[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&source="+n+o+a]:[yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=most&source="+n+o+a,yasrWindowVar.ajaxurl+"?action=yasr_load_rankings&show=highest&source="+n+o+a]},S=function(e){var t=e.tableId,r=e.source,n=e.params,a=e.nonce,o={tableId:t,source:r,rankingParams:n},s=I(j(null),2),i=s[0],l=s[1],c=I(j(!1),2),d=c[0],u=c[1],m=I(j([]),2),y=m[0],p=m[1],g=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=JSON.parse(document.getElementById(t).dataset.rankingData);!0===e&&console.info("Ajax Disabled, getting data from source"),p(r)};return R((function(){var e,t;"yes"!==yasrWindowVar.ajaxEnabled?(g(!0),u(!0)):r?(e=[],t=C(n,r,a),Promise.all(t.map((function(t){return fetch(t).then((function(e){return!0===e.ok?e.json():(console.info("Ajax Call Failed. Getting data from source"),"KO")})).then((function(t){"KO"===t?g():("overall_rating"===t.source||"author_multi"===t.source?e="overall_rating"===t.source?t.data_overall:t.data_mv:e[t.show]=t.data_vv,p(e))})).catch((function(e){g(),console.info(e)}))}))).then((function(e){u(!0)})).catch((function(e){g(),console.info(e)}))):l("Invalid Data Source")}),[]),React.createElement(React.Fragment,null,React.createElement(w,k({error:i,isLoaded:d,data:y},o)))},N=wp.element.render,O=function(){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,n=JSON.parse(e.item(t).dataset.rankingSource),a=JSON.parse(e.item(t).dataset.rankingParams),o=JSON.parse(e.item(t).dataset.rankingNonce),s=document.getElementById(r);N(React.createElement(S,{source:n,tableId:r,params:a,nonce:o}),s)}};O();var L,Q=r(268),T=wp.i18n.__;if(document.getElementsByClassName("nav-tab-active").length>0&&(L=document.getElementsByClassName("nav-tab-active")[0].id),"rankings"===L){var A,H=function(e){var t=$.value,r=document.getElementById("yasr-builder-shortcode").textContent,n=["yasr_ov_ranking","yasr_most_or_highest_rated_posts","yasr_multi_set_ranking","yasr_visitor_multi_set_ranking"];n=wp.hooks.applyFilters("yasrBuilderDrawRankingsShortcodes",n),fetch(ajaxurl+"?action=yasr_rankings_preview_shortcode&shortcode="+t+"&full_shortcode="+r).then((function(e){return!0===e.ok?e.json():(console.info(T("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,K.childNodes.length>0?K.replaceChild(t,K.childNodes[0]):K.appendChild(t)}})).then((function(e){n.forEach((function(e){t===e&&O()}))}))},M=function(e,t,r,n,a,o,s,i,l){e.style.display="",t.style.display="",o.style.display="",l.style.display="",r.style.display="none",n.style.display="none",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="none")},V=function(e,t,r,n,a,o,s,i,l){r.style.display="",n.style.display="",t.style.display="",o.style.display="",l.style.display="",e.style.display="none",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="none")},P=function(e,t,r,n,a,o,s,i,l){a.style.display="",l.style.display="none",e.style.display="none",r.style.display="none",n.style.display="none",t.style.display="none",o.style.display="none",null!==s&&(s.style.display="none"),null!==i&&(i.style.display="none")},J=function(e,t,r,n,a,o,s,i){var l=arguments.length>8&&void 0!==arguments[8]&&arguments[8],c=arguments.length>9?arguments[9]:void 0;!0===l?(Z.className="",Z.classList.add("yasr-settings-row-24"),r.style.display="",n.style.display="",e.style.display="none"):(r.style.display="none",n.style.display="none",e.style.display=""),o.style.display="",t.style.display="",c.style.display="",a.style.display="none",null!==s&&(s.style.display=""),null!==i&&(i.style.display="")},W=".yasr-builder-elements-parents",q=".yasr-builder-elements-childs";jQuery(W).prop("disabled",!0),jQuery(q).prop("disabled",!0),jQuery(W).find("input").each((function(){jQuery(this).prop("disabled",!0)})),wp.hooks.doAction("yasrBuilderBegin",W,q);var D=[],z={name:"yasr_most_or_highest_rated_posts",setid:"",rows:"",size:"",view:"",minvotesmost:"",minvoteshg:"",txtPosition:"",txt:"",display:"",start_date:"",end_date:"",category:"",cpt:""};A=z.name,document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]");var F=document.getElementById("yasr-builder-button-preview"),U=document.getElementById("yasr-builder-copy-shortcode"),K=document.getElementById("yasr-builder-preview"),$=document.getElementById("yasr-ranking-source"),Y=document.getElementById("yasr-ranking-multiset-select"),G=document.getElementById("yasr-builder-datepicker-start"),X=document.getElementById("yasr-builder-datepicker-end"),Z=document.getElementById("yasr-builder-params-container"),ee=document.getElementById("builder-vv-default-view"),te=document.getElementById("builder-vv-required-votes"),re=document.getElementById("builder-stars-size"),ne=document.getElementById("builder-overall-text"),ae=document.getElementById("builder-username-options"),oe=document.getElementById("builder-category"),se=document.getElementById("builder-cpt"),ie=document.getElementById("yasr-ranking-multiset"),le=document.getElementById("yasr-builder-datepicker"),ce=$.value,de=!1;G.value="",X.value="","yasr_ov_ranking"===ce?M(ne,re,ee,te,ae,oe,se,ie,le):"yasr_most_active_users"===ce||"yasr_top_reviewers"===ce?P(ne,re,ee,te,ae,oe,se,ie,le):"yasr_multi_set_ranking"===ce?J(ne,re,ee,te,ae,oe,se,ie,!1,le):"yasr_visitor_multi_set_ranking"===ce?J(ne,re,ee,te,ae,oe,se,ie,!0,le):V(ne,re,ee,te,ae,oe,se,ie,le),document.addEventListener("change",(function(e){if("yasr-ranking-source"===e.target.id)Z.className="",Z.classList.add("yasr-settings-row-33"),K.innerHTML="",G.value="",X.value="",z={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?M(ne,re,ee,te,ae,oe,se,ie,le):"yasr_most_active_users"===e.target.value||"yasr_top_reviewers"===e.target.value?P(ne,re,ee,te,ae,oe,se,ie,le):"yasr_multi_set_ranking"===e.target.value?(J(ne,re,ee,te,ae,oe,se,ie,!1,le),z.setid=" setid="+Y[0].value):"yasr_visitor_multi_set_ranking"===e.target.value?(J(ne,re,ee,te,ae,oe,se,ie,!0,le),z.setid=" setid="+Y[0].value):V(ne,re,ee,te,ae,oe,se,ie,le),z.name=e.target.value,A=z.name+z.setid;else{"yasr-ranking-multiset-select"===e.target.id&&(z.setid=" setid="+e.target.value),D=wp.hooks.applyFilters("yasrBuilderFilterShortcode",z);for(var t=2;z.length;t++)D.hasOwnProperty(z[t])&&(z[t]=D[t]);A=z.name+z.setid+z.rows+z.view+z.minvotesmost+z.minvoteshg+z.size+z.txtPosition+z.txt+z.display+z.start_date+z.end_date+z.category+z.cpt}document.getElementById("yasr-builder-shortcode").textContent="["+A+"]",document.getElementById("yasr-builder-copy-shortcode").setAttribute("data-shortcode","["+A+"]"),!0===de&&"yasr-ranking-source"!==e.target.id&&"yasr-builder-category-radio"!==e.target.name&&H()})),U.onclick=function(e){var t=document.getElementById(e.target.id);(0,Q.v)(t.getAttribute("data-shortcode"))},F.onclick=function(e){H(),de=!0}}})()})();
admin/settings/classes/YasrImportRatingPlugins.php CHANGED
@@ -21,11 +21,64 @@ if (!defined('ABSPATH')) {
21
  exit('You\'re not allowed to see this page');
22
  } // Exit if accessed directly
23
 
24
- /****** Check for previous rate my post INSTALLATION *******/
25
  class YasrImportRatingPlugins {
26
 
27
- //Search for WP-PostRatings
28
- public function yasr_search_wppr() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  //only check for active plugin, since import from table will be not used
30
  if (is_plugin_active('wp-postratings/wp-postratings.php')) {
31
  return true;
@@ -33,8 +86,14 @@ class YasrImportRatingPlugins {
33
  return false;
34
  }
35
 
36
- //Search for KK STar Rating
37
- public function yasr_search_kksr() {
 
 
 
 
 
 
38
  //only check for active plugin, since import from table will be not used
39
  if (is_plugin_active('kk-star-ratings/index.php')) {
40
  return true;
@@ -42,8 +101,14 @@ class YasrImportRatingPlugins {
42
  return false;
43
  }
44
 
45
- //Search for Rate My Post
46
- public function yasr_search_rmp() {
 
 
 
 
 
 
47
  if (is_plugin_active('rate-my-post/rate-my-post.php')) {
48
  return true;
49
  }
@@ -57,8 +122,14 @@ class YasrImportRatingPlugins {
57
  return false;
58
  }
59
 
60
- //Search for Multi Rating
61
- public function yasr_search_mr() {
 
 
 
 
 
 
62
  //only check for active plugin, since import from table will be not used
63
  if (is_plugin_active('multi-rating/multi-rating.php')) {
64
  return true;
@@ -66,14 +137,21 @@ class YasrImportRatingPlugins {
66
  return false;
67
  }
68
 
69
- public function yasr_count_wppr_query_number() {
 
 
 
 
 
 
 
70
  $number_of_query_transient = get_transient('yasr_wppr_import_query_number');
71
 
72
  if ($number_of_query_transient !== false) {
73
  return $number_of_query_transient;
74
  }
75
 
76
- $logs = $this->yasr_return_wppr_data();
77
 
78
  //set counter to 0
79
  $i = 0;
@@ -95,14 +173,21 @@ class YasrImportRatingPlugins {
95
 
96
  }
97
 
98
- public function yasr_count_kksr_query_number() {
 
 
 
 
 
 
 
99
  $number_of_query_transient = get_transient('yasr_kksr_import_query_number');
100
 
101
  if ($number_of_query_transient !== false) {
102
  return $number_of_query_transient;
103
  }
104
 
105
- $logs = $this->yasr_return_kksr_data();
106
 
107
  //set counter to 0
108
  $i = 0;
@@ -124,7 +209,14 @@ class YasrImportRatingPlugins {
124
 
125
  }
126
 
127
- public function yasr_count_rmp_query_number() {
 
 
 
 
 
 
 
128
  global $wpdb;
129
 
130
  $number_of_query_transient = get_transient('yasr_rmp_import_query_number');
@@ -133,7 +225,7 @@ class YasrImportRatingPlugins {
133
  return $number_of_query_transient;
134
  }
135
 
136
- $logs = $this->yasr_return_rmp_data();
137
 
138
  if (empty($logs)) {
139
  return 0;
@@ -145,14 +237,21 @@ class YasrImportRatingPlugins {
145
 
146
  }
147
 
148
- public function yasr_count_mr_query_number() {
 
 
 
 
 
 
 
149
  $number_of_query_transient = get_transient('yasr_mr_import_query_number');
150
 
151
  if ($number_of_query_transient !== false) {
152
  return $number_of_query_transient;
153
  }
154
 
155
- $logs = $this->yasr_return_mr_data();
156
 
157
  //set counter to 0
158
  $i = 0;
@@ -173,8 +272,14 @@ class YasrImportRatingPlugins {
173
 
174
  }
175
 
176
- //Import WpPostRating Data
177
- public function yasr_return_wppr_data() {
 
 
 
 
 
 
178
  global $wpdb;
179
 
180
  $logs = $wpdb->get_results(
@@ -197,8 +302,14 @@ class YasrImportRatingPlugins {
197
  return $logs;
198
  }
199
 
200
- //Import KK Star Rating Data
201
- public function yasr_return_kksr_data() {
 
 
 
 
 
 
202
  global $wpdb;
203
 
204
  $logs = $wpdb->get_results(
@@ -221,7 +332,14 @@ class YasrImportRatingPlugins {
221
  return $logs;
222
  }
223
 
224
- public function yasr_return_rmp_data() {
 
 
 
 
 
 
 
225
  global $wpdb;
226
 
227
  $rmp_table = $wpdb->prefix . 'rmp_analytics';
@@ -244,8 +362,14 @@ class YasrImportRatingPlugins {
244
  return $logs;
245
  }
246
 
247
- //Import Multi Rating Data
248
- public function yasr_return_mr_data() {
 
 
 
 
 
 
249
  global $wpdb;
250
 
251
  $logs = $wpdb->get_results(
@@ -268,4 +392,549 @@ class YasrImportRatingPlugins {
268
  return $logs;
269
  }
270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
271
  }
21
  exit('You\'re not allowed to see this page');
22
  } // Exit if accessed directly
23
 
 
24
  class YasrImportRatingPlugins {
25
 
26
+ //save here get_option yasr_plugin_imported
27
+ public $plugin_imported;
28
+
29
+ //The plugin nicename
30
+ public $plugin_name;
31
+
32
+ public function __construct() {
33
+ if($this->plugin_imported === NULL) {
34
+ $this->plugin_imported = get_option('yasr_plugin_imported');
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Set the plugin name
40
+ *
41
+ * @author Dario Curvino <@dudo>
42
+ * @since 3.1.6
43
+ * @param $plugin_name
44
+ */
45
+ public function setPluginName($plugin_name) {
46
+ $this->plugin_name = $plugin_name;
47
+ }
48
+
49
+ /**
50
+ * @author Dario Curvino <@dudo>
51
+ * @since 3.1.6
52
+ * @return mixed
53
+ */
54
+ public function getPluginName() {
55
+ return $this->plugin_name;
56
+ }
57
+
58
+ /**
59
+ * Add ajax action for plugin import
60
+ *
61
+ * @author Dario Curvino <@dudo>
62
+ * @since 3.1.6
63
+ */
64
+ public function addAjaxActions () {
65
+ add_action( 'wp_ajax_yasr_import_wppr', array($this, 'wpprAjaxCallback') );
66
+
67
+ add_action( 'wp_ajax_yasr_import_kksr', array($this, 'kksrAjaxCallback') );
68
+
69
+ add_action( 'wp_ajax_yasr_import_ratemypost', array($this, 'ratemypostAjaxCallback') );
70
+
71
+ add_action( 'wp_ajax_yasr_import_mr', array($this, 'mrAjaxCallback') );
72
+ }
73
+
74
+ /**
75
+ * Return true if wp post ratings is installed
76
+ *
77
+ * @author Dario Curvino <@dudo>
78
+ * @since 2.0.0
79
+ * @return bool
80
+ */
81
+ public function searchWPPR() {
82
  //only check for active plugin, since import from table will be not used
83
  if (is_plugin_active('wp-postratings/wp-postratings.php')) {
84
  return true;
86
  return false;
87
  }
88
 
89
+ /**
90
+ * Return true if KK star ratings is installed
91
+ *
92
+ * @author Dario Curvino <@dudo>
93
+ * @since 2.0.0
94
+ * @return bool
95
+ */
96
+ public function searchKKSR() {
97
  //only check for active plugin, since import from table will be not used
98
  if (is_plugin_active('kk-star-ratings/index.php')) {
99
  return true;
101
  return false;
102
  }
103
 
104
+ /**
105
+ * Return true if rate my post is installed
106
+ *
107
+ * @author Dario Curvino <@dudo>
108
+ * @since 2.0.0
109
+ * @return bool
110
+ */
111
+ public function searchRMP() {
112
  if (is_plugin_active('rate-my-post/rate-my-post.php')) {
113
  return true;
114
  }
122
  return false;
123
  }
124
 
125
+ /**
126
+ * Return true if multi rating is installed
127
+ *
128
+ * @author Dario Curvino <@dudo>
129
+ * @since 2.0.0
130
+ * @return bool
131
+ */
132
+ public function searchMR() {
133
  //only check for active plugin, since import from table will be not used
134
  if (is_plugin_active('multi-rating/multi-rating.php')) {
135
  return true;
137
  return false;
138
  }
139
 
140
+ /**
141
+ * Returns the number of necessary INSERT query for Wp post rating
142
+ *
143
+ * @author Dario Curvino <@dudo>
144
+ * @since 2.0.0
145
+ * @return int|mixed
146
+ */
147
+ public function wpprQueryNumber() {
148
  $number_of_query_transient = get_transient('yasr_wppr_import_query_number');
149
 
150
  if ($number_of_query_transient !== false) {
151
  return $number_of_query_transient;
152
  }
153
 
154
+ $logs = $this->returnWPPRData();
155
 
156
  //set counter to 0
157
  $i = 0;
173
 
174
  }
175
 
176
+ /**
177
+ * Returns the number of necessary INSERT query for KK star ratings
178
+ *
179
+ * @author Dario Curvino <@dudo>
180
+ * @since 2.0.0
181
+ * @return int|mixed
182
+ */
183
+ public function kksrQueryNumber() {
184
  $number_of_query_transient = get_transient('yasr_kksr_import_query_number');
185
 
186
  if ($number_of_query_transient !== false) {
187
  return $number_of_query_transient;
188
  }
189
 
190
+ $logs = $this->returnKKSRData();
191
 
192
  //set counter to 0
193
  $i = 0;
209
 
210
  }
211
 
212
+ /**
213
+ * Returns the number of necessary INSERT query for rate my post
214
+ *
215
+ * @author Dario Curvino <@dudo>
216
+ * @since 2.0.0
217
+ * @return int|mixed
218
+ */
219
+ public function rmpQueryNumber() {
220
  global $wpdb;
221
 
222
  $number_of_query_transient = get_transient('yasr_rmp_import_query_number');
225
  return $number_of_query_transient;
226
  }
227
 
228
+ $logs = $this->returnRMPData();
229
 
230
  if (empty($logs)) {
231
  return 0;
237
 
238
  }
239
 
240
+ /**
241
+ * Returns the number of necessary INSERT query for multi rating
242
+ *
243
+ * @author Dario Curvino <@dudo>
244
+ * @since 2.0.0
245
+ * @return int|mixed
246
+ */
247
+ public function mrQueryNumber() {
248
  $number_of_query_transient = get_transient('yasr_mr_import_query_number');
249
 
250
  if ($number_of_query_transient !== false) {
251
  return $number_of_query_transient;
252
  }
253
 
254
+ $logs = $this->returnMRData();
255
 
256
  //set counter to 0
257
  $i = 0;
272
 
273
  }
274
 
275
+ /**
276
+ * Get WpPostRating Data
277
+ *
278
+ * @author Dario Curvino <@dudo>
279
+ * @since 2.0.0
280
+ * @return array|int|object|\stdClass[]
281
+ */
282
+ public function returnWPPRData() {
283
  global $wpdb;
284
 
285
  $logs = $wpdb->get_results(
302
  return $logs;
303
  }
304
 
305
+ /**
306
+ * Get KK star rating data
307
+ *
308
+ * @author Dario Curvino <@dudo>
309
+ * @since 2.0.0
310
+ * @return array|int|object|\stdClass[]
311
+ */
312
+ public function returnKKSRData() {
313
  global $wpdb;
314
 
315
  $logs = $wpdb->get_results(
332
  return $logs;
333
  }
334
 
335
+ /**
336
+ * Get rate my post data
337
+ *
338
+ * @author Dario Curvino <@dudo>
339
+ * @since 2.0.0
340
+ * @return array|int|object|\stdClass[]
341
+ */
342
+ public function returnRMPData() {
343
  global $wpdb;
344
 
345
  $rmp_table = $wpdb->prefix . 'rmp_analytics';
362
  return $logs;
363
  }
364
 
365
+ /**
366
+ * get multi rating data
367
+ *
368
+ * @author Dario Curvino <@dudo>
369
+ * @since 2.0.0
370
+ * @return array|int|object|\stdClass[]
371
+ */
372
+ public function returnMRData() {
373
  global $wpdb;
374
 
375
  $logs = $wpdb->get_results(
392
  return $logs;
393
  }
394
 
395
+ /**
396
+ * Ajax callback for import data from WordPress post Ratings
397
+ *
398
+ * @author Dario Curvino <@dudo>
399
+ * @since 2.0.0
400
+ */
401
+ public function wpprAjaxCallback() {
402
+ if($_POST['nonce']) {
403
+ $nonce = $_POST['nonce'];
404
+ } else {
405
+ exit();
406
+ }
407
+
408
+ if (!wp_verify_nonce( $nonce, 'yasr-import-wppr-action' ) ) {
409
+ die('Error while checking nonce');
410
+ }
411
+
412
+ if (!current_user_can( 'manage_options' ) ) {
413
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
414
+ }
415
+
416
+ global $wpdb;
417
+
418
+ //get logs
419
+ //With Wp Post Rating I need to import postmeta.
420
+ //It has his own table too, but can be disabled in the settings.
421
+ //The only way to be sure is get the postmeta
422
+
423
+ $logs = $this->returnWPPRData();
424
+
425
+ if(empty($logs)) {
426
+ echo json_encode(esc_html__('No WP Post Rating data found'));
427
+ } else {
428
+ $result = false;
429
+
430
+ /****** Insert logs ******/
431
+ foreach ($logs as $column) {
432
+
433
+ if($column->ratings_average > 5) {
434
+ $column->ratings_average = 5;
435
+ }
436
+
437
+ for ($i=1; $i<=$column->ratings_users; $i++) {
438
+
439
+ //check if rating_average is not null.
440
+ //I found out that sometimes Wp Post Rating can save value with null data (sigh!!)
441
+ if ($column->ratings_average !== null) {
442
+
443
+ $result = $wpdb->replace(
444
+ YASR_LOG_TABLE,
445
+ array(
446
+ 'post_id' => $column->post_id,
447
+ 'user_id' => 0, //not stored on wp post rating
448
+ 'vote' => $column->ratings_average,
449
+ 'date' => 'wppostrating', //not stored on wp post rating
450
+ 'ip' => 'wppostrating'//not stored on wp post rating
451
+ ),
452
+ array('%d', '%d', '%f', '%s', '%s')
453
+ );
454
+ }
455
+ }
456
+ }
457
+
458
+ if ($result) {
459
+ $this->savePluginImported('wppr');
460
+
461
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
462
+ echo json_encode($string_to_return);
463
+ }
464
+
465
+ }
466
+ die();
467
+ }
468
+
469
+ /**
470
+ * Ajax callback for import data from KK Star Ratings
471
+ *
472
+ * @author Dario Curvino <@dudo>
473
+ * @since 2.0.0
474
+ */
475
+ public function kksrAjaxCallback() {
476
+ if($_POST['nonce']) {
477
+ $nonce = $_POST['nonce'];
478
+ } else {
479
+ exit();
480
+ }
481
+
482
+ if (!wp_verify_nonce( $nonce, 'yasr-import-kksr-action' ) ) {
483
+ die('Error while checking nonce');
484
+ }
485
+
486
+ if (!current_user_can( 'manage_options' ) ) {
487
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
488
+ }
489
+
490
+ global $wpdb;
491
+
492
+ //get logs
493
+ //With KK star rating I need to import postmeta.
494
+ $logs= $this->returnKKSRData();
495
+
496
+ if(empty($logs)) {
497
+ echo json_encode(esc_html__('No KK Star Ratings data found'));
498
+ } else {
499
+ $result = false;
500
+
501
+ /****** Insert logs ******/
502
+ foreach ($logs as $column) {
503
+ if($column->ratings_average > 5) {
504
+ $column->ratings_average = 5;
505
+ }
506
+
507
+ for ($i=1; $i<=$column->ratings_users; $i++) {
508
+ $result = $wpdb->replace(
509
+ YASR_LOG_TABLE,
510
+ array(
511
+ 'post_id' => $column->post_id,
512
+ 'user_id' => 0, //not stored on KK star rating
513
+ 'vote' => $column->ratings_average,
514
+ 'date' => 'kkstarratings', //not stored KK star rating
515
+ 'ip' => 'kkstarratings'//not stored KK star rating
516
+ ),
517
+ array('%d', '%d', '%f', '%s', '%s')
518
+ );
519
+ }
520
+ }
521
+
522
+ if ($result) {
523
+ $this->savePluginImported('kksr');
524
+
525
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
526
+ echo json_encode($string_to_return);
527
+ }
528
+
529
+ }
530
+ die();
531
+ }
532
+
533
+ /**
534
+ * Ajax callback for import data from rate My Post
535
+ *
536
+ * @author Dario Curvino <@dudo>
537
+ * @since 2.0.0
538
+ */
539
+ public function ratemypostAjaxCallback() {
540
+ if($_POST['nonce']) {
541
+ $nonce = $_POST['nonce'];
542
+ } else {
543
+ exit();
544
+ }
545
+
546
+ if (!wp_verify_nonce($nonce, 'yasr-import-rmp-action')) {
547
+ die('Error while checking nonce');
548
+ }
549
+
550
+ if (!current_user_can( 'manage_options' ) ) {
551
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
552
+ }
553
+
554
+ global $wpdb;
555
+
556
+ //get logs
557
+ $logs=$this->returnRMPData();
558
+
559
+ if(empty($logs)) {
560
+ echo json_encode(esc_html__('No Rate My Post data found'));
561
+ } else {
562
+ $result = false;
563
+
564
+ /****** Insert logs ******/
565
+ foreach ($logs as $column) {
566
+ $result = $wpdb->replace(
567
+ YASR_LOG_TABLE,
568
+ array(
569
+ 'post_id' => $column->post_id,
570
+ 'user_id' => 0, //seems like rate my post store all users like -1, so I cant import the user_id
571
+ 'vote' => $column->vote,
572
+ 'date' => $column->date,
573
+ 'ip' => 'ratemypost'
574
+ ),
575
+ array('%d', '%d', '%f', '%s', '%s')
576
+ );
577
+ }
578
+
579
+ if ($result) {
580
+ $this->savePluginImported('rmp');
581
+
582
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
583
+ echo json_encode($string_to_return);
584
+ }
585
+ }
586
+ die();
587
+ }
588
+
589
+ /**
590
+ * Ajax callback for import data from multi rating
591
+ *
592
+ * @author Dario Curvino <@dudo>
593
+ * @since 2.0.0
594
+ */
595
+ public function mrAjaxCallback() {
596
+ if($_POST['nonce']) {
597
+ $nonce = $_POST['nonce'];
598
+ } else {
599
+ exit();
600
+ }
601
+
602
+ if (!wp_verify_nonce( $nonce, 'yasr-import-mr-action' ) ) {
603
+ die('Error while checking nonce');
604
+ }
605
+
606
+ if (!current_user_can( 'manage_options' ) ) {
607
+ die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
608
+ }
609
+
610
+ global $wpdb;
611
+
612
+ //get logs
613
+ //With Multi Rating I need to import postmeta.
614
+ $logs= $this->returnMRData();
615
+
616
+ if(empty($logs)) {
617
+ echo json_encode(esc_html__('No Multi Rating data found'));
618
+ } else {
619
+ $result = false;
620
+
621
+ /****** Insert logs ******/
622
+ foreach ($logs as $column) {
623
+
624
+ if($column->ratings_average > 5) {
625
+ $column->ratings_average = 5;
626
+ }
627
+
628
+ for ($i=1; $i<=$column->ratings_users; $i++) {
629
+ $result = $wpdb->replace(
630
+ YASR_LOG_TABLE,
631
+ array(
632
+ 'post_id' => $column->post_id,
633
+ 'user_id' => 0, //not stored on KK star rating
634
+ 'vote' => $column->ratings_average,
635
+ 'date' => 'multirating', //not stored KK star rating
636
+ 'ip' => 'multirating'//not stored KK star rating
637
+ ),
638
+ array('%d', '%d', '%f', '%s', '%s')
639
+ );
640
+ }
641
+ }
642
+
643
+ if ($result) {
644
+ $this->savePluginImported('mr');
645
+
646
+ $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
647
+ echo json_encode($string_to_return);
648
+ }
649
+
650
+ }
651
+
652
+ die();
653
+ }
654
+
655
+ /**
656
+ * Returns an alert box
657
+ *
658
+ * @author Dario Curvino <@dudo>
659
+ * @since 3.1.6
660
+ *
661
+ * @param $number_of_queries
662
+ *
663
+ * @return string
664
+ */
665
+ public function alertBox($number_of_queries) {
666
+ $plugin_name = $this->getPluginName();
667
+
668
+ $div = '<div class="yasr-alert-box">';
669
+ $div .= sprintf(__(
670
+ 'To import %s seems like %s %d %s INSERT queries are necessary. %s
671
+ There is nothing wrong with that, but some hosting provider can have a query limit/hour. %s
672
+ I strongly suggest to contact your hosting and ask about your plan limit',
673
+ 'yet-another-stars-rating'
674
+ ), $plugin_name, '<strong>', $number_of_queries, '</strong>', '<br />','<br />');
675
+ $div .= '</div>';
676
+
677
+ return $div;
678
+ }
679
+
680
+ /**
681
+ * Insert option yasr_plugin_imported
682
+ *
683
+ * @author Dario Curvino <@dudo>
684
+ * @since 3.1.6
685
+ * @param $plugin
686
+ */
687
+ public function savePluginImported($plugin) {
688
+ //get actual data
689
+ $plugin_imported = $this->plugin_imported;
690
+
691
+ //Since php 8.1, it is not possible anymore to automatically convert false into array, so I need to declare it first
692
+ //if plugin_imported === false
693
+ //https://wiki.php.net/rfc/autovivification_false
694
+ if($plugin_imported === false) {
695
+ $plugin_imported = array();
696
+ }
697
+ //Add plugin just imported as a key
698
+ $plugin_imported[$plugin] = array('date' => date('Y-m-d H:i:s'));
699
+ //update option
700
+ update_option('yasr_plugin_imported', $plugin_imported, false);
701
+ }
702
+
703
+ /**
704
+ * Print fields to import Wp PostRatings
705
+ *
706
+ * @author Dario Curvino <@dudo>
707
+ * @since 3.1.6
708
+ */
709
+ public function importWPPR () {
710
+ $this->setPluginName('WP-PostRatings');
711
+
712
+ echo wp_kses_post($this->pluginFoundTitle());
713
+
714
+ $number_of_stars = (int)get_option('postratings_max', false);
715
+
716
+ if ($number_of_stars && $number_of_stars !== 5) {
717
+ $error = '<div class="yasr-indented-answer" style="margin-top: 10px;">';
718
+ $error .= sprintf(__('You\' re using a star set different from 5 %s
719
+ Import can not be done', 'yet-another-stars-rating'), '<br />');
720
+ $error .= '</div>';
721
+ echo wp_kses_post($error);
722
+ } else {
723
+ echo wp_kses_post($this->noteAverageRating());
724
+
725
+ $wppr_imported = $this->alreadyImported($this->plugin_imported, 'wppr');
726
+
727
+ if($wppr_imported !== false) {
728
+ echo wp_kses_post($wppr_imported);
729
+ } else {
730
+ $number_of_queries_wppr = (int) $this->wpprQueryNumber();
731
+
732
+ if ($number_of_queries_wppr > 1000) {
733
+ echo wp_kses_post(
734
+ $this->alertBox($number_of_queries_wppr)
735
+ );
736
+ }
737
+ $this->htmlImportButton('wppr');
738
+ }
739
+ }
740
+ }
741
+
742
+ /**
743
+ * Print fields to import KKSR
744
+ *
745
+ * @author Dario Curvino <@dudo>
746
+ * @since 3.1.6
747
+ */
748
+ public function importKKSR () {
749
+ $this->setPluginName('KK Star Ratings');
750
+
751
+ echo wp_kses_post($this->pluginFoundTitle());
752
+ echo wp_kses_post($this->noteAverageRating());
753
+ $kksr_imported = $this->alreadyImported($this->plugin_imported, 'kksr');
754
+
755
+ if($kksr_imported !== false) {
756
+ echo wp_kses_post($kksr_imported);
757
+ }
758
+ else {
759
+ $number_of_queries_kksr = (int)$this->kksrQueryNumber();
760
+
761
+ if($number_of_queries_kksr > 1000) {
762
+ echo wp_kses_post($this->alertBox($number_of_queries_kksr));
763
+ }
764
+ $this->htmlImportButton('kksr');
765
+ }
766
+ }
767
+
768
+ /**
769
+ * Print fields to import Rate My post
770
+ *
771
+ * @author Dario Curvino <@dudo>
772
+ * @since 3.1.6
773
+ */
774
+ public function importRMP () {
775
+ $this->setPluginName('Rate My Post');
776
+
777
+ echo wp_kses_post($this->pluginFoundTitle());
778
+ $rmp_imported = $this->alreadyImported($this->plugin_imported, 'rmp');
779
+
780
+ if($rmp_imported !== false) {
781
+ echo wp_kses_post($rmp_imported);
782
+ }
783
+ else {
784
+ $number_of_queries_rmp = (int)$this->rmpQueryNumber();
785
+
786
+ if($number_of_queries_rmp > 1000) {
787
+ echo wp_kses_post($this->alertBox($number_of_queries_rmp));
788
+ }
789
+ $this->htmlImportButton('rmp');
790
+ }
791
+ }
792
+
793
+ /**
794
+ * Print fields to import Multi Rating
795
+ *
796
+ * @author Dario Curvino <@dudo>
797
+ * @since 3.1.6
798
+ */
799
+ public function importMR() {
800
+ $this->setPluginName('Multi Rating');
801
+
802
+ echo wp_kses_post($this->pluginFoundTitle());
803
+ echo wp_kses_post($this->noteAverageRating());
804
+ $mr_imported = $this->alreadyImported($this->plugin_imported, 'mr');
805
+
806
+ if($mr_imported !== false) {
807
+ echo wp_kses_post($mr_imported);
808
+ }
809
+ else {
810
+ $number_of_queries_mr = (int) $this->mrQueryNumber();
811
+
812
+ if ($number_of_queries_mr > 1000) {
813
+ echo wp_kses_post($this->alertBox($number_of_queries_mr));
814
+ }
815
+ $this->htmlImportButton('mr');
816
+ }
817
+ }
818
+
819
+ /**
820
+ * Return a span with title of the plugin found
821
+ *
822
+ * @author Dario Curvino <@dudo>
823
+ * @since 3.1.6
824
+ *
825
+ * @return string
826
+ */
827
+ public function pluginFoundTitle() {
828
+ $plugin_name = $this->getPluginName();
829
+ if($plugin_name === '') {
830
+ $class = 'title-noplugin-found';
831
+ $text = __('No supported plugin has been found' , 'yet-another-stars-rating');
832
+ } else {
833
+ $class = 'title-plugin-found';
834
+ $text = __('Plugin found:' , 'yet-another-stars-rating');
835
+ }
836
+ return (
837
+ "<div class='$class'>
838
+ $text $plugin_name
839
+ </div>"
840
+ );
841
+ }
842
+
843
+ /**
844
+ * Returns a note to explain ho data is imported if a plugin doesn't have a full log
845
+ *
846
+ * @author Dario Curvino <@dudo>
847
+ * @since 3.1.6
848
+ * @return string
849
+ */
850
+ public function noteAverageRating() {
851
+ $plugin_name = $this->getPluginName();
852
+
853
+ $head = sprintf(__(
854
+ '%s Please note: %s depending on the settings, %s may save data in different ways.',
855
+ 'yet-another-stars-rating'),
856
+ '<strong>', '</strong>', $plugin_name
857
+ ). '<br />';
858
+ $further_info = '';
859
+
860
+ if($plugin_name === 'KK Star Ratings') {
861
+ $head = sprintf(__(
862
+ '%s Please note: %s KK Star Ratings doesn\'t save information about the single vote.',
863
+ 'yet-another-stars-rating'),
864
+ '<strong>', '</strong>'
865
+ ) . '<br />';
866
+
867
+ $further_info = '<br />' . __('If you use a rating scale different than 1 to 5, all ratings will be
868
+ converted to work with a 5 ratings star scale.');
869
+ }
870
+
871
+ $info = '<div class="yasr-indented-answer">';
872
+ $info .= $head;
873
+ $info .= sprintf(__(
874
+ 'The only way to be sure to get ALL data is, for every single post or page, getting the total
875
+ number of votes, and save the current average as the rating for all votes. %s
876
+ E.g. A post has 130 votes with an average of 4.4: since is impossible to know the single rating,
877
+ YASR will import 130 votes with an average of 4.4. %s
878
+ Because of this, statistics in front end will be disabled for all post or page published before
879
+ the import.',
880
+ 'yet-another-stars-rating'
881
+ ), '<br />', '<br />');
882
+ $info .= $further_info;
883
+ $info .='</div>';
884
+
885
+ return $info;
886
+ }
887
+
888
+ /**
889
+ * Return an "already imported" message with date
890
+ *
891
+ * @author Dario Curvino <@dudo>
892
+ * @since 3.1.6
893
+ * @param $plugin_imported_option | value from get_option('yasr_plugin_imported');
894
+ * @param $plugin_key | plugin key to search
895
+ *
896
+ * @return false|string
897
+ */
898
+ public function alreadyImported($plugin_imported_option, $plugin_key) {
899
+ $plugin_name = $this->getPluginName();
900
+
901
+ if (is_array($plugin_imported_option) && array_key_exists($plugin_key, $plugin_imported_option)) {
902
+ return(
903
+ '<div class="yasr-indented-answer" style="margin-top: 10px;">'
904
+ . sprintf(__('You\'ve already imported %s data on', 'yet-another-stars-rating'), $plugin_name) .
905
+ '&nbsp;<strong>' . $plugin_imported_option[$plugin_key]['date'] . '</strong>
906
+ </div>'
907
+ );
908
+ }
909
+
910
+ return false;
911
+ }
912
+
913
+ /**
914
+ * Print the import button
915
+ *
916
+ * @author Dario Curvino <@dudo>
917
+ * @since 3.1.6
918
+ * @param $plugin_key
919
+ */
920
+ public function htmlImportButton($plugin_key) {
921
+ $button_id = 'yasr-import-'.$plugin_key.'-submit';
922
+ $nonce_name = 'yasr-import-'.$plugin_key.'-action';
923
+ $id_nonce = 'yasr-import-'.$plugin_key.'-nonce';
924
+ $id_answer = 'yasr-import-'.$plugin_key.'-answer';
925
+ $nonce = wp_create_nonce($nonce_name);
926
+
927
+ ?>
928
+ <div class="yasr-indented-answer">
929
+ <button class="button-primary" id="<?php echo esc_attr($button_id);?>">
930
+ <?php esc_html_e('Import data', 'yet-another-stars-rating') ?>
931
+ </button>
932
+ <input type="hidden" id="<?php echo esc_attr($id_nonce)?>" value="<?php echo esc_attr($nonce) ?>">
933
+ </div>
934
+ <div id="<?php echo esc_attr($id_answer)?>" class="yasr-indented-answer">
935
+ </div>
936
+ <div class="yasr-space-settings-div">
937
+ </div>
938
+ <?php
939
+ }
940
  }
admin/settings/classes/YasrSettings.php CHANGED
@@ -17,12 +17,10 @@ GNU General Public License for more details.
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
  /**
27
  * @since 2.4.7
28
  *
@@ -30,143 +28,146 @@ if (!defined('ABSPATH')) {
30
  *
31
  * Class YasrSettings
32
  */
33
- class YasrSettings {
 
34
  /**
35
  * Init Settings
36
  */
37
- public function init () {
38
- add_action('admin_init', array($this, 'generalOptions')); //This is for general options
39
-
 
40
  //include multiset functions
41
- require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/multiset/yasr-settings-functions-multiset.php');
42
-
43
  $multiset = new YasrSettingsMultiset();
44
  $multiset->init();
45
-
46
  //include style functions
47
- require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/aspect_style/yasr-settings-style-functions.php');
48
-
49
- //load functions migration
50
- require(YASR_ABSOLUTE_PATH_ADMIN . '/settings/migrations/yasr-settings-migration-functions.php');
 
 
 
 
 
51
  }
52
-
53
  /**
54
  * Load general options
55
  */
56
- public function generalOptions() {
 
57
  register_setting(
58
- 'yasr_general_options_group', // A settings group name. Must exist prior to the register_setting call.
 
59
  // This must match the group name in settings_fields()
60
- 'yasr_general_options', //The name of an options to sanitize and save.
61
- array($this, 'sanitize')
 
62
  );
63
-
64
- $settings = new YasrSettingsValues();
65
- $options = $settings->getGeneralSettings();
66
-
67
  add_settings_section(
68
  'yasr_general_options_section_id',
69
- __('General settings', 'yet-another-stars-rating'),
70
- array($this, 'sectionCallback'),
71
  'yasr_general_settings_tab'
72
  );
73
-
74
  add_settings_field(
75
  'yasr_use_auto_insert_id',
76
- yasr_description_auto_insert(),
77
- array($this, 'autoInsert'),
78
  'yasr_general_settings_tab',
79
  'yasr_general_options_section_id',
80
  $options
81
  );
82
-
83
  add_settings_field(
84
  'yasr_stars_title',
85
- yasr_description_stars_title(),
86
- array($this, 'starsTitle'),
87
  'yasr_general_settings_tab',
88
  'yasr_general_options_section_id',
89
  $options
90
  );
91
-
92
  add_settings_field(
93
  'yasr_show_overall_in_loop',
94
- yasr_description_archive_page(),
95
- array($this, 'archivePages'),
96
  'yasr_general_settings_tab',
97
  'yasr_general_options_section_id',
98
  $options
99
  );
100
-
101
  add_settings_field(
102
  'yasr_visitors_stats',
103
- yasr_description_vv_stats(),
104
- array($this, 'vvStats'),
105
  'yasr_general_settings_tab',
106
  'yasr_general_options_section_id',
107
  $options
108
  );
109
-
110
  add_settings_field(
111
  'yasr_allow_only_logged_in_id',
112
- yasr_description_allow_vote(),
113
- array($this, 'loggedOnly'),
114
  'yasr_general_settings_tab',
115
  'yasr_general_options_section_id',
116
  $options
117
  );
118
-
119
  add_settings_field(
120
  'yasr_choose_snippet_id',
121
- yasr_description_strucutured_data(),
122
- array($this, 'snippets'),
123
  'yasr_general_settings_tab',
124
  'yasr_general_options_section_id',
125
  $options
126
  );
127
-
128
  add_settings_field(
129
  'yasr_custom_text',
130
- wp_kses_post(yasr_description_cstm_txt()),
131
- array($this, 'customText'),
132
  'yasr_general_settings_tab',
133
  'yasr_general_options_section_id',
134
  $options
135
  );
136
-
137
  add_settings_field(
138
  'yasr_advanced',
139
- __('Advanced Settings', 'yet-another-stars-rating'),
140
- array($this, 'advancedSettings'),
141
  'yasr_general_settings_tab',
142
  'yasr_general_options_section_id',
143
  $options
144
  );
145
-
146
  }
147
-
148
  /**
149
  * @return void
150
  */
151
- public function sectionCallback() {
 
152
  }
153
-
154
  /**
155
  * Display options for Auto insert
156
  *
157
  * @param $option
158
  */
159
- public function autoInsert($option) {
 
160
  ?>
161
  <div>
162
  <strong>
163
- <?php esc_html_e('Use Auto Insert?', 'yet-another-stars-rating'); ?>
 
 
164
  </strong>
165
  <div class="yasr-onoffswitch-big">
166
  <input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox"
167
- value="1" id="yasr_auto_insert_switch" <?php if ($option['auto_insert_enabled'] === 1) {
168
- echo " checked='checked' ";
169
- } ?> >
 
 
170
  <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
171
  <span class="yasr-onoffswitch-inner"></span>
172
  <span class="yasr-onoffswitch-switch"></span>
@@ -175,139 +176,164 @@ class YasrSettings {
175
 
176
  <div class="yasr-settings-row-35">
177
  <div>
178
- <?php
179
- $option_title = __('What?', 'yet-another-stars-rating');
180
- $array_options = array (
181
- 'visitor_rating' => __('Visitor Votes', 'yet-another-stars-rating'),
182
- 'overall_rating' => __('Overall Rating', 'yet-another-stars-rating'),
183
- 'both' => __('Both', 'yet-another-stars-rating')
184
- );
185
- $default = $option['auto_insert_what'];
186
- $name = 'yasr_general_options[auto_insert_what]';
187
- $class = 'yasr-auto-insert-options-class';
188
-
189
- echo yasr_kses(
190
- YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default)
191
- );
192
- ?>
 
 
 
193
  </div>
194
  <div>
195
- <?php
196
- $option_title = __('Where?', 'yet-another-stars-rating');
197
- $array_options = array (
198
- 'top' => __('Before the content', 'yet-another-stars-rating'),
199
- 'bottom' => __('After the content', 'yet-another-stars-rating'),
200
- 'both' => __('Both', 'yet-another-stars-rating')
201
- );
202
- $default = $option['auto_insert_where'];
203
- $name = 'yasr_general_options[auto_insert_where]';
204
- $class = 'yasr-auto-insert-options-class';
205
-
206
- echo yasr_kses(
207
- YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
208
- );
209
- ?>
 
 
 
210
  </div>
211
  <div>
212
- <?php
213
- $option_title = __('Align', 'yet-another-stars-rating');
214
- $array_options = array (
215
- 'left' => __('Left', 'yet-another-stars-rating'),
216
- 'center' => __('Center', 'yet-another-stars-rating'),
217
- 'right' => __('Right', 'yet-another-stars-rating')
218
- );
219
- $default = $option['auto_insert_align'];
220
- $name = 'yasr_general_options[auto_insert_align]';
221
- $class = 'yasr-auto-insert-options-class';
222
-
223
- echo yasr_kses(
224
- YasrPhpFieldsHelper::radio($option_title, $class, $array_options, $name, $default)
225
- );
226
- ?>
 
 
 
227
  </div>
228
  <div>
229
  <strong>
230
- <?php esc_html_e('Size', 'yet-another-stars-rating'); ?>
 
 
231
  </strong>
232
- <?php
233
- $name = 'yasr_general_options[auto_insert_size]';
234
- $class = 'yasr-auto-insert-options-class';
235
- $id = 'yasr-auto-insert-options-stars-size-';
236
-
237
- echo yasr_kses(
238
- self::radioSelectSize($name, $class, $option['auto_insert_size'], $id)
239
- );
240
- ?>
 
 
241
  </div>
242
  <div>
243
- <?php
244
- $option_title = __('Exclude Pages?', 'yet-another-stars-rating');
245
- $array_options = array (
246
- 'yes' => __('Yes', 'yet-another-stars-rating'),
247
- 'no' => __('No', 'yet-another-stars-rating'),
248
- );
249
- $default = $option['auto_insert_exclude_pages'];
250
- $name = 'yasr_general_options[auto_insert_exclude_pages]';
251
- $class = 'yasr-auto-insert-options-class';
252
-
253
- echo yasr_kses(
254
- YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
255
- );
256
- ?>
 
 
 
257
  </div>
258
- <?php
259
- $custom_post_types = YasrCustomPostTypes::getCustomPostTypes();
260
- if ($custom_post_types) {
261
- echo '<div>';
262
- $option_title = __('Use only in custom post types?', 'yet-another-stars-rating');
263
- $array_options = array (
264
- 'yes' => __('Yes', 'yet-another-stars-rating'),
265
- 'no' => __('No', 'yet-another-stars-rating'),
266
- );
267
- $default = $option['auto_insert_custom_post_only'];
268
- $name = 'yasr_general_options[auto_insert_custom_post_only]';
269
- $class = 'yasr-auto-insert-options-class';
270
-
271
- echo yasr_kses(
272
- YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
273
- );
274
- ?>
 
 
 
 
275
  <div>
276
- <?php
277
- esc_html_e('Select yes if you want to use auto insert only in custom post types',
278
- 'yet-another-stars-rating');
279
- ?>
280
  </div>
281
- <?php
282
- echo '</div>';
283
- } else {
284
- ?>
285
  <input type="hidden" name="yasr_general_options[auto_insert_custom_post_only]" value="no">
286
- <?php
287
- }
288
- ?>
 
289
  </div>
290
- <?php submit_button(YASR_SAVE_All_SETTINGS_TEXT); ?>
 
 
291
  </div>
292
  <hr />
293
- <?php
294
-
295
- } //End yasr_auto_insert_callback
296
-
297
  /**
298
  * Display options for stars near title
299
  *
300
  * @author Dario Curvino <@dudo>
301
  * @param $option
302
  */
303
- public function starsTitle($option) {
 
304
  ?>
305
  <div>
306
  <div class="yasr-onoffswitch-big">
307
  <input type="checkbox" name="yasr_general_options[stars_title]" class="yasr-onoffswitch-checkbox"
308
- id="yasr-general-options-stars-title-switch" <?php if ($option['stars_title'] === 'yes') {
309
- echo " checked='checked' ";
310
- } ?> >
 
 
311
  <label class="yasr-onoffswitch-label" for="yasr-general-options-stars-title-switch">
312
  <span class="yasr-onoffswitch-inner"></span>
313
  <span class="yasr-onoffswitch-switch"></span>
@@ -315,53 +341,62 @@ class YasrSettings {
315
  </div>
316
  <div class="yasr-settings-row-35">
317
  <div>
318
- <?php
319
- $option_title = __('What?', 'yet-another-stars-rating');
320
- $array_options = array (
321
- 'visitor_rating' => __('Visitor Votes', 'yet-another-stars-rating'),
322
- 'overall_rating' => __('Overall Rating / Author Rating', 'yet-another-stars-rating'),
323
- );
324
- $default = $option['stars_title_what'];
325
- $name = 'yasr_general_options[stars_title_what]';
326
- $class = 'yasr-stars-title-options-class';
327
-
328
- echo yasr_kses(
329
- YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
330
- );
331
- ?>
 
 
 
332
  </div>
333
  <div>
334
- <?php
335
- $option_title = __('Exclude Pages?', 'yet-another-stars-rating');
336
- $array_options = array (
337
- 'yes' => __('Yes', 'yet-another-stars-rating'),
338
- 'no' => __('No', 'yet-another-stars-rating'),
339
- );
340
- $default = $option['stars_title_exclude_pages'];
341
- $name = 'yasr_general_options[stars_title_exclude_pages]';
342
- $class = 'yasr-stars-title-options-class';
343
-
344
- echo yasr_kses(
345
- YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
346
- );
347
- ?>
 
 
 
348
  </div>
349
  <div style="flex: 0 0 50%">
350
- <?php
351
- $option_title = __('Where do you want show ratings?', 'yet-another-stars-rating');
352
- $array_options = array (
353
- 'archive' => __('Only on archive pages (categories, tags, etc.)', 'yet-another-stars-rating'),
354
- 'single' => __('Only on single posts or pages', 'yet-another-stars-rating'),
355
- 'both' => __('Both', 'yet-another-stars-rating'),
356
- );
357
- $default = $option['stars_title_where'];
358
- $name = 'yasr_general_options[stars_title_where]';
359
- $class = 'yasr-stars-title-options-class';
360
-
361
- echo yasr_kses(
362
- YasrPhpFieldsHelper::radio( $option_title, $class, $array_options, $name, $default )
363
- );
364
- ?>
 
 
 
365
  </div>
366
  </div>
367
  </div>
@@ -369,206 +404,238 @@ class YasrSettings {
369
  <p>&nbsp;</p>
370
  <hr />
371
 
372
- <?php
373
-
374
  }
375
-
376
  /**
377
  * Display options for stars in archive pages
378
  *
379
  * @author Dario Curvino <@dudo>
380
  * @param $option
381
  */
382
- public function archivePages($option) {
 
383
  ?>
384
  <div class="yasr-settings-row-45">
385
  <div>
386
  <strong>
387
- <?php esc_html_e('Show "Overall Rating" in Archive Pages?', 'yet-another-stars-rating'); ?>
 
 
388
  </strong>
389
  <div class="yasr-onoffswitch-big">
390
  <input type="checkbox" name="yasr_general_options[show_overall_in_loop]" class="yasr-onoffswitch-checkbox"
391
- id="yasr-show-overall-in-loop-switch" <?php if($option['show_overall_in_loop'] === 'enabled') {
392
- echo " checked='checked' ";
393
- } ?> >
 
 
394
  <label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
395
  <span class="yasr-onoffswitch-inner"></span>
396
  <span class="yasr-onoffswitch-switch"></span>
397
  </label>
398
  </div>
399
  <br/>
400
- <?php esc_html_e('Enable to show "Overall Rating" in archive pages.','yet-another-stars-rating') ?>
 
 
401
  </div>
402
 
403
  <div>
404
  <strong>
405
- <?php esc_html_e('Show "Visitor Votes" in Archive Page?', 'yet-another-stars-rating') ?>
 
 
406
  </strong>
407
  <div class="yasr-onoffswitch-big">
408
  <input type="checkbox" name="yasr_general_options[show_visitor_votes_in_loop]" class="yasr-onoffswitch-checkbox"
409
- id="yasr-show-visitor-votes-in-loop-switch" <?php if ($option['show_visitor_votes_in_loop'] === 'enabled') {
410
- echo " checked='checked' ";
411
- } ?> >
 
 
412
  <label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
413
  <span class="yasr-onoffswitch-inner"></span>
414
  <span class="yasr-onoffswitch-switch"></span>
415
  </label>
416
  </div>
417
  <br/>
418
- <?php esc_html_e('Enable to show "Visitor Votes" in archive pages','yet-another-stars-rating') ?>
 
 
419
  </div>
420
 
421
  </div>
422
  <p>&nbsp;</p>
423
  <hr>
424
- <?php
425
-
426
  }
427
-
428
  /**
429
  * Display options for vvStats
430
  *
431
  * @author Dario Curvino <@dudo>
432
  * @param $option
433
  */
434
- public function vvStats($option) {
 
435
  ?>
436
  <div class="yasr-settings-row">
437
  <div class="yasr-settings-col-30">
438
  <div class="yasr-onoffswitch-big">
439
  <input type="checkbox" name="yasr_general_options[visitors_stats]" class="yasr-onoffswitch-checkbox"
440
- id="yasr-general-options-visitors-stats-switch" <?php if ($option['visitors_stats'] === 'yes') {
441
- echo " checked='checked' ";
442
- } ?> >
 
 
443
  <label class="yasr-onoffswitch-label" for="yasr-general-options-visitors-stats-switch">
444
  <span class="yasr-onoffswitch-inner"></span>
445
  <span class="yasr-onoffswitch-switch"></span>
446
  </label>
447
  </div>
448
  <br/>
449
- <?php
450
- esc_html_e('Select "Yes" to enable.', 'yet-another-stars-rating');
451
- ?>
452
  <br />
453
  <p>&nbsp;</p>
454
  </div>
455
  <div class="yasr-settings-col-60">
456
  <strong>
457
- <?php esc_html_e('Example', 'yet-another-stars-rating') ?>:
 
 
458
  </strong>
459
  <br />
460
- <img src="<?php echo esc_url(YASR_IMG_DIR . 'yasr-settings-stats.png')?>"
 
 
461
  class="yasr-help-box-settings"
462
  style="display: block; width: 330px"
463
  alt="yasr-statsexplained">
464
  </div>
465
  </div>
466
- <?php
467
- submit_button(YASR_SAVE_All_SETTINGS_TEXT);
468
  ?>
469
  <hr />
470
- <?php
471
-
472
  }
473
-
474
  /**
475
  * Display options for choose who is allowed to votes
476
  *
477
  * @author Dario Curvino <@dudo>
478
  * @param $option
479
  */
480
- public function loggedOnly($option) {
 
481
  ?>
482
  <div class="yasr-settings-padding-left">
483
- <?php
484
- $array_options = array(
485
- 'logged_only' => __('Allow only logged-in users', 'yet-another-stars-rating' ),
486
- 'allow_anonymous' => __('Allow everybody (logged in and anonymous)', 'yet-another-stars-rating' ),
487
- );
488
- $default = $option['allowed_user'];
489
- $name = 'yasr_general_options[allowed_user]';
490
- $class = 'yasr_auto_insert_loggedonly';
491
-
492
- echo yasr_kses(
493
- YasrPhpFieldsHelper::radio( false, $class, $array_options, $name, $default )
494
- );
495
- ?>
 
 
 
496
  <br />
497
  <div class="yasr-indented-answer">
498
- <?php
499
- esc_html_e('Select who can rate your posts.','yet-another-stars-rating')
500
- ?>
501
  </div>
502
  </div>
503
  <p>&nbsp;</p>
504
  <hr />
505
- <?php
506
-
507
- } //End function
508
-
509
  /**
510
  * Display options for rich snippets
511
  *
512
  * @author Dario Curvino <@dudo>
513
  * @param $option
514
  */
515
- public function snippets($option) {
 
516
  $publisher_name = $option['publisher_name'];
517
  $publisher_logo = $option['publisher_logo'];
518
  ?>
519
  <div class="yasr-settings-padding-left yasr-settings-row">
520
  <div class="yasr-settings-col-60">
521
  <strong>
522
- <?php esc_html_e('Select default itemType for all post or pages', 'yet-another-stars-rating'); ?>
 
 
523
  </strong>
524
  <div>
525
- <?php
526
- yasr_select_itemtype(
527
- 'yasr-choose-reviews-types-list', 'yasr_general_options[snippet_itemtype]',
528
- $option['snippet_itemtype']
529
- );
530
- ?>
531
 
532
  <div class="yasr-element-row-container-description">
533
- <?php
534
- esc_html_e('You can always change itemType in the single post or page.',
535
- 'yet-another-stars-rating');
536
- ?>
537
  </div>
538
 
539
- <?php
540
- $option_title = __('Choose whether the site represents an organization or a person.', 'yet-another-stars-rating');
541
- $array_options = array (
542
- 'Organization' => 'Organization',
543
- 'Person' => 'Person'
544
- );
545
- $default = $option['publisher'];
546
- $name = 'yasr_general_options[publisher]';
547
- $id = 'yasr-general-options-publisher';
548
-
549
- echo yasr_kses(
550
- YasrPhpFieldsHelper::radio( $option_title, 'none', $array_options, $name, $default, $id )
551
- );
552
- ?>
 
 
 
 
553
  <br/>
554
  <input type='text' name='yasr_general_options[publisher_name]'
555
  id="yasr-general-options-publisher-name"
556
- class="yasr-additional-info-inputs" <?php printf('value="%s"', esc_attr($publisher_name)); ?>
 
 
557
  maxlength="180"/>
558
  <div class="yasr-element-row-container-description">
559
  <label for="yasr-general-options-publisher-name">
560
- <?php esc_html_e('Publisher name (e.g. Google)', 'yet-another-stars-rating') ?>
 
 
561
  </label>
562
  </div>
563
 
564
  <input type='text' name='yasr_general_options[publisher_logo]'
565
  id="yasr-general-options-publisher-logo"
566
  class="yasr-blogPosting-additional-info-inputs"
567
- <?php printf('value="%s"', esc_url($publisher_logo)); ?>
 
 
568
  maxlength="300"/>
569
  <div class="yasr-element-row-container-description">
570
  <label for="yasr-general-options-publisher-logo">
571
- <?php esc_html_e('Image Url (if empty siteicon will be used instead)', 'yet-another-stars-rating') ?>
 
 
572
  </label>
573
  </div>
574
  </div>
@@ -576,205 +643,195 @@ class YasrSettings {
576
 
577
  <div class="yasr-settings-col-40" id="yasr-blogPosting-additional-info">
578
  <div class="yasr-help-box-settings" style="display:block">
579
- <?php
580
- echo wp_kses_post(sprintf(
581
- __('Please keep in mind that since September, 16, 2019 blogPosting itemType will
582
- no show stars in SERP anymore. %sHere%s the announcement by Google.',
583
- 'yet-another-stars-rating'),
584
- '<br /><br /><a href="https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html">',
585
- '</a>')
586
- );
587
- echo "<br /><br />";
588
- echo wp_kses_post(sprintf(
589
- __('Also, %sread Google guidelines%s', 'yet-another-stars-rating'),
590
- '<a href="https://developers.google.com/search/docs/data-types/review-snippet#guidelines">',
591
- '</a>.')
592
- );
593
- ?>
594
  </div>
595
  </div>
596
  </div>
597
- <?php
598
- submit_button(YASR_SAVE_All_SETTINGS_TEXT);
599
  ?>
600
 
601
  <hr />
602
- <?php
603
-
604
- } //End function yasr_choose_snippet_callback
605
-
606
  /**
607
  * Display options for custom texts
608
  *
609
  * @author Dario Curvino <@dudo>
610
  * @param $option
611
  */
612
- public function customText($option) {
 
613
  ?>
614
  <div>
615
- <?php
616
- $custom_text = array(
617
- 'txt_before_overall' => array (
618
- 'name' => 'text_before_overall',
619
- 'description' => '&sup1; '.esc_html__('Custom text to display before Overall Rating', 'yet-another-stars-rating'),
620
- 'id' => 'yasr-settings-custom-text-before-overall',
621
- 'class' => 'yasr-general-options-text-before'
622
- ),
623
- 'txt_before_vv' => array (
624
- 'name' => 'text_before_visitor_rating',
625
- 'description' => '&sup2; '.esc_html__('Custom text to display BEFORE Visitor Rating', 'yet-another-stars-rating'),
626
- 'id' => 'yasr-settings-custom-text-before-visitor',
627
- 'class' => 'yasr-general-options-text-before'
628
- ),
629
- 'txt_after_vv' => array (
630
- 'name' => 'text_after_visitor_rating',
631
- 'description' => '&sup2; '.esc_html__('Custom text to display AFTER Visitor Rating', 'yet-another-stars-rating'),
632
- 'id' => 'yasr-settings-custom-text-after-visitor',
633
- 'class' => 'yasr-general-options-text-before'
634
- ),
635
- 'txt_login_required' => array (
636
- 'name' => 'custom_text_must_sign_in',
637
- 'description' => esc_html__('Custom text to display when login is required to vote', 'yet-another-stars-rating'),
638
- 'id' => 'yasr-settings-custom-text-must-sign-in',
639
- 'class' => 'yasr-general-options-text-before'
640
- ),
641
- 'txt_vv_rating_saved' => array (
642
- 'name' => 'custom_text_rating_saved',
643
- 'description' => esc_html__('Custom text to display when rating is saved', 'yet-another-stars-rating'),
644
- 'id' => 'yasr-settings-custom-text-rating-saved',
645
- 'class' => 'yasr-general-options-text-before'
646
- ),
647
- 'txt_vv_rating_updated' => array (
648
- 'name' => 'custom_text_rating_updated',
649
- 'description' => esc_html__('Custom text to display when rating is updated (only for logged in users)',
650
- 'yet-another-stars-rating'),
651
- 'id' => 'yasr-settings-custom-text-rating-updated',
652
- 'class' => 'yasr-general-options-text-before'
653
- ),
654
- 'txt_vv_rated' => array (
655
- 'name' => 'custom_text_user_voted',
656
- 'description' => '&sup1; '.esc_html__('Custom text to display when an user has already rated', 'yet-another-stars-rating'),
657
- 'id' => 'yasr-settings-custom-text-already-rated',
658
- 'class' => 'yasr-general-options-text-before'
659
- ),
660
- );
661
- ?>
662
  <div class="yasr-settings-row-45" id="yasr-general-options-custom-text">
663
- <?php
664
- self::echoSettingFields($custom_text, $option);
665
- ?>
666
  </div>
667
 
668
  <div class="yasr-help-box-settings" style="display: block">
669
- <?php
670
- $string_custom_overall = sprintf(
671
- __('%s In these fields you can use %s pattern to show the rating (as text).',
672
- 'yet-another-stars-rating'),
673
- '<strong>&sup1;</strong>','<strong>%rating%</strong>');
674
-
675
- $string_custom_visitor = sprintf(__('%s In these fields you can use %s pattern to show the
676
- total count, and %s pattern to show the average.', 'yet-another-stars-rating'),
677
- '<strong>&sup2;</strong>','<strong>%total_count%</strong>', '<strong>%average%</strong>');
678
-
679
- $description = esc_html__('Leave a field empty to disable it.', 'yet-another-stars-rating');
680
- $description .= '<p>'.$string_custom_overall.'</p>';
681
- $description .= '<p>'.$string_custom_visitor.'</p>';
682
- $description .= '<p>'.esc_html__('Allowed html tags:', 'yet-another-stars-rating');
683
- $description .= '<br /><strong>' . esc_html('<strong>, <p>') . '</strong>'.'.</p>';
684
-
685
- echo wp_kses_post($description);
686
- ?>
687
  </div>
688
  <div style="padding-left: 10px; padding-bottom: 15px;">
689
  <p>
690
  <input type="button"
691
  id="yasr-settings-custom-texts"
692
  class="button"
693
- value="<?php esc_attr_e('Restore default strings', 'yet-another-stars-rating') ?>"
 
 
694
  >
695
  </p>
696
  </div>
697
  </div>
698
  <hr />
699
- <?php
700
  }
701
-
702
  /**
703
  * Display options for advanced settings
704
  *
705
  * @author Dario Curvino <@dudo>
706
  * @param $option
707
  */
708
- public function advancedSettings($option) {
 
709
  ?>
710
  <div class="yasr-settings-row-45">
711
  <div>
712
  <strong>
713
- <?php
714
- esc_html_e('Load results with AJAX?', 'yet-another-stars-rating');
715
- ?>
716
  </strong>
717
  <div class="yasr-onoffswitch-big">
718
  <input type="checkbox" name="yasr_general_options[enable_ajax]" class="yasr-onoffswitch-checkbox"
719
- id="yasr-general-options-enable-ajax-switch" <?php if ($option['enable_ajax'] === 'yes') {
720
- echo " checked='checked' ";
721
- } ?> >
 
 
722
  <label class="yasr-onoffswitch-label" for="yasr-general-options-enable-ajax-switch">
723
  <span class="yasr-onoffswitch-inner"></span>
724
  <span class="yasr-onoffswitch-switch"></span>
725
  </label>
726
  </div>
727
  <br/>
728
- <?php
729
- esc_html_e('This should be enabled if you\'re using caching plugins.
730
- Not required for yasr_overall_rating and yasr_multiset.',
731
- 'yet-another-stars-rating'
732
- );
733
- $caching_plugin = new YasrFindCachingPlugins();
734
- $caching_plugin_found = $caching_plugin->cachingPluginFound();
735
- if($caching_plugin_found !== false) {
736
- echo wp_kses_post('<div class="yasr-element-row-container-description">'.
737
- sprintf(
738
- __('Since you\'re using the caching plugin %s you should enable this.',
739
- 'yet-another-stars-rating'),
740
- '<strong>'.$caching_plugin_found.'</strong>'
741
- ).
742
- '</div>');
743
- }
744
- ?>
745
  </div>
746
  <div>
747
  <strong>
748
- <?php esc_html_e('Do you want to save ip address?', 'yet-another-stars-rating') ?>
 
 
749
  </strong>
750
  <div class="yasr-onoffswitch-big">
751
  <input type="checkbox" name="yasr_general_options[enable_ip]" class="yasr-onoffswitch-checkbox"
752
- id="yasr-general-options-enable-ip-switch" <?php if ($option['enable_ip'] === 'yes') {
753
- echo " checked='checked' ";
754
- } ?> >
 
 
755
  <label class="yasr-onoffswitch-label" for="yasr-general-options-enable-ip-switch">
756
  <span class="yasr-onoffswitch-inner"></span>
757
  <span class="yasr-onoffswitch-switch"></span>
758
  </label>
759
  </div>
760
  <br/>
761
- <?php
762
- $string = sprintf(
763
- __('Please note that to comply with the %s EU law, you %s MUST %s warn your users that you\'re storing their ip. %s
764
- If in doubt, leave no.',
765
- 'yet-another-stars-rating'
766
- ),
767
- '<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>',
768
- '<strong>', '</strong>', '<br />'
769
- );
770
- echo wp_kses_post($string);
771
- ?>
772
  </div>
773
  </div>
774
- <?php
775
- } //End function
776
-
777
-
778
  /**
779
  * Action to do before save data into the db
780
  *
@@ -784,122 +841,109 @@ class YasrSettings {
784
  *
785
  * @return array
786
  */
787
- public function sanitize($option) {
 
788
  //Array to return
789
  $output = array();
790
-
791
- $tidy_installed = yasr_is_tidy_installed();
792
-
793
  // Loop through each of the incoming options
794
- foreach ($option as $key => $value) {
795
  // Check to see if the current option has a value. If so, process it.
796
- if (isset($option[$key])) {
 
797
  //Tags are not allowed for any fields
798
  $allowed_tags = '';
799
-
800
  //except these ones
801
- if ($key === 'text_before_overall' || $key === 'text_before_visitor_rating' ||
802
- $key === 'text_after_visitor_rating' || $key === 'custom_text_must_sign_in' ||
803
- $key === 'custom_text_rating_saved' || $key === 'custom_text_rating_updated' ||
804
- $key === 'custom_text_user_voted') {
805
-
806
  $allowed_tags = '<strong><p>';
807
-
808
  // handle quoted strings and allow some tags
809
- $output[$key] = strip_tags(stripslashes($option[$key]), $allowed_tags);
810
-
811
  //if tidy extension is enabled, fix errors in html
812
- if ($tidy_installed === true) {
813
- $tidy = new Tidy();
814
- $output[$key] = $tidy->repairString($output[$key], array('show-body-only' => true));
 
 
 
815
  }
816
-
817
- }
818
- else {
819
  // handle quoted strings and allow no tags
820
- $output[$key] = strip_tags(stripslashes($option[$key]), $allowed_tags);
821
  }
822
-
823
- if ($key === 'publisher_logo') {
824
  //if is not a valid url get_site_icon_url instead
825
- if (filter_var($value, FILTER_VALIDATE_URL) === false) {
826
  $output[$key] = get_site_icon_url();
827
  }
828
  }
829
-
830
- } // end if
831
-
832
- } // end foreach
833
-
834
  /** The following steps are needed to avoid undefined index if a setting is saved to "no" **/
835
-
836
  //if in array doesn't exists [auto_insert_enabled] key, create it and set to 0
837
- if (!array_key_exists('auto_insert_enabled', $output)) {
 
838
  $output['auto_insert_enabled'] = 0;
839
- }
840
- //if exists value must be 1
841
- else {
842
  $output['auto_insert_enabled'] = 1;
843
  }
844
-
845
  //if in array doesn't exists [stars title] key, create it and set to 'no'
846
- if (!array_key_exists('stars_title', $output)) {
 
847
  $output['stars_title'] = 'no';
848
- }
849
- //if exists value must be 1
850
- else {
851
  $output['stars_title'] = 'yes';
852
  }
853
-
854
  //Same as above but for [show_overall_in_loop] key
855
- if (!array_key_exists('show_overall_in_loop', $output)) {
 
856
  $output['show_overall_in_loop'] = 'disabled';
857
- }
858
- //if exists must be string 'enabled'
859
- else {
860
  $output['show_overall_in_loop'] = 'enabled';
861
  }
862
-
863
  //Same as above but for [show_visitor_votes_in_loop] key
864
- if (!array_key_exists('show_visitor_votes_in_loop', $output)) {
 
865
  $output['show_visitor_votes_in_loop'] = 'disabled';
866
- }
867
- //if exists must be string 'enabled'
868
- else {
869
  $output['show_visitor_votes_in_loop'] = 'enabled';
870
  }
871
-
872
  //Same as above but for visitors_stats key
873
- if (!array_key_exists('visitors_stats', $output)) {
 
874
  $output['visitors_stats'] = 'no';
875
- }
876
- //if exists must be string 'yes'
877
- else {
878
  $output['visitors_stats'] = 'yes';
879
  }
880
-
881
  //Same as above but for enable_ip key
882
- if (!array_key_exists('enable_ip', $output)) {
 
883
  $output['enable_ip'] = 'no';
884
- }
885
- //if exists must be string 'yes'
886
- else {
887
  $output['enable_ip'] = 'yes';
888
  }
889
-
890
  //Same as above but for enable_ip key
891
- if (!array_key_exists('enable_ajax', $output)) {
 
892
  $output['enable_ajax'] = 'no';
893
- }
894
- //if exists must be string 'yes'
895
- else {
896
  $output['enable_ajax'] = 'yes';
897
  }
898
-
899
  return $output;
900
-
901
  }
902
-
903
  /**
904
  * @author Dario Curvino <@dudo>
905
  * @since 2.4.7
@@ -907,49 +951,64 @@ class YasrSettings {
907
  * @param $option
908
  * @param string $option_prefix
909
  */
910
- public static function echoSettingFields($elementsType_array, $option, $option_prefix='yasr_general_options') {
 
911
  $string_input = false;
912
- $type = false;
913
-
914
- foreach($elementsType_array as $property) {
915
-
916
  //concatenate yasr_general_options with property name
917
- $element_name = $option_prefix.'[' . $property['name'] . ']';
918
-
919
- if(isset($property['type'])) {
920
- if($property['type'] === 'select') {
 
921
  $string_input = YasrPhpFieldsHelper::select(
922
- '', $property['label'], $property['options'], $property['name'], '', esc_attr($option[$property['name']])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
  );
924
- } elseif($property['type'] === 'textarea') {
925
- $string_input = YasrPhpFieldsHelper::textArea('', '', $property['name'], '', '',
926
- esc_textarea($option[$property['name']]));
927
  }
928
- } //to use text, there is no need to set the type element
929
- else {
930
- $type = 'text';
931
- $placeholder = isset($property['placeholder']) ? $property['placeholder'] : '';
932
-
933
  //if description exists, add another <div> before
934
- $string_input = isset($property['description']) && ($property['description'] !== '') ? '<div>' : '';
935
  $string_input .= YasrPhpFieldsHelper::text(
936
- $property['class'], '', $element_name, $property['id'], $placeholder, esc_attr($option[$property['name']])
 
 
 
 
 
937
  );
938
  }
939
-
940
- if(isset($property['description']) && $property['description'] !== '') {
 
941
  $string_input .= '<div class="yasr-element-row-container-description">';
942
- $string_input .= esc_html($property['description']);
943
  //if this is coming from "text field, close 2 divs"
944
- $string_input .= ($type === 'text') ? '</div>' : '';
945
  $string_input .= '</div>';
946
  }
947
-
948
- echo yasr_kses($string_input);
949
-
950
  }
951
  }
952
-
953
  /**
954
  * Returns the radio buttons that allow to select stars size
955
  *
@@ -964,40 +1023,45 @@ class YasrSettings {
964
  * @since 2.3.3
965
  * @return string
966
  */
967
- public static function radioSelectSize($name, $class, $db_value=false, $id=false, $txt_label=true, $newline=false) {
968
- $array_size = array('small', 'medium', 'large');
969
- $span_label = '';
 
 
 
 
 
 
 
 
970
  $html_to_return = '';
971
-
972
- foreach ($array_size as $size) {
973
  $id_string = $id . $size;
974
-
975
  //must be inside for each, or when loop arrive to last element
976
  //checked is defined
977
  $checked = '';
978
-
979
  //If db_value === false, there is no need to check for db value
980
  //so checked is the medium star (i.e. ranking page)
981
- if ($db_value === false) {
982
- if ($size === 'medium') {
 
 
 
 
 
983
  $checked = 'checked';
984
  }
985
  }
986
- else if ($db_value === $size) {
987
- $checked = 'checked';
988
- }
989
-
990
- if($txt_label !== false) {
991
- $span_label =
992
- '<span class="yasr-text-options-size">'.
993
- __(ucwords($size), 'yet-another-stars-rating').
994
- '</span>';
995
- if($newline !== false) {
996
  $span_label = '<br />' . $span_label;
997
  }
998
  }
999
- $src = YASR_IMG_DIR . 'yasr-stars-'.$size.'.png';
1000
-
1001
  $html_to_return .= sprintf(
1002
  '<div class="yasr-option-div">
1003
  <label for="%s">
@@ -1023,10 +1087,547 @@ class YasrSettings {
1023
  $size,
1024
  $span_label
1025
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1026
 
1027
- } //end foreach
1028
 
1029
- return $html_to_return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1030
  }
1031
 
1032
  }
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
+ if ( !defined( 'ABSPATH' ) ) {
21
+ exit( 'You\'re not allowed to see this page' );
22
+ }
23
+ // Exit if accessed directly
 
 
24
  /**
25
  * @since 2.4.7
26
  *
28
  *
29
  * Class YasrSettings
30
  */
31
+ class YasrSettings
32
+ {
33
  /**
34
  * Init Settings
35
  */
36
+ public function init()
37
+ {
38
+ add_action( 'admin_init', array( $this, 'generalOptions' ) );
39
+ //This is for general options
40
  //include multiset functions
41
+ require YASR_ABSOLUTE_PATH_ADMIN . '/settings/multiset/yasr-settings-functions-multiset.php';
 
42
  $multiset = new YasrSettingsMultiset();
43
  $multiset->init();
 
44
  //include style functions
45
+ require YASR_ABSOLUTE_PATH_ADMIN . '/settings/aspect_style/yasr-settings-style-functions.php';
46
+ $yasr_import_plugin = new YasrImportRatingPlugins();
47
+ //add ajax actions
48
+ $yasr_import_plugin->addAjaxActions();
49
+ /** Change default admin footer on yasr settings pages
50
+ * $text is the default WordPress text
51
+ * Since 0.8.9
52
+ */
53
+ add_filter( 'admin_footer_text', array( $this, 'customFooter' ) );
54
  }
55
+
56
  /**
57
  * Load general options
58
  */
59
+ public function generalOptions()
60
+ {
61
  register_setting(
62
+ 'yasr_general_options_group',
63
+ // A settings group name. Must exist prior to the register_setting call.
64
  // This must match the group name in settings_fields()
65
+ 'yasr_general_options',
66
+ //The name of an options to sanitize and save.
67
+ array( $this, 'sanitize' )
68
  );
69
+ $settings = new YasrSettingsValues();
70
+ $options = $settings->getGeneralSettings();
 
 
71
  add_settings_section(
72
  'yasr_general_options_section_id',
73
+ __( 'General settings', 'yet-another-stars-rating' ),
74
+ array( $this, 'sectionCallback' ),
75
  'yasr_general_settings_tab'
76
  );
 
77
  add_settings_field(
78
  'yasr_use_auto_insert_id',
79
+ $this->descriptionAutoInsert(),
80
+ array( $this, 'autoInsert' ),
81
  'yasr_general_settings_tab',
82
  'yasr_general_options_section_id',
83
  $options
84
  );
 
85
  add_settings_field(
86
  'yasr_stars_title',
87
+ $this->descriptionStarsTitle(),
88
+ array( $this, 'starsTitle' ),
89
  'yasr_general_settings_tab',
90
  'yasr_general_options_section_id',
91
  $options
92
  );
 
93
  add_settings_field(
94
  'yasr_show_overall_in_loop',
95
+ $this->descriptionArchivePage(),
96
+ array( $this, 'archivePages' ),
97
  'yasr_general_settings_tab',
98
  'yasr_general_options_section_id',
99
  $options
100
  );
 
101
  add_settings_field(
102
  'yasr_visitors_stats',
103
+ $this->descriptionVVStats(),
104
+ array( $this, 'vvStats' ),
105
  'yasr_general_settings_tab',
106
  'yasr_general_options_section_id',
107
  $options
108
  );
 
109
  add_settings_field(
110
  'yasr_allow_only_logged_in_id',
111
+ $this->descriptionAllowVote(),
112
+ array( $this, 'loggedOnly' ),
113
  'yasr_general_settings_tab',
114
  'yasr_general_options_section_id',
115
  $options
116
  );
 
117
  add_settings_field(
118
  'yasr_choose_snippet_id',
119
+ $this->descriptionStructuredData(),
120
+ array( $this, 'snippets' ),
121
  'yasr_general_settings_tab',
122
  'yasr_general_options_section_id',
123
  $options
124
  );
 
125
  add_settings_field(
126
  'yasr_custom_text',
127
+ wp_kses_post( $this->descriptionCSTMTxt() ),
128
+ array( $this, 'customText' ),
129
  'yasr_general_settings_tab',
130
  'yasr_general_options_section_id',
131
  $options
132
  );
 
133
  add_settings_field(
134
  'yasr_advanced',
135
+ __( 'Advanced Settings', 'yet-another-stars-rating' ),
136
+ array( $this, 'advancedSettings' ),
137
  'yasr_general_settings_tab',
138
  'yasr_general_options_section_id',
139
  $options
140
  );
 
141
  }
142
+
143
  /**
144
  * @return void
145
  */
146
+ public function sectionCallback()
147
+ {
148
  }
149
+
150
  /**
151
  * Display options for Auto insert
152
  *
153
  * @param $option
154
  */
155
+ public function autoInsert( $option )
156
+ {
157
  ?>
158
  <div>
159
  <strong>
160
+ <?php
161
+ esc_html_e( 'Use Auto Insert?', 'yet-another-stars-rating' );
162
+ ?>
163
  </strong>
164
  <div class="yasr-onoffswitch-big">
165
  <input type="checkbox" name="yasr_general_options[auto_insert_enabled]" class="yasr-onoffswitch-checkbox"
166
+ value="1" id="yasr_auto_insert_switch" <?php
167
+ if ( $option['auto_insert_enabled'] === 1 ) {
168
+ echo " checked='checked' " ;
169
+ }
170
+ ?> >
171
  <label class="yasr-onoffswitch-label" for="yasr_auto_insert_switch">
172
  <span class="yasr-onoffswitch-inner"></span>
173
  <span class="yasr-onoffswitch-switch"></span>
176
 
177
  <div class="yasr-settings-row-35">
178
  <div>
179
+ <?php
180
+ $option_title = __( 'What?', 'yet-another-stars-rating' );
181
+ $array_options = array(
182
+ 'visitor_rating' => __( 'Visitor Votes', 'yet-another-stars-rating' ),
183
+ 'overall_rating' => __( 'Overall Rating', 'yet-another-stars-rating' ),
184
+ 'both' => __( 'Both', 'yet-another-stars-rating' ),
185
+ );
186
+ $default = $option['auto_insert_what'];
187
+ $name = 'yasr_general_options[auto_insert_what]';
188
+ $class = 'yasr-auto-insert-options-class';
189
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
190
+ $option_title,
191
+ $class,
192
+ $array_options,
193
+ $name,
194
+ $default
195
+ ) ) ;
196
+ ?>
197
  </div>
198
  <div>
199
+ <?php
200
+ $option_title = __( 'Where?', 'yet-another-stars-rating' );
201
+ $array_options = array(
202
+ 'top' => __( 'Before the content', 'yet-another-stars-rating' ),
203
+ 'bottom' => __( 'After the content', 'yet-another-stars-rating' ),
204
+ 'both' => __( 'Both', 'yet-another-stars-rating' ),
205
+ );
206
+ $default = $option['auto_insert_where'];
207
+ $name = 'yasr_general_options[auto_insert_where]';
208
+ $class = 'yasr-auto-insert-options-class';
209
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
210
+ $option_title,
211
+ $class,
212
+ $array_options,
213
+ $name,
214
+ $default
215
+ ) ) ;
216
+ ?>
217
  </div>
218
  <div>
219
+ <?php
220
+ $option_title = __( 'Align', 'yet-another-stars-rating' );
221
+ $array_options = array(
222
+ 'left' => __( 'Left', 'yet-another-stars-rating' ),
223
+ 'center' => __( 'Center', 'yet-another-stars-rating' ),
224
+ 'right' => __( 'Right', 'yet-another-stars-rating' ),
225
+ );
226
+ $default = $option['auto_insert_align'];
227
+ $name = 'yasr_general_options[auto_insert_align]';
228
+ $class = 'yasr-auto-insert-options-class';
229
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
230
+ $option_title,
231
+ $class,
232
+ $array_options,
233
+ $name,
234
+ $default
235
+ ) ) ;
236
+ ?>
237
  </div>
238
  <div>
239
  <strong>
240
+ <?php
241
+ esc_html_e( 'Size', 'yet-another-stars-rating' );
242
+ ?>
243
  </strong>
244
+ <?php
245
+ $name = 'yasr_general_options[auto_insert_size]';
246
+ $class = 'yasr-auto-insert-options-class';
247
+ $id = 'yasr-auto-insert-options-stars-size-';
248
+ echo yasr_kses( self::radioSelectSize(
249
+ $name,
250
+ $class,
251
+ $option['auto_insert_size'],
252
+ $id
253
+ ) ) ;
254
+ ?>
255
  </div>
256
  <div>
257
+ <?php
258
+ $option_title = __( 'Exclude Pages?', 'yet-another-stars-rating' );
259
+ $array_options = array(
260
+ 'yes' => __( 'Yes', 'yet-another-stars-rating' ),
261
+ 'no' => __( 'No', 'yet-another-stars-rating' ),
262
+ );
263
+ $default = $option['auto_insert_exclude_pages'];
264
+ $name = 'yasr_general_options[auto_insert_exclude_pages]';
265
+ $class = 'yasr-auto-insert-options-class';
266
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
267
+ $option_title,
268
+ $class,
269
+ $array_options,
270
+ $name,
271
+ $default
272
+ ) ) ;
273
+ ?>
274
  </div>
275
+ <?php
276
+ $custom_post_types = YasrCustomPostTypes::getCustomPostTypes();
277
+
278
+ if ( $custom_post_types ) {
279
+ echo '<div>' ;
280
+ $option_title = __( 'Use only in custom post types?', 'yet-another-stars-rating' );
281
+ $array_options = array(
282
+ 'yes' => __( 'Yes', 'yet-another-stars-rating' ),
283
+ 'no' => __( 'No', 'yet-another-stars-rating' ),
284
+ );
285
+ $default = $option['auto_insert_custom_post_only'];
286
+ $name = 'yasr_general_options[auto_insert_custom_post_only]';
287
+ $class = 'yasr-auto-insert-options-class';
288
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
289
+ $option_title,
290
+ $class,
291
+ $array_options,
292
+ $name,
293
+ $default
294
+ ) ) ;
295
+ ?>
296
  <div>
297
+ <?php
298
+ esc_html_e( 'Select yes if you want to use auto insert only in custom post types', 'yet-another-stars-rating' );
299
+ ?>
 
300
  </div>
301
+ <?php
302
+ echo '</div>' ;
303
+ } else {
304
+ ?>
305
  <input type="hidden" name="yasr_general_options[auto_insert_custom_post_only]" value="no">
306
+ <?php
307
+ }
308
+
309
+ ?>
310
  </div>
311
+ <?php
312
+ submit_button( YASR_SAVE_All_SETTINGS_TEXT );
313
+ ?>
314
  </div>
315
  <hr />
316
+ <?php
317
+ }
318
+
319
+ //End yasr_auto_insert_callback
320
  /**
321
  * Display options for stars near title
322
  *
323
  * @author Dario Curvino <@dudo>
324
  * @param $option
325
  */
326
+ public function starsTitle( $option )
327
+ {
328
  ?>
329
  <div>
330
  <div class="yasr-onoffswitch-big">
331
  <input type="checkbox" name="yasr_general_options[stars_title]" class="yasr-onoffswitch-checkbox"
332
+ id="yasr-general-options-stars-title-switch" <?php
333
+ if ( $option['stars_title'] === 'yes' ) {
334
+ echo " checked='checked' " ;
335
+ }
336
+ ?> >
337
  <label class="yasr-onoffswitch-label" for="yasr-general-options-stars-title-switch">
338
  <span class="yasr-onoffswitch-inner"></span>
339
  <span class="yasr-onoffswitch-switch"></span>
341
  </div>
342
  <div class="yasr-settings-row-35">
343
  <div>
344
+ <?php
345
+ $option_title = __( 'What?', 'yet-another-stars-rating' );
346
+ $array_options = array(
347
+ 'visitor_rating' => __( 'Visitor Votes', 'yet-another-stars-rating' ),
348
+ 'overall_rating' => __( 'Overall Rating / Author Rating', 'yet-another-stars-rating' ),
349
+ );
350
+ $default = $option['stars_title_what'];
351
+ $name = 'yasr_general_options[stars_title_what]';
352
+ $class = 'yasr-stars-title-options-class';
353
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
354
+ $option_title,
355
+ $class,
356
+ $array_options,
357
+ $name,
358
+ $default
359
+ ) ) ;
360
+ ?>
361
  </div>
362
  <div>
363
+ <?php
364
+ $option_title = __( 'Exclude Pages?', 'yet-another-stars-rating' );
365
+ $array_options = array(
366
+ 'yes' => __( 'Yes', 'yet-another-stars-rating' ),
367
+ 'no' => __( 'No', 'yet-another-stars-rating' ),
368
+ );
369
+ $default = $option['stars_title_exclude_pages'];
370
+ $name = 'yasr_general_options[stars_title_exclude_pages]';
371
+ $class = 'yasr-stars-title-options-class';
372
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
373
+ $option_title,
374
+ $class,
375
+ $array_options,
376
+ $name,
377
+ $default
378
+ ) ) ;
379
+ ?>
380
  </div>
381
  <div style="flex: 0 0 50%">
382
+ <?php
383
+ $option_title = __( 'Where do you want show ratings?', 'yet-another-stars-rating' );
384
+ $array_options = array(
385
+ 'archive' => __( 'Only on archive pages (categories, tags, etc.)', 'yet-another-stars-rating' ),
386
+ 'single' => __( 'Only on single posts or pages', 'yet-another-stars-rating' ),
387
+ 'both' => __( 'Both', 'yet-another-stars-rating' ),
388
+ );
389
+ $default = $option['stars_title_where'];
390
+ $name = 'yasr_general_options[stars_title_where]';
391
+ $class = 'yasr-stars-title-options-class';
392
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
393
+ $option_title,
394
+ $class,
395
+ $array_options,
396
+ $name,
397
+ $default
398
+ ) ) ;
399
+ ?>
400
  </div>
401
  </div>
402
  </div>
404
  <p>&nbsp;</p>
405
  <hr />
406
 
407
+ <?php
 
408
  }
409
+
410
  /**
411
  * Display options for stars in archive pages
412
  *
413
  * @author Dario Curvino <@dudo>
414
  * @param $option
415
  */
416
+ public function archivePages( $option )
417
+ {
418
  ?>
419
  <div class="yasr-settings-row-45">
420
  <div>
421
  <strong>
422
+ <?php
423
+ esc_html_e( 'Show "Overall Rating" in Archive Pages?', 'yet-another-stars-rating' );
424
+ ?>
425
  </strong>
426
  <div class="yasr-onoffswitch-big">
427
  <input type="checkbox" name="yasr_general_options[show_overall_in_loop]" class="yasr-onoffswitch-checkbox"
428
+ id="yasr-show-overall-in-loop-switch" <?php
429
+ if ( $option['show_overall_in_loop'] === 'enabled' ) {
430
+ echo " checked='checked' " ;
431
+ }
432
+ ?> >
433
  <label class="yasr-onoffswitch-label" for="yasr-show-overall-in-loop-switch">
434
  <span class="yasr-onoffswitch-inner"></span>
435
  <span class="yasr-onoffswitch-switch"></span>
436
  </label>
437
  </div>
438
  <br/>
439
+ <?php
440
+ esc_html_e( 'Enable to show "Overall Rating" in archive pages.', 'yet-another-stars-rating' );
441
+ ?>
442
  </div>
443
 
444
  <div>
445
  <strong>
446
+ <?php
447
+ esc_html_e( 'Show "Visitor Votes" in Archive Page?', 'yet-another-stars-rating' );
448
+ ?>
449
  </strong>
450
  <div class="yasr-onoffswitch-big">
451
  <input type="checkbox" name="yasr_general_options[show_visitor_votes_in_loop]" class="yasr-onoffswitch-checkbox"
452
+ id="yasr-show-visitor-votes-in-loop-switch" <?php
453
+ if ( $option['show_visitor_votes_in_loop'] === 'enabled' ) {
454
+ echo " checked='checked' " ;
455
+ }
456
+ ?> >
457
  <label class="yasr-onoffswitch-label" for="yasr-show-visitor-votes-in-loop-switch">
458
  <span class="yasr-onoffswitch-inner"></span>
459
  <span class="yasr-onoffswitch-switch"></span>
460
  </label>
461
  </div>
462
  <br/>
463
+ <?php
464
+ esc_html_e( 'Enable to show "Visitor Votes" in archive pages', 'yet-another-stars-rating' );
465
+ ?>
466
  </div>
467
 
468
  </div>
469
  <p>&nbsp;</p>
470
  <hr>
471
+ <?php
 
472
  }
473
+
474
  /**
475
  * Display options for vvStats
476
  *
477
  * @author Dario Curvino <@dudo>
478
  * @param $option
479
  */
480
+ public function vvStats( $option )
481
+ {
482
  ?>
483
  <div class="yasr-settings-row">
484
  <div class="yasr-settings-col-30">
485
  <div class="yasr-onoffswitch-big">
486
  <input type="checkbox" name="yasr_general_options[visitors_stats]" class="yasr-onoffswitch-checkbox"
487
+ id="yasr-general-options-visitors-stats-switch" <?php
488
+ if ( $option['visitors_stats'] === 'yes' ) {
489
+ echo " checked='checked' " ;
490
+ }
491
+ ?> >
492
  <label class="yasr-onoffswitch-label" for="yasr-general-options-visitors-stats-switch">
493
  <span class="yasr-onoffswitch-inner"></span>
494
  <span class="yasr-onoffswitch-switch"></span>
495
  </label>
496
  </div>
497
  <br/>
498
+ <?php
499
+ esc_html_e( 'Select "Yes" to enable.', 'yet-another-stars-rating' );
500
+ ?>
501
  <br />
502
  <p>&nbsp;</p>
503
  </div>
504
  <div class="yasr-settings-col-60">
505
  <strong>
506
+ <?php
507
+ esc_html_e( 'Example', 'yet-another-stars-rating' );
508
+ ?>:
509
  </strong>
510
  <br />
511
+ <img src="<?php
512
+ echo esc_url( YASR_IMG_DIR . 'yasr-settings-stats.png' ) ;
513
+ ?>"
514
  class="yasr-help-box-settings"
515
  style="display: block; width: 330px"
516
  alt="yasr-statsexplained">
517
  </div>
518
  </div>
519
+ <?php
520
+ submit_button( YASR_SAVE_All_SETTINGS_TEXT );
521
  ?>
522
  <hr />
523
+ <?php
 
524
  }
525
+
526
  /**
527
  * Display options for choose who is allowed to votes
528
  *
529
  * @author Dario Curvino <@dudo>
530
  * @param $option
531
  */
532
+ public function loggedOnly( $option )
533
+ {
534
  ?>
535
  <div class="yasr-settings-padding-left">
536
+ <?php
537
+ $array_options = array(
538
+ 'logged_only' => __( 'Allow only logged-in users', 'yet-another-stars-rating' ),
539
+ 'allow_anonymous' => __( 'Allow everybody (logged in and anonymous)', 'yet-another-stars-rating' ),
540
+ );
541
+ $default = $option['allowed_user'];
542
+ $name = 'yasr_general_options[allowed_user]';
543
+ $class = 'yasr_auto_insert_loggedonly';
544
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
545
+ false,
546
+ $class,
547
+ $array_options,
548
+ $name,
549
+ $default
550
+ ) ) ;
551
+ ?>
552
  <br />
553
  <div class="yasr-indented-answer">
554
+ <?php
555
+ esc_html_e( 'Select who can rate your posts.', 'yet-another-stars-rating' );
556
+ ?>
557
  </div>
558
  </div>
559
  <p>&nbsp;</p>
560
  <hr />
561
+ <?php
562
+ }
563
+
564
+ //End function
565
  /**
566
  * Display options for rich snippets
567
  *
568
  * @author Dario Curvino <@dudo>
569
  * @param $option
570
  */
571
+ public function snippets( $option )
572
+ {
573
  $publisher_name = $option['publisher_name'];
574
  $publisher_logo = $option['publisher_logo'];
575
  ?>
576
  <div class="yasr-settings-padding-left yasr-settings-row">
577
  <div class="yasr-settings-col-60">
578
  <strong>
579
+ <?php
580
+ esc_html_e( 'Select default itemType for all post or pages', 'yet-another-stars-rating' );
581
+ ?>
582
  </strong>
583
  <div>
584
+ <?php
585
+ yasr_select_itemtype( 'yasr-choose-reviews-types-list', 'yasr_general_options[snippet_itemtype]', $option['snippet_itemtype'] );
586
+ ?>
 
 
 
587
 
588
  <div class="yasr-element-row-container-description">
589
+ <?php
590
+ esc_html_e( 'You can always change itemType in the single post or page.', 'yet-another-stars-rating' );
591
+ ?>
 
592
  </div>
593
 
594
+ <?php
595
+ $option_title = __( 'Choose whether the site represents an organization or a person.', 'yet-another-stars-rating' );
596
+ $array_options = array(
597
+ 'Organization' => 'Organization',
598
+ 'Person' => 'Person',
599
+ );
600
+ $default = $option['publisher'];
601
+ $name = 'yasr_general_options[publisher]';
602
+ $id = 'yasr-general-options-publisher';
603
+ echo yasr_kses( YasrPhpFieldsHelper::radio(
604
+ $option_title,
605
+ 'none',
606
+ $array_options,
607
+ $name,
608
+ $default,
609
+ $id
610
+ ) ) ;
611
+ ?>
612
  <br/>
613
  <input type='text' name='yasr_general_options[publisher_name]'
614
  id="yasr-general-options-publisher-name"
615
+ class="yasr-additional-info-inputs" <?php
616
+ printf( 'value="%s"', esc_attr( $publisher_name ) );
617
+ ?>
618
  maxlength="180"/>
619
  <div class="yasr-element-row-container-description">
620
  <label for="yasr-general-options-publisher-name">
621
+ <?php
622
+ esc_html_e( 'Publisher name (e.g. Google)', 'yet-another-stars-rating' );
623
+ ?>
624
  </label>
625
  </div>
626
 
627
  <input type='text' name='yasr_general_options[publisher_logo]'
628
  id="yasr-general-options-publisher-logo"
629
  class="yasr-blogPosting-additional-info-inputs"
630
+ <?php
631
+ printf( 'value="%s"', esc_url( $publisher_logo ) );
632
+ ?>
633
  maxlength="300"/>
634
  <div class="yasr-element-row-container-description">
635
  <label for="yasr-general-options-publisher-logo">
636
+ <?php
637
+ esc_html_e( 'Image Url (if empty siteicon will be used instead)', 'yet-another-stars-rating' );
638
+ ?>
639
  </label>
640
  </div>
641
  </div>
643
 
644
  <div class="yasr-settings-col-40" id="yasr-blogPosting-additional-info">
645
  <div class="yasr-help-box-settings" style="display:block">
646
+ <?php
647
+ echo wp_kses_post( sprintf( __( 'Please keep in mind that since September, 16, 2019 blogPosting itemType will
648
+ no show stars in SERP anymore. %sHere%s the announcement by Google.', 'yet-another-stars-rating' ), '<br /><br /><a href="https://webmasters.googleblog.com/2019/09/making-review-rich-results-more-helpful.html">', '</a>' ) ) ;
649
+ echo "<br /><br />" ;
650
+ echo wp_kses_post( sprintf( __( 'Also, %sread Google guidelines%s', 'yet-another-stars-rating' ), '<a href="https://developers.google.com/search/docs/data-types/review-snippet#guidelines">', '</a>.' ) ) ;
651
+ ?>
 
 
 
 
 
 
 
 
 
652
  </div>
653
  </div>
654
  </div>
655
+ <?php
656
+ submit_button( YASR_SAVE_All_SETTINGS_TEXT );
657
  ?>
658
 
659
  <hr />
660
+ <?php
661
+ }
662
+
663
+ //End function yasr_choose_snippet_callback
664
  /**
665
  * Display options for custom texts
666
  *
667
  * @author Dario Curvino <@dudo>
668
  * @param $option
669
  */
670
+ public function customText( $option )
671
+ {
672
  ?>
673
  <div>
674
+ <?php
675
+ $custom_text = array(
676
+ 'txt_before_overall' => array(
677
+ 'name' => 'text_before_overall',
678
+ 'description' => '&sup1; ' . esc_html__( 'Custom text to display before Overall Rating', 'yet-another-stars-rating' ),
679
+ 'id' => 'yasr-settings-custom-text-before-overall',
680
+ 'class' => 'yasr-general-options-text-before',
681
+ ),
682
+ 'txt_before_vv' => array(
683
+ 'name' => 'text_before_visitor_rating',
684
+ 'description' => '&sup2; ' . esc_html__( 'Custom text to display BEFORE Visitor Rating', 'yet-another-stars-rating' ),
685
+ 'id' => 'yasr-settings-custom-text-before-visitor',
686
+ 'class' => 'yasr-general-options-text-before',
687
+ ),
688
+ 'txt_after_vv' => array(
689
+ 'name' => 'text_after_visitor_rating',
690
+ 'description' => '&sup2; ' . esc_html__( 'Custom text to display AFTER Visitor Rating', 'yet-another-stars-rating' ),
691
+ 'id' => 'yasr-settings-custom-text-after-visitor',
692
+ 'class' => 'yasr-general-options-text-before',
693
+ ),
694
+ 'txt_login_required' => array(
695
+ 'name' => 'custom_text_must_sign_in',
696
+ 'description' => esc_html__( 'Custom text to display when login is required to vote', 'yet-another-stars-rating' ),
697
+ 'id' => 'yasr-settings-custom-text-must-sign-in',
698
+ 'class' => 'yasr-general-options-text-before',
699
+ ),
700
+ 'txt_vv_rating_saved' => array(
701
+ 'name' => 'custom_text_rating_saved',
702
+ 'description' => esc_html__( 'Custom text to display when rating is saved', 'yet-another-stars-rating' ),
703
+ 'id' => 'yasr-settings-custom-text-rating-saved',
704
+ 'class' => 'yasr-general-options-text-before',
705
+ ),
706
+ 'txt_vv_rating_updated' => array(
707
+ 'name' => 'custom_text_rating_updated',
708
+ 'description' => esc_html__( 'Custom text to display when rating is updated (only for logged in users)', 'yet-another-stars-rating' ),
709
+ 'id' => 'yasr-settings-custom-text-rating-updated',
710
+ 'class' => 'yasr-general-options-text-before',
711
+ ),
712
+ 'txt_vv_rated' => array(
713
+ 'name' => 'custom_text_user_voted',
714
+ 'description' => '&sup1; ' . esc_html__( 'Custom text to display when an user has already rated', 'yet-another-stars-rating' ),
715
+ 'id' => 'yasr-settings-custom-text-already-rated',
716
+ 'class' => 'yasr-general-options-text-before',
717
+ ),
718
+ );
719
+ ?>
 
720
  <div class="yasr-settings-row-45" id="yasr-general-options-custom-text">
721
+ <?php
722
+ self::echoSettingFields( $custom_text, $option );
723
+ ?>
724
  </div>
725
 
726
  <div class="yasr-help-box-settings" style="display: block">
727
+ <?php
728
+ $string_custom_overall = sprintf( __( '%s In these fields you can use %s pattern to show the rating (as text).', 'yet-another-stars-rating' ), '<strong>&sup1;</strong>', '<strong>%rating%</strong>' );
729
+ $string_custom_visitor = sprintf(
730
+ __( '%s In these fields you can use %s pattern to show the
731
+ total count, and %s pattern to show the average.', 'yet-another-stars-rating' ),
732
+ '<strong>&sup2;</strong>',
733
+ '<strong>%total_count%</strong>',
734
+ '<strong>%average%</strong>'
735
+ );
736
+ $description = esc_html__( 'Leave a field empty to disable it.', 'yet-another-stars-rating' );
737
+ $description .= '<p>' . $string_custom_overall . '</p>';
738
+ $description .= '<p>' . $string_custom_visitor . '</p>';
739
+ $description .= '<p>' . esc_html__( 'Allowed html tags:', 'yet-another-stars-rating' );
740
+ $description .= '<br /><strong>' . esc_html( '<strong>, <p>' ) . '</strong>' . '.</p>';
741
+ echo wp_kses_post( $description ) ;
742
+ ?>
 
 
743
  </div>
744
  <div style="padding-left: 10px; padding-bottom: 15px;">
745
  <p>
746
  <input type="button"
747
  id="yasr-settings-custom-texts"
748
  class="button"
749
+ value="<?php
750
+ esc_attr_e( 'Restore default strings', 'yet-another-stars-rating' );
751
+ ?>"
752
  >
753
  </p>
754
  </div>
755
  </div>
756
  <hr />
757
+ <?php
758
  }
759
+
760
  /**
761
  * Display options for advanced settings
762
  *
763
  * @author Dario Curvino <@dudo>
764
  * @param $option
765
  */
766
+ public function advancedSettings( $option )
767
+ {
768
  ?>
769
  <div class="yasr-settings-row-45">
770
  <div>
771
  <strong>
772
+ <?php
773
+ esc_html_e( 'Load results with AJAX?', 'yet-another-stars-rating' );
774
+ ?>
775
  </strong>
776
  <div class="yasr-onoffswitch-big">
777
  <input type="checkbox" name="yasr_general_options[enable_ajax]" class="yasr-onoffswitch-checkbox"
778
+ id="yasr-general-options-enable-ajax-switch" <?php
779
+ if ( $option['enable_ajax'] === 'yes' ) {
780
+ echo " checked='checked' " ;
781
+ }
782
+ ?> >
783
  <label class="yasr-onoffswitch-label" for="yasr-general-options-enable-ajax-switch">
784
  <span class="yasr-onoffswitch-inner"></span>
785
  <span class="yasr-onoffswitch-switch"></span>
786
  </label>
787
  </div>
788
  <br/>
789
+ <?php
790
+ esc_html_e( 'This should be enabled if you\'re using caching plugins.
791
+ Not required for yasr_overall_rating and yasr_multiset.', 'yet-another-stars-rating' );
792
+ $caching_plugin = new YasrFindCachingPlugins();
793
+ $caching_plugin_found = $caching_plugin->cachingPluginFound();
794
+ if ( $caching_plugin_found !== false ) {
795
+ echo wp_kses_post( '<div class="yasr-element-row-container-description">' . sprintf( __( 'Since you\'re using the caching plugin %s you should enable this.', 'yet-another-stars-rating' ), '<strong>' . $caching_plugin_found . '</strong>' ) . '</div>' ) ;
796
+ }
797
+ ?>
 
 
 
 
 
 
 
 
798
  </div>
799
  <div>
800
  <strong>
801
+ <?php
802
+ esc_html_e( 'Do you want to save ip address?', 'yet-another-stars-rating' );
803
+ ?>
804
  </strong>
805
  <div class="yasr-onoffswitch-big">
806
  <input type="checkbox" name="yasr_general_options[enable_ip]" class="yasr-onoffswitch-checkbox"
807
+ id="yasr-general-options-enable-ip-switch" <?php
808
+ if ( $option['enable_ip'] === 'yes' ) {
809
+ echo " checked='checked' " ;
810
+ }
811
+ ?> >
812
  <label class="yasr-onoffswitch-label" for="yasr-general-options-enable-ip-switch">
813
  <span class="yasr-onoffswitch-inner"></span>
814
  <span class="yasr-onoffswitch-switch"></span>
815
  </label>
816
  </div>
817
  <br/>
818
+ <?php
819
+ $string = sprintf(
820
+ __( 'Please note that to comply with the %s EU law, you %s MUST %s warn your users that you\'re storing their ip. %s
821
+ If in doubt, leave no.', 'yet-another-stars-rating' ),
822
+ '<a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation">GDPR</a>',
823
+ '<strong>',
824
+ '</strong>',
825
+ '<br />'
826
+ );
827
+ echo wp_kses_post( $string ) ;
828
+ ?>
829
  </div>
830
  </div>
831
+ <?php
832
+ }
833
+
834
+ //End function
835
  /**
836
  * Action to do before save data into the db
837
  *
841
  *
842
  * @return array
843
  */
844
+ public function sanitize( $option )
845
+ {
846
  //Array to return
847
  $output = array();
848
+ $tidy_installed = self::isTidyInstalled();
 
 
849
  // Loop through each of the incoming options
850
+ foreach ( $option as $key => $value ) {
851
  // Check to see if the current option has a value. If so, process it.
852
+
853
+ if ( isset( $option[$key] ) ) {
854
  //Tags are not allowed for any fields
855
  $allowed_tags = '';
 
856
  //except these ones
857
+
858
+ if ( $key === 'text_before_overall' || $key === 'text_before_visitor_rating' || $key === 'text_after_visitor_rating' || $key === 'custom_text_must_sign_in' || $key === 'custom_text_rating_saved' || $key === 'custom_text_rating_updated' || $key === 'custom_text_user_voted' ) {
 
 
 
859
  $allowed_tags = '<strong><p>';
 
860
  // handle quoted strings and allow some tags
861
+ $output[$key] = strip_tags( stripslashes( $option[$key] ), $allowed_tags );
 
862
  //if tidy extension is enabled, fix errors in html
863
+
864
+ if ( $tidy_installed === true ) {
865
+ $tidy = new Tidy();
866
+ $output[$key] = $tidy->repairString( $output[$key], array(
867
+ 'show-body-only' => true,
868
+ ) );
869
  }
870
+
871
+ } else {
 
872
  // handle quoted strings and allow no tags
873
+ $output[$key] = strip_tags( stripslashes( $option[$key] ), $allowed_tags );
874
  }
875
+
876
+ if ( $key === 'publisher_logo' ) {
877
  //if is not a valid url get_site_icon_url instead
878
+ if ( filter_var( $value, FILTER_VALIDATE_URL ) === false ) {
879
  $output[$key] = get_site_icon_url();
880
  }
881
  }
882
+ }
883
+
884
+ // end if
885
+ }
886
+ // end foreach
887
  /** The following steps are needed to avoid undefined index if a setting is saved to "no" **/
 
888
  //if in array doesn't exists [auto_insert_enabled] key, create it and set to 0
889
+
890
+ if ( !array_key_exists( 'auto_insert_enabled', $output ) ) {
891
  $output['auto_insert_enabled'] = 0;
892
+ } else {
 
 
893
  $output['auto_insert_enabled'] = 1;
894
  }
895
+
896
  //if in array doesn't exists [stars title] key, create it and set to 'no'
897
+
898
+ if ( !array_key_exists( 'stars_title', $output ) ) {
899
  $output['stars_title'] = 'no';
900
+ } else {
 
 
901
  $output['stars_title'] = 'yes';
902
  }
903
+
904
  //Same as above but for [show_overall_in_loop] key
905
+
906
+ if ( !array_key_exists( 'show_overall_in_loop', $output ) ) {
907
  $output['show_overall_in_loop'] = 'disabled';
908
+ } else {
 
 
909
  $output['show_overall_in_loop'] = 'enabled';
910
  }
911
+
912
  //Same as above but for [show_visitor_votes_in_loop] key
913
+
914
+ if ( !array_key_exists( 'show_visitor_votes_in_loop', $output ) ) {
915
  $output['show_visitor_votes_in_loop'] = 'disabled';
916
+ } else {
 
 
917
  $output['show_visitor_votes_in_loop'] = 'enabled';
918
  }
919
+
920
  //Same as above but for visitors_stats key
921
+
922
+ if ( !array_key_exists( 'visitors_stats', $output ) ) {
923
  $output['visitors_stats'] = 'no';
924
+ } else {
 
 
925
  $output['visitors_stats'] = 'yes';
926
  }
927
+
928
  //Same as above but for enable_ip key
929
+
930
+ if ( !array_key_exists( 'enable_ip', $output ) ) {
931
  $output['enable_ip'] = 'no';
932
+ } else {
 
 
933
  $output['enable_ip'] = 'yes';
934
  }
935
+
936
  //Same as above but for enable_ip key
937
+
938
+ if ( !array_key_exists( 'enable_ajax', $output ) ) {
939
  $output['enable_ajax'] = 'no';
940
+ } else {
 
 
941
  $output['enable_ajax'] = 'yes';
942
  }
943
+
944
  return $output;
 
945
  }
946
+
947
  /**
948
  * @author Dario Curvino <@dudo>
949
  * @since 2.4.7
951
  * @param $option
952
  * @param string $option_prefix
953
  */
954
+ public static function echoSettingFields( $elementsType_array, $option, $option_prefix = 'yasr_general_options' )
955
+ {
956
  $string_input = false;
957
+ $type = false;
958
+ foreach ( $elementsType_array as $property ) {
 
 
959
  //concatenate yasr_general_options with property name
960
+ $element_name = $option_prefix . '[' . $property['name'] . ']';
961
+
962
+ if ( isset( $property['type'] ) ) {
963
+
964
+ if ( $property['type'] === 'select' ) {
965
  $string_input = YasrPhpFieldsHelper::select(
966
+ '',
967
+ $property['label'],
968
+ $property['options'],
969
+ $property['name'],
970
+ '',
971
+ esc_attr( $option[$property['name']] )
972
+ );
973
+ } elseif ( $property['type'] === 'textarea' ) {
974
+ $string_input = YasrPhpFieldsHelper::textArea(
975
+ '',
976
+ '',
977
+ $property['name'],
978
+ '',
979
+ '',
980
+ esc_textarea( $option[$property['name']] )
981
  );
 
 
 
982
  }
983
+
984
+ } else {
985
+ $type = 'text';
986
+ $placeholder = ( isset( $property['placeholder'] ) ? $property['placeholder'] : '' );
 
987
  //if description exists, add another <div> before
988
+ $string_input = ( isset( $property['description'] ) && $property['description'] !== '' ? '<div>' : '' );
989
  $string_input .= YasrPhpFieldsHelper::text(
990
+ $property['class'],
991
+ '',
992
+ $element_name,
993
+ $property['id'],
994
+ $placeholder,
995
+ esc_attr( $option[$property['name']] )
996
  );
997
  }
998
+
999
+
1000
+ if ( isset( $property['description'] ) && $property['description'] !== '' ) {
1001
  $string_input .= '<div class="yasr-element-row-container-description">';
1002
+ $string_input .= esc_html( $property['description'] );
1003
  //if this is coming from "text field, close 2 divs"
1004
+ $string_input .= ( $type === 'text' ? '</div>' : '' );
1005
  $string_input .= '</div>';
1006
  }
1007
+
1008
+ echo yasr_kses( $string_input ) ;
 
1009
  }
1010
  }
1011
+
1012
  /**
1013
  * Returns the radio buttons that allow to select stars size
1014
  *
1023
  * @since 2.3.3
1024
  * @return string
1025
  */
1026
+ public static function radioSelectSize(
1027
+ $name,
1028
+ $class,
1029
+ $db_value = false,
1030
+ $id = false,
1031
+ $txt_label = true,
1032
+ $newline = false
1033
+ )
1034
+ {
1035
+ $array_size = array( 'small', 'medium', 'large' );
1036
+ $span_label = '';
1037
  $html_to_return = '';
1038
+ foreach ( $array_size as $size ) {
 
1039
  $id_string = $id . $size;
 
1040
  //must be inside for each, or when loop arrive to last element
1041
  //checked is defined
1042
  $checked = '';
 
1043
  //If db_value === false, there is no need to check for db value
1044
  //so checked is the medium star (i.e. ranking page)
1045
+
1046
+ if ( $db_value === false ) {
1047
+ if ( $size === 'medium' ) {
1048
+ $checked = 'checked';
1049
+ }
1050
+ } else {
1051
+ if ( $db_value === $size ) {
1052
  $checked = 'checked';
1053
  }
1054
  }
1055
+
1056
+
1057
+ if ( $txt_label !== false ) {
1058
+ $span_label = '<span class="yasr-text-options-size">' . __( ucwords( $size ), 'yet-another-stars-rating' ) . '</span>';
1059
+ if ( $newline !== false ) {
 
 
 
 
 
1060
  $span_label = '<br />' . $span_label;
1061
  }
1062
  }
1063
+
1064
+ $src = YASR_IMG_DIR . 'yasr-stars-' . $size . '.png';
1065
  $html_to_return .= sprintf(
1066
  '<div class="yasr-option-div">
1067
  <label for="%s">
1087
  $size,
1088
  $span_label
1089
  );
1090
+ }
1091
+ //end foreach
1092
+ return $html_to_return;
1093
+ }
1094
+
1095
+ /**
1096
+ * Print settings tabs
1097
+ *
1098
+ * @param $active_tab
1099
+ *
1100
+ * @return void
1101
+ */
1102
+ public static function printTabs( $active_tab )
1103
+ {
1104
+ ?>
1105
 
1106
+ <h2 class="nav-tab-wrapper yasr-no-underline">
1107
 
1108
+ <a href="?page=yasr_settings_page&tab=general_settings"
1109
+ id="general_settings"
1110
+ class="nav-tab <?php
1111
+ if ( $active_tab === 'general_settings' ) {
1112
+ echo 'nav-tab-active' ;
1113
+ }
1114
+ ?>">
1115
+ <?php
1116
+ esc_html_e( 'General Settings', 'yet-another-stars-rating' );
1117
+ ?>
1118
+ </a>
1119
+
1120
+ <a href="?page=yasr_settings_page&tab=style_options"
1121
+ id="style_options"
1122
+ class="nav-tab <?php
1123
+ if ( $active_tab === 'style_options' ) {
1124
+ echo 'nav-tab-active' ;
1125
+ }
1126
+ ?>">
1127
+ <?php
1128
+ esc_html_e( 'Aspect & Styles', 'yet-another-stars-rating' );
1129
+ ?>
1130
+ </a>
1131
+
1132
+ <a href="?page=yasr_settings_page&tab=manage_multi"
1133
+ id="manage_multi"
1134
+ class="nav-tab <?php
1135
+ if ( $active_tab === 'manage_multi' ) {
1136
+ echo 'nav-tab-active' ;
1137
+ }
1138
+ ?>">
1139
+ <?php
1140
+ esc_html_e( 'Multi Criteria', 'yet-another-stars-rating' );
1141
+ ?>
1142
+ </a>
1143
+
1144
+ <a href="?page=yasr_settings_page&tab=rankings"
1145
+ id="rankings"
1146
+ class="nav-tab <?php
1147
+ if ( $active_tab === 'rankings' ) {
1148
+ echo 'nav-tab-active' ;
1149
+ }
1150
+ ?>">
1151
+ <?php
1152
+ esc_html_e( "Rankings", 'yet-another-stars-rating' );
1153
+ ?>
1154
+ </a>
1155
+
1156
+ <?php
1157
+ do_action( 'yasr_add_settings_tab', $active_tab );
1158
+ $rating_plugin_exists = new YasrImportRatingPlugins();
1159
+
1160
+ if ( $rating_plugin_exists->searchWPPR() || $rating_plugin_exists->searchRMP() || $rating_plugin_exists->searchKKSR() || $rating_plugin_exists->searchMR() ) {
1161
+ ?>
1162
+ <a href="?page=yasr_settings_page&tab=migration_tools"
1163
+ id="migration_tools"
1164
+ class="nav-tab <?php
1165
+ if ( $active_tab === 'migration_tools' ) {
1166
+ echo 'nav-tab-active' ;
1167
+ }
1168
+ ?>">
1169
+ <?php
1170
+ esc_html_e( "Migration Tools", 'yet-another-stars-rating' );
1171
+ ?>
1172
+ </a>
1173
+ <?php
1174
+ }
1175
+
1176
+ ?>
1177
+
1178
+ </h2>
1179
+
1180
+ <?php
1181
+ }
1182
+
1183
+ /**
1184
+ * Return the description of auto insert
1185
+ *
1186
+ * @author Dario Curvino <@dudo>
1187
+ * @since 2.6.6
1188
+ * @return string
1189
+ */
1190
+ public function descriptionAutoInsert()
1191
+ {
1192
+ $name = esc_html__( 'Auto Insert Options', 'yet-another-stars-rating' );
1193
+ $div_desc = '<div class="yasr-settings-description">';
1194
+ $description = sprintf( esc_html__( 'Automatically adds YASR in your posts or pages. %s
1195
+ Disable this if you prefer to use shortcodes.', 'yet-another-stars-rating' ), '<br />' );
1196
+ $end_div = '</div>';
1197
+ return $name . $div_desc . $description . $end_div;
1198
+ }
1199
+
1200
+ /**
1201
+ * @author Dario Curvino <@dudo>
1202
+ * @since 2.6.6
1203
+ * @return string
1204
+ */
1205
+ public function descriptionStarsTitle()
1206
+ {
1207
+ $name = esc_html__( 'Enable stars next to the title?', 'yet-another-stars-rating' );
1208
+ $div_desc = '<div class="yasr-settings-description">';
1209
+ $description = esc_html__( 'Enable this if you want to show stars next to the title.', 'yet-another-stars-rating' );
1210
+ $description .= '<br />';
1211
+ $description .= esc_html__( 'Please note that this may not work with all themes', 'yet-another-stars-rating' );
1212
+ $end_div = '.</div>';
1213
+ return $name . $div_desc . $description . $end_div;
1214
+ }
1215
+
1216
+ /**
1217
+ * @author Dario Curvino <@dudo>
1218
+ * @since 2.6.6
1219
+ * @return string
1220
+ */
1221
+ public function descriptionArchivePage()
1222
+ {
1223
+ $name = esc_html__( 'Archive Pages', 'yet-another-stars-rating' );
1224
+ $div_desc = '<div class="yasr-settings-description">';
1225
+ $description = esc_html__( 'Enable or disable these settings if you want to show ratings in archive pages (categories, tags, etc.)', 'yet-another-stars-rating' );
1226
+ $end_div = '.</div>';
1227
+ return $name . $div_desc . $description . $end_div;
1228
+ }
1229
+
1230
+ /**
1231
+ * @author Dario Curvino <@dudo>
1232
+ * @since 2.6.6
1233
+ * @return string
1234
+ */
1235
+ public function descriptionVVStats()
1236
+ {
1237
+ $name = esc_html__( 'Show stats for visitors votes?', 'yet-another-stars-rating' );
1238
+ $div_desc = '<div class="yasr-settings-description">';
1239
+ $description = sprintf( esc_html__( 'Enable or disable the chart bar icon (and tooltip hover it) next to the %syasr_visitor_votes%s shortcode', 'yet-another-stars-rating' ), '<em>', '</em>' );
1240
+ $end_div = '.</div>';
1241
+ return $name . $div_desc . $description . $end_div;
1242
+ }
1243
+
1244
+ /**
1245
+ * @author Dario Curvino <@dudo>
1246
+ * @since 2.6.6
1247
+ * @return string
1248
+ */
1249
+ public function descriptionAllowVote()
1250
+ {
1251
+ $name = esc_html__( 'Who is allowed to vote?', 'yet-another-stars-rating' );
1252
+ $div_desc = '<div class="yasr-settings-description">';
1253
+ $description = sprintf(
1254
+ esc_html__( 'Select who can rate your posts for %syasr_visitor_votes%s and %syasr_visitor_multiset%s shortcodes', 'yet-another-stars-rating' ),
1255
+ '<em>',
1256
+ '</em>',
1257
+ '<em>',
1258
+ '</em>'
1259
+ );
1260
+ $end_div = '.</div>';
1261
+ return $name . $div_desc . $description . $end_div;
1262
+ }
1263
+
1264
+ /**
1265
+ * @author Dario Curvino <@dudo>
1266
+ * @since 2.6.6
1267
+ * @return string
1268
+ */
1269
+ public function descriptionCSTMTxt()
1270
+ {
1271
+ $name = esc_html__( 'Customize strings', 'yet-another-stars-rating' );
1272
+ $div_desc = '<div class="yasr-settings-description">';
1273
+ $description = '<p>' . esc_html__( 'Customize YASR strings.', 'yet-another-stars-rating' ) . '</p>';
1274
+ $end_div = '</div>';
1275
+ return $name . $div_desc . $description . $end_div;
1276
+ }
1277
+
1278
+ /**
1279
+ * @author Dario Curvino <@dudo>
1280
+ * @since 2.6.6
1281
+ * @return string
1282
+ */
1283
+ public function descriptionStructuredData()
1284
+ {
1285
+ $name = esc_html__( 'Stuctured data options', 'yet-another-stars-rating' );
1286
+ $div_desc = '<div class="yasr-settings-description">';
1287
+ $description = esc_html__( 'If ratings in a post or page are found, YASR will create structured data to show them in search results
1288
+ (SERP)', 'yet-another-stars-rating' );
1289
+ $description .= '<br /><a href="https://yetanotherstarsrating.com/docs/rich-snippet/reviewrating-and-aggregaterating/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_rischnippets_desc"
1290
+ target="_blank">';
1291
+ $description .= esc_html__( 'More info here', 'yet-another-stars-rating' );
1292
+ $description .= '</a>';
1293
+ $end_div = '.</div>';
1294
+ return $name . $div_desc . $description . $end_div;
1295
+ }
1296
+
1297
+ /**
1298
+ * @author Dario Curvino <@dudo>
1299
+ * @since 1.9.5
1300
+ */
1301
+ public static function printRightColumn()
1302
+ {
1303
+ add_thickbox();
1304
+ ?>
1305
+ <div id="yasr-settings-panel-right">
1306
+ <?php
1307
+ do_action( 'yasr_right_settings_panel_box' );
1308
+ self::upgradeBox();
1309
+ self::resourcesBox();
1310
+ self::buyCofee();
1311
+ self::relatedPlugins();
1312
+ self::askRating();
1313
+ ?>
1314
+ </div>
1315
+ <?php
1316
+ }
1317
+
1318
+ private static function upgradeBox()
1319
+ {
1320
+
1321
+ if ( yasr_fs()->is_free_plan() ) {
1322
+ ?>
1323
+
1324
+ <div class="yasr-donatedivdx">
1325
+ <h2 class="yasr-donate-title" style="color: #34A7C1">
1326
+ <?php
1327
+ esc_html_e( 'Upgrade to YASR Pro', 'yet-another-stars-rating' );
1328
+ ?>
1329
+ </h2>
1330
+ <div class="yasr-upgrade-to-pro">
1331
+ <ul>
1332
+ <li><strong><?php
1333
+ esc_html_e( 'User Reviews', 'yet-another-stars-rating' );
1334
+ ?></strong></li>
1335
+ <li><strong><?php
1336
+ esc_html_e( 'Custom Rankings', 'yet-another-stars-rating' );
1337
+ ?></strong></li>
1338
+ <li><strong><?php
1339
+ esc_html_e( '20+ ready to use themes', 'yet-another-stars-rating' );
1340
+ ?></strong></li>
1341
+ <li><strong><?php
1342
+ esc_html_e( 'Upload your own theme', 'yet-another-stars-rating' );
1343
+ ?></strong></li>
1344
+ <li><strong><?php
1345
+ esc_html_e( 'Fake ratings', 'yet-another-stars-rating' );
1346
+ ?></strong></li>
1347
+ <li><strong><?php
1348
+ esc_html_e( 'Dedicate support', 'yet-another-stars-rating' );
1349
+ ?></strong></li>
1350
+ <li>
1351
+ <strong>
1352
+ <a href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr-pro#yasr-pro">
1353
+ <?php
1354
+ esc_html_e( '...And much more!!', 'yet-another-stars-rating' );
1355
+ ?>
1356
+ </a>
1357
+ </strong>
1358
+ </li>
1359
+ </ul>
1360
+ <a href="<?php
1361
+ echo esc_url( yasr_fs()->get_upgrade_url() ) ;
1362
+ ?>">
1363
+ <button class="button button-primary">
1364
+ <span style="font-size: large; font-weight: bold;">
1365
+ <?php
1366
+ esc_html_e( 'Upgrade Now', 'yet-another-stars-rating' );
1367
+ ?>
1368
+ </span>
1369
+ </button>
1370
+ </a>
1371
+ <div style="display: block; margin-top: 10px; margin-bottom: 10px; ">
1372
+ --- or ---
1373
+ </div>
1374
+ <a href="<?php
1375
+ echo esc_url( yasr_fs()->get_trial_url() ) ;
1376
+ ?>">
1377
+ <button class="button button-primary">
1378
+ <span style="display: block; font-size: large; font-weight: bold; margin: -3px;">
1379
+ <?php
1380
+ esc_html_e( 'Start Free Trial', 'yet-another-stars-rating' );
1381
+ ?>
1382
+ </span>
1383
+ <span style="display: block; margin-top: -10px; font-size: smaller;">
1384
+ <?php
1385
+ esc_html_e( 'No credit-card, risk free!', 'yet-another-stars-rating' );
1386
+ ?>
1387
+ </span>
1388
+ </button>
1389
+ </a>
1390
+ </div>
1391
+ </div>
1392
+
1393
+ <?php
1394
+ }
1395
+
1396
+ }
1397
+
1398
+ /*
1399
+ * Add a box on with the resouces
1400
+ * Since version 1.9.5
1401
+ *
1402
+ */
1403
+ private static function resourcesBox()
1404
+ {
1405
+ ?>
1406
+
1407
+ <div class='yasr-donatedivdx' id='yasr-resources-box'>
1408
+ <div class="yasr-donate-title">Resources</div>
1409
+ <div class="yasr-donate-single-resource">
1410
+ <span class="dashicons dashicons-star-filled" style="color: #6c6c6c"></span>
1411
+ <a target="blank" href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_official">
1412
+ <?php
1413
+ esc_html_e( 'YASR official website', 'yet-another-stars-rating' );
1414
+ ?>
1415
+ </a>
1416
+ </div>
1417
+ <div class="yasr-donate-single-resource">
1418
+ <img src="<?php
1419
+ echo esc_attr( YASR_IMG_DIR . 'github.svg' ) ;
1420
+ ?>"
1421
+ width="20" height="20" alt="github logo" style="vertical-align: bottom;">
1422
+ <a target="blank" href="https://github.com/Dudo1985/yet-another-stars-rating">
1423
+ GitHub Page
1424
+ </a>
1425
+ </div>
1426
+ <div class="yasr-donate-single-resource">
1427
+ <span class="dashicons dashicons-edit" style="color: #6c6c6c"></span>
1428
+ <a target="blank" href="https://yetanotherstarsrating.com/docs/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=documentation">
1429
+ <?php
1430
+ esc_html_e( 'Documentation', 'yet-another-stars-rating' );
1431
+ ?>
1432
+ </a>
1433
+ </div>
1434
+ <div class="yasr-donate-single-resource">
1435
+ <span class="dashicons dashicons-video-alt3" style="color: #6c6c6c"></span>
1436
+ <a target="blank" href="https://www.youtube.com/channel/UCU5jbO1PJsUUsCNbME9S-Zw">
1437
+ <?php
1438
+ esc_html_e( 'Youtube channel', 'yet-another-stars-rating' );
1439
+ ?>
1440
+ </a>
1441
+ </div>
1442
+ <div class="yasr-donate-single-resource">
1443
+ <span class="dashicons dashicons-smiley" style="color: #6c6c6c"></span>
1444
+ <a target="blank" href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr-pro#yasr-pro">
1445
+ Yasr Pro
1446
+ </a>
1447
+ </div>
1448
+ </div>
1449
+
1450
+ <?php
1451
+ }
1452
+
1453
+ /**
1454
+ * Adds buy a cofee box
1455
+ *
1456
+ * @author Dario Curvino <@dudo>
1457
+ */
1458
+ private static function buyCofee()
1459
+ {
1460
+ $buymecofeetext = esc_html__( 'Coffee is vital to make YASR development going on!', 'yet-another-stars-rating' );
1461
+ $buymecofeetext .= '<br />';
1462
+
1463
+ if ( yasr_fs()->is_free_plan() ) {
1464
+ $buymecofeetext .= esc_html__( 'If you are enjoying YASR, and you don\'t need the pro version, please consider to buy me a coffee, thanks!', 'yet-another-stars-rating' );
1465
+ } else {
1466
+ $buymecofeetext .= esc_html__( 'If you are enjoying YASR, please consider to buy me a coffee, thanks!', 'yet-another-stars-rating' );
1467
+ }
1468
+
1469
+ $div = "<div class='yasr-donatedivdx' id='yasr-buy-cofee'>";
1470
+ $text = '<div class="yasr-donate-title">' . __( 'Buy me a coffee!', 'yet-another-stars-rating' ) . '</div>';
1471
+ $text .= '<div style="text-align: center">';
1472
+ $text .= '<a href="https://www.paypal.com/donate/?hosted_button_id=SVTAVUF62QZ4W" target="_blank">
1473
+ <img src="' . YASR_IMG_DIR . '/button_paypal.png" alt="paypal" width="200">
1474
+ </a>';
1475
+ $text .= '</div>';
1476
+ $text .= '<div style="margin-top: 15px;">';
1477
+ $text .= $buymecofeetext;
1478
+ $text .= '</div>';
1479
+ $div_and_text = $div . $text . '</div>';
1480
+ echo wp_kses_post( $div_and_text ) ;
1481
+ }
1482
+
1483
+ /**
1484
+ * Show related plugins
1485
+ *
1486
+ * @author Dario Curvino <@dudo>
1487
+ */
1488
+ private static function relatedPlugins()
1489
+ {
1490
+ $div = "<div class='yasr-donatedivdx' id='yasr-related-plugins'>";
1491
+ $text = '<div class="yasr-donate-title">' . esc_html__( 'You may also like...', 'yet-another-stars-rating' ) . '</div>';
1492
+ $text .= self::movieHelper();
1493
+ $text .= '<hr />';
1494
+ $text .= self::cnrt();
1495
+ $div_and_text = $div . $text . '</div>';
1496
+ echo wp_kses_post( $div_and_text ) ;
1497
+ }
1498
+
1499
+ /**
1500
+ * @author Dario Curvino <@dudo>
1501
+ * @since 2.9.3
1502
+ * @return string
1503
+ */
1504
+ private static function movieHelper()
1505
+ {
1506
+ $url = add_query_arg( array(
1507
+ 'tab' => 'plugin-information',
1508
+ 'plugin' => 'yet-another-movie',
1509
+ 'TB_iframe' => 'true',
1510
+ 'width' => '772',
1511
+ 'height' => '670',
1512
+ ), network_admin_url( 'plugin-install.php' ) );
1513
+ $movie_helper_description = esc_html__( 'Movie Helper allows you to easily add links to movie and tv shows, just by searching
1514
+ them while you\'re writing your content. Search, click, done!', 'yet-another-stars-rating' );
1515
+ $text = '<h4>Movie Helper</h4>';
1516
+ $text .= '<div style="margin-top: 15px;">';
1517
+ $text .= $movie_helper_description;
1518
+ $text .= '</div>';
1519
+ $text .= '<div style="margin-top: 15px;">
1520
+ <a href="' . esc_url( $url ) . '"
1521
+ class="install-now button thickbox open-plugin-details-modal"
1522
+ target="_blank">' . __( 'Install', 'yet-another-stars-rating' ) . '</a>';
1523
+ $text .= '</div>';
1524
+ return $text;
1525
+ }
1526
+
1527
+ /**
1528
+ * @author Dario Curvino <@dudo>
1529
+ * @since 2.9.3
1530
+ * @return string
1531
+ */
1532
+ private static function cnrt()
1533
+ {
1534
+ $url = add_query_arg( array(
1535
+ 'tab' => 'plugin-information',
1536
+ 'plugin' => 'comments-not-replied-to',
1537
+ 'TB_iframe' => 'true',
1538
+ 'width' => '772',
1539
+ 'height' => '670',
1540
+ ), network_admin_url( 'plugin-install.php' ) );
1541
+ $text = '<h4>Comments Not Replied To</h4>';
1542
+ $text .= '<div style="margin-top: 15px;">';
1543
+ $text .= esc_html__( '"Comments Not Replied To" introduces a new area in the administrative dashboard that allows you to
1544
+ see what comments to which you - as the site author - have not yet replied.', 'yet-another-stars-rating' );
1545
+ $text .= '</div>';
1546
+ $text .= '<div style="margin-top: 15px;">
1547
+ <a href="' . esc_url( $url ) . '"
1548
+ class="install-now button thickbox open-plugin-details-modal"
1549
+ target="_blank">' . __( 'Install', 'yet-another-stars-rating' ) . '</a>';
1550
+ $text .= '</div>';
1551
+ return $text;
1552
+ }
1553
+
1554
+ /** Add a box on the right for asking to rate 5 stars on Wordpress.org
1555
+ * Since version 0.9.0
1556
+ */
1557
+ private static function askRating()
1558
+ {
1559
+ $div = "<div class='yasr-donatedivdx' id='yasr-ask-five-stars'>";
1560
+ $text = '<div class="yasr-donate-title">' . esc_html__( 'Can I ask your help?', 'yet-another-stars-rating' ) . '</div>';
1561
+ $text .= '<div style="font-size: 32px; color: #F1CB32; text-align:center; margin-bottom: 20px; margin-top: -5px;">
1562
+ <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
1563
+ <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
1564
+ <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
1565
+ <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
1566
+ <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
1567
+ </div>';
1568
+ $text .= esc_html__( 'Please rate YASR 5 stars on', 'yet-another-stars-rating' );
1569
+ $text .= ' <a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5">
1570
+ WordPress.org.</a><br />';
1571
+ $text .= esc_html__( ' It will require just 1 min but it\'s a HUGE help for me. Thank you.', 'yet-another-stars-rating' );
1572
+ $text .= "<br /><br />";
1573
+ $text .= "<em>> Dario Curvino</em>";
1574
+ $div_and_text = $div . $text . '</div>';
1575
+ echo wp_kses_post( $div_and_text ) ;
1576
+ }
1577
+
1578
+ /*
1579
+ * @author Dario Curvino <@dudo>
1580
+ *
1581
+ * @param $text
1582
+ *
1583
+ * @return mixed|string
1584
+ */
1585
+ public function customFooter( $text )
1586
+ {
1587
+
1588
+ if ( isset( $_GET['page'] ) ) {
1589
+ $yasr_page = $_GET['page'];
1590
+
1591
+ if ( $yasr_page === 'yasr_settings_page' || $yasr_page === 'yasr_stats_page' ) {
1592
+ $custom_text = ' | <i>';
1593
+ $custom_text .= sprintf(
1594
+ esc_html__( 'Thank you for using %s. Please %s rate it%s 5 stars on %s', 'yet-another-stars-rating' ),
1595
+ '<a href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=footer&utm_campaign=yasr_settings"
1596
+ target="_blank">Yet Another Stars Rating</a>',
1597
+ '<a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5" target="_blank">',
1598
+ '</a>',
1599
+ '<a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5" target="_blank">
1600
+ WordPress.org</a>'
1601
+ );
1602
+ $custom_text .= '</i>';
1603
+ return $text . $custom_text;
1604
+ }
1605
+
1606
+ return $text;
1607
+ }
1608
+
1609
+ return $text;
1610
+ }
1611
+
1612
+ /**
1613
+ * Return true if tidy is installed and version is later than 25 Nov 2017, false otherwise
1614
+ *
1615
+ * @author Dario Curvino <@dudo>
1616
+ * @since 3.0.5
1617
+ * @return bool
1618
+ */
1619
+ public static function isTidyInstalled()
1620
+ {
1621
+
1622
+ if ( extension_loaded( 'tidy' ) ) {
1623
+ $tidy_release_date = strtotime( tidy_get_release() );
1624
+ $tidy_working_release_date = strtotime( '2017/11/25' );
1625
+ if ( $tidy_release_date >= $tidy_working_release_date ) {
1626
+ return true;
1627
+ }
1628
+ }
1629
+
1630
+ return false;
1631
  }
1632
 
1633
  }
admin/settings/classes/YasrSettingsMultiset.php CHANGED
@@ -70,24 +70,21 @@ class YasrSettingsMultiset {
70
  */
71
  public function addSettingsFields ($option_multiset) {
72
  add_settings_field(
73
- 'add_multi_set',
74
- yasr_multiset_description(),
75
  array($this, 'formCreateMultiset'),
76
  'yasr_new_multiset_form',
77
  'yasr_new_multiset_form_section_id'
78
  );
79
 
80
  add_settings_field(
81
- 'manage_multi_set',
82
- yasr_manage_multiset_description(),
83
  array($this, 'formManageMultiset'),
84
  'yasr_edit_multiset_form',
85
  'yasr_edit_multiset_form_section_id'
86
  );
87
 
88
  add_settings_field(
89
- 'yasr_multiset_hide_average_id',
90
- yasr_show_average_multiset_description(),
91
  array($this, 'hideAverage'),
92
  'yasr_multiset_tab',
93
  'yasr_multiset_options_section_id',
@@ -308,4 +305,70 @@ class YasrSettingsMultiset {
308
 
309
  }
310
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  }
70
  */
71
  public function addSettingsFields ($option_multiset) {
72
  add_settings_field(
73
+ 'add_multi_set', $this->descriptionMultiset(),
 
74
  array($this, 'formCreateMultiset'),
75
  'yasr_new_multiset_form',
76
  'yasr_new_multiset_form_section_id'
77
  );
78
 
79
  add_settings_field(
80
+ 'manage_multi_set', $this->descriptionManageMultiset(),
 
81
  array($this, 'formManageMultiset'),
82
  'yasr_edit_multiset_form',
83
  'yasr_edit_multiset_form_section_id'
84
  );
85
 
86
  add_settings_field(
87
+ 'yasr_multiset_hide_average_id', $this->descriptionShowAverage(),
 
88
  array($this, 'hideAverage'),
89
  'yasr_multiset_tab',
90
  'yasr_multiset_options_section_id',
305
 
306
  }
307
 
308
+ /**
309
+ * Describe what is a Multiset in the setting page
310
+ *
311
+ * @author Dario Curvino <@dudo>
312
+ * @since 3.1.3
313
+ * @return string
314
+ */
315
+ public function descriptionMultiset() {
316
+ $title = esc_html__('Multi-criteria based rating system.', 'yet-another-stars-rating');
317
+
318
+ $div = '<div class="yasr-settings-description">';
319
+
320
+ $description = sprintf(
321
+ esc_html__(
322
+ 'A Multi-criteria set allows you to insert a rating for each aspect of your review (up to nine rows).
323
+ %s Once you\'ve saved it, you can insert
324
+ the rates while typing your article in the %s box below the editor.%s %s
325
+ See it in action %s here%s .', 'yet-another-stars-rating'
326
+ ), '<br />', '<a href=' . esc_url(YASR_IMG_DIR . 'yasr-multi-set-insert-rating.png') . ' target="_blank">',
327
+ '</a>', '<br />', '<a href=' . esc_url(
328
+ "https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_newmultiset_desc#yasr-multiset-shortcodes"
329
+ ) . ' target="_blank">', '</a>'
330
+ );
331
+
332
+ return $title . $div . $description . '</div>';
333
+
334
+ }
335
+
336
+ /**
337
+ * Description for setting field "edit multiset"
338
+ *
339
+ * @author Dario Curvino <@dudo>
340
+ * @since 3.1.3
341
+ * @return string
342
+ */
343
+ public function descriptionManageMultiset() {
344
+ $title = esc_html__('Manage Multi Set', 'yet-another-stars-rating');
345
+
346
+ $div = '<div class="yasr-settings-description">';
347
+
348
+ $description = esc_html__('Add or remove an element, or the entire set.');
349
+
350
+ return $title . $div . $description . '</div>';
351
+ }
352
+
353
+ /**
354
+ * Show the description for "Show average" row in multi set setting page
355
+ *
356
+ * @author Dario Curvino <@dudo>
357
+ * @since 3.1.3
358
+ * @return string
359
+ */
360
+ public function descriptionShowAverage() {
361
+ $title = esc_html__('Show average?', 'yet-another-stars-rating');
362
+
363
+ $div = '<div class="yasr-settings-description">';
364
+
365
+ $description = esc_html__(
366
+ 'If you select no, the "Average" row will not be displayed.
367
+ You can override this in the single multi set by using the parameter "show_average".',
368
+ 'yet-another-stars-rating'
369
+ );
370
+
371
+ return $title . $div . $description . '</div>';
372
+ }
373
+
374
  }
admin/settings/classes/YasrSettingsRankings.php CHANGED
@@ -29,7 +29,7 @@ class YasrSettingsRankings {
29
 
30
  public function __construct($custom_post_types) {
31
  $this->custom_post_types = $custom_post_types;
32
- $this->multi_set_array = YasrMultiSetData::returnMultiSetNames();
33
 
34
  global $wpdb;
35
  //wpdb->num_rows always store the the count number of rows of the last query
29
 
30
  public function __construct($custom_post_types) {
31
  $this->custom_post_types = $custom_post_types;
32
+ $this->multi_set_array = YasrDB::returnMultiSetNames();
33
 
34
  global $wpdb;
35
  //wpdb->num_rows always store the the count number of rows of the last query
admin/settings/classes/YasrStats.php CHANGED
@@ -48,13 +48,13 @@ class YasrStats extends Yasr_WP_List_Table {
48
  $this->process_bulk_action();
49
 
50
  if ($this->active_tab === 'logs' || $this->active_tab === '') {
51
- $data = YasrDatabaseRatings::getAllVisitorVotes();
52
  }
53
  else if($this->active_tab === 'logs_multi') {
54
- $data = YasrMultiSetData::returnAllLogMulti();
55
  }
56
  else if($this->active_tab === 'overall') {
57
- $data = YasrDatabaseRatings::getAllOverallRatings();
58
  }
59
 
60
  usort($data, array( $this, 'sort_data' ));
48
  $this->process_bulk_action();
49
 
50
  if ($this->active_tab === 'logs' || $this->active_tab === '') {
51
+ $data = YasrDB::allVisitorVotes();
52
  }
53
  else if($this->active_tab === 'logs_multi') {
54
+ $data = YasrDB::returnAllLogMulti();
55
  }
56
  else if($this->active_tab === 'overall') {
57
+ $data = YasrDB::allOverallRatings();
58
  }
59
 
60
  usort($data, array( $this, 'sort_data' ));
admin/settings/migrations/yasr-settings-migration-functions.php DELETED
@@ -1,303 +0,0 @@
1
- <?php
2
-
3
- /*
4
-
5
- Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
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
- add_action( 'wp_ajax_yasr_import_wppr', 'yasr_import_wppr_callback' );
26
-
27
- function yasr_import_wppr_callback() {
28
-
29
- if($_POST['nonce']) {
30
- $nonce = $_POST['nonce'];
31
- } else {
32
- exit();
33
- }
34
-
35
- if (!wp_verify_nonce( $nonce, 'yasr-import-wppr-action' ) ) {
36
- die('Error while checking nonce');
37
- }
38
-
39
- if (!current_user_can( 'manage_options' ) ) {
40
- die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
41
- }
42
-
43
- global $wpdb;
44
-
45
- //get logs
46
- //With Wp Post Rating I need to import postmeta.
47
- //It has his own table too, but can be disabled in the settings.
48
- //The only way to be sure is get the postmeta
49
-
50
- $wppr = new YasrImportRatingPlugins();
51
-
52
- $logs = $wppr->yasr_return_wppr_data();
53
-
54
- if(empty($logs)) {
55
- echo json_encode(esc_html__('No WP Post Rating data found'));
56
- } else {
57
- $result = false;
58
-
59
- /****** Insert logs ******/
60
- foreach ($logs as $column) {
61
-
62
- if($column->ratings_average > 5) {
63
- $column->ratings_average = 5;
64
- }
65
-
66
- for ($i=1; $i<=$column->ratings_users; $i++) {
67
-
68
- //check if rating_average is not null.
69
- //I found out that sometimes Wp Post Rating can save value with null data (sigh!!)
70
- if ($column->ratings_average !== null) {
71
-
72
- $result = $wpdb->replace(
73
- YASR_LOG_TABLE,
74
- array(
75
- 'post_id' => $column->post_id,
76
- 'user_id' => 0, //not stored on wp post rating
77
- 'vote' => $column->ratings_average,
78
- 'date' => 'wppostrating', //not stored on wp post rating
79
- 'ip' => 'wppostrating'//not stored on wp post rating
80
- ),
81
- array('%d', '%d', '%f', '%s', '%s')
82
- );
83
- }
84
- }
85
- }
86
-
87
- if ($result) {
88
- yasr_save_option_imported_plugin('wppr');
89
-
90
- $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
91
- echo json_encode($string_to_return);
92
- }
93
-
94
- }
95
- die();
96
- }
97
-
98
- add_action( 'wp_ajax_yasr_import_kksr', 'yasr_import_kksr_callback' );
99
-
100
- function yasr_import_kksr_callback() {
101
-
102
- if($_POST['nonce']) {
103
- $nonce = $_POST['nonce'];
104
- } else {
105
- exit();
106
- }
107
-
108
- if (!wp_verify_nonce( $nonce, 'yasr-import-kksr-action' ) ) {
109
- die('Error while checking nonce');
110
- }
111
-
112
- if (!current_user_can( 'manage_options' ) ) {
113
- die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
114
- }
115
-
116
- global $wpdb;
117
-
118
- //get logs
119
- //With KK star rating I need to import postmeta.
120
- $kksr = new YasrImportRatingPlugins();
121
-
122
- $logs= $kksr->yasr_return_kksr_data();
123
-
124
- if(empty($logs)) {
125
- echo json_encode(esc_html__('No KK Star Ratings data found'));
126
- } else {
127
- $result = false;
128
-
129
- /****** Insert logs ******/
130
- foreach ($logs as $column) {
131
- if($column->ratings_average > 5) {
132
- $column->ratings_average = 5;
133
- }
134
-
135
- for ($i=1; $i<=$column->ratings_users; $i++) {
136
- $result = $wpdb->replace(
137
- YASR_LOG_TABLE,
138
- array(
139
- 'post_id' => $column->post_id,
140
- 'user_id' => 0, //not stored on KK star rating
141
- 'vote' => $column->ratings_average,
142
- 'date' => 'kkstarratings', //not stored KK star rating
143
- 'ip' => 'kkstarratings'//not stored KK star rating
144
- ),
145
- array('%d', '%d', '%f', '%s', '%s')
146
- );
147
- }
148
- }
149
-
150
- if ($result) {
151
- yasr_save_option_imported_plugin('kksr');
152
-
153
- $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
154
- echo json_encode($string_to_return);
155
- }
156
-
157
- }
158
- die();
159
- }
160
-
161
- add_action( 'wp_ajax_yasr_import_ratemypost', 'yasr_import_ratemypost_callback' );
162
-
163
- function yasr_import_ratemypost_callback() {
164
-
165
- if($_POST['nonce']) {
166
- $nonce = $_POST['nonce'];
167
- } else {
168
- exit();
169
- }
170
-
171
- if (!wp_verify_nonce($nonce, 'yasr-import-ratemypost-action')) {
172
- die('Error while checking nonce');
173
- }
174
-
175
- if (!current_user_can( 'manage_options' ) ) {
176
- die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
177
- }
178
-
179
- global $wpdb;
180
-
181
- $rmp = new YasrImportRatingPlugins();
182
-
183
- //get logs
184
- $logs=$rmp->yasr_return_rmp_data();
185
-
186
- if(empty($logs)) {
187
- echo json_encode(esc_html__('No Rate My Post data found'));
188
- } else {
189
- $result = false;
190
-
191
- /****** Insert logs ******/
192
- foreach ($logs as $column) {
193
- $result = $wpdb->replace(
194
- YASR_LOG_TABLE,
195
- array(
196
- 'post_id' => $column->post_id,
197
- 'user_id' => 0, //seems like rate my post store all users like -1, so I cant import the user_id
198
- 'vote' => $column->vote,
199
- 'date' => $column->date,
200
- 'ip' => 'ratemypost'
201
- ),
202
- array('%d', '%d', '%f', '%s', '%s')
203
- );
204
- }
205
-
206
- if ($result) {
207
- yasr_save_option_imported_plugin('rmp');
208
-
209
- $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
210
- echo json_encode($string_to_return);
211
- }
212
- }
213
- die();
214
- }
215
-
216
- add_action( 'wp_ajax_yasr_import_mr', 'yasr_import_mr_callback' );
217
-
218
- function yasr_import_mr_callback() {
219
-
220
- if($_POST['nonce']) {
221
- $nonce = $_POST['nonce'];
222
- } else {
223
- exit();
224
- }
225
-
226
- if (!wp_verify_nonce( $nonce, 'yasr-import-mr-action' ) ) {
227
- die('Error while checking nonce');
228
- }
229
-
230
- if (!current_user_can( 'manage_options' ) ) {
231
- die(esc_html__( 'You do not have sufficient permissions to access this page.', 'yet-another-stars-rating' ));
232
- }
233
-
234
- global $wpdb;
235
-
236
- $mr_exists = new YasrImportRatingPlugins();
237
-
238
- //get logs
239
- //With Multi Rating I need to import postmeta.
240
- $logs=$mr_exists->yasr_return_mr_data();
241
-
242
- if(empty($logs)) {
243
- echo json_encode(esc_html__('No Multi Rating data found'));
244
- } else {
245
- $result = false;
246
-
247
- /****** Insert logs ******/
248
- foreach ($logs as $column) {
249
-
250
- if($column->ratings_average > 5) {
251
- $column->ratings_average = 5;
252
- }
253
-
254
- for ($i=1; $i<=$column->ratings_users; $i++) {
255
- $result = $wpdb->replace(
256
- YASR_LOG_TABLE,
257
- array(
258
- 'post_id' => $column->post_id,
259
- 'user_id' => 0, //not stored on KK star rating
260
- 'vote' => $column->ratings_average,
261
- 'date' => 'multirating', //not stored KK star rating
262
- 'ip' => 'multirating'//not stored KK star rating
263
- ),
264
- array('%d', '%d', '%f', '%s', '%s')
265
- );
266
- }
267
- }
268
-
269
- if ($result) {
270
- yasr_save_option_imported_plugin('mr');
271
-
272
- $string_to_return = esc_html__('Woot! All data have been imported!', 'yet-another-stars-rating');
273
- echo json_encode($string_to_return);
274
- }
275
-
276
- }
277
-
278
- die();
279
- }
280
-
281
- function yasr_save_option_imported_plugin($plugin) {
282
-
283
- //get actual data
284
- $plugin_imported = get_option('yasr_plugin_imported');
285
- //Add plugin just imported as a key
286
- $plugin_imported[$plugin] = array('date' => date('Y-m-d H:i:s'));
287
- //update option
288
- update_option('yasr_plugin_imported', $plugin_imported, false);
289
- }
290
-
291
- function yasr_import_plugin_alert_box($plugin, $number_of_queries) {
292
-
293
- echo '<div class="yasr-alert-box">';
294
- echo wp_kses_post(sprintf(__(
295
- 'To import %s seems like %s %d %s INSERT queries are necessary. %s
296
- There is nothing wrong with that, but some hosting provider can have a query limit/hour. %s
297
- I strongly suggest to contact your hosting and ask about your plan limit',
298
- 'yet-another-stars-rating'
299
- ),$plugin, '<strong>', $number_of_queries, '</strong>', '<br />','<br />'));
300
- echo '</div>';
301
-
302
- }
303
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/settings/migrations/yasr-settings-migration-page.php DELETED
@@ -1,265 +0,0 @@
1
- <?php
2
-
3
- /*
4
-
5
- Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
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
- $plugin_imported = get_option('yasr_plugin_imported');
26
-
27
- ?>
28
-
29
- <h3><?php esc_html_e('Migration Tools', 'yet-another-stars-rating'); ?></h3>
30
-
31
- <table class="form-table yasr-settings-table" id="yasr-migrate-table">
32
- <tr>
33
- <td>
34
- <div>
35
- <?php
36
- $rating_plugin_exists = new YasrImportRatingPlugins;
37
-
38
- if (!$rating_plugin_exists->yasr_search_wppr() && !$rating_plugin_exists->yasr_search_rmp()
39
- && !$rating_plugin_exists->yasr_search_kksr() && !$rating_plugin_exists->yasr_search_mr()) {
40
- ?>
41
- <span class="title-noplugin-found">
42
- <?php esc_html_e('No supported plugin has been found' , 'yet-another-stars-rating'); ?>
43
- </span>
44
- <?php
45
- }
46
-
47
- if($rating_plugin_exists->yasr_search_wppr()){
48
- $nonce_import_wppr = wp_create_nonce('yasr-import-wppr-action');
49
- ?>
50
- <span class="title-plugin-found">
51
- <?php esc_html_e('Plugin found: WP-PostRatings' , 'yet-another-stars-rating'); ?>
52
- </span>
53
- <?php
54
-
55
- $number_of_stars = (int)get_option('postratings_max', false);
56
-
57
- if ($number_of_stars && $number_of_stars !== 5) {
58
- $error = '<div class="yasr-indented-answer" style="margin-top: 10px;">';
59
- $error .= sprintf(__('You\' re using a star set different from 5 %s
60
- Import can not be done', 'yet-another-stars-rating'), '<br />');
61
- $error .= '</div>';
62
- echo wp_kses_post($error);
63
- } else {
64
- $info = '<div class="yasr-indented-answer" style="margin-top: 10px;">';
65
- $info .= sprintf(__(
66
- '%s Please note: %s depending on the settings, Wp-PostRatings may save data in different ways. %s
67
- The only way to be sure to get ALL data is, for every single post or page, getting the total
68
- number of votes, and save the current average as the rating for all votes. %s
69
- E.g. A post has 130 votes with an average of 4.4: since is impossible to know the single rating,
70
- Yasr will import 130 votes with an average of 4.4. %s
71
- Because of this, statistics in front end will be disabled for all post or page published before
72
- the import.',
73
- 'yet-another-stars-rating'
74
- ), '<strong>', '</strong>', '<br />', '<br />', '<br />');
75
- $info.='</div>';
76
-
77
- echo wp_kses_post($info);
78
-
79
- if (is_array($plugin_imported) && array_key_exists('wppr', $plugin_imported)) {
80
- echo wp_kses_post('<div class="yasr-indented-answer" style="margin-top: 10px;">'
81
- . __('You\'ve already imported WP-PostRatings data on', 'yet-another-stars-rating') .
82
- '&nbsp;<strong>' . $plugin_imported['wppr']['date'] . '</strong>
83
- </div>');
84
- } else {
85
-
86
- $number_of_queries_wppr = (int) $rating_plugin_exists->yasr_count_wppr_query_number();
87
-
88
- if ($number_of_queries_wppr > 1000) {
89
- yasr_import_plugin_alert_box('WP-PostRatings', $number_of_queries_wppr);
90
- }
91
-
92
- ?>
93
- <div class="yasr-indented-answer">
94
- <button class="button-primary" id="yasr-import-wppr-submit">
95
- <?php esc_html_e('Import data', 'yet-another-stars-rating') ?>
96
- </button>
97
- <input type="hidden" id="yasr-import-wppr-nonce"
98
- value="<?php echo esc_attr($nonce_import_wppr) ?>">
99
- </div>
100
- <div id="yasr-import-wppr-answer" class="yasr-indented-answer">
101
- </div>
102
-
103
- <div class="yasr-space-settings-div">
104
- </div>
105
-
106
- <?php
107
- }
108
-
109
- }
110
- ?>
111
-
112
- <?php
113
- }
114
-
115
- if($rating_plugin_exists->yasr_search_kksr()){
116
- $nonce_import_kksr = wp_create_nonce('yasr-import-kksr-action');
117
- ?>
118
- <span class="title-plugin-found">
119
- <?php esc_html_e('Plugin found: KK Star Ratings' , 'yet-another-stars-rating'); ?>
120
- </span>
121
- <?php
122
-
123
- echo '<div class="yasr-indented-answer" style="margin-top: 10px;">';
124
- echo sprintf(__(
125
- '%s Please note: %s KK Star Ratings doesn\'t save information about the single vote. %s
126
- The only way to be sure to get ALL data is, for every single post or page, getting the total
127
- number of votes, and save the current average as the rating for all votes. %s
128
- E.g. A post has 130 votes with an average of 4.4: since is impossible to know the single rating,
129
- Yasr will import 130 votes with an average of 4.4 %s
130
- Because of this, statistics in front end will be disabled for all post or page published before
131
- the import.%s
132
- If you use a rating scale different than 1 to 5, all ratings will be converted to work with a
133
- 5 ratings star scale.',
134
- 'yet-another-stars-rating'
135
- ), '<strong>', '</strong>', '<br />', '<br />', '<br />', '<br />');
136
- echo '</div>';
137
-
138
- if (is_array($plugin_imported) && array_key_exists('kksr', $plugin_imported)) {
139
- echo '<div class="yasr-indented-answer" style="margin-top: 10px;">'
140
- .__('You\'ve already imported KK Star Rating data on', 'yet-another-stars-rating').
141
- '&nbsp;<strong>'.$plugin_imported['kksr']['date']. '</strong>
142
- </div>';
143
- } else {
144
-
145
- $number_of_queries_kksr = (int)$rating_plugin_exists->yasr_count_kksr_query_number();
146
-
147
- if($number_of_queries_kksr > 1000) {
148
- yasr_import_plugin_alert_box ('KK Stars Rating', $number_of_queries_kksr);
149
- }
150
-
151
- ?>
152
- <div class="yasr-indented-answer">
153
- <button class="button-primary" id="yasr-import-kksr-submit">
154
- <?php esc_html_e('Import data', 'yet-another-stars-rating') ?>
155
- </button>
156
- <input type="hidden" id="yasr-import-kksr-nonce" value="<?php echo $nonce_import_kksr ?>">
157
- </div>
158
- <div id="yasr-import-kksr-answer" class="yasr-indented-answer">
159
- </div>
160
-
161
- <div class="yasr-space-settings-div">
162
- </div>
163
-
164
- <?php
165
- }
166
- ?>
167
-
168
- <?php
169
- }
170
-
171
- if($rating_plugin_exists->yasr_search_rmp()) {
172
- $nonce_import_rmp = wp_create_nonce('yasr-import-ratemypost-action');
173
- ?>
174
- <span class="title-plugin-found">
175
- <?php esc_html_e('Plugin found: Rate My Post' , 'yet-another-stars-rating'); ?>
176
- </span>
177
- <?php
178
- if (is_array($plugin_imported) && array_key_exists('rmp', $plugin_imported)) {
179
- echo '<div class="yasr-indented-answer">'
180
- .__('You\'ve already imported Rate My Post data on', 'yet-another-stars-rating').
181
- '&nbsp;<strong>'.$plugin_imported['rmp']['date']. '</strong>
182
- </div>';
183
- } else {
184
- $number_of_queries_rmp = (int)$rating_plugin_exists->yasr_count_rmp_query_number();
185
-
186
- if($number_of_queries_rmp > 1000) {
187
- yasr_import_plugin_alert_box ('Rate My Post', $number_of_queries_rmp);
188
- }
189
- ?>
190
- <div class="yasr-indented-answer">
191
- <button class="button-primary" id="yasr-import-ratemypost-submit">
192
- <?php esc_html_e('Import data', 'yet-another-stars-rating') ?>
193
- </button>
194
- <input type="hidden" id="yasr-import-rmp-nonce" value="<?php echo $nonce_import_rmp ?>">
195
- </div>
196
- <div id="yasr-import-ratemypost-answer" class="yasr-indented-answer">
197
- </div>
198
- <?php
199
- }
200
- ?>
201
-
202
- <?php
203
- }
204
-
205
- if($rating_plugin_exists->yasr_search_mr()){
206
- $nonce_import_mr = wp_create_nonce('yasr-import-mr-action');
207
- ?>
208
- <span class="title-plugin-found">
209
- <?php esc_html_e('Plugin found: Multi Rating' , 'yet-another-stars-rating'); ?>
210
- </span>
211
- <?php
212
-
213
- echo '<div class="yasr-indented-answer" style="margin-top: 10px;">';
214
- echo sprintf(__(
215
- '%s Please note: %s depending on the settings, Multi Rating may save data in different ways. %s
216
- The only way to be sure to get ALL data is, for every single post or page, getting the total
217
- number of votes, and save the current average as the rating for all votes. %s
218
- E.g. A post has 130 votes with an average of 4.4: since is impossible to know the single rating,
219
- YASR will import 130 votes with an average of 4.4. %s
220
- Because of this, statistics in front end will be disabled for all post or page published before
221
- the import.',
222
- 'yet-another-stars-rating'
223
- ), '<strong>', '</strong>', '<br />', '<br />', '<br />');
224
- echo '</div>';
225
-
226
- if (is_array($plugin_imported) && array_key_exists('mr', $plugin_imported)) {
227
- echo '<div class="yasr-indented-answer" style="margin-top: 10px;">'
228
- . __('You\'ve already imported Multi Rating data on', 'yet-another-stars-rating') .
229
- '&nbsp;<strong>' . $plugin_imported['mr']['date'] . '</strong>
230
- </div>';
231
- } else {
232
-
233
- $number_of_queries_mr = (int) $rating_plugin_exists->yasr_count_mr_query_number();
234
-
235
- if ($number_of_queries_mr > 1000) {
236
- yasr_import_plugin_alert_box('Multi Rating', $number_of_queries_mr);
237
- }
238
-
239
- ?>
240
- <div class="yasr-indented-answer">
241
- <button class="button-primary" id="yasr-import-mr-submit">
242
- <?php esc_html_e('Import data', 'yet-another-stars-rating') ?>
243
- </button>
244
- <input type="hidden" id="yasr-import-mr-nonce"
245
- value="<?php echo $nonce_import_mr ?>">
246
- </div>
247
- <div id="yasr-import-mr-answer" class="yasr-indented-answer">
248
- </div>
249
-
250
- <div class="yasr-space-settings-div">
251
- </div>
252
-
253
- <?php
254
- }
255
- }
256
-
257
- do_action('yasr_migration_page_bottom', $plugin_imported);
258
- ?>
259
- </div>
260
- </td>
261
- </tr>
262
-
263
- <!--Most or highest rated chart-->
264
-
265
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/settings/multiset/yasr-settings-functions-multiset-page.php CHANGED
@@ -49,7 +49,7 @@ if ($error_edit_multi_set) {
49
 
50
  global $wpdb;
51
 
52
- $multi_set = YasrMultiSetData::returnMultiSetNames();
53
  $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
54
 
55
  ?>
49
 
50
  global $wpdb;
51
 
52
+ $multi_set = YasrDB::returnMultiSetNames();
53
  $n_multi_set = $wpdb->num_rows; //wpdb->num_rows always store the last of the last query
54
 
55
  ?>
admin/settings/multiset/yasr-settings-functions-multiset.php CHANGED
@@ -28,7 +28,7 @@ function yasr_edit_multi_form() {
28
 
29
  global $wpdb;
30
 
31
- $multi_set = YasrMultiSetData::returnMultiSetNames();
32
 
33
  $n_multi_set = (int)$wpdb->num_rows; //wpdb->num_rows always store the last of the last query
34
 
28
 
29
  global $wpdb;
30
 
31
+ $multi_set = YasrDB::returnMultiSetNames();
32
 
33
  $n_multi_set = (int)$wpdb->num_rows; //wpdb->num_rows always store the last of the last query
34
 
admin/settings/{yasr-pricing-page.php → yasr-pricing-page.html} RENAMED
@@ -1,28 +1,3 @@
1
- <?php
2
- /*
3
-
4
- Copyright 2020 Dario Curvino (email : d.curvino@gmail.com)
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 2 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>
18
- */
19
-
20
- if (!defined('ABSPATH')) {
21
- exit('You\'re not allowed to see this page');
22
- } // Exit if accessed directly
23
-
24
- ?>
25
-
26
  <div id="money_back_guarantee_cont">
27
  <section id="money_back_guarantee">
28
  <h1>
@@ -39,8 +14,8 @@ if (!defined('ABSPATH')) {
39
  </b>
40
  </h1>
41
  <p>
42
- You are fully protected by our 100% Money Back Guarantee. If during the next 7 days you experience an issue
43
- that makes the plugin unusable and we are unable to resolve it, we'll happily consider offering a full refund
44
  of your money. <a id="yasr-link-policy" href="#">Learn more...</a>
45
  </p>
46
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <div id="money_back_guarantee_cont">
2
  <section id="money_back_guarantee">
3
  <h1>
14
  </b>
15
  </h1>
16
  <p>
17
+ You are fully protected by our 100% Money-Back Guarantee. If during the next 7 days you experience an issue
18
+ that makes the plugin unusable, and we are unable to resolve it, we'll happily consider offering a full refund
19
  of your money. <a id="yasr-link-policy" href="#">Learn more...</a>
20
  </p>
21
  </section>
admin/settings/yasr-settings-functions-misc.php DELETED
@@ -1,576 +0,0 @@
1
- <?php
2
-
3
- if ( !defined( 'ABSPATH' ) ) {
4
- exit( 'You\'re not allowed to see this page' );
5
- }
6
- // Exit if accessed directly
7
- /**Drow settings tab*/
8
- function yasr_settings_tabs( $active_tab )
9
- {
10
- ?>
11
-
12
- <h2 class="nav-tab-wrapper yasr-no-underline">
13
-
14
- <a href="?page=yasr_settings_page&tab=general_settings"
15
- id="general_settings"
16
- class="nav-tab <?php
17
- if ( $active_tab === 'general_settings' ) {
18
- echo 'nav-tab-active' ;
19
- }
20
- ?>">
21
- <?php
22
- esc_html_e( 'General Settings', 'yet-another-stars-rating' );
23
- ?>
24
- </a>
25
-
26
- <a href="?page=yasr_settings_page&tab=style_options"
27
- id="style_options"
28
- class="nav-tab <?php
29
- if ( $active_tab === 'style_options' ) {
30
- echo 'nav-tab-active' ;
31
- }
32
- ?>">
33
- <?php
34
- esc_html_e( 'Aspect & Styles', 'yet-another-stars-rating' );
35
- ?>
36
- </a>
37
-
38
- <a href="?page=yasr_settings_page&tab=manage_multi"
39
- id="manage_multi"
40
- class="nav-tab <?php
41
- if ( $active_tab === 'manage_multi' ) {
42
- echo 'nav-tab-active' ;
43
- }
44
- ?>">
45
- <?php
46
- esc_html_e( 'Multi Criteria', 'yet-another-stars-rating' );
47
- ?>
48
- </a>
49
-
50
- <a href="?page=yasr_settings_page&tab=rankings"
51
- id="rankings"
52
- class="nav-tab <?php
53
- if ( $active_tab === 'rankings' ) {
54
- echo 'nav-tab-active' ;
55
- }
56
- ?>">
57
- <?php
58
- esc_html_e( "Rankings", 'yet-another-stars-rating' );
59
- ?>
60
- </a>
61
-
62
- <?php
63
- do_action( 'yasr_add_settings_tab', $active_tab );
64
- $rating_plugin_exists = new YasrImportRatingPlugins();
65
-
66
- if ( $rating_plugin_exists->yasr_search_wppr() || $rating_plugin_exists->yasr_search_rmp() || $rating_plugin_exists->yasr_search_kksr() || $rating_plugin_exists->yasr_search_mr() ) {
67
- ?>
68
- <a href="?page=yasr_settings_page&tab=migration_tools"
69
- id="migration_tools"
70
- class="nav-tab <?php
71
- if ( $active_tab === 'migration_tools' ) {
72
- echo 'nav-tab-active' ;
73
- }
74
- ?>">
75
- <?php
76
- esc_html_e( "Migration Tools", 'yet-another-stars-rating' );
77
- ?>
78
- </a>
79
- <?php
80
- }
81
-
82
- ?>
83
-
84
- </h2>
85
-
86
- <?php
87
- }
88
-
89
- /**
90
- * Return the description of auto insert
91
- *
92
- * @author Dario Curvino <@dudo>
93
- * @since 2.6.6
94
- * @return string
95
- */
96
- function yasr_description_auto_insert()
97
- {
98
- $name = esc_html__( 'Auto Insert Options', 'yet-another-stars-rating' );
99
- $div_desc = '<div class="yasr-settings-description">';
100
- $description = sprintf( esc_html__( 'Automatically adds YASR in your posts or pages. %s
101
- Disable this if you prefer to use shortcodes.', 'yet-another-stars-rating' ), '<br />' );
102
- $end_div = '</div>';
103
- return $name . $div_desc . $description . $end_div;
104
- }
105
-
106
- /**
107
- * @author Dario Curvino <@dudo>
108
- * @since 2.6.6
109
- *
110
- * @return string
111
- */
112
- function yasr_description_stars_title()
113
- {
114
- $name = esc_html__( 'Enable stars next to the title?', 'yet-another-stars-rating' );
115
- $div_desc = '<div class="yasr-settings-description">';
116
- $description = esc_html__( 'Enable this if you want to show stars next to the title.', 'yet-another-stars-rating' );
117
- $description .= '<br />';
118
- $description .= esc_html__( 'Please note that this may not work with all themes', 'yet-another-stars-rating' );
119
- $end_div = '.</div>';
120
- return $name . $div_desc . $description . $end_div;
121
- }
122
-
123
- /**
124
- * @author Dario Curvino <@dudo>
125
- * @since 2.6.6
126
- * @return string
127
- */
128
- function yasr_description_archive_page()
129
- {
130
- $name = esc_html__( 'Archive Pages', 'yet-another-stars-rating' );
131
- $div_desc = '<div class="yasr-settings-description">';
132
- $description = esc_html__( 'Enable or disable these settings if you want to show ratings in archive pages (categories, tags, etc.)', 'yet-another-stars-rating' );
133
- $end_div = '.</div>';
134
- return $name . $div_desc . $description . $end_div;
135
- }
136
-
137
- /**
138
- * @author Dario Curvino <@dudo>
139
- * @since 2.6.6
140
- * @return string
141
- */
142
- function yasr_description_vv_stats()
143
- {
144
- $name = esc_html__( 'Show stats for visitors votes?', 'yet-another-stars-rating' );
145
- $div_desc = '<div class="yasr-settings-description">';
146
- $description = sprintf( esc_html__( 'Enable or disable the chart bar icon (and tooltip hover it) next to the %syasr_visitor_votes%s shortcode', 'yet-another-stars-rating' ), '<em>', '</em>' );
147
- $end_div = '.</div>';
148
- return $name . $div_desc . $description . $end_div;
149
- }
150
-
151
- /**
152
- * @author Dario Curvino <@dudo>
153
- * @since 2.6.6
154
- * @return string
155
- */
156
- function yasr_description_allow_vote()
157
- {
158
- $name = esc_html__( 'Who is allowed to vote?', 'yet-another-stars-rating' );
159
- $div_desc = '<div class="yasr-settings-description">';
160
- $description = sprintf(
161
- esc_html__( 'Select who can rate your posts for %syasr_visitor_votes%s and %syasr_visitor_multiset%s shortcodes', 'yet-another-stars-rating' ),
162
- '<em>',
163
- '</em>',
164
- '<em>',
165
- '</em>'
166
- );
167
- $end_div = '.</div>';
168
- return $name . $div_desc . $description . $end_div;
169
- }
170
-
171
- /**
172
- * Describe what is a Multiset in the setting page
173
- *
174
- * @author Dario Curvino <@dudo>
175
- * @since 3.1.3
176
- * @return string
177
- */
178
- function yasr_multiset_description()
179
- {
180
- $title = esc_html__( 'Multi-criteria based rating system.', 'yet-another-stars-rating' );
181
- $div = '<div class="yasr-settings-description">';
182
- $description = sprintf(
183
- esc_html__( 'A Multi-criteria set allows you to insert a rating for each aspect of your review (up to nine rows).
184
- %s Once you\'ve saved it, you can insert
185
- the rates while typing your article in the %s box below the editor.%s %s
186
- See it in action %s here%s .', 'yet-another-stars-rating' ),
187
- '<br />',
188
- '<a href=' . esc_url( YASR_IMG_DIR . 'yasr-multi-set-insert-rating.png' ) . ' target="_blank">',
189
- '</a>',
190
- '<br />',
191
- '<a href=' . esc_url( "https://yetanotherstarsrating.com/yasr-shortcodes/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_newmultiset_desc#yasr-multiset-shortcodes" ) . ' target="_blank">',
192
- '</a>'
193
- );
194
- return $title . $div . $description . '</div>';
195
- }
196
-
197
- /**
198
- * Description for setting field "edit multiset"
199
- *
200
- * @author Dario Curvino <@dudo>
201
- * @since 3.1.3
202
- * @return string
203
- */
204
- function yasr_manage_multiset_description()
205
- {
206
- $title = esc_html__( 'Manage Multi Set', 'yet-another-stars-rating' );
207
- $div = '<div class="yasr-settings-description">';
208
- $description = esc_html__( 'Add or remove an element, or the entire set.' );
209
- return $title . $div . $description . '</div>';
210
- }
211
-
212
- /**
213
- * Show the description for "Show average" row in multi set setting page
214
- *
215
- * @author Dario Curvino <@dudo>
216
- * @since 3.1.3
217
- * @return string
218
- */
219
- function yasr_show_average_multiset_description()
220
- {
221
- $title = esc_html__( 'Show average?', 'yet-another-stars-rating' );
222
- $div = '<div class="yasr-settings-description">';
223
- $description = esc_html__( 'If you select no, the "Average" row will not be displayed.
224
- You can override this in the single multi set by using the parameter "show_average".', 'yet-another-stars-rating' );
225
- return $title . $div . $description . '</div>';
226
- }
227
-
228
- /**
229
- * @author Dario Curvino <@dudo>
230
- * @since 2.6.6
231
- * @return string
232
- */
233
- function yasr_description_cstm_txt()
234
- {
235
- $name = esc_html__( 'Customize strings', 'yet-another-stars-rating' );
236
- $div_desc = '<div class="yasr-settings-description">';
237
- $description = '<p>' . esc_html__( 'Customize YASR strings.', 'yet-another-stars-rating' ) . '</p>';
238
- $end_div = '</div>';
239
- return $name . $div_desc . $description . $end_div;
240
- }
241
-
242
- /**
243
- * @author Dario Curvino <@dudo>
244
- * @since 2.6.6
245
- * @return string
246
- */
247
- function yasr_description_strucutured_data()
248
- {
249
- $name = esc_html__( 'Stuctured data options', 'yet-another-stars-rating' );
250
- $div_desc = '<div class="yasr-settings-description">';
251
- $description = esc_html__( 'If ratings in a post or page are found, YASR will create structured data to show them in search results
252
- (SERP)', 'yet-another-stars-rating' );
253
- $description .= '<br /><a href="https://yetanotherstarsrating.com/docs/rich-snippet/reviewrating-and-aggregaterating/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_rischnippets_desc"
254
- target="_blank">';
255
- $description .= esc_html__( 'More info here', 'yet-another-stars-rating' );
256
- $description .= '</a>';
257
- $end_div = '.</div>';
258
- return $name . $div_desc . $description . $end_div;
259
- }
260
-
261
- function yasr_upgrade_pro_box()
262
- {
263
-
264
- if ( yasr_fs()->is_free_plan() ) {
265
- ?>
266
-
267
- <div class="yasr-donatedivdx">
268
- <h2 class="yasr-donate-title" style="color: #34A7C1">
269
- <?php
270
- esc_html_e( 'Upgrade to YASR Pro', 'yet-another-stars-rating' );
271
- ?>
272
- </h2>
273
- <div class="yasr-upgrade-to-pro">
274
- <ul>
275
- <li><strong><?php
276
- esc_html_e( ' User Reviews', 'yet-another-stars-rating' );
277
- ?></strong></li>
278
- <li><strong><?php
279
- esc_html_e( ' Custom Rankings', 'yet-another-stars-rating' );
280
- ?></strong></li>
281
- <li><strong><?php
282
- esc_html_e( ' 20 + ready to use themes', 'yet-another-stars-rating' );
283
- ?></strong></li>
284
- <li><strong><?php
285
- esc_html_e( ' Upload your own theme', 'yet-another-stars-rating' );
286
- ?></strong></li>
287
- <li><strong><?php
288
- esc_html_e( ' Dedicate support', 'yet-another-stars-rating' );
289
- ?></strong></li>
290
- <li><strong><?php
291
- esc_html_e( ' ...And much more!!', 'yet-another-stars-rating' );
292
- ?></strong></li>
293
- </ul>
294
- <a href="<?php
295
- echo esc_url( yasr_fs()->get_upgrade_url() ) ;
296
- ?>">
297
- <button class="button button-primary">
298
- <span style="font-size: large; font-weight: bold;">
299
- <?php
300
- esc_html_e( 'Upgrade Now', 'yet-another-stars-rating' );
301
- ?>
302
- </span>
303
- </button>
304
- </a>
305
- <div style="display: block; margin-top: 10px; margin-bottom: 10px; ">
306
- --- or ---
307
- </div>
308
- <a href="<?php
309
- echo esc_url( yasr_fs()->get_trial_url() ) ;
310
- ?>">
311
- <button class="button button-primary">
312
- <span style="display: block; font-size: large; font-weight: bold; margin: -3px;">
313
- <?php
314
- esc_html_e( 'Start Free Trial', 'yet-another-stars-rating' );
315
- ?>
316
- </span>
317
- <span style="display: block; margin-top: -10px; font-size: smaller;">
318
- <?php
319
- esc_html_e( 'No credit-card, risk free!', 'yet-another-stars-rating' );
320
- ?>
321
- </span>
322
- </button>
323
- </a>
324
- </div>
325
- </div>
326
-
327
- <?php
328
- }
329
-
330
- }
331
-
332
- /*
333
- * Add a box on with the resouces
334
- * Since version 1.9.5
335
- *
336
- */
337
- function yasr_resources_box()
338
- {
339
- ?>
340
-
341
- <div class='yasr-donatedivdx' id='yasr-resources-box'>
342
- <div class="yasr-donate-title">Resources</div>
343
- <div class="yasr-donate-single-resource">
344
- <span class="dashicons dashicons-star-filled" style="color: #6c6c6c"></span>
345
- <a target="blank" href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr_official">
346
- <?php
347
- esc_html_e( 'YASR official website', 'yet-another-stars-rating' );
348
- ?>
349
- </a>
350
- </div>
351
- <div class="yasr-donate-single-resource">
352
- <img src="<?php
353
- echo esc_attr( YASR_IMG_DIR . 'github.svg' ) ;
354
- ?>"
355
- width="20" height="20" alt="github logo" style="vertical-align: bottom;">
356
- <a target="blank" href="https://github.com/Dudo1985/yet-another-stars-rating">
357
- GitHub Page
358
- </a>
359
- </div>
360
- <div class="yasr-donate-single-resource">
361
- <span class="dashicons dashicons-edit" style="color: #6c6c6c"></span>
362
- <a target="blank" href="https://yetanotherstarsrating.com/docs/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=documentation">
363
- <?php
364
- esc_html_e( 'Documentation', 'yet-another-stars-rating' );
365
- ?>
366
- </a>
367
- </div>
368
- <div class="yasr-donate-single-resource">
369
- <span class="dashicons dashicons-book-alt" style="color: #6c6c6c"></span>
370
- <a target="blank" href="https://yetanotherstarsrating.com/docs/faq/?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=faq">
371
- <?php
372
- esc_html_e( 'F.A.Q.', 'yet-another-stars-rating' );
373
- ?>
374
- </a>
375
- </div>
376
- <div class="yasr-donate-single-resource">
377
- <span class="dashicons dashicons-video-alt3" style="color: #6c6c6c"></span>
378
- <a target="blank" href="https://www.youtube.com/channel/UCU5jbO1PJsUUsCNbME9S-Zw">
379
- <?php
380
- esc_html_e( 'Youtube channel', 'yet-another-stars-rating' );
381
- ?>
382
- </a>
383
- </div>
384
- <div class="yasr-donate-single-resource">
385
- <span class="dashicons dashicons-smiley" style="color: #6c6c6c"></span>
386
- <a target="blank" href="https://yetanotherstarsrating.com/#yasr-pro?utm_source=wp-plugin&utm_medium=settings_resources&utm_campaign=yasr_settings&utm_content=yasr-pro">
387
- Yasr Pro
388
- </a>
389
- </div>
390
- </div>
391
-
392
- <?php
393
- }
394
-
395
- /**
396
- * Adds buy a cofee box
397
- *
398
- * @author Dario Curvino <@dudo>
399
- */
400
- function yasr_buy_cofee()
401
- {
402
- $buymecofeetext = esc_html__( 'Coffee is vital to make YASR development going on!', 'yet-another-stars-rating' );
403
- $buymecofeetext .= '<br />';
404
-
405
- if ( yasr_fs()->is_free_plan() ) {
406
- $buymecofeetext .= esc_html__( 'If you are enjoying YASR, and you don\'t need the pro version, please consider to buy me a coffee, thanks!', 'yet-another-stars-rating' );
407
- } else {
408
- $buymecofeetext .= esc_html__( 'If you are enjoying YASR, please consider to buy me a coffee, thanks!', 'yet-another-stars-rating' );
409
- }
410
-
411
- $div = "<div class='yasr-donatedivdx' id='yasr-buy-cofee'>";
412
- $text = '<div class="yasr-donate-title">' . __( 'Buy me a coffee!', 'yet-another-stars-rating' ) . '</div>';
413
- $text .= '<div style="text-align: center">';
414
- $text .= '<a href="https://www.paypal.com/donate/?hosted_button_id=SVTAVUF62QZ4W" target="_blank">
415
- <img src="' . YASR_IMG_DIR . '/button_paypal.png" alt="paypal" width="200">
416
- </a>';
417
- $text .= '</div>';
418
- $text .= '<div style="margin-top: 15px;">';
419
- $text .= $buymecofeetext;
420
- $text .= '</div>';
421
- $div_and_text = $div . $text . '</div>';
422
- echo wp_kses_post( $div_and_text ) ;
423
- }
424
-
425
- /**
426
- * Show related plugins
427
- *
428
- * @author Dario Curvino <@dudo>
429
- */
430
- function yasr_related_plugins()
431
- {
432
- $div = "<div class='yasr-donatedivdx' id='yasr-related-plugins'>";
433
- $text = '<div class="yasr-donate-title">' . esc_html__( 'You may also like...', 'yet-another-stars-rating' ) . '</div>';
434
- $text .= yasr_movie_helper();
435
- $text .= '<hr />';
436
- $text .= yasr_cnrt();
437
- $div_and_text = $div . $text . '</div>';
438
- echo wp_kses_post( $div_and_text ) ;
439
- }
440
-
441
- /**
442
- * @author Dario Curvino <@dudo>
443
- * @since 2.9.3
444
- * @return string
445
- */
446
- function yasr_movie_helper()
447
- {
448
- $movie_helper_description = esc_html__( 'Movie Helper allows you to easily add links to movie and tv shows, just by searching
449
- them while you\'re writing your content. Search, click, done!', 'yet-another-stars-rating' );
450
- $text = '<div style="text-align: center">';
451
- $text .= '<a href="https://wordpress.org/plugins/yet-another-movie/" target="_blank">
452
- <img src="' . esc_attr( YASR_IMG_DIR ) . '/movie_helper.svg" alt="Movie Helper" >
453
- </a>';
454
- $text .= '</div>';
455
- $text .= '<div style="margin-top: 15px;">';
456
- $text .= $movie_helper_description;
457
- $text .= '</div>';
458
- return $text;
459
- }
460
-
461
- /**
462
- * @author Dario Curvino <@dudo>
463
- * @since 2.9.3
464
- * @return string
465
- */
466
- function yasr_cnrt()
467
- {
468
- $text = '<div style="text-align: center">';
469
- $text .= '<a href="https://wordpress.org/plugins/comments-not-replied-to/">';
470
- $text .= '<img src="' . esc_attr( YASR_IMG_DIR ) . '/cnrt.png" alt="cnrt" width="110">';
471
- $text .= '<div>Comments Not Replied To</div>';
472
- $text .= '</a>';
473
- $text .= '</div>';
474
- $text .= '<div style="margin-top: 15px;">';
475
- $text .= esc_html__( '"Comments Not Replied To" introduces a new area in the administrative dashboard that allows you to
476
- see what comments to which you - as the site author - have not yet replied.', 'yet-another-stars-rating' );
477
- $text .= '</div>';
478
- return $text;
479
- }
480
-
481
- /** Add a box on the right for asking to rate 5 stars on Wordpress.org
482
- * Since version 0.9.0
483
- */
484
- function yasr_ask_rating()
485
- {
486
- $div = "<div class='yasr-donatedivdx' id='yasr-ask-five-stars'>";
487
- $text = '<div class="yasr-donate-title">' . esc_html__( 'Can I ask your help?', 'yet-another-stars-rating' ) . '</div>';
488
- $text .= '<div style="font-size: 32px; color: #F1CB32; text-align:center; margin-bottom: 20px; margin-top: -5px;">
489
- <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
490
- <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
491
- <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
492
- <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
493
- <span class="dashicons dashicons-star-filled" style="font-size: 26px;"></span>
494
- </div>';
495
- $text .= esc_html__( 'Please rate YASR 5 stars on', 'yet-another-stars-rating' );
496
- $text .= ' <a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5">
497
- WordPress.org.</a><br />';
498
- $text .= esc_html__( ' It will require just 1 min but it\'s a HUGE help for me. Thank you.', 'yet-another-stars-rating' );
499
- $text .= "<br /><br />";
500
- $text .= "<em>> Dario Curvino</em>";
501
- $div_and_text = $div . $text . '</div>';
502
- echo wp_kses_post( $div_and_text ) ;
503
- }
504
-
505
- /**
506
- * @author Dario Curvino <@dudo>
507
- * @since 1.9.5
508
- */
509
- function yasr_right_settings_panel()
510
- {
511
- ?>
512
- <div id="yasr-settings-panel-right">
513
- <?php
514
- do_action( 'yasr_right_settings_panel_box' );
515
- yasr_upgrade_pro_box();
516
- yasr_resources_box();
517
- yasr_buy_cofee();
518
- yasr_related_plugins();
519
- yasr_ask_rating();
520
- ?>
521
- </div>
522
- <?php
523
- }
524
-
525
- /** Change default admin footer on yasr settings pages
526
- * $text is the default wordpress text
527
- * Since 0.8.9
528
- */
529
- add_filter( 'admin_footer_text', 'yasr_custom_admin_footer' );
530
- function yasr_custom_admin_footer( $text )
531
- {
532
-
533
- if ( isset( $_GET['page'] ) ) {
534
- $yasr_page = $_GET['page'];
535
-
536
- if ( $yasr_page === 'yasr_settings_page' || $yasr_page === 'yasr_stats_page' ) {
537
- $custom_text = ' | <i>';
538
- $custom_text .= sprintf(
539
- esc_html__( 'Thank you for using %s. Please %s rate it%s 5 stars on %s', 'yet-another-stars-rating' ),
540
- '<a href="https://yetanotherstarsrating.com/?utm_source=wp-plugin&utm_medium=footer&utm_campaign=yasr_settings"
541
- target="_blank">Yet Another Stars Rating</a>',
542
- '<a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5" target="_blank">',
543
- '</a>',
544
- '<a href="https://wordpress.org/support/view/plugin-reviews/yet-another-stars-rating?filter=5" target="_blank">
545
- WordPress.org</a>'
546
- );
547
- $custom_text .= '</i>';
548
- return $text . $custom_text;
549
- }
550
-
551
- return $text;
552
- }
553
-
554
- return $text;
555
- }
556
-
557
- /**
558
- * Return true if tidy is installed and version is later than 25 Nov 2017, false otherwise
559
- *
560
- * @author Dario Curvino <@dudo>
561
- * @since 3.0.5
562
- * @return bool
563
- */
564
- function yasr_is_tidy_installed()
565
- {
566
-
567
- if ( extension_loaded( 'tidy' ) ) {
568
- $tidy_release_date = strtotime( tidy_get_release() );
569
- $tidy_working_release_date = strtotime( '2017/11/25' );
570
- if ( $tidy_release_date >= $tidy_working_release_date ) {
571
- return true;
572
- }
573
- }
574
-
575
- return false;
576
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/settings/yasr-settings-migration-page.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
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
+
27
+ <h3><?php esc_html_e('Migration Tools', 'yet-another-stars-rating'); ?></h3>
28
+
29
+ <table class="form-table yasr-settings-table" id="yasr-migrate-table">
30
+ <tr>
31
+ <td>
32
+ <div>
33
+ <?php
34
+ $import_plugin = new YasrImportRatingPlugins;
35
+
36
+ if (!$import_plugin->searchWPPR() && !$import_plugin->searchRMP()
37
+ && !$import_plugin->searchKKSR() && !$import_plugin->searchMR()) {
38
+ echo wp_kses_post($import_plugin->pluginFoundTitle(''));
39
+ }
40
+
41
+ if($import_plugin->searchWPPR()){
42
+ $import_plugin->importWPPR();
43
+ }
44
+
45
+ if($import_plugin->searchKKSR()){
46
+ $import_plugin->importKKSR();
47
+ }
48
+
49
+ if($import_plugin->searchRMP()) {
50
+ $import_plugin->importRMP();
51
+ }
52
+
53
+ if($import_plugin->searchMR()){
54
+ $import_plugin->importMR();
55
+ }
56
+
57
+ do_action('yasr_migration_page_bottom', $import_plugin->plugin_imported);
58
+ ?>
59
+ </div>
60
+ </td>
61
+ </tr>
62
+ </table>
admin/settings/yasr-settings-page.php CHANGED
@@ -39,7 +39,7 @@ if (!current_user_can('manage_options')) {
39
  }
40
 
41
  //Do the settings tab
42
- yasr_settings_tabs($active_tab);
43
  ?>
44
  <div class="yasr-settingsdiv">
45
  <div class="yasr-settings-table">
@@ -81,7 +81,7 @@ if (!current_user_can('manage_options')) {
81
 
82
  if ($active_tab === 'migration_tools') {
83
  //include migration functions
84
- include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/migrations/yasr-settings-migration-page.php');
85
  } //End tab migration
86
 
87
  //Adds new tab content here
@@ -94,7 +94,7 @@ if (!current_user_can('manage_options')) {
94
 
95
  <div class="yasr-clear-both-dynamic"></div>
96
  <?php
97
- yasr_right_settings_panel();
98
  ?>
99
  <!--End div wrap-->
100
  </div>
39
  }
40
 
41
  //Do the settings tab
42
+ YasrSettings::printTabs($active_tab);
43
  ?>
44
  <div class="yasr-settingsdiv">
45
  <div class="yasr-settings-table">
81
 
82
  if ($active_tab === 'migration_tools') {
83
  //include migration functions
84
+ include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-settings-migration-page.php');
85
  } //End tab migration
86
 
87
  //Adds new tab content here
94
 
95
  <div class="yasr-clear-both-dynamic"></div>
96
  <?php
97
+ YasrSettings::printRightColumn();
98
  ?>
99
  <!--End div wrap-->
100
  </div>
admin/settings/yasr-stats-page.php CHANGED
@@ -132,6 +132,6 @@ if (isset($_GET['tab'])) {
132
 
133
  <div class="yasr-clear-both-dynamic"></div>
134
 
135
- <?php yasr_right_settings_panel(); ?>
136
 
137
  </div><!--End div wrap-->
132
 
133
  <div class="yasr-clear-both-dynamic"></div>
134
 
135
+ <?php YasrSettings::printRightColumn(); ?>
136
 
137
  </div><!--End div wrap-->
admin/yasr-admin-actions-ajax.php CHANGED
@@ -25,7 +25,7 @@ if (!defined('ABSPATH')) {
25
  //This function is also hooked into yasr-admin-actions
26
  add_action('wp_ajax_yasr_change_log_page', 'yasr_widget_log_dashboard_callback');
27
  function yasr_widget_log_dashboard_callback() {
28
- $log_widget = new YasrLogDashboardWidget();
29
  $log_widget->adminWidget();
30
  } //End callback function
31
 
@@ -34,7 +34,7 @@ function yasr_widget_log_dashboard_callback() {
34
  //This function is also hooked into yasr-admin-actions
35
  add_action('wp_ajax_yasr_change_user_log_page', 'yasr_users_dashboard_widget_callback');
36
  function yasr_users_dashboard_widget_callback() {
37
- $log_widget = new YasrLogDashboardWidget();
38
  $log_widget->userWidget();
39
  } //End callback function
40
 
@@ -53,7 +53,6 @@ function yasr_rankings_preview_shortcode() {
53
  die();
54
  }
55
 
56
-
57
  $shortcode = $_GET['shortcode'];
58
 
59
  if(!shortcode_exists($shortcode)) {
25
  //This function is also hooked into yasr-admin-actions
26
  add_action('wp_ajax_yasr_change_log_page', 'yasr_widget_log_dashboard_callback');
27
  function yasr_widget_log_dashboard_callback() {
28
+ $log_widget = new YasrLastRatingsWidget();
29
  $log_widget->adminWidget();
30
  } //End callback function
31
 
34
  //This function is also hooked into yasr-admin-actions
35
  add_action('wp_ajax_yasr_change_user_log_page', 'yasr_users_dashboard_widget_callback');
36
  function yasr_users_dashboard_widget_callback() {
37
+ $log_widget = new YasrLastRatingsWidget();
38
  $log_widget->userWidget();
39
  } //End callback function
40
 
53
  die();
54
  }
55
 
 
56
  $shortcode = $_GET['shortcode'];
57
 
58
  if(!shortcode_exists($shortcode)) {
admin/yasr-admin-filters.php CHANGED
@@ -30,3 +30,23 @@ function yasr_filter_style_options_callback($style_options) {
30
 
31
  return $style_options;
32
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  return $style_options;
32
  }
33
+
34
+ global $yasr_fs;
35
+
36
+ /**
37
+ * https://freemius.com/help/documentation/selling-with-freemius/free-trials/
38
+ *
39
+ * With this hook I change the default Freemius behavior to show trial message after 1 week instead of 1 day
40
+ */
41
+ $yasr_fs->add_filter( 'show_first_trial_after_n_sec', static function ($day_in_sec) {
42
+ return WEEK_IN_SECONDS;
43
+ } );
44
+
45
+ /**
46
+ * https://freemius.com/help/documentation/selling-with-freemius/free-trials/
47
+ *
48
+ * With this hook I change the default Freemius behavior to show trial every 60 days instead of 30
49
+ */
50
+ $yasr_fs->add_filter( 'reshow_trial_after_every_n_sec', static function ($thirty_days_in_sec) {
51
+ return 2 * MONTH_IN_SECONDS;
52
+ } );
admin/yasr-admin-functions.php CHANGED
@@ -87,6 +87,11 @@ function yasr_add_admin_scripts($hook) {
87
  ) {
88
  YasrScriptsLoader::loadRequiredJs();
89
 
 
 
 
 
 
90
  do_action('yasr_add_admin_scripts_begin', $hook);
91
 
92
  YasrScriptsLoader::loadTippy();
@@ -99,6 +104,11 @@ function yasr_add_admin_scripts($hook) {
99
  YASR_VERSION_NUM
100
  );
101
 
 
 
 
 
 
102
  do_action('yasr_add_admin_scripts_end', $hook);
103
  }
104
 
@@ -126,11 +136,9 @@ function yasr_add_pages() {
126
 
127
  global $yasr_settings_page;
128
 
129
- $settings_menu_title = '<span class="dashicons dashicons-admin-settings"></span>&nbsp;' .
130
- esc_html__('Settings', 'yet-another-stars-rating');
131
 
132
- $stats_menu_title = '<span class="dashicons dashicons-chart-line"></span>&nbsp;' .
133
- esc_html__('Manage Ratings', 'yet-another-stars-rating');
134
 
135
  //Add Settings Page
136
  $yasr_settings_page = add_menu_page(
@@ -164,15 +172,6 @@ function yasr_add_pages() {
164
  yasr_fs()->add_filter( 'templates/pricing.php', 'yasr_pricing_page_callback' );
165
  }
166
 
167
- if (yasr_fs()->is_free_plan() && !yasr_fs()->is_trial()) {
168
- global $submenu;
169
- $permalink = '#';
170
- $contact_us_string = YASR_LOCKED_FEATURE . '&nbsp;' .
171
- esc_html__('Contact Us', 'yet-another-stars-rating');
172
-
173
- $submenu['yasr_settings_page'][] = array($contact_us_string, 'manage_options', $permalink);
174
- }
175
-
176
  }
177
 
178
  // Settings Page Content
@@ -201,7 +200,7 @@ function yasr_pricing_page_callback() {
201
  wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
202
  }
203
 
204
- include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-pricing-page.php');
205
  }
206
 
207
 
87
  ) {
88
  YasrScriptsLoader::loadRequiredJs();
89
 
90
+ /**
91
+ * Add custom script in one of the page used by YASR, at the beginning
92
+ *
93
+ * @param $hook string
94
+ */
95
  do_action('yasr_add_admin_scripts_begin', $hook);
96
 
97
  YasrScriptsLoader::loadTippy();
104
  YASR_VERSION_NUM
105
  );
106
 
107
+ /**
108
+ * Add custom script in one of the page used by YASR, at the end
109
+ *
110
+ * @param $hook string
111
+ */
112
  do_action('yasr_add_admin_scripts_end', $hook);
113
  }
114
 
136
 
137
  global $yasr_settings_page;
138
 
139
+ $settings_menu_title = esc_html__('Settings', 'yet-another-stars-rating');
 
140
 
141
+ $stats_menu_title = esc_html__('Manage Ratings', 'yet-another-stars-rating');
 
142
 
143
  //Add Settings Page
144
  $yasr_settings_page = add_menu_page(
172
  yasr_fs()->add_filter( 'templates/pricing.php', 'yasr_pricing_page_callback' );
173
  }
174
 
 
 
 
 
 
 
 
 
 
175
  }
176
 
177
  // Settings Page Content
200
  wp_die(__('You do not have sufficient permissions to access this page.', 'yet-another-stars-rating'));
201
  }
202
 
203
+ include(YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-pricing-page.html');
204
  }
205
 
206
 
admin/yasr-admin-init.php CHANGED
@@ -71,7 +71,6 @@ require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-functions.php';
71
  require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-actions.php';
72
  require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-actions-ajax.php';
73
  require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-filters.php';
74
- require YASR_ABSOLUTE_PATH_ADMIN . '/settings/yasr-settings-functions-misc.php';
75
 
76
  /**
77
  * Callback function for the spl_autoload_register above.
71
  require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-actions.php';
72
  require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-actions-ajax.php';
73
  require YASR_ABSOLUTE_PATH_ADMIN . '/yasr-admin-filters.php';
 
74
 
75
  /**
76
  * Callback function for the spl_autoload_register above.
changelog.txt CHANGED
@@ -583,7 +583,7 @@ Many other support types will comes.
583
  - Wp Post Ratings
584
  - KK Star Ratings
585
  - Rate My Post
586
- * FIXED: in editor screen, multi set didn't shows up if more than 1 was used
587
  * TWEAKED: minor changes
588
 
589
  = 1.9.9 =
583
  - Wp Post Ratings
584
  - KK Star Ratings
585
  - Rate My Post
586
+ * FIXED: in editor screen, multi set didn't show up if more than 1 was used
587
  * TWEAKED: minor changes
588
 
589
  = 1.9.9 =
docs/readme.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ These docs are for developers ONLY.
2
+ If you're an end user, you can find all the info here https://yetanotherstarsrating.com/
docs/yasr_hooks.md ADDED
@@ -0,0 +1,897 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hooks
2
+
3
+ - [Actions](#actions)
4
+ - [Filters](#filters)
5
+
6
+ ## Actions
7
+
8
+ ### `yasr_metabox_below_editor_add_tab`
9
+
10
+ *Use this hook to add new tabs into the metabox below the editor*
11
+
12
+
13
+ Source: [./admin/editor/YasrMetaboxBelowEditor.php](admin/editor/YasrMetaboxBelowEditor.php), [line 57](admin/editor/YasrMetaboxBelowEditor.php#L57-L60)
14
+
15
+ ### `yasr_metabox_below_editor_content`
16
+
17
+ **Arguments**
18
+
19
+ Argument | Type | Description
20
+ -------- | ---- | -----------
21
+ `$post_id` | |
22
+ `$multi_set` | |
23
+ `$n_multi_set` | |
24
+
25
+ Source: [./admin/editor/YasrMetaboxBelowEditor.php](admin/editor/YasrMetaboxBelowEditor.php), [line 65](admin/editor/YasrMetaboxBelowEditor.php#L65-L66)
26
+
27
+ ### `yasr_add_content_multiset_tab_top`
28
+
29
+ *Hook here to add new content at the beginning of the div*
30
+
31
+ **Arguments**
32
+
33
+ Argument | Type | Description
34
+ -------- | ---- | -----------
35
+ `$post_id` | | int
36
+ `$set_id` | | int
37
+
38
+ Source: [./admin/editor/YasrMetaboxBelowEditor.php](admin/editor/YasrMetaboxBelowEditor.php), [line 227](admin/editor/YasrMetaboxBelowEditor.php#L227-L233)
39
+
40
+ ### `yasr_add_content_multiset_tab_pro`
41
+
42
+ *Hook here to add new content*
43
+
44
+ **Arguments**
45
+
46
+ Argument | Type | Description
47
+ -------- | ---- | -----------
48
+ `$post_id` | | int
49
+ `$set_id` | | int
50
+
51
+ Source: [./admin/editor/YasrMetaboxBelowEditor.php](admin/editor/YasrMetaboxBelowEditor.php), [line 310](admin/editor/YasrMetaboxBelowEditor.php#L310-L316)
52
+
53
+ ### `yasr_add_content_bottom_topright_metabox`
54
+
55
+ *Hook here to add content at the bottom of the metabox*
56
+
57
+ **Arguments**
58
+
59
+ Argument | Type | Description
60
+ -------- | ---- | -----------
61
+ `$post_id` | | int
62
+
63
+ Source: [./admin/editor/yasr-metabox-top-right.php](admin/editor/yasr-metabox-top-right.php), [line 116](admin/editor/yasr-metabox-top-right.php#L116-L121)
64
+
65
+ ### `yasr_on_save_post`
66
+
67
+ *Hook here to add actions when YASR save data on save_post*
68
+
69
+ **Arguments**
70
+
71
+ Argument | Type | Description
72
+ -------- | ---- | -----------
73
+ `$this->post_id` | |
74
+
75
+ Source: [./admin/editor/YasrOnSavePost.php](admin/editor/YasrOnSavePost.php), [line 56](admin/editor/YasrOnSavePost.php#L56-L61)
76
+
77
+ ### `yasr_action_on_overall_rating`
78
+
79
+ *Do action before overall rating is saved, works only in classic editor*
80
+
81
+ **Arguments**
82
+
83
+ Argument | Type | Description
84
+ -------- | ---- | -----------
85
+ `$this->post_id` | |
86
+ `$rating` | | float
87
+
88
+ Source: [./admin/editor/YasrOnSavePost.php](admin/editor/YasrOnSavePost.php), [line 100](admin/editor/YasrOnSavePost.php#L100-L106)
89
+
90
+ ### `yasr_add_tabs_on_tinypopupform`
91
+
92
+ *Use this action to add tabs inside shortcode creator for tinymce*
93
+
94
+
95
+ Source: [./admin/editor/YasrEditorHooks.php](admin/editor/YasrEditorHooks.php), [line 212](admin/editor/YasrEditorHooks.php#L212-L215)
96
+
97
+ ### `yasr_add_content_on_tinypopupform`
98
+
99
+ *Use this action to add content inside shortcode creator*
100
+
101
+ **Arguments**
102
+
103
+ Argument | Type | Description
104
+ -------- | ---- | -----------
105
+ `$n_multi_set` | | int
106
+ `$multi_set` | | string the multiset name
107
+
108
+ Source: [./admin/editor/YasrEditorHooks.php](admin/editor/YasrEditorHooks.php), [line 225](admin/editor/YasrEditorHooks.php#L225-L231)
109
+
110
+ ### `yasr_add_admin_scripts_begin`
111
+
112
+ *Add custom script in one of the page used by YASR, at the beginning*
113
+
114
+ **Arguments**
115
+
116
+ Argument | Type | Description
117
+ -------- | ---- | -----------
118
+ `$hook` | | string
119
+
120
+ Source: [./admin/yasr-admin-functions.php](admin/yasr-admin-functions.php), [line 90](admin/yasr-admin-functions.php#L90-L95)
121
+
122
+ ### `yasr_add_admin_scripts_end`
123
+
124
+ *Add custom script in one of the page used by YASR, at the end*
125
+
126
+ **Arguments**
127
+
128
+ Argument | Type | Description
129
+ -------- | ---- | -----------
130
+ `$hook` | | string
131
+
132
+ Source: [./admin/yasr-admin-functions.php](admin/yasr-admin-functions.php), [line 107](admin/yasr-admin-functions.php#L107-L112)
133
+
134
+ ### `yasr_settings_tab_content`
135
+
136
+ **Arguments**
137
+
138
+ Argument | Type | Description
139
+ -------- | ---- | -----------
140
+ `$active_tab` | |
141
+
142
+ Source: [./admin/settings/yasr-settings-page.php](admin/settings/yasr-settings-page.php), [line 88](admin/settings/yasr-settings-page.php#L88-L88)
143
+
144
+ ### `yasr_add_stats_tab`
145
+
146
+ **Arguments**
147
+
148
+ Argument | Type | Description
149
+ -------- | ---- | -----------
150
+ `$active_tab` | |
151
+
152
+ Source: [./admin/settings/yasr-stats-page.php](admin/settings/yasr-stats-page.php), [line 63](admin/settings/yasr-stats-page.php#L63-L63)
153
+
154
+ ### `yasr_settings_check_active_tab`
155
+
156
+ **Arguments**
157
+
158
+ Argument | Type | Description
159
+ -------- | ---- | -----------
160
+ `$active_tab` | |
161
+
162
+ Source: [./admin/settings/yasr-stats-page.php](admin/settings/yasr-stats-page.php), [line 130](admin/settings/yasr-stats-page.php#L130-L130)
163
+
164
+ ### `yasr_style_options_add_settings_field`
165
+
166
+ **Arguments**
167
+
168
+ Argument | Type | Description
169
+ -------- | ---- | -----------
170
+ `$style_options` | |
171
+
172
+ Source: [./admin/settings/aspect_style/yasr-settings-style-functions.php](admin/settings/aspect_style/yasr-settings-style-functions.php), [line 49](admin/settings/aspect_style/yasr-settings-style-functions.php#L49-L49)
173
+
174
+ ### `yasr_add_settings_tab`
175
+
176
+ **Arguments**
177
+
178
+ Argument | Type | Description
179
+ -------- | ---- | -----------
180
+ `$active_tab` | |
181
+
182
+ Source: [./admin/settings/classes/YasrSettings.php](admin/settings/classes/YasrSettings.php), [line 1096](admin/settings/classes/YasrSettings.php#L1096-L1096)
183
+
184
+ ### `yasr_right_settings_panel_box`
185
+
186
+
187
+ Source: [./admin/settings/classes/YasrSettings.php](admin/settings/classes/YasrSettings.php), [line 1266](admin/settings/classes/YasrSettings.php#L1266-L1266)
188
+
189
+ ### `yasr_migration_page_bottom`
190
+
191
+ **Arguments**
192
+
193
+ Argument | Type | Description
194
+ -------- | ---- | -----------
195
+ `$import_plugin->plugin_imported` | |
196
+
197
+ Source: [./admin/settings/yasr-settings-migration-page.php](admin/settings/yasr-settings-migration-page.php), [line 57](admin/settings/yasr-settings-migration-page.php#L57-L57)
198
+
199
+ ### `yasr_ur_add_custom_form_fields`
200
+
201
+
202
+ Source: [./yasr_pro/public/classes/YasrProCommentForm.php](yasr_pro/public/classes/YasrProCommentForm.php), [line 170](yasr_pro/public/classes/YasrProCommentForm.php#L170-L170)
203
+
204
+ ### `yasr_ur_save_custom_form_fields`
205
+
206
+ **Arguments**
207
+
208
+ Argument | Type | Description
209
+ -------- | ---- | -----------
210
+ `$comment_id` | |
211
+
212
+ Source: [./yasr_pro/public/classes/YasrProCommentForm.php](yasr_pro/public/classes/YasrProCommentForm.php), [line 495](yasr_pro/public/classes/YasrProCommentForm.php#L495-L495)
213
+
214
+ ### `yasr_ur_do_content_after_save_commentmeta`
215
+
216
+ **Arguments**
217
+
218
+ Argument | Type | Description
219
+ -------- | ---- | -----------
220
+ `$comment_id` | |
221
+
222
+ Source: [./yasr_pro/public/classes/YasrProCommentForm.php](yasr_pro/public/classes/YasrProCommentForm.php), [line 504](yasr_pro/public/classes/YasrProCommentForm.php#L504-L504)
223
+
224
+ ### `yasr_fs_loaded`
225
+
226
+
227
+ Source: [./yet-another-stars-rating.php](yet-another-stars-rating.php), [line 82](yet-another-stars-rating.php#L82-L82)
228
+
229
+ ### `yasr_action_on_visitor_vote`
230
+
231
+ **Arguments**
232
+
233
+ Argument | Type | Description
234
+ -------- | ---- | -----------
235
+ `$array_action_visitor_vote` | |
236
+
237
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 86](includes/shortcodes/classes/YasrShortcodesAjax.php#L86-L86)
238
+
239
+ ### `yasr_action_on_visitor_multiset_vote`
240
+
241
+ **Arguments**
242
+
243
+ Argument | Type | Description
244
+ -------- | ---- | -----------
245
+ `$array_action_visitor_multiset_vote` | |
246
+
247
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 345](includes/shortcodes/classes/YasrShortcodesAjax.php#L345-L345)
248
+
249
+ ### `yasr_enqueue_assets_shortcode`
250
+
251
+
252
+ Source: [./includes/shortcodes/classes/YasrShortcode.php](includes/shortcodes/classes/YasrShortcode.php), [line 158](includes/shortcodes/classes/YasrShortcode.php#L158-L158)
253
+
254
+ ### `yasr_add_front_script_css`
255
+
256
+
257
+ Source: [./includes/classes/YasrScriptsLoader.php](includes/classes/YasrScriptsLoader.php), [line 118](includes/classes/YasrScriptsLoader.php#L118-L118)
258
+
259
+ ### `yasr_add_front_script_js`
260
+
261
+
262
+ Source: [./includes/classes/YasrScriptsLoader.php](includes/classes/YasrScriptsLoader.php), [line 127](includes/classes/YasrScriptsLoader.php#L127-L127)
263
+
264
+ ## Filters
265
+
266
+ ### `yasr_feature_locked`
267
+
268
+ **Arguments**
269
+
270
+ Argument | Type | Description
271
+ -------- | ---- | -----------
272
+ `'<span class="dashicons dashicons-lock" title="' . esc_attr($text) . '"></span>'` | |
273
+ `10` | |
274
+ `1` | |
275
+
276
+ Source: [./admin/yasr-admin-init.php](admin/yasr-admin-init.php), [line 44](admin/yasr-admin-init.php#L44-L47)
277
+
278
+ ### `yasr_feature_locked_html_attribute`
279
+
280
+ **Arguments**
281
+
282
+ Argument | Type | Description
283
+ -------- | ---- | -----------
284
+ `'disabled'` | |
285
+ `10` | |
286
+ `1` | |
287
+
288
+ Source: [./admin/yasr-admin-init.php](admin/yasr-admin-init.php), [line 49](admin/yasr-admin-init.php#L49-L49)
289
+
290
+ ### `yasr_filter_style_options`
291
+
292
+ **Arguments**
293
+
294
+ Argument | Type | Description
295
+ -------- | ---- | -----------
296
+ `$style_options` | |
297
+
298
+ Source: [./admin/settings/aspect_style/yasr-settings-style-functions.php](admin/settings/aspect_style/yasr-settings-style-functions.php), [line 40](admin/settings/aspect_style/yasr-settings-style-functions.php#L40-L40)
299
+
300
+ ### `yasr_sanitize_style_options`
301
+
302
+ **Arguments**
303
+
304
+ Argument | Type | Description
305
+ -------- | ---- | -----------
306
+ `$style_options` | |
307
+
308
+ Source: [./admin/settings/aspect_style/yasr-settings-style-functions.php](admin/settings/aspect_style/yasr-settings-style-functions.php), [line 136](admin/settings/aspect_style/yasr-settings-style-functions.php#L136-L136)
309
+
310
+ ### `yasr_settings_select_ranking`
311
+
312
+ **Arguments**
313
+
314
+ Argument | Type | Description
315
+ -------- | ---- | -----------
316
+ `$source_array` | |
317
+
318
+ Source: [./admin/settings/classes/YasrSettingsRankings.php](admin/settings/classes/YasrSettingsRankings.php), [line 62](admin/settings/classes/YasrSettingsRankings.php#L62-L62)
319
+
320
+ ### `yasr_ur_display_custom_fields`
321
+
322
+ **Arguments**
323
+
324
+ Argument | Type | Description
325
+ -------- | ---- | -----------
326
+ `$comment_id` | |
327
+
328
+ Source: [./yasr_pro/public/classes/YasrProCommentForm.php](yasr_pro/public/classes/YasrProCommentForm.php), [line 284](yasr_pro/public/classes/YasrProCommentForm.php#L284-L284)
329
+
330
+ ### `yasr_filter_schema_jsonld`
331
+
332
+ **Arguments**
333
+
334
+ Argument | Type | Description
335
+ -------- | ---- | -----------
336
+ `$review_choosen` | |
337
+
338
+ Source: [./public/classes/YasrRichSnippets.php](public/classes/YasrRichSnippets.php), [line 73](public/classes/YasrRichSnippets.php#L73-L73)
339
+
340
+ ### `yasr_filter_existing_schema`
341
+
342
+ **Arguments**
343
+
344
+ Argument | Type | Description
345
+ -------- | ---- | -----------
346
+ `$rich_snippet` | |
347
+ `$rich_snippet_data` | |
348
+
349
+ Source: [./public/classes/YasrRichSnippets.php](public/classes/YasrRichSnippets.php), [line 132](public/classes/YasrRichSnippets.php#L132-L132)
350
+
351
+ ### `yasr_filter_schema_title`
352
+
353
+ **Arguments**
354
+
355
+ Argument | Type | Description
356
+ -------- | ---- | -----------
357
+ `$post_id` | |
358
+
359
+ Source: [./public/classes/YasrRichSnippets.php](public/classes/YasrRichSnippets.php), [line 164](public/classes/YasrRichSnippets.php#L164-L164)
360
+
361
+ ### `yasr_auto_insert_disable`
362
+
363
+ **Arguments**
364
+
365
+ Argument | Type | Description
366
+ -------- | ---- | -----------
367
+ `$post_excluded` | |
368
+ `$content` | |
369
+
370
+ Source: [./public/classes/YasrPublicFilters.php](public/classes/YasrPublicFilters.php), [line 53](public/classes/YasrPublicFilters.php#L53-L53)
371
+
372
+ ### `yasr_auto_insert_exclude_cpt`
373
+
374
+ **Arguments**
375
+
376
+ Argument | Type | Description
377
+ -------- | ---- | -----------
378
+ `$excluded_cpt` | |
379
+
380
+ Source: [./public/classes/YasrPublicFilters.php](public/classes/YasrPublicFilters.php), [line 83](public/classes/YasrPublicFilters.php#L83-L83)
381
+
382
+ ### `yasr_title_vv_widget`
383
+
384
+ **Arguments**
385
+
386
+ Argument | Type | Description
387
+ -------- | ---- | -----------
388
+ `$vv_widget` | |
389
+ `$stored_votes` | |
390
+
391
+ Source: [./public/classes/YasrPublicFilters.php](public/classes/YasrPublicFilters.php), [line 273](public/classes/YasrPublicFilters.php#L273-L273)
392
+
393
+ ### `yasr_title_overall_widget`
394
+
395
+ **Arguments**
396
+
397
+ Argument | Type | Description
398
+ -------- | ---- | -----------
399
+ `$overall_widget` | |
400
+ `$overall_rating` | |
401
+
402
+ Source: [./public/classes/YasrPublicFilters.php](public/classes/YasrPublicFilters.php), [line 310](public/classes/YasrPublicFilters.php#L310-L310)
403
+
404
+ ### `yasr_overall_rating_shortcode`
405
+
406
+ **Arguments**
407
+
408
+ Argument | Type | Description
409
+ -------- | ---- | -----------
410
+ `$shortcode_html` | |
411
+ `$overall_attributes` | |
412
+
413
+ Source: [./includes/shortcodes/classes/YasrOverallRating.php](includes/shortcodes/classes/YasrOverallRating.php), [line 52](includes/shortcodes/classes/YasrOverallRating.php#L52-L52)
414
+
415
+ ### `yasr_cstm_text_before_overall`
416
+
417
+ **Arguments**
418
+
419
+ Argument | Type | Description
420
+ -------- | ---- | -----------
421
+ `$this->overall_rating` | |
422
+
423
+ Source: [./includes/shortcodes/classes/YasrOverallRating.php](includes/shortcodes/classes/YasrOverallRating.php), [line 124](includes/shortcodes/classes/YasrOverallRating.php#L124-L124)
424
+
425
+ ### `yasr_vv_cookie`
426
+
427
+ **Arguments**
428
+
429
+ Argument | Type | Description
430
+ -------- | ---- | -----------
431
+ `'yasr_visitor_vote_cookie'` | |
432
+
433
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 216](includes/shortcodes/classes/YasrShortcodesAjax.php#L216-L216)
434
+
435
+ ### `yasr_vv_updated_text`
436
+
437
+ **Arguments**
438
+
439
+ Argument | Type | Description
440
+ -------- | ---- | -----------
441
+ `$rating_saved_text` | |
442
+
443
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 229](includes/shortcodes/classes/YasrShortcodesAjax.php#L229-L229)
444
+
445
+ ### `yasr_vv_saved_text`
446
+
447
+ **Arguments**
448
+
449
+ Argument | Type | Description
450
+ -------- | ---- | -----------
451
+ `$rating_saved_text` | |
452
+
453
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 232](includes/shortcodes/classes/YasrShortcodesAjax.php#L232-L232)
454
+
455
+ ### `yasr_vv_rating_error_text`
456
+
457
+ **Arguments**
458
+
459
+ Argument | Type | Description
460
+ -------- | ---- | -----------
461
+ `$error_text` | |
462
+
463
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 255](includes/shortcodes/classes/YasrShortcodesAjax.php#L255-L255)
464
+
465
+ ### `yasr_mv_cookie`
466
+
467
+ **Arguments**
468
+
469
+ Argument | Type | Description
470
+ -------- | ---- | -----------
471
+ `'yasr_multi_visitor_cookie'` | |
472
+
473
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 498](includes/shortcodes/classes/YasrShortcodesAjax.php#L498-L498)
474
+
475
+ ### `yasr_mv_saved_text`
476
+
477
+ **Arguments**
478
+
479
+ Argument | Type | Description
480
+ -------- | ---- | -----------
481
+ `__('Rating Saved', 'yet-another-stars-rating')` | |
482
+
483
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 507](includes/shortcodes/classes/YasrShortcodesAjax.php#L507-L507)
484
+
485
+ ### `yasr_filter_ranking_request`
486
+
487
+ **Arguments**
488
+
489
+ Argument | Type | Description
490
+ -------- | ---- | -----------
491
+ `false` | |
492
+ `$request` | |
493
+
494
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 690](includes/shortcodes/classes/YasrShortcodesAjax.php#L690-L690)
495
+
496
+ ### `yasr_add_sources_ranking_request`
497
+
498
+ **Arguments**
499
+
500
+ Argument | Type | Description
501
+ -------- | ---- | -----------
502
+ `$data_to_return` | |
503
+ `$source` | |
504
+ `$request` | |
505
+ `$sql_params` | |
506
+
507
+ Source: [./includes/shortcodes/classes/YasrShortcodesAjax.php](includes/shortcodes/classes/YasrShortcodesAjax.php), [line 741](includes/shortcodes/classes/YasrShortcodesAjax.php#L741-L741)
508
+
509
+ ### `yasr_mv_cookie`
510
+
511
+ **Arguments**
512
+
513
+ Argument | Type | Description
514
+ -------- | ---- | -----------
515
+ `'yasr_multi_visitor_cookie'` | |
516
+
517
+ Source: [./includes/shortcodes/classes/YasrVisitorMultiSet.php](includes/shortcodes/classes/YasrVisitorMultiSet.php), [line 115](includes/shortcodes/classes/YasrVisitorMultiSet.php#L115-L115)
518
+
519
+ ### `yasr_must_sign_in`
520
+
521
+ **Arguments**
522
+
523
+ Argument | Type | Description
524
+ -------- | ---- | -----------
525
+ `''` | |
526
+
527
+ Source: [./includes/shortcodes/classes/YasrVisitorMultiSet.php](includes/shortcodes/classes/YasrVisitorMultiSet.php), [line 170](includes/shortcodes/classes/YasrVisitorMultiSet.php#L170-L170)
528
+
529
+ ### `yasr_vv_ro_shortcode`
530
+
531
+ **Arguments**
532
+
533
+ Argument | Type | Description
534
+ -------- | ---- | -----------
535
+ `$shortcode_html` | |
536
+ `$stored_votes` | |
537
+ `$this->post_id` | |
538
+
539
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 110](includes/shortcodes/classes/YasrVisitorVotes.php#L110-L110)
540
+
541
+ ### `yasr_vv_cookie`
542
+
543
+ **Arguments**
544
+
545
+ Argument | Type | Description
546
+ -------- | ---- | -----------
547
+ `'yasr_visitor_vote_cookie'` | |
548
+
549
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 120](includes/shortcodes/classes/YasrVisitorVotes.php#L120-L120)
550
+
551
+ ### `yasr_cstm_text_already_voted`
552
+
553
+ **Arguments**
554
+
555
+ Argument | Type | Description
556
+ -------- | ---- | -----------
557
+ `$rating` | |
558
+
559
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 194](includes/shortcodes/classes/YasrVisitorVotes.php#L194-L194)
560
+
561
+ ### `yasr_must_sign_in`
562
+
563
+ **Arguments**
564
+
565
+ Argument | Type | Description
566
+ -------- | ---- | -----------
567
+ `''` | |
568
+
569
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 206](includes/shortcodes/classes/YasrVisitorVotes.php#L206-L206)
570
+
571
+ ### `yasr_cstm_text_before_vv`
572
+
573
+ **Arguments**
574
+
575
+ Argument | Type | Description
576
+ -------- | ---- | -----------
577
+ `$number_of_votes` | |
578
+ `$average_rating` | |
579
+ `$this->unique_id` | |
580
+
581
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 232](includes/shortcodes/classes/YasrVisitorVotes.php#L232-L232)
582
+
583
+ ### `yasr_cstm_text_after_vv`
584
+
585
+ **Arguments**
586
+
587
+ Argument | Type | Description
588
+ -------- | ---- | -----------
589
+ `$number_of_votes` | |
590
+ `$average_rating` | |
591
+ `$this->unique_id` | |
592
+
593
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 275](includes/shortcodes/classes/YasrVisitorVotes.php#L275-L275)
594
+
595
+ ### `yasr_vv_shortcode`
596
+
597
+ **Arguments**
598
+
599
+ Argument | Type | Description
600
+ -------- | ---- | -----------
601
+ `$shortcode_html` | |
602
+ `$stored_votes` | |
603
+ `$this->post_id` | |
604
+ `$this->starSize()` | |
605
+ `$this->readonly` | |
606
+ `$this->ajax_nonce_visitor` | |
607
+ `$this->is_singular` | |
608
+
609
+ Source: [./includes/shortcodes/classes/YasrVisitorVotes.php](includes/shortcodes/classes/YasrVisitorVotes.php), [line 378](includes/shortcodes/classes/YasrVisitorVotes.php#L378-L387)
610
+
611
+ ### `yasr_tr_rankings_atts`
612
+
613
+ **Arguments**
614
+
615
+ Argument | Type | Description
616
+ -------- | ---- | -----------
617
+ `false` | |
618
+ `$atts` | |
619
+
620
+ Source: [./includes/shortcodes/classes/YasrNoStarsRankings.php](includes/shortcodes/classes/YasrNoStarsRankings.php), [line 36](includes/shortcodes/classes/YasrNoStarsRankings.php#L36-L36)
621
+
622
+ ### `yasr_tu_rankings_atts`
623
+
624
+ **Arguments**
625
+
626
+ Argument | Type | Description
627
+ -------- | ---- | -----------
628
+ `false` | |
629
+ `$atts` | |
630
+
631
+ Source: [./includes/shortcodes/classes/YasrNoStarsRankings.php](includes/shortcodes/classes/YasrNoStarsRankings.php), [line 63](includes/shortcodes/classes/YasrNoStarsRankings.php#L63-L63)
632
+
633
+ ### `yasr_tu_rankings_display`
634
+
635
+ **Arguments**
636
+
637
+ Argument | Type | Description
638
+ -------- | ---- | -----------
639
+ `$user_data->user_login` | |
640
+ `$user_data` | |
641
+
642
+ Source: [./includes/shortcodes/classes/YasrNoStarsRankings.php](includes/shortcodes/classes/YasrNoStarsRankings.php), [line 124](includes/shortcodes/classes/YasrNoStarsRankings.php#L124-L124)
643
+
644
+ ### `yasr_size_ranking`
645
+
646
+ **Arguments**
647
+
648
+ Argument | Type | Description
649
+ -------- | ---- | -----------
650
+ `'medium'` | |
651
+
652
+ Source: [./includes/shortcodes/classes/YasrShortcode.php](includes/shortcodes/classes/YasrShortcode.php), [line 89](includes/shortcodes/classes/YasrShortcode.php#L89-L89)
653
+
654
+ ### `yasr_ov_rankings_atts`
655
+
656
+ **Arguments**
657
+
658
+ Argument | Type | Description
659
+ -------- | ---- | -----------
660
+ `$this->shortcode_name` | |
661
+ `$atts` | |
662
+
663
+ Source: [./includes/shortcodes/classes/YasrRankings.php](includes/shortcodes/classes/YasrRankings.php), [line 54](includes/shortcodes/classes/YasrRankings.php#L54-L54)
664
+
665
+ ### `yasr_vv_rankings_atts`
666
+
667
+ *Hook here to use shortcode atts.*
668
+
669
+ If not used, will work with no support for atts
670
+
671
+ **Arguments**
672
+
673
+ Argument | Type | Description
674
+ -------- | ---- | -----------
675
+ `$this->shortcode_name` | |
676
+ `$atts` | `string\|array` | Shortcode atts
677
+
678
+ Source: [./includes/shortcodes/classes/YasrRankings.php](includes/shortcodes/classes/YasrRankings.php), [line 77](includes/shortcodes/classes/YasrRankings.php#L77-L84)
679
+
680
+ ### `yasr_multi_set_ranking_atts`
681
+
682
+ **Arguments**
683
+
684
+ Argument | Type | Description
685
+ -------- | ---- | -----------
686
+ `$this->shortcode_name` | |
687
+ `$atts` | |
688
+
689
+ Source: [./includes/shortcodes/classes/YasrRankings.php](includes/shortcodes/classes/YasrRankings.php), [line 112](includes/shortcodes/classes/YasrRankings.php#L112-L112)
690
+
691
+ ### `yasr_visitor_multi_set_ranking_atts`
692
+
693
+ *Hook here to use shortcode atts.*
694
+
695
+ If not used, shortcode will works only with setId param
696
+
697
+ **Arguments**
698
+
699
+ Argument | Type | Description
700
+ -------- | ---- | -----------
701
+ `$this->shortcode_name` | |
702
+ `$atts` | `string\|array` | Shortcode atts
703
+
704
+ Source: [./includes/shortcodes/classes/YasrRankings.php](includes/shortcodes/classes/YasrRankings.php), [line 137](includes/shortcodes/classes/YasrRankings.php#L137-L144)
705
+
706
+ ### `yasr_filter_ip`
707
+
708
+ **Arguments**
709
+
710
+ Argument | Type | Description
711
+ -------- | ---- | -----------
712
+ `$ip` | |
713
+
714
+ Source: [./includes/yasr-includes-functions.php](includes/yasr-includes-functions.php), [line 148](includes/yasr-includes-functions.php#L148-L148)
715
+
716
+ ### `yasr_rest_rankings_args`
717
+
718
+ **Arguments**
719
+
720
+ Argument | Type | Description
721
+ -------- | ---- | -----------
722
+ `$args` | |
723
+
724
+ Source: [./includes/rest/classes/YasrCustomEndpoint.php](includes/rest/classes/YasrCustomEndpoint.php), [line 146](includes/rest/classes/YasrCustomEndpoint.php#L146-L146)
725
+
726
+ ### `yasr_rest_sanitize`
727
+
728
+ **Arguments**
729
+
730
+ Argument | Type | Description
731
+ -------- | ---- | -----------
732
+ `$key` | |
733
+ `$param` | |
734
+
735
+ Source: [./includes/rest/classes/YasrCustomEndpoint.php](includes/rest/classes/YasrCustomEndpoint.php), [line 277](includes/rest/classes/YasrCustomEndpoint.php#L277-L277)
736
+
737
+ ### `yasr_rankings_query_ov`
738
+
739
+ **Arguments**
740
+
741
+ Argument | Type | Description
742
+ -------- | ---- | -----------
743
+ `$atts` | |
744
+
745
+ Source: [./includes/classes/YasrDB.php](includes/classes/YasrDB.php), [line 201](includes/classes/YasrDB.php#L201-L201)
746
+
747
+ ### `yasr_rankings_query_vv`
748
+
749
+ **Arguments**
750
+
751
+ Argument | Type | Description
752
+ -------- | ---- | -----------
753
+ `$atts` | |
754
+ `$ranking` | |
755
+
756
+ Source: [./includes/classes/YasrDB.php](includes/classes/YasrDB.php), [line 245](includes/classes/YasrDB.php#L245-L245)
757
+
758
+ ### `yasr_rankings_query_tu`
759
+
760
+ **Arguments**
761
+
762
+ Argument | Type | Description
763
+ -------- | ---- | -----------
764
+ `$atts` | |
765
+
766
+ Source: [./includes/classes/YasrDB.php](includes/classes/YasrDB.php), [line 295](includes/classes/YasrDB.php#L295-L295)
767
+
768
+ ### `yasr_rankings_multi_query`
769
+
770
+ **Arguments**
771
+
772
+ Argument | Type | Description
773
+ -------- | ---- | -----------
774
+ `$sql_atts` | |
775
+ `$set_id` | |
776
+
777
+ Source: [./includes/classes/YasrDB.php](includes/classes/YasrDB.php), [line 340](includes/classes/YasrDB.php#L340-L340)
778
+
779
+ ### `yasr_rankings_query_tr`
780
+
781
+ **Arguments**
782
+
783
+ Argument | Type | Description
784
+ -------- | ---- | -----------
785
+ `$atts` | |
786
+
787
+ Source: [./includes/classes/YasrDB.php](includes/classes/YasrDB.php), [line 394](includes/classes/YasrDB.php#L394-L394)
788
+
789
+ ### `yasr_rankings_multivv_query`
790
+
791
+ **Arguments**
792
+
793
+ Argument | Type | Description
794
+ -------- | ---- | -----------
795
+ `$sql_atts` | |
796
+ `$ranking` | |
797
+ `$set_id` | |
798
+
799
+ Source: [./includes/classes/YasrDB.php](includes/classes/YasrDB.php), [line 445](includes/classes/YasrDB.php#L445-L445)
800
+
801
+ ### `yasr_custom_loader`
802
+
803
+ **Arguments**
804
+
805
+ Argument | Type | Description
806
+ -------- | ---- | -----------
807
+ `$yasr_visitor_votes_loader` | |
808
+
809
+ Source: [./includes/classes/YasrScriptsLoader.php](includes/classes/YasrScriptsLoader.php), [line 59](includes/classes/YasrScriptsLoader.php#L59-L59)
810
+
811
+ ### `yasr_custom_loader_url`
812
+
813
+ **Arguments**
814
+
815
+ Argument | Type | Description
816
+ -------- | ---- | -----------
817
+ `YASR_IMG_DIR . 'loader.gif'` | |
818
+
819
+ Source: [./includes/classes/YasrScriptsLoader.php](includes/classes/YasrScriptsLoader.php), [line 63](includes/classes/YasrScriptsLoader.php#L63-L63)
820
+
821
+ ### `yasr_gutenberg_constants`
822
+
823
+ **Arguments**
824
+
825
+ Argument | Type | Description
826
+ -------- | ---- | -----------
827
+ `$constants_array` | |
828
+
829
+ Source: [./includes/classes/YasrScriptsLoader.php](includes/classes/YasrScriptsLoader.php), [line 525](includes/classes/YasrScriptsLoader.php#L525-L525)
830
+
831
+ ### `yasr_rankings_query_ov`
832
+
833
+ **Arguments**
834
+
835
+ Argument | Type | Description
836
+ -------- | ---- | -----------
837
+ `$atts` | |
838
+
839
+ Source: [./includes/classes/YasrRankingData.php](includes/classes/YasrRankingData.php), [line 52](includes/classes/YasrRankingData.php#L52-L52)
840
+
841
+ ### `yasr_rankings_query_vv`
842
+
843
+ **Arguments**
844
+
845
+ Argument | Type | Description
846
+ -------- | ---- | -----------
847
+ `$atts` | |
848
+ `$ranking` | |
849
+
850
+ Source: [./includes/classes/YasrRankingData.php](includes/classes/YasrRankingData.php), [line 98](includes/classes/YasrRankingData.php#L98-L98)
851
+
852
+ ### `yasr_rankings_query_tr`
853
+
854
+ **Arguments**
855
+
856
+ Argument | Type | Description
857
+ -------- | ---- | -----------
858
+ `$atts` | |
859
+
860
+ Source: [./includes/classes/YasrRankingData.php](includes/classes/YasrRankingData.php), [line 148](includes/classes/YasrRankingData.php#L148-L148)
861
+
862
+ ### `yasr_rankings_query_tu`
863
+
864
+ **Arguments**
865
+
866
+ Argument | Type | Description
867
+ -------- | ---- | -----------
868
+ `$atts` | |
869
+
870
+ Source: [./includes/classes/YasrRankingData.php](includes/classes/YasrRankingData.php), [line 192](includes/classes/YasrRankingData.php#L192-L192)
871
+
872
+ ### `yasr_rankings_multi_query`
873
+
874
+ **Arguments**
875
+
876
+ Argument | Type | Description
877
+ -------- | ---- | -----------
878
+ `$sql_atts` | |
879
+ `$set_id` | |
880
+
881
+ Source: [./includes/classes/YasrRankingData.php](includes/classes/YasrRankingData.php), [line 238](includes/classes/YasrRankingData.php#L238-L238)
882
+
883
+ ### `yasr_rankings_multivv_query`
884
+
885
+ **Arguments**
886
+
887
+ Argument | Type | Description
888
+ -------- | ---- | -----------
889
+ `$sql_atts` | |
890
+ `$ranking` | |
891
+ `$set_id` | |
892
+
893
+ Source: [./includes/classes/YasrRankingData.php](includes/classes/YasrRankingData.php), [line 301](includes/classes/YasrRankingData.php#L301-L301)
894
+
895
+
896
+ <p align="center"><a href="https://github.com/pronamic/wp-documentor"><img src="https://cdn.jsdelivr.net/gh/pronamic/wp-documentor@main/logos/pronamic-wp-documentor.svgo-min.svg" alt="Pronamic WordPress Documentor" width="32" height="32"></a><br><em>Generated by <a href="https://github.com/pronamic/wp-documentor">Pronamic WordPress Documentor</a> <code>1.2.0</code></em><p>
897
+
includes/classes/YasrDB.php ADDED
@@ -0,0 +1,909 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*
4
+
5
+ Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
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
+ * This class is used to connect to the DB
27
+ *
28
+ * Class YasrDB
29
+ */
30
+ class YasrDB {
31
+
32
+ /**
33
+ * Returns overall rating for single post or page
34
+ *
35
+ * @param $post_id void|bool|int
36
+ *
37
+ * @return mixed|null
38
+ */
39
+ public static function overallRating ($post_id=false) {
40
+ //if values it's not passed get the post id, since version 1.6.9 this is just for yasr_add_schema function
41
+ //and for a further check
42
+ if (!is_int($post_id)) {
43
+ $post_id = get_the_ID();
44
+ }
45
+
46
+ $overall_rating = get_post_meta($post_id, 'yasr_overall_rating', true);
47
+
48
+ if (!$overall_rating || $overall_rating < 0) {
49
+ $overall_rating = 0;
50
+ }
51
+ if($overall_rating > 5) {
52
+ $overall_rating = 5;
53
+ }
54
+ return $overall_rating;
55
+ }
56
+
57
+ /**
58
+ * Returns *ALL* Overall Ratings*
59
+ *
60
+ * @author Dario Curvino <@dudo>
61
+ * @since 2.5.2
62
+ * @return array|object|\stdClass[]|null
63
+ */
64
+ public static function allOverallRatings() {
65
+ global $wpdb;
66
+
67
+ $query = "SELECT pm.post_id,
68
+ pm.meta_value as vote,
69
+ pm.meta_id as id,
70
+ p.post_author as user_id,
71
+ p.post_modified as date
72
+ FROM $wpdb->postmeta as pm,
73
+ $wpdb->posts as p
74
+ WHERE pm.meta_key = 'yasr_overall_rating'
75
+ AND p.ID = pm.post_id
76
+ AND pm.meta_value > 0";
77
+
78
+ return $wpdb->get_results($query, ARRAY_A);
79
+
80
+ }
81
+
82
+ /**
83
+ * Return Visitor Votes for a single post or page
84
+ *
85
+ * @param bool|integer $post_id
86
+ *
87
+ * @return array|null
88
+ * array(
89
+ * 'number_of_votes' = (int)$user_votes->number_of_votes;
90
+ * 'sum_votes' = (int)$user_votes->sum_votes;
91
+ * 'average' = (int)average result
92
+ * )
93
+ */
94
+ public static function visitorVotes ($post_id = false) {
95
+ global $wpdb;
96
+
97
+ //if values it's not passed get the post id, most of the cases and default one
98
+ if (!is_int($post_id)) {
99
+ $post_id = get_the_ID();
100
+ }
101
+
102
+ $result = $wpdb->get_results(
103
+ $wpdb->prepare(
104
+ "SELECT SUM(vote) as sum_votes,
105
+ COUNT(vote) as number_of_votes
106
+ FROM " . YASR_LOG_TABLE .
107
+ " WHERE post_id=%d
108
+ AND vote > 0
109
+ AND vote <= 5
110
+ ",
111
+ $post_id
112
+ )
113
+ );
114
+
115
+ $array_to_return = array(
116
+ 'number_of_votes' => 0,
117
+ 'sum_votes' => 0,
118
+ 'average' => 0
119
+ );
120
+
121
+ foreach ($result as $user_votes) {
122
+ $array_to_return['number_of_votes'] = (int)$user_votes->number_of_votes;
123
+ $array_to_return['sum_votes'] = (int)$user_votes->sum_votes;
124
+
125
+ if ($array_to_return['number_of_votes'] > 0) {
126
+ $array_to_return['average'] = ($array_to_return['sum_votes'] / $array_to_return['number_of_votes']);
127
+ $array_to_return['average'] = round($array_to_return['average'], 1);
128
+ }
129
+ }
130
+
131
+ return $array_to_return;
132
+ }
133
+
134
+ /**
135
+ * Returns *ALL* visitor votes in YASR_LOG_TABLE
136
+ * used in stats page
137
+ *
138
+ * @author Dario Curvino <@dudo>
139
+ * @since 2.5.2
140
+ *
141
+ * @return array|object|null
142
+ */
143
+ public static function allVisitorVotes() {
144
+ global $wpdb;
145
+
146
+ $query = 'SELECT * FROM ' .YASR_LOG_TABLE. ' ORDER BY date';
147
+
148
+ return $wpdb->get_results($query, ARRAY_A);
149
+ }
150
+
151
+ /**
152
+ * Check if current user has already rated, and if so, return the rating, or false otherwise
153
+ *
154
+ * @param int | bool $post_id
155
+ *
156
+ * @return bool|int
157
+ */
158
+ public static function vvCurrentUserRating($post_id = false) {
159
+ global $wpdb;
160
+
161
+ $user_id = get_current_user_id();
162
+
163
+ //just to be safe
164
+ if (!is_int($post_id)) {
165
+ $post_id = get_the_ID();
166
+ }
167
+
168
+ $rating = $wpdb->get_var(
169
+ $wpdb->prepare(
170
+ "SELECT vote FROM "
171
+ . YASR_LOG_TABLE .
172
+ " WHERE post_id=%d
173
+ AND user_id=%d
174
+ LIMIT 1 ",
175
+ $post_id, $user_id
176
+ )
177
+ );
178
+
179
+ if ($rating === null) {
180
+ return false;
181
+ }
182
+
183
+ return (int)$rating;
184
+ }
185
+
186
+ /**
187
+ * Run $wpdb->get_results for overall Rating
188
+ *
189
+ * @author Dario Curvino <@dudo>
190
+ * @since 2.5.2
191
+ *
192
+ * @param bool|array $atts
193
+ *
194
+ * @return array|false|object|void
195
+ */
196
+ public static function rankingOverall($atts) {
197
+ global $wpdb;
198
+
199
+ //return custom query_result here
200
+ //must returns rating and post_id
201
+ $query = apply_filters('yasr_rankings_query_ov', $atts);
202
+
203
+ //if query_results === $sql_params means that filters doesn't exists
204
+ if ($query === $atts) {
205
+ //default query_results
206
+ $query = "SELECT pm.meta_value AS rating,
207
+ pm.post_id AS post_id
208
+ FROM $wpdb->postmeta AS pm,
209
+ $wpdb->posts AS p
210
+ WHERE pm.post_id = p.ID
211
+ AND p.post_status = 'publish'
212
+ AND pm.meta_key = 'yasr_overall_rating'
213
+ AND pm.meta_value > 0
214
+ ORDER BY pm.meta_value DESC,
215
+ pm.post_id
216
+ LIMIT 10";
217
+
218
+ $query_results = $wpdb->get_results($query);
219
+ }
220
+ else {
221
+ $query_results = $query;
222
+ }
223
+
224
+ if ($query_results) {
225
+ return $query_results;
226
+ }
227
+ return false;
228
+ }
229
+
230
+ /**
231
+ * Returns yasr_most_or_highest_rated_posts with no params and 10 rows.
232
+ *
233
+ * @author Dario Curvino <@dudo>
234
+ * @since 2.5.2
235
+ *
236
+ * @param array $atts
237
+ * @param $ranking
238
+ *
239
+ * @return array|false|object|void
240
+ */
241
+ public static function rankingVV($atts, $ranking) {
242
+ global $wpdb;
243
+
244
+ //hooks here to return a query
245
+ $query = apply_filters('yasr_rankings_query_vv', $atts, $ranking);
246
+
247
+ //if no custom query is hooked
248
+ if ($query === $atts) {
249
+ $common_query = "SELECT post_id,
250
+ COUNT(post_id) AS number_of_votes,
251
+ ROUND(SUM(vote) / COUNT(post_id),1) AS rating
252
+ FROM " . YASR_LOG_TABLE . ",
253
+ $wpdb->posts AS p
254
+ WHERE post_id = p.ID
255
+ AND p.post_status = 'publish'
256
+ GROUP BY post_id
257
+ HAVING number_of_votes > 1
258
+ ";
259
+
260
+ if ($ranking === 'highest') {
261
+ $order_by = ' ORDER BY rating DESC, number_of_votes DESC';
262
+ }
263
+ else {
264
+ $order_by = ' ORDER BY number_of_votes DESC, rating DESC, post_id DESC';
265
+ }
266
+
267
+ $limit = ' LIMIT 10';
268
+ $query = $common_query . $order_by . $limit;
269
+
270
+ $query_results = $wpdb->get_results($query);
271
+ }
272
+ else {
273
+ $query_results = $query;
274
+ }
275
+
276
+ if ($query_results) {
277
+ return $query_results;
278
+ }
279
+ return false;
280
+ }
281
+
282
+ /***
283
+ * @author Dario Curvino <@dudo>
284
+ * @since 2.6.3
285
+ *
286
+ * @param $atts
287
+ *
288
+ * @return array|false|object|void
289
+ */
290
+ public static function rankingTopUsers($atts) {
291
+ global $wpdb;
292
+
293
+ //return custom query here
294
+ //must returns rating and post_id
295
+ $query = apply_filters('yasr_rankings_query_tu', $atts);
296
+
297
+ //if query === $sql_params (both are falses) means that filters doesn't exists
298
+ if ($query === $atts) {
299
+ $query = 'SELECT COUNT(user_id) as total_count,
300
+ user_id as user
301
+ FROM ' . YASR_LOG_TABLE . ",
302
+ $wpdb->posts AS p
303
+ WHERE post_id = p.ID
304
+ AND p.post_status = 'publish'
305
+ GROUP BY user_id
306
+ ORDER BY ( total_count ) DESC
307
+ LIMIT 10";
308
+
309
+ $query_results = $wpdb->get_results($query);
310
+
311
+ }
312
+ else {
313
+ $query_results = $query;
314
+ }
315
+
316
+ if ($query_results) {
317
+ return $query_results;
318
+ }
319
+ return false;
320
+ }
321
+
322
+ /**
323
+ * @author Dario Curvino <@dudo>
324
+ * @since 2.7.2
325
+ *
326
+ * @param $set_id
327
+ * @param false $sql_atts
328
+ *
329
+ * @return bool|array
330
+ */
331
+ public static function rankingMulti($set_id, $sql_atts = false) {
332
+ global $wpdb;
333
+ if ($set_id === null) {
334
+ $set_id = YASR_FIRST_SETID;
335
+ }
336
+
337
+ $set_id = (int) $set_id;
338
+
339
+ //hooks here to return a query
340
+ $query_result = apply_filters('yasr_rankings_multi_query', $sql_atts, $set_id);
341
+
342
+ //if hook has run
343
+ if ($query_result !== $sql_atts) {
344
+ //but don't return an array or array is empty, return false
345
+ if (!is_array($query_result) || empty($query_result)) {
346
+ return false;
347
+ }
348
+ //else return hooks result
349
+ return $query_result;
350
+ }
351
+
352
+ //if no hook is found in $query_result, return default ranking
353
+ if ($query_result === $sql_atts) {
354
+ //Create an array of post_id that has meta key = yasr_multiset_author_votes
355
+ $array_post_id
356
+ = $wpdb->get_results(
357
+ "SELECT pm.post_id AS id
358
+ FROM $wpdb->postmeta AS pm,
359
+ $wpdb->posts AS p
360
+ WHERE pm.post_id = p.ID
361
+ AND p.post_status = 'publish'
362
+ AND pm.meta_key = 'yasr_multiset_author_votes'
363
+ ORDER BY pm.post_id"
364
+ );
365
+
366
+ if (!is_array($array_post_id) || empty($array_post_id)) {
367
+ return false;
368
+ }
369
+
370
+ //set fields name and ids
371
+ $average_array = self::returnMultiAuthorAverageArray($array_post_id, $set_id);
372
+
373
+ //Limit the array to N results
374
+ return array_slice($average_array, 0, 10);
375
+ }
376
+
377
+ //should never happen
378
+ return false;
379
+ }
380
+
381
+ /***
382
+ * @author Dario Curvino <@dudo>
383
+ * @since 2.6.3
384
+ *
385
+ * @param $atts
386
+ *
387
+ * @return array|false|object|void
388
+ */
389
+ public static function rankingTopReviewers($atts) {
390
+ global $wpdb;
391
+
392
+ //return custom query here
393
+ //must returns rating and post_id
394
+ $query = apply_filters('yasr_rankings_query_tr', $atts);
395
+
396
+ //if query === $sql_params (both are falses) means that filters doesn't exists
397
+ if ($query === $atts) {
398
+ $query = "SELECT COUNT( pm.post_id ) AS total_count,
399
+ p.post_author AS user,
400
+ u.user_login AS name
401
+ FROM $wpdb->posts AS p,
402
+ $wpdb->postmeta AS pm,
403
+ $wpdb->users AS u
404
+ WHERE pm.post_id = p.ID
405
+ AND pm.meta_key = 'yasr_overall_rating'
406
+ AND p.post_status = 'publish'
407
+ AND p.post_author = u.ID
408
+ GROUP BY user
409
+ ORDER BY total_count DESC
410
+ LIMIT 5";
411
+
412
+ $query_results = $wpdb->get_results($query);
413
+
414
+ }
415
+ else {
416
+ $query_results = $query;
417
+ }
418
+
419
+ if ($query_results) {
420
+ return $query_results;
421
+ }
422
+ return false;
423
+ }
424
+
425
+ /**
426
+ * @author Dario Curvino <@dudo>
427
+ * @since 2.7.2
428
+ *
429
+ * @param int|bool|string $set_id
430
+ * @param string $ranking
431
+ * @param false $sql_atts
432
+ *
433
+ * @return array|false|object
434
+ */
435
+ public static function rankingMultiVV($set_id, $ranking = 'most', $sql_atts = false) {
436
+ global $wpdb;
437
+ //if set_id is not set (e.g. in rest parameter setid is not set)
438
+ if ($set_id === null) {
439
+ $set_id = YASR_FIRST_SETID;
440
+ }
441
+
442
+ $set_id = (int) $set_id;
443
+
444
+ //hooks here to return a query
445
+ $query = apply_filters('yasr_rankings_multivv_query', $sql_atts, $ranking, $set_id);
446
+
447
+ //if no custom query is hooked
448
+ if ($query === $sql_atts) {
449
+ $query = $wpdb->prepare(
450
+ "SELECT CAST((SUM(l.vote)/COUNT(l.vote)) AS DECIMAL(2,1)) AS rating,
451
+ COUNT(l.vote) AS number_of_votes,
452
+ l.post_id
453
+ FROM " . YASR_LOG_MULTI_SET . " AS l,
454
+ $wpdb->posts AS p
455
+ WHERE l.set_type = %d
456
+ AND p.ID = l.post_id
457
+ AND p.post_status = 'publish'
458
+ GROUP BY l.post_id", '%d'
459
+ );
460
+ if ($ranking === 'highest') {
461
+ $query .= ' ORDER BY rating DESC';
462
+ }
463
+ else {
464
+ $query .= ' ORDER BY number_of_votes DESC';
465
+ }
466
+ $query .= ' LIMIT 10';
467
+
468
+ $query_results = $wpdb->get_results($query);
469
+
470
+ }
471
+ else {
472
+ $query_results = $query;
473
+ }
474
+
475
+ if ($query_results) {
476
+ return $query_results;
477
+ }
478
+ return false;
479
+ }
480
+
481
+ /**
482
+ * Returns the first set id or false if not exists
483
+ *
484
+ * @author Dario Curvino <@dudo>
485
+ * @since 2.6.8
486
+ * @return false|int
487
+ */
488
+ public static function returnFirstSetId() {
489
+ global $wpdb;
490
+ $set_id = false;
491
+
492
+ $result = $wpdb->get_results(
493
+ "SELECT set_id
494
+ FROM " . YASR_MULTI_SET_NAME_TABLE . "
495
+ ORDER BY set_id
496
+ LIMIT 1"
497
+ );
498
+
499
+ if (is_array($result) && !empty($result[0]) && property_exists($result[0], 'set_id')) {
500
+ $set_id = (int) $result[0]->set_id;
501
+ }
502
+
503
+ return $set_id;
504
+ }
505
+
506
+ /**
507
+ * @author Dario Curvino <@dudo>
508
+ * @since 2.2.2
509
+ * @return array|object|\stdClass[]|null
510
+ */
511
+ public static function returnMultiSetNames() {
512
+ global $wpdb;
513
+
514
+ return $wpdb->get_results("SELECT * FROM " . YASR_MULTI_SET_NAME_TABLE . " ORDER BY set_id");
515
+ }
516
+
517
+ /**
518
+ * This function loops an array of post_id that that has yasr_multiset_author_votes as meta key.
519
+ * Returns an ordered array by rating's average for each post id
520
+ *
521
+ * @author Dario Curvino <@dudo>
522
+ * @since 2.7.3
523
+ *
524
+ * @param $array_post_id
525
+ * @param $set_id
526
+ *
527
+ * @return array
528
+ */
529
+ public static function returnMultiAuthorAverageArray($array_post_id, $set_id) {
530
+ $average_array = array();
531
+
532
+ $i = 0;
533
+ //loop the array
534
+ foreach ($array_post_id as $post_id) {
535
+ $average = self::returnMultiSetAverage($post_id->id, $set_id, false);
536
+ if ($average > 0) {
537
+ $average_array[$i]['post_id'] = $post_id->id;
538
+ $average_array[$i]['rating'] = $average;
539
+ }
540
+ $i++;
541
+ }
542
+
543
+ //order the array by average rating
544
+ array_multisort(array_column($average_array, 'rating'), SORT_DESC, SORT_NUMERIC, $average_array);
545
+
546
+ return $average_array;
547
+ }
548
+
549
+ /**
550
+ * This functions returns an array with all the values to print the multiset
551
+ *
552
+ * array (
553
+ * array (
554
+ * 'id' => 0,
555
+ * 'name' => 'Field 1',
556
+ * 'average_rating' => 3.5,
557
+ * ),
558
+ * array (
559
+ * 'id' => 1,
560
+ * 'name' => 'Field 2',
561
+ * 'average_rating' => 3,
562
+ * )
563
+ * )
564
+ *
565
+ * @param integer $set_id the set id
566
+ * @param array $set_fields an array with fields names and id
567
+ * @param integer|bool $post_id the post_id
568
+ *
569
+ * @return bool | array
570
+ */
571
+ public static function returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id = false) {
572
+ $array_to_return = array();
573
+ $set_id = (int) $set_id;
574
+
575
+ if (!$set_fields) {
576
+ return false;
577
+ }
578
+
579
+ if (!is_int($post_id)) {
580
+ $post_id = get_the_ID();
581
+ }
582
+
583
+ //get meta values (field id and rating)
584
+ $set_post_meta_values = get_post_meta($post_id, 'yasr_multiset_author_votes', true);
585
+
586
+ //index
587
+ $i = 0;
588
+ //always returns field id and name
589
+ foreach ($set_fields as $fields_ids_and_names) {
590
+ $array_to_return[$i]['id'] = (int) $fields_ids_and_names['id'];
591
+ $array_to_return[$i]['name'] = $fields_ids_and_names['name'];
592
+ $array_to_return[$i]['average_rating'] = 0;
593
+
594
+ //if there is post meta
595
+ if ($set_post_meta_values) {
596
+ //first, loop saved fields and ratings
597
+ foreach ($set_post_meta_values as $saved_set_id) {
598
+ //if the saved set is the same selected
599
+ if ($saved_set_id['set_id'] === $set_id) {
600
+ //loop the saved arrays
601
+ foreach ($saved_set_id['fields_and_ratings'] as $single_value) {
602
+ //if field id is the same, add the rating
603
+ if ($array_to_return[$i]['id'] === $single_value->field) {
604
+ //save the rating
605
+ $array_to_return[$i]['average_rating'] = $single_value->rating;
606
+ }
607
+ }
608
+ }
609
+ }
610
+ }
611
+ //this is for list the set names
612
+ $i++;
613
+ }
614
+ return $array_to_return;
615
+ }
616
+
617
+ /**
618
+ * Returns *ALL* multiset votes in YASR_LOG_MULTI_SET
619
+ * used in stats page
620
+ *
621
+ * @author Dario Curvino <@dudo>
622
+ * @since 2.5.2
623
+ * @return array|object|null
624
+ */
625
+ public static function returnAllLogMulti() {
626
+ global $wpdb;
627
+
628
+ $query = 'SELECT * FROM ' . YASR_LOG_MULTI_SET . ' ORDER BY date, set_type, post_id DESC';
629
+
630
+ return $wpdb->get_results($query, ARRAY_A);
631
+ }
632
+
633
+ /**
634
+ * Get from the db all the values for VisitorMultiSet
635
+ *
636
+ * @param $post_id
637
+ * @param $set_id
638
+ * @param bool $visitor_multiset
639
+ * @param int $comment_id
640
+ *
641
+ * @return array|bool
642
+ */
643
+ public static function returnMultisetContent($post_id, $set_id, $visitor_multiset = false, $comment_id = 0) {
644
+ $set_id = (int) $set_id;
645
+ $post_id = (int) $post_id;
646
+ $comment_id = (int) $comment_id;
647
+
648
+ if ($post_id === 0 && $comment_id === 0) {
649
+ return false;
650
+ }
651
+
652
+ //set fields name and ids
653
+ $set_fields = self::multisetFieldsAndID($set_id);
654
+
655
+ if ($set_fields === false) {
656
+ return false;
657
+ }
658
+
659
+ if ($visitor_multiset === true || $comment_id > 0) {
660
+ return self::returnArrayFieldsRatingsVisitor($set_id, $set_fields, $comment_id, $post_id);
661
+ }
662
+
663
+ //return
664
+ return self::returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id);
665
+ }
666
+
667
+ /**
668
+ * Return an average of a given multiset_content if provided.
669
+ * Otherwise, it will get the average using the post_id and set_id
670
+ *
671
+ * @param int $post_id
672
+ * @param int $set_id
673
+ * @param bool $visitor_multiset
674
+ * @param bool|array $multiset_content | This is useful to avoid double query
675
+ *
676
+ * @return float|int
677
+ */
678
+ public static function returnMultiSetAverage($post_id, $set_id, $visitor_multiset, $multiset_content = false) {
679
+ if ($multiset_content === false) {
680
+ $post_id = (int) $post_id;
681
+ $set_id = (int) $set_id;
682
+
683
+ if ($visitor_multiset === true) {
684
+ $multiset_content = self::returnMultisetContent($post_id, $set_id, true);
685
+ }
686
+ else {
687
+ $multiset_content = self::returnMultisetContent($post_id, $set_id);
688
+ }
689
+ }
690
+
691
+ if (!is_array($multiset_content)) {
692
+ return 0;
693
+ }
694
+ //default values
695
+ $multiset_vote_sum = 0;
696
+ $multiset_rows_number = 0;
697
+
698
+ foreach ($multiset_content as $set_content) {
699
+ $multiset_vote_sum = $multiset_vote_sum + $set_content['average_rating'];
700
+ $multiset_rows_number = $multiset_rows_number + 1;
701
+ }
702
+
703
+ return round($multiset_vote_sum / $multiset_rows_number, 1);
704
+ }
705
+
706
+ /** This functions returns an array with all the value to print the multiset
707
+ * array (
708
+ * array (
709
+ * 'id' => 0,
710
+ * 'name' => 'Field 1',
711
+ * 'average_rating' => 3.5
712
+ * 'number_of_votes' => 3
713
+ * ),
714
+ * array (
715
+ * 'id' => 1,
716
+ * 'name' => 'Field 2',
717
+ * 'average_rating' => 3,
718
+ * 'number_of_votes' => 3,
719
+ * )
720
+ *
721
+ * @param int $set_id the set id
722
+ * @param array $set_fields an array with fields names and id
723
+ * @param int $comment_id the comment_id
724
+ * @param int $post_id the post_id
725
+ *
726
+ * @return bool | array
727
+ */
728
+ public static function returnArrayFieldsRatingsVisitor($set_id, $set_fields, $comment_id, $post_id) {
729
+ $array_to_return = array();
730
+
731
+ global $wpdb;
732
+
733
+ $set_id = (int) $set_id;
734
+ $comment_id = (int) $comment_id;
735
+ $post_id = (int) $post_id;
736
+
737
+ if (!$set_fields) {
738
+ return false;
739
+ }
740
+
741
+ if ($post_id < 1) {
742
+ $and_post_id = '';
743
+ }
744
+ else {
745
+ $and_post_id = 'AND l.post_id=' . $post_id;
746
+ }
747
+
748
+ //get meta values (field id and rating)
749
+ $ratings = $wpdb->get_results(
750
+ $wpdb->prepare(
751
+ "SELECT CAST((SUM(l.vote)/COUNT(l.vote)) AS DECIMAL(2,1)) AS average_rating,
752
+ COUNT(l.vote) AS number_of_votes,
753
+ field_id AS field
754
+ FROM " . YASR_LOG_MULTI_SET . " AS l
755
+ WHERE l.set_type=%d
756
+ AND l.comment_id=%d " . esc_sql($and_post_id) . "
757
+ GROUP BY l.field_id
758
+ ORDER BY l.field_id", $set_id, $comment_id
759
+ ), ARRAY_A
760
+ );
761
+
762
+ //index
763
+ $i = 0;
764
+ //always returns field id and name
765
+ foreach ($set_fields as $fields_ids_and_names) {
766
+ $array_to_return[$i]['id'] = (int) $fields_ids_and_names['id'];
767
+ $array_to_return[$i]['name'] = $fields_ids_and_names['name'];
768
+ $array_to_return[$i]['average_rating'] = 0;
769
+ $array_to_return[$i]['number_of_votes'] = 0;
770
+
771
+ //if there are ratings
772
+ if ($ratings) {
773
+ //loop the saved arrays
774
+ foreach ($ratings as $single_value) {
775
+ //if field id is the same, add the rating
776
+ if ($array_to_return[$i]['id'] === (int) $single_value['field']) {
777
+ $array_to_return[$i]['average_rating'] = $single_value['average_rating'];
778
+ $array_to_return[$i]['number_of_votes'] = (int) $single_value['number_of_votes'];
779
+ }
780
+ }
781
+
782
+ }
783
+ //this is for list the set names
784
+ $i++;
785
+ }
786
+
787
+ return $array_to_return;
788
+ }
789
+
790
+ /**
791
+ * This function returns an multidimensional array of multiset ID and Fields
792
+ * array (
793
+ * array (
794
+ * 'id' => '0',
795
+ * 'name' => 'Field1',
796
+ * ),
797
+ * array (
798
+ * 'id' => '1',
799
+ * 'name' => 'Field2',
800
+ * ),
801
+ * )
802
+ *
803
+ * @param int $set_id
804
+ *
805
+ * @return array|bool
806
+ */
807
+ public static function multisetFieldsAndID($set_id) {
808
+ $set_id = (int) $set_id;
809
+
810
+ global $wpdb;
811
+
812
+ $result = $wpdb->get_results(
813
+ $wpdb->prepare(
814
+ "SELECT f.field_id AS id,
815
+ f.field_name AS name
816
+ FROM " . YASR_MULTI_SET_FIELDS_TABLE . " AS f
817
+ WHERE f.parent_set_id=%d
818
+ ORDER BY f.field_id
819
+ ", $set_id
820
+ ), ARRAY_A
821
+ );
822
+
823
+ if (empty($result)) {
824
+ return false;
825
+ }
826
+ return $result;
827
+ }
828
+
829
+ /**
830
+ * Returns the length of a MultiSet
831
+ *
832
+ * @author Dario Curvino <@dudo>
833
+ * @since 2.9.7
834
+ *
835
+ * @param $set_id
836
+ *
837
+ * @return int
838
+ */
839
+ public static function multisetLength($set_id) {
840
+ $set_id = (int) $set_id;
841
+
842
+ global $wpdb;
843
+
844
+ $result = $wpdb->get_results(
845
+ $wpdb->prepare(
846
+ "SELECT f.field_id AS id
847
+ FROM " . YASR_MULTI_SET_FIELDS_TABLE . " AS f
848
+ WHERE f.parent_set_id=%d", $set_id
849
+ )
850
+ );
851
+
852
+ return $wpdb->num_rows;
853
+ }
854
+
855
+ /**
856
+ * Return the postmeta itemType
857
+ *
858
+ * @param bool|int $term_id
859
+ *
860
+ * @return bool|string
861
+ */
862
+ public static function getItemType($term_id = false) {
863
+ $review_types = YASR_SUPPORTED_SCHEMA_TYPES;
864
+
865
+ //if term_id is not an int, use get_post_meta
866
+ if (!is_int($term_id)) {
867
+ $post_id = get_the_ID();
868
+
869
+ if (!$post_id) {
870
+ return false;
871
+ }
872
+ $result = get_post_meta($post_id, 'yasr_review_type', true);
873
+ }
874
+ else {
875
+ $result = get_term_meta($term_id, 'yasr_review_type', true);
876
+ }
877
+
878
+ if ($result) {
879
+ $snippet_type = trim($result);
880
+
881
+ //to keep compatibility with version <2.2.3
882
+ if ($snippet_type === 'Place') {
883
+ $snippet_type = 'LocalBusiness';
884
+ }
885
+ //to keep compatibility with version <2.2.3
886
+ if ($snippet_type === 'Other') {
887
+ $snippet_type = 'BlogPosting';
888
+ }
889
+ if (!in_array($snippet_type, $review_types, true)) {
890
+ $snippet_type = YASR_ITEMTYPE;
891
+ }
892
+ }
893
+ else {
894
+ $snippet_type = YASR_ITEMTYPE;
895
+ }
896
+
897
+ //to keep compatibility with version <2.2.3
898
+ if ($snippet_type === 'Place') {
899
+ $snippet_type = 'LocalBusiness';
900
+ }
901
+ //to keep compatibility with version <2.2.3
902
+ if ($snippet_type === 'Other') {
903
+ $snippet_type = 'BlogPosting';
904
+ }
905
+
906
+ return $snippet_type;
907
+ }
908
+
909
+ }
includes/classes/YasrDatabaseRatings.php CHANGED
@@ -25,10 +25,18 @@ if (!defined('ABSPATH')) {
25
  /**
26
  * class for get overallRating and visitorVotes values
27
  *
 
 
 
28
  * Class YasrDatabaseRatings
29
  */
30
  class YasrDatabaseRatings {
31
 
 
 
 
 
 
32
  /**
33
  * Returns overall rating for single post or page
34
  *
@@ -37,6 +45,8 @@ class YasrDatabaseRatings {
37
  * @return mixed|null
38
  */
39
  public static function getOverallRating ($post_id=false) {
 
 
40
  //if values it's not passed get the post id, since version 1.6.9 this is just for yasr_add_schema function
41
  //and for a further check
42
  if (!is_int($post_id)) {
@@ -56,6 +66,8 @@ class YasrDatabaseRatings {
56
 
57
 
58
  public static function getAllOverallRatings() {
 
 
59
  global $wpdb;
60
 
61
  $query = "SELECT pm.post_id,
@@ -86,6 +98,8 @@ class YasrDatabaseRatings {
86
  * )
87
  */
88
  public static function getVisitorVotes ($post_id = false) {
 
 
89
  global $wpdb;
90
 
91
  //if values it's not passed get the post id, most of cases and default one
@@ -135,6 +149,8 @@ class YasrDatabaseRatings {
135
  * @return array|object|null
136
  */
137
  public static function getAllVisitorVotes() {
 
 
138
  global $wpdb;
139
 
140
  $query = 'SELECT * FROM ' .YASR_LOG_TABLE. ' ORDER BY date';
@@ -150,6 +166,8 @@ class YasrDatabaseRatings {
150
  * @return bool|string
151
  */
152
  public static function visitorVotesHasUserVoted($post_id = false) {
 
 
153
  global $wpdb;
154
 
155
  $user_id = get_current_user_id();
25
  /**
26
  * class for get overallRating and visitorVotes values
27
  *
28
+ * @deprecated 3.1.6 this class is deprecated. Use YasrDB instead
29
+ * @todo remove this class in Feb 2023
30
+ *
31
  * Class YasrDatabaseRatings
32
  */
33
  class YasrDatabaseRatings {
34
 
35
+ public static function deprecationNotice($class_method, $method) {
36
+ $message = $class_method .' has been deprecated. Use YasrDB::'.$method. ' instead.';
37
+ trigger_error(esc_html($message), E_USER_DEPRECATED );
38
+ }
39
+
40
  /**
41
  * Returns overall rating for single post or page
42
  *
45
  * @return mixed|null
46
  */
47
  public static function getOverallRating ($post_id=false) {
48
+ self::deprecationNotice(__METHOD__, 'overallRating');
49
+
50
  //if values it's not passed get the post id, since version 1.6.9 this is just for yasr_add_schema function
51
  //and for a further check
52
  if (!is_int($post_id)) {
66
 
67
 
68
  public static function getAllOverallRatings() {
69
+ self::deprecationNotice(__METHOD__, 'allOverallRatings');
70
+
71
  global $wpdb;
72
 
73
  $query = "SELECT pm.post_id,
98
  * )
99
  */
100
  public static function getVisitorVotes ($post_id = false) {
101
+ self::deprecationNotice(__METHOD__, 'visitorVotes');
102
+
103
  global $wpdb;
104
 
105
  //if values it's not passed get the post id, most of cases and default one
149
  * @return array|object|null
150
  */
151
  public static function getAllVisitorVotes() {
152
+ self::deprecationNotice(__METHOD__, 'allVisitorVotes');
153
+
154
  global $wpdb;
155
 
156
  $query = 'SELECT * FROM ' .YASR_LOG_TABLE. ' ORDER BY date';
166
  * @return bool|string
167
  */
168
  public static function visitorVotesHasUserVoted($post_id = false) {
169
+ self::deprecationNotice(__METHOD__, 'vvCurrentUserRating');
170
+
171
  global $wpdb;
172
 
173
  $user_id = get_current_user_id();
includes/classes/YasrDefineOptions.php CHANGED
@@ -135,14 +135,14 @@ class YasrDefineOptions {
135
  }
136
 
137
  /**
138
- * Do these defines on plugins_loaded
139
  *
140
  * @author Dario Curvino <@dudo>
141
  * @since 3.0.5
142
  */
143
  public function onPluginsLoaded() {
144
  add_action('plugins_loaded', static function () {
145
- define('YASR_FIRST_SETID', YasrMultiSetData::returnFirstSetId());
146
  define('YASR_CATCH_INFINITE_SCROLL_INSTALLED', yasr_is_catch_infinite_sroll_installed());
147
  });
148
  }
135
  }
136
 
137
  /**
138
+ * Do This defines on plugins_loaded
139
  *
140
  * @author Dario Curvino <@dudo>
141
  * @since 3.0.5
142
  */
143
  public function onPluginsLoaded() {
144
  add_action('plugins_loaded', static function () {
145
+ define('YASR_FIRST_SETID', YasrDB::returnFirstSetId());
146
  define('YASR_CATCH_INFINITE_SCROLL_INSTALLED', yasr_is_catch_infinite_sroll_installed());
147
  });
148
  }
includes/classes/{YasrLogDashboardWidget.php → YasrLastRatingsWidget.php} RENAMED
@@ -22,12 +22,15 @@ if (!defined('ABSPATH')) {
22
  } // Exit if accessed directly
23
 
24
  /**
25
- * Class YasrLogDashboardWidget
26
  *
27
- * Class to print the Dashboard widgets
 
 
 
28
  *
29
  */
30
- class YasrLogDashboardWidget {
31
  private $limit = 8;
32
  private $offset = 0;
33
  private $page_num;
@@ -140,7 +143,6 @@ class YasrLogDashboardWidget {
140
  echo $this->returnWidget();
141
 
142
  $this->die_if_is_ajax();
143
-
144
  }
145
 
146
  /**
@@ -163,7 +165,7 @@ class YasrLogDashboardWidget {
163
  }
164
 
165
  /**
166
- * Print the widget
167
  * @return string|void
168
  */
169
  private function returnWidget() {
@@ -183,7 +185,7 @@ class YasrLogDashboardWidget {
183
  );
184
 
185
  if (!$log_result) {
186
- return __("No Recent votes yet", 'yet-another-stars-rating');
187
  }
188
 
189
  $html_to_return = "<div class='yasr-log-container' id='$this->container_id'>";
@@ -250,7 +252,7 @@ class YasrLogDashboardWidget {
250
  $html_to_return .= "<div id='yasr-log-page-navigation'>";
251
 
252
  //use data attribute instead of value of #yasr-log-total-pages, because, on ajaxresponse,
253
- //the "last" button could not exists
254
  $html_to_return .= "<span id='$this->span_total_pages' data-yasr-log-total-pages='$this->num_of_pages'>";
255
  $html_to_return .= __("Pages", 'yet-another-stars-rating') . ": ($this->num_of_pages) &nbsp;&nbsp;&nbsp;";
256
  $html_to_return .= '</span>';
@@ -268,7 +270,6 @@ class YasrLogDashboardWidget {
268
  * This function will print the row with pagination
269
  */
270
  private function pagination($html_to_return) {
271
-
272
  if ($this->num_of_pages <= 3) {
273
  for ($i = 1; $i <= $this->num_of_pages; $i++) {
274
  if ($i === $this->page_num) {
@@ -324,7 +325,6 @@ class YasrLogDashboardWidget {
324
  }
325
 
326
  return $html_to_return;
327
-
328
  }
329
 
330
  /**
22
  } // Exit if accessed directly
23
 
24
  /**
25
+ * Class YasrLastRatingsWidget
26
  *
27
+ * This class is used to show:
28
+ * - "Recent Ratings" widget in dashboard
29
+ * - "Your Ratings" widget in dashboard
30
+ * - [yasr_user_rate_history] shortcode
31
  *
32
  */
33
+ class YasrLastRatingsWidget {
34
  private $limit = 8;
35
  private $offset = 0;
36
  private $page_num;
143
  echo $this->returnWidget();
144
 
145
  $this->die_if_is_ajax();
 
146
  }
147
 
148
  /**
165
  }
166
 
167
  /**
168
+ * Return the widget
169
  * @return string|void
170
  */
171
  private function returnWidget() {
185
  );
186
 
187
  if (!$log_result) {
188
+ return __('No Recent votes yet', 'yet-another-stars-rating');
189
  }
190
 
191
  $html_to_return = "<div class='yasr-log-container' id='$this->container_id'>";
252
  $html_to_return .= "<div id='yasr-log-page-navigation'>";
253
 
254
  //use data attribute instead of value of #yasr-log-total-pages, because, on ajaxresponse,
255
+ //the "last" button could not exist
256
  $html_to_return .= "<span id='$this->span_total_pages' data-yasr-log-total-pages='$this->num_of_pages'>";
257
  $html_to_return .= __("Pages", 'yet-another-stars-rating') . ": ($this->num_of_pages) &nbsp;&nbsp;&nbsp;";
258
  $html_to_return .= '</span>';
270
  * This function will print the row with pagination
271
  */
272
  private function pagination($html_to_return) {
 
273
  if ($this->num_of_pages <= 3) {
274
  for ($i = 1; $i <= $this->num_of_pages; $i++) {
275
  if ($i === $this->page_num) {
325
  }
326
 
327
  return $html_to_return;
 
328
  }
329
 
330
  /**
includes/classes/YasrMultiSetData.php CHANGED
@@ -25,6 +25,9 @@ if (!defined('ABSPATH')) {
25
  /**
26
  * All functions needed to work with MultiSet
27
  *
 
 
 
28
  * Class YasrMultiSetData
29
  */
30
  class YasrMultiSetData {
@@ -35,6 +38,8 @@ class YasrMultiSetData {
35
  * @return array|object|\stdClass[]|null
36
  */
37
  public static function returnMultiSetNames() {
 
 
38
  global $wpdb;
39
 
40
  return $wpdb->get_results("SELECT * FROM " . YASR_MULTI_SET_NAME_TABLE . " ORDER BY set_id");
@@ -48,6 +53,8 @@ class YasrMultiSetData {
48
  * @return false|int
49
  */
50
  public static function returnFirstSetId() {
 
 
51
  global $wpdb;
52
  $set_id = false;
53
 
@@ -74,6 +81,8 @@ class YasrMultiSetData {
74
  * @return int
75
  */
76
  public static function multisetLength($set_id) {
 
 
77
  $set_id = (int)$set_id;
78
 
79
  global $wpdb;
@@ -107,6 +116,8 @@ class YasrMultiSetData {
107
  */
108
 
109
  public static function multisetFieldsAndID($set_id) {
 
 
110
  $set_id = (int)$set_id;
111
 
112
  global $wpdb;
@@ -137,6 +148,8 @@ class YasrMultiSetData {
137
  * @return array|bool
138
  */
139
  public static function returnMultisetContent($post_id, $set_id, $visitor_multiset=false, $comment_id=0) {
 
 
140
  $set_id = (int)$set_id;
141
  $post_id = (int)$post_id;
142
  $comment_id = (int)$comment_id;
@@ -182,6 +195,8 @@ class YasrMultiSetData {
182
  */
183
 
184
  public static function returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id=false) {
 
 
185
  $array_to_return = array ();
186
  $set_id = (int)$set_id;
187
 
@@ -252,6 +267,8 @@ class YasrMultiSetData {
252
  */
253
 
254
  public static function returnArrayFieldsRatingsVisitor($set_id, $set_fields, $comment_id, $post_id) {
 
 
255
  $array_to_return = array();
256
 
257
  global $wpdb;
@@ -322,6 +339,8 @@ class YasrMultiSetData {
322
  * @return float|int
323
  */
324
  public static function returnMultiSetAverage($post_id, $set_id, $visitor_multiset, $multiset_content=false) {
 
 
325
  if($multiset_content === false) {
326
  $post_id = (int)$post_id;
327
  $set_id = (int)$set_id;
@@ -362,6 +381,8 @@ class YasrMultiSetData {
362
  * @return array
363
  */
364
  public static function returnMultiAuthorAverageArray ($array_post_id, $set_id) {
 
 
365
  $average_array = array();
366
 
367
  $i = 0;
@@ -391,6 +412,8 @@ class YasrMultiSetData {
391
  * @return array|object|null
392
  */
393
  public static function returnAllLogMulti() {
 
 
394
  global $wpdb;
395
 
396
  $query = 'SELECT * FROM ' .YASR_LOG_MULTI_SET. ' ORDER BY date, set_type, post_id DESC';
25
  /**
26
  * All functions needed to work with MultiSet
27
  *
28
+ * @deprecated 3.1.6 this class is deprecated. Use YasrDB instead
29
+ * @todo remove this class in Feb 2023
30
+ *
31
  * Class YasrMultiSetData
32
  */
33
  class YasrMultiSetData {
38
  * @return array|object|\stdClass[]|null
39
  */
40
  public static function returnMultiSetNames() {
41
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnMultiSetNames');
42
+
43
  global $wpdb;
44
 
45
  return $wpdb->get_results("SELECT * FROM " . YASR_MULTI_SET_NAME_TABLE . " ORDER BY set_id");
53
  * @return false|int
54
  */
55
  public static function returnFirstSetId() {
56
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnFirstSetId');
57
+
58
  global $wpdb;
59
  $set_id = false;
60
 
81
  * @return int
82
  */
83
  public static function multisetLength($set_id) {
84
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'multisetLength');
85
+
86
  $set_id = (int)$set_id;
87
 
88
  global $wpdb;
116
  */
117
 
118
  public static function multisetFieldsAndID($set_id) {
119
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'multisetFieldsAndID');
120
+
121
  $set_id = (int)$set_id;
122
 
123
  global $wpdb;
148
  * @return array|bool
149
  */
150
  public static function returnMultisetContent($post_id, $set_id, $visitor_multiset=false, $comment_id=0) {
151
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnMultisetContent');
152
+
153
  $set_id = (int)$set_id;
154
  $post_id = (int)$post_id;
155
  $comment_id = (int)$comment_id;
195
  */
196
 
197
  public static function returnArrayFieldsRatingsAuthor($set_id, $set_fields, $post_id=false) {
198
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnArrayFieldsRatingsAuthor');
199
+
200
  $array_to_return = array ();
201
  $set_id = (int)$set_id;
202
 
267
  */
268
 
269
  public static function returnArrayFieldsRatingsVisitor($set_id, $set_fields, $comment_id, $post_id) {
270
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnArrayFieldsRatingsVisitor');
271
+
272
  $array_to_return = array();
273
 
274
  global $wpdb;
339
  * @return float|int
340
  */
341
  public static function returnMultiSetAverage($post_id, $set_id, $visitor_multiset, $multiset_content=false) {
342
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnMultiSetAverage');
343
+
344
  if($multiset_content === false) {
345
  $post_id = (int)$post_id;
346
  $set_id = (int)$set_id;
381
  * @return array
382
  */
383
  public static function returnMultiAuthorAverageArray ($array_post_id, $set_id) {
384
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnMultiAuthorAverageArray');
385
+
386
  $average_array = array();
387
 
388
  $i = 0;
412
  * @return array|object|null
413
  */
414
  public static function returnAllLogMulti() {
415
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'returnAllLogMulti');
416
+
417
  global $wpdb;
418
 
419
  $query = 'SELECT * FROM ' .YASR_LOG_MULTI_SET. ' ORDER BY date, set_type, post_id DESC';
includes/classes/YasrPhpFieldsHelper.php CHANGED
@@ -295,7 +295,7 @@ if (!class_exists('YasrPhpFieldsHelper') ) {
295
 
296
  //Use a random string (uniqueid and str_shuffle to add randomness) if id is still empty
297
  if (!$id) {
298
- $id = str_shuffle(uniqid('', true));
299
  }
300
 
301
  if($autocomplete !== 'on') {
295
 
296
  //Use a random string (uniqueid and str_shuffle to add randomness) if id is still empty
297
  if (!$id) {
298
+ $id = str_shuffle(uniqid(''));
299
  }
300
 
301
  if($autocomplete !== 'on') {
includes/classes/YasrRankingData.php CHANGED
@@ -22,6 +22,14 @@ if (!defined('ABSPATH')) {
22
  exit('You\'re not allowed to see this page');
23
  } // Exit if accessed directly
24
 
 
 
 
 
 
 
 
 
25
  class YasrRankingData {
26
 
27
  /**
@@ -35,6 +43,8 @@ class YasrRankingData {
35
  * @return array|false|object|void
36
  */
37
  public static function rankingOverallGetResults($atts) {
 
 
38
  global $wpdb;
39
 
40
  //return custom query_result here
@@ -80,6 +90,8 @@ class YasrRankingData {
80
  */
81
 
82
  public static function rankingVVGetResults($atts, $ranking) {
 
 
83
  global $wpdb;
84
 
85
  //hooks here to return a query
@@ -127,6 +139,8 @@ class YasrRankingData {
127
  * @return array|false|object|void
128
  */
129
  public static function rankingTopReviewers($atts) {
 
 
130
  global $wpdb;
131
 
132
  //return custom query here
@@ -169,6 +183,8 @@ class YasrRankingData {
169
  * @return array|false|object|void
170
  */
171
  public static function rankingTopUsers($atts) {
 
 
172
  global $wpdb;
173
 
174
  //return custom query here
@@ -209,6 +225,8 @@ class YasrRankingData {
209
  * @return bool|array
210
  */
211
  public static function rankingMulti($set_id, $sql_atts=false) {
 
 
212
  global $wpdb;
213
  if($set_id === NULL) {
214
  $set_id = YASR_FIRST_SETID;
@@ -269,6 +287,8 @@ class YasrRankingData {
269
  * @return array|false|object
270
  */
271
  public static function rankingMultiVV ($set_id, $ranking='most', $sql_atts=false) {
 
 
272
  global $wpdb;
273
  //if set_id is not set (e.g. in rest parameter setid is not set)
274
  if($set_id === NULL) {
22
  exit('You\'re not allowed to see this page');
23
  } // Exit if accessed directly
24
 
25
+ /**
26
+ * Class YasrRankingData
27
+ *
28
+ * @author Dario Curvino <@dudo>
29
+ * @deprecated 3.1.6 this class is deprecated. Use YasrDB instead
30
+ * @todo remove this class in Feb 2023
31
+ *
32
+ */
33
  class YasrRankingData {
34
 
35
  /**
43
  * @return array|false|object|void
44
  */
45
  public static function rankingOverallGetResults($atts) {
46
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'rankingOverall');
47
+
48
  global $wpdb;
49
 
50
  //return custom query_result here
90
  */
91
 
92
  public static function rankingVVGetResults($atts, $ranking) {
93
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'rankingVV');
94
+
95
  global $wpdb;
96
 
97
  //hooks here to return a query
139
  * @return array|false|object|void
140
  */
141
  public static function rankingTopReviewers($atts) {
142
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'rankingTopReviewers');
143
+
144
  global $wpdb;
145
 
146
  //return custom query here
183
  * @return array|false|object|void
184
  */
185
  public static function rankingTopUsers($atts) {
186
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'rankingTopUsers');
187
+
188
  global $wpdb;
189
 
190
  //return custom query here
225
  * @return bool|array
226
  */
227
  public static function rankingMulti($set_id, $sql_atts=false) {
228
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'rankingMulti');
229
+
230
  global $wpdb;
231
  if($set_id === NULL) {
232
  $set_id = YASR_FIRST_SETID;
287
  * @return array|false|object
288
  */
289
  public static function rankingMultiVV ($set_id, $ranking='most', $sql_atts=false) {
290
+ YasrDatabaseRatings::deprecationNotice(__METHOD__, 'rankingMultiVV');
291
+
292
  global $wpdb;
293
  //if set_id is not set (e.g. in rest parameter setid is not set)
294
  if($set_id === NULL) {
includes/classes/YasrScriptsLoader.php CHANGED
@@ -486,9 +486,9 @@ class YasrScriptsLoader {
486
  $scan = scandir(YASR_ABSOLUTE_BLOCKS_PATH);
487
 
488
  foreach($scan as $dir) {
489
- //be sure it is a dir and it is not . and ..
490
  if ($dir !== '.' && $dir !== '..' && is_dir(YASR_ABSOLUTE_BLOCKS_PATH . '/' . $dir)) {
491
- //use regist_block_type if wp version > 5.8
492
  if ($use_register_post_type === true) {
493
  register_block_type(YASR_ABSOLUTE_BLOCKS_PATH .'/'.$dir.'/block.json');
494
  }
486
  $scan = scandir(YASR_ABSOLUTE_BLOCKS_PATH);
487
 
488
  foreach($scan as $dir) {
489
+ //be sure it is a dir, and it is not . and ..
490
  if ($dir !== '.' && $dir !== '..' && is_dir(YASR_ABSOLUTE_BLOCKS_PATH . '/' . $dir)) {
491
+ //use register_block_type if wp version > 5.8
492
  if ($use_register_post_type === true) {
493
  register_block_type(YASR_ABSOLUTE_BLOCKS_PATH .'/'.$dir.'/block.json');
494
  }
includes/img/cnrt.png DELETED
Binary file
includes/img/movie_helper.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2119.53 566.24"><defs><style>.a{fill:#333;}.b{fill:#194172;}.c{fill:#d8eaf8;}.d{fill:#174172;}.e{fill:#f0f7fc;}.f{fill:#143b60;}.g{fill:#fff;}</style></defs><title>movie-helper-logo-horizontal</title><path class="a" d="M801.09,354.67,776,407.6q-5.49,10.59-13.62,10.59T748.74,407l-25.49-52.35V438H696V298.4h26.86L762.27,379l39.21-80.58h26.86V438H801.09Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M969.1,361.73v10.58q0,35.1-13.23,51t-42.45,15.88q-29.2,0-42.25-15.88t-13-51.57V361.53q0-32.53,13.23-48.43t42-15.88q28.71,0,42.25,16.08T969.1,361.73Zm-27.25,10v-7.25q0-18.83-4.7-30-5.49-12.93-23.53-12.94-18.24,0-23.72,12.94-4.51,10.59-4.51,30v7.25q0,25.3,7.06,34.12a21.73,21.73,0,0,0,8.13,6.37,29.06,29.06,0,0,0,12.94,2.65,29.37,29.37,0,0,0,12.84-2.55A22.87,22.87,0,0,0,934.6,406a26.3,26.3,0,0,0,4.51-9.8Q941.86,386.63,941.85,371.72Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1099.87,298.4,1056,430.15q-3.54,9-12.55,9-9.4,0-12.94-9L987.14,298.4h28.23l28,91,28-91Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1153.79,438h-27.25V298.4h27.25Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1288.08,438h-49.4q-23.54,0-33-8.13t-9.51-28.73V298.4h91.95v24.31h-64.69v32.74h45.29l-2,24.31h-43.32v19.41q0,8.24,3.72,11.37t13.53,3.14h47.44Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1502.55,438H1475.3V381.53h-51.17V438h-27.25V298.4h27.25v59h51.17v-59h27.25Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1634.89,438h-49.41q-23.52,0-33-8.13t-9.51-28.73V298.4h92v24.31h-64.7v32.74h45.29l-2,24.31h-43.33v19.41q0,8.24,3.73,11.37t13.52,3.14h47.45Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1757.42,438h-41.56q-23.53,0-34-9.12t-10.49-29.7V298.4h27.26V399.17q0,8.24,3.72,11.37t13.53,3.14h41.56Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M1877.11,310.46q12.06,12,12.06,35.38t-12.06,35.39q-12.06,12.06-34,12.06h-26.86V438H1789V298.4h54.11Q1865,298.4,1877.11,310.46Zm-15.19,35.38q0-23.13-20.2-23.13h-25.48v46.07h25.48q9.81,0,15-5.29T1861.92,345.84Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M2013.86,438h-49.4q-23.54,0-33-8.13t-9.51-28.73V298.4h91.95v24.31h-64.7v32.74h45.29l-2,24.31h-43.33v19.41q0,8.24,3.73,11.37t13.53,3.14h47.44Z" transform="translate(-36.47 -19.7)"/><path class="a" d="M2156,438h-31.57l-27.25-51.76h-19.6V438h-27.25V328.4q0-15.69,7.25-22.84t24.31-7.16H2105q20.78,0,33,12.65t12.26,32.05q0,14.11-7.36,24.41a38.09,38.09,0,0,1-18.13,14.21Zm-38.52-80.48a21,21,0,0,0,5.58-14.9q0-8.92-5.39-14.41t-14.41-5.49h-13.53q-12.15,0-12.15,12.35v28.43h25.68A18.61,18.61,0,0,0,2117.48,357.51Z" transform="translate(-36.47 -19.7)"/><path class="b" d="M204.79,347.74l-85.44-48.41a30.78,30.78,0,0,0-41.92,11.58l-37,65.2a30.81,30.81,0,0,0,11.63,42l85.43,48.4Z" transform="translate(-36.47 -19.7)"/><path class="b" d="M437.92,347.74l85.44-48.41a30.82,30.82,0,0,1,42,11.58l36.93,65.2a30.79,30.79,0,0,1-11.58,42l-85.44,48.4Z" transform="translate(-36.47 -19.7)"/><polygon class="c" points="264.32 163.78 294.83 163.78 286.77 100.27 272.39 100.27 264.32 163.78"/><path class="d" d="M331.3,186H300.79a2.48,2.48,0,0,1-2.48-2.81l8.07-63.51a2.49,2.49,0,0,1,2.48-2.18h14.38a2.49,2.49,0,0,1,2.48,2.18l8.06,63.51A2.5,2.5,0,0,1,331.3,186Zm-27.67-5h24.83L321,122.47h-10Z" transform="translate(-36.47 -19.7)"/><path class="b" d="M368.56,243.94V186.12c0-10-10.46-18.11-23.36-18.11H288.36c-12.88,0-23.34,8.1-23.34,18.11v57.82Z" transform="translate(-36.47 -19.7)"/><path class="c" d="M577.84,466.69c0,48.14-31.24,89.71-75.42,107.23a126.38,126.38,0,0,1-46.63,8.86H181.45a126.34,126.34,0,0,1-46.66-8.87c-44.17-17.52-75.41-59.09-75.41-107.22,0-63.88,82.23-257.54,259.22-257.54C497.85,209.15,577.84,402.81,577.84,466.69Z" transform="translate(-36.47 -19.7)"/><path class="d" d="M455.79,585.93H181.45a128.85,128.85,0,0,1-47.82-9.1A124.87,124.87,0,0,1,78,533.61a114.29,114.29,0,0,1-21.73-66.92c0-17.36,5.77-42.27,15.82-68.32a359.74,359.74,0,0,1,48.06-86.3C156.72,263.68,220.88,206,318.6,206c98.85,0,163,57.68,199.35,106.06a355.66,355.66,0,0,1,47.53,86.31c9.85,26,15.51,50.86,15.51,68.31a114.33,114.33,0,0,1-21.74,66.93,124.76,124.76,0,0,1-55.67,43.22A129,129,0,0,1,455.79,585.93ZM318.6,212.3c-95.13,0-157.72,56.32-193.48,103.56C94.78,356,62.52,422.45,62.52,466.69a108,108,0,0,0,20.56,63.25A118.48,118.48,0,0,0,136,571a122.51,122.51,0,0,0,45.5,8.66H455.79A122.7,122.7,0,0,0,501.26,571a118.45,118.45,0,0,0,52.88-41,108.12,108.12,0,0,0,20.55-63.26c0-33.29-21.65-97.47-61.77-150.83C477.4,268.61,414.86,212.3,318.6,212.3Z" transform="translate(-36.47 -19.7)"/><path class="e" d="M561.66,478.67c0,40.83-28.36,73.59-63.61,92.2a117.71,117.71,0,0,1-45,8.62H180.41c-16.5,0-27.85-5.58-41.08-11.83-35.25-18.61-63.77-48.16-63.77-89,0-59.89,77.09-241.45,243-241.45C486.66,237.22,561.66,418.78,561.66,478.67Z" transform="translate(-36.47 -19.7)"/><path class="d" d="M318.74,282.09c-138.92,0-203.56,143.8-203.56,185.21s43.06,75.34,95.77,75.34H426.27c52.7,0,95.82-33.89,95.82-75.34S459.44,282.09,318.74,282.09Z" transform="translate(-36.47 -19.7)"/><path class="f" d="M318.7,301.86c-128.38,0-188.11,132.89-188.11,171.16s39.79,69.62,88.5,69.62h199c48.71,0,88.56-31.32,88.56-69.62S448.73,301.86,318.7,301.86Z" transform="translate(-36.47 -19.7)"/><path class="g" d="M260.68,406.17a37.14,37.14,0,0,1-37.34,36.89c-20.65,0-37.39-16.55-37.39-36.89s16.74-36.89,37.39-36.89A37.12,37.12,0,0,1,260.68,406.17Z" transform="translate(-36.47 -19.7)"/><path class="g" d="M451.26,406.17c0,20.34-16.72,36.89-37.37,36.89s-37.39-16.55-37.39-36.89,16.77-36.89,37.39-36.89A37.13,37.13,0,0,1,451.26,406.17Z" transform="translate(-36.47 -19.7)"/><path class="d" d="M285.9,21.48,371.75,70a13.07,13.07,0,0,1,0,22.85L285.9,141.43c-9,5.07-20.2-1.27-20.2-11.43V32.9C265.7,22.75,276.92,16.41,285.9,21.48Z" transform="translate(-36.47 -19.7)"/><path class="g" d="M259,484H383c2.15,0-4,39-61,40C266,525,256.38,484,259,484Z" transform="translate(-36.47 -19.7)"/></svg>
 
includes/rest/classes/YasrCustomEndpoint.php CHANGED
@@ -293,7 +293,7 @@ class YasrCustomEndpoint extends WP_REST_Controller {
293
  return $this->returnErrorPostId();
294
  }
295
 
296
- $data_to_return['yasr_visitor_multiset'] = YasrMultiSetData::returnMultisetContent($post_id, $set_id, true);
297
  if ($data_to_return['yasr_visitor_multiset'] === false) {
298
  return $this->returnInvalidMultiset();
299
  }
@@ -312,7 +312,7 @@ class YasrCustomEndpoint extends WP_REST_Controller {
312
  */
313
  protected function returnCommentMultiset($set_id, $comment_id) {
314
  //if comment id is valid, post_id can be ignored at all
315
- $data_to_return['yasr_comment_multiset'] = YasrMultiSetData::returnMultisetContent(false, $set_id, false, $comment_id);
316
  if ($data_to_return['yasr_comment_multiset'] === false) {
317
  return $this->returnInvalidMultiset();
318
  }
@@ -333,7 +333,7 @@ class YasrCustomEndpoint extends WP_REST_Controller {
333
  return $this->returnErrorPostId();
334
  }
335
 
336
- $data_to_return['yasr_multiset'] = YasrMultiSetData::returnMultisetContent($post_id, $set_id);
337
  if ($data_to_return['yasr_multiset'] === false) {
338
  return $this->returnInvalidMultiset();
339
  }
293
  return $this->returnErrorPostId();
294
  }
295
 
296
+ $data_to_return['yasr_visitor_multiset'] = YasrDB::returnMultisetContent($post_id, $set_id, true);
297
  if ($data_to_return['yasr_visitor_multiset'] === false) {
298
  return $this->returnInvalidMultiset();
299
  }
312
  */
313
  protected function returnCommentMultiset($set_id, $comment_id) {
314
  //if comment id is valid, post_id can be ignored at all
315
+ $data_to_return['yasr_comment_multiset'] = YasrDB::returnMultisetContent(false, $set_id, false, $comment_id);
316
  if ($data_to_return['yasr_comment_multiset'] === false) {
317
  return $this->returnInvalidMultiset();
318
  }
333
  return $this->returnErrorPostId();
334
  }
335
 
336
+ $data_to_return['yasr_multiset'] = YasrDB::returnMultisetContent($post_id, $set_id);
337
  if ($data_to_return['yasr_multiset'] === false) {
338
  return $this->returnInvalidMultiset();
339
  }
includes/shortcodes/classes/YasrMultiSet.php CHANGED
@@ -62,7 +62,7 @@ class YasrMultiSet extends YasrShortcode {
62
 
63
  $this->shortcode_html = '<!-- Yasr Multi Set Shortcode-->';
64
 
65
- $multiset_content = YasrMultiSetData::returnMultisetContent($post_id, $set_id);
66
 
67
  if ($multiset_content === false) {
68
  return $this->returnErrorData('<!-- Yasr Multi Set Shortcode-->');
@@ -138,7 +138,7 @@ class YasrMultiSet extends YasrShortcode {
138
  * @return string
139
  */
140
  public function returnStarsDiv ($field_id, $average_rating, $readonly) {
141
- $unique_id_identifier = 'yasr-multiset-' . str_shuffle(uniqid());
142
 
143
  return "<div class='yasr-multiset-visitors-rater'
144
  id='$unique_id_identifier'
@@ -196,7 +196,9 @@ class YasrMultiSet extends YasrShortcode {
196
  //If average row should be showed
197
  if ($this->showAverageMultiset() === true) {
198
  //get the average of the multiset
199
- $multiset_average = YasrMultiSetData::returnMultiSetAverage($this->post_id, $this->set_id, $visitor_multiset, $multiset_content);
 
 
200
 
201
  //return it
202
  return $this->returnAverageRowMultiSet($multiset_average);
@@ -219,7 +221,7 @@ class YasrMultiSet extends YasrShortcode {
219
  $html_average = null;
220
 
221
  //Show average row
222
- $unique_id_identifier = 'yasr-multiset-' . str_shuffle(uniqid());
223
 
224
  $html_average = "<tr>
225
  <td colspan='2' class='yasr-multiset-average'>
62
 
63
  $this->shortcode_html = '<!-- Yasr Multi Set Shortcode-->';
64
 
65
+ $multiset_content = YasrDB::returnMultisetContent($post_id, $set_id);
66
 
67
  if ($multiset_content === false) {
68
  return $this->returnErrorData('<!-- Yasr Multi Set Shortcode-->');
138
  * @return string
139
  */
140
  public function returnStarsDiv ($field_id, $average_rating, $readonly) {
141
+ $unique_id_identifier = yasr_return_dom_id('yasr-multiset-');
142
 
143
  return "<div class='yasr-multiset-visitors-rater'
144
  id='$unique_id_identifier'
196
  //If average row should be showed
197
  if ($this->showAverageMultiset() === true) {
198
  //get the average of the multiset
199
+ $multiset_average = YasrDB::returnMultiSetAverage(
200
+ $this->post_id, $this->set_id, $visitor_multiset, $multiset_content
201
+ );
202
 
203
  //return it
204
  return $this->returnAverageRowMultiSet($multiset_average);
221
  $html_average = null;
222
 
223
  //Show average row
224
+ $unique_id_identifier = yasr_return_dom_id('yasr-multiset-');
225
 
226
  $html_average = "<tr>
227
  <td colspan='2' class='yasr-multiset-average'>
includes/shortcodes/classes/YasrNoStarsRankings.php CHANGED
@@ -34,7 +34,7 @@ class YasrNoStarsRankings extends YasrShortcode {
34
  $this->shortcode_html = '<!-- Yasr '.$this->shortcode_name.' Shortcode-->';
35
 
36
  $sql_atts = apply_filters('yasr_tr_rankings_atts', false, $atts);
37
- $query_result = YasrRankingData::rankingTopReviewers($sql_atts);
38
 
39
  if ($query_result) {
40
  $this->shortcode_html = $this->returnTableContent($query_result, $sql_atts);
@@ -61,7 +61,7 @@ class YasrNoStarsRankings extends YasrShortcode {
61
  $this->shortcode_html = '<!-- Yasr '.$this->shortcode_name.' Shortcode-->';
62
 
63
  $sql_atts = apply_filters('yasr_tu_rankings_atts', false, $atts);
64
- $query_result = YasrRankingData::rankingTopUsers($sql_atts);
65
 
66
  if ($query_result) {
67
  $this->shortcode_html = $this->returnTableContent($query_result, $sql_atts);
34
  $this->shortcode_html = '<!-- Yasr '.$this->shortcode_name.' Shortcode-->';
35
 
36
  $sql_atts = apply_filters('yasr_tr_rankings_atts', false, $atts);
37
+ $query_result = YasrDB::rankingTopReviewers($sql_atts);
38
 
39
  if ($query_result) {
40
  $this->shortcode_html = $this->returnTableContent($query_result, $sql_atts);
61
  $this->shortcode_html = '<!-- Yasr '.$this->shortcode_name.' Shortcode-->';
62
 
63
  $sql_atts = apply_filters('yasr_tu_rankings_atts', false, $atts);
64
+ $query_result = YasrDB::rankingTopUsers($sql_atts);
65
 
66
  if ($query_result) {
67
  $this->shortcode_html = $this->returnTableContent($query_result, $sql_atts);
includes/shortcodes/classes/YasrOverallRating.php CHANGED
@@ -88,14 +88,13 @@ class YasrOverallRating extends YasrShortcode {
88
  if($rating !== false) {
89
  $overall_rating = $rating;
90
  } else {
91
- $overall_rating = YasrDatabaseRatings::getOverallRating($post_id);
92
  }
93
  } else {
94
  $overall_rating = $this->overall_rating;
95
  }
96
 
97
- $unique_id = str_shuffle(uniqid());
98
- $overall_rating_html_id = 'yasr-overall-rating-rater-' . $unique_id;
99
 
100
  $html_stars = "<div class='$class'
101
  id='$overall_rating_html_id'
@@ -121,7 +120,7 @@ class YasrOverallRating extends YasrShortcode {
121
  */
122
  protected function customTextBefore() {
123
  //Get overall Rating
124
- $this->overall_rating = YasrDatabaseRatings::getOverallRating();
125
  $text_before_star = apply_filters('yasr_cstm_text_before_overall', $this->overall_rating);
126
 
127
  return "<div class='yasr-container-custom-text-and-overall'>
88
  if($rating !== false) {
89
  $overall_rating = $rating;
90
  } else {
91
+ $overall_rating = YasrDB::overallRating($post_id);
92
  }
93
  } else {
94
  $overall_rating = $this->overall_rating;
95
  }
96
 
97
+ $overall_rating_html_id = yasr_return_dom_id('yasr-overall-rating-rater-');
 
98
 
99
  $html_stars = "<div class='$class'
100
  id='$overall_rating_html_id'
120
  */
121
  protected function customTextBefore() {
122
  //Get overall Rating
123
+ $this->overall_rating = YasrDB::overallRating();
124
  $text_before_star = apply_filters('yasr_cstm_text_before_overall', $this->overall_rating);
125
 
126
  return "<div class='yasr-container-custom-text-and-overall'>
includes/shortcodes/classes/YasrRankings.php CHANGED
@@ -28,7 +28,6 @@ if (!defined('ABSPATH')) {
28
  * Class YasrRankings
29
  */
30
  class YasrRankings extends YasrMultiSet {
31
-
32
  protected $query_highest_rated_overall;
33
  public $query_result_most_rated_visitor;
34
  public $query_result_highest_rated_visitor;
@@ -54,7 +53,7 @@ class YasrRankings extends YasrMultiSet {
54
  //$this->shorcode_name is the default value
55
  $sql_atts = apply_filters('yasr_ov_rankings_atts', $this->shortcode_name, $atts);
56
 
57
- $this->query_highest_rated_overall = YasrRankingData::rankingOverallGetResults($sql_atts);
58
 
59
  $this->returnSingleTableRanking($this->urlencodeAtts($sql_atts));
60
  $this->shortcode_html .= '<!--End Yasr Top 10 highest Rated Shortcode-->';
@@ -77,15 +76,15 @@ class YasrRankings extends YasrMultiSet {
77
 
78
  /**
79
  * Hook here to use shortcode atts.
80
- * If not used, will works with no support for atts
81
  *
82
  * @param string $this->shortcode_name Name of shortcode caller
83
  * @param string|array $atts Shortcode atts
84
  */
85
  $sql_atts = apply_filters('yasr_vv_rankings_atts', $this->shortcode_name, $atts);
86
 
87
- $this->query_result_most_rated_visitor = YasrRankingData::rankingVVGetResults($sql_atts, 'most');
88
- $this->query_result_highest_rated_visitor = YasrRankingData::rankingVVGetResults($sql_atts, 'highest');
89
 
90
  $this->returnDoubleTableRanking($this->urlencodeAtts($sql_atts), $source);
91
  $this->shortcode_html .= '<!--End Yasr TMost Or Highest Rated Shortcode -->';
@@ -112,7 +111,7 @@ class YasrRankings extends YasrMultiSet {
112
  //$this->shorcode_name is the default value
113
  $sql_atts = apply_filters('yasr_multi_set_ranking_atts', $this->shortcode_name, $atts);
114
 
115
- $this->query_highest_rated_overall = YasrRankingData::rankingMulti($this->set_id, $sql_atts);
116
 
117
  $this->returnSingleTableRanking($this->urlencodeAtts($sql_atts), 'author_multi');
118
  $this->shortcode_html .= '<!-- Yasr Ranking by Multiset -->';
@@ -144,8 +143,8 @@ class YasrRankings extends YasrMultiSet {
144
  */
145
  $sql_atts = apply_filters('yasr_visitor_multi_set_ranking_atts', $this->shortcode_name, $atts);
146
 
147
- $this->query_result_most_rated_visitor = YasrRankingData::rankingMultiVV($this->set_id, 'most', $sql_atts);
148
- $this->query_result_highest_rated_visitor = YasrRankingData::rankingMultiVV($this->set_id, 'highest', $sql_atts);
149
 
150
  //this means no filter has run, I've to create an array with the setid
151
  //that will be later urlencoded
@@ -174,7 +173,7 @@ class YasrRankings extends YasrMultiSet {
174
  protected function returnSingleTableRanking($sql_params=false, $source='overall_rating') {
175
  if ($this->query_highest_rated_overall) {
176
 
177
- $table_id = 'yasr_overall_ranking_'.str_shuffle(uniqid());
178
  $array_with_title = htmlspecialchars(
179
  json_encode(self::rankingData($this->query_highest_rated_overall)),ENT_QUOTES, 'UTF-8'
180
  );
@@ -221,7 +220,7 @@ class YasrRankings extends YasrMultiSet {
221
  $array_with_title['most'] = self::rankingData($this->query_result_most_rated_visitor);
222
  $array_with_title['highest'] = self::rankingData($this->query_result_highest_rated_visitor);
223
 
224
- $table_id = 'yasr_vv_ranking_' . str_shuffle(uniqid());
225
 
226
  $this->shortcode_html .= "<table
227
  class='yasr-rankings yasr-stars-rankings'
28
  * Class YasrRankings
29
  */
30
  class YasrRankings extends YasrMultiSet {
 
31
  protected $query_highest_rated_overall;
32
  public $query_result_most_rated_visitor;
33
  public $query_result_highest_rated_visitor;
53
  //$this->shorcode_name is the default value
54
  $sql_atts = apply_filters('yasr_ov_rankings_atts', $this->shortcode_name, $atts);
55
 
56
+ $this->query_highest_rated_overall = YasrDB::rankingOverall($sql_atts);
57
 
58
  $this->returnSingleTableRanking($this->urlencodeAtts($sql_atts));
59
  $this->shortcode_html .= '<!--End Yasr Top 10 highest Rated Shortcode-->';
76
 
77
  /**
78
  * Hook here to use shortcode atts.
79
+ * If not used, will work with no support for atts
80
  *
81
  * @param string $this->shortcode_name Name of shortcode caller
82
  * @param string|array $atts Shortcode atts
83
  */
84
  $sql_atts = apply_filters('yasr_vv_rankings_atts', $this->shortcode_name, $atts);
85
 
86
+ $this->query_result_most_rated_visitor = YasrDB::rankingVV($sql_atts, 'most');
87
+ $this->query_result_highest_rated_visitor = YasrDB::rankingVV($sql_atts, 'highest');
88
 
89
  $this->returnDoubleTableRanking($this->urlencodeAtts($sql_atts), $source);
90
  $this->shortcode_html .= '<!--End Yasr TMost Or Highest Rated Shortcode -->';
111
  //$this->shorcode_name is the default value
112
  $sql_atts = apply_filters('yasr_multi_set_ranking_atts', $this->shortcode_name, $atts);
113
 
114
+ $this->query_highest_rated_overall = YasrDB::rankingMulti($this->set_id, $sql_atts);
115
 
116
  $this->returnSingleTableRanking($this->urlencodeAtts($sql_atts), 'author_multi');
117
  $this->shortcode_html .= '<!-- Yasr Ranking by Multiset -->';
143
  */
144
  $sql_atts = apply_filters('yasr_visitor_multi_set_ranking_atts', $this->shortcode_name, $atts);
145
 
146
+ $this->query_result_most_rated_visitor = YasrDB::rankingMultiVV($this->set_id, 'most', $sql_atts);
147
+ $this->query_result_highest_rated_visitor = YasrDB::rankingMultiVV($this->set_id, 'highest', $sql_atts);
148
 
149
  //this means no filter has run, I've to create an array with the setid
150
  //that will be later urlencoded
173
  protected function returnSingleTableRanking($sql_params=false, $source='overall_rating') {
174
  if ($this->query_highest_rated_overall) {
175
 
176
+ $table_id = yasr_return_dom_id('yasr_overall_ranking_');
177
  $array_with_title = htmlspecialchars(
178
  json_encode(self::rankingData($this->query_highest_rated_overall)),ENT_QUOTES, 'UTF-8'
179
  );
220
  $array_with_title['most'] = self::rankingData($this->query_result_most_rated_visitor);
221
  $array_with_title['highest'] = self::rankingData($this->query_result_highest_rated_visitor);
222
 
223
+ $table_id = yasr_return_dom_id('yasr_vv_ranking_');
224
 
225
  $this->shortcode_html .= "<table
226
  class='yasr-rankings yasr-stars-rankings'
includes/shortcodes/classes/YasrShortcodesAjax.php CHANGED
@@ -207,7 +207,7 @@ class YasrShortcodesAjax {
207
  * @return string
208
  */
209
  public function vvReturnResponse($post_id, $rating, $result_update_log) {
210
- $row_exists = YasrDatabaseRatings::getVisitorVotes($post_id);
211
 
212
  $number_of_votes = $row_exists['number_of_votes'];
213
  $medium_rating = $row_exists['average'];
@@ -293,7 +293,7 @@ class YasrShortcodesAjax {
293
 
294
  $array_to_return['stars_attributes']['span_bottom'] = YasrVisitorVotes::showTextBelowStars($cookie_value, $post_id);
295
 
296
- $array_visitor_votes = YasrDatabaseRatings::getVisitorVotes($post_id);
297
 
298
  $array_to_return['number_of_votes'] = $array_visitor_votes['number_of_votes'];
299
  $array_to_return['sum_votes'] = $array_visitor_votes['sum_votes'];
@@ -325,10 +325,6 @@ class YasrShortcodesAjax {
325
  $set_id = (int) $_POST['set_id'];
326
  $nonce = $_POST['nonce'];
327
 
328
- if (!is_int($post_id) || !is_int($set_id)) {
329
- die($this->returnErrorResponse(__('Missing post id or set id', 'yet-another-stars-rating')));
330
- }
331
-
332
  if (!is_array($rating)) {
333
  die($this->returnErrorResponse(__('Error with rating', 'yet-another-stars-rating')));
334
  }
@@ -534,7 +530,7 @@ class YasrShortcodesAjax {
534
  die();
535
  }
536
 
537
- $votes_array = YasrDatabaseRatings::getVisitorVotes($post_id);
538
  $average_rating = $votes_array['average'];
539
 
540
  $missing_vote = null; //avoid undefined variable
@@ -694,7 +690,7 @@ class YasrShortcodesAjax {
694
  $sql_params = apply_filters('yasr_filter_ranking_request', false, $request);
695
 
696
  if($source === 'overall_rating') {
697
- $overall_data = YasrRankingData::rankingOverallGetResults($sql_params);
698
  if($overall_data === false){
699
  $data_to_return = false;
700
  }
@@ -708,7 +704,7 @@ class YasrShortcodesAjax {
708
  $ranking = ($request['show'] === 'highest') ? $request['show'] : 'most';
709
  $data_to_return['show'] = $ranking;
710
 
711
- $vv_data = YasrRankingData::rankingVVGetResults($sql_params, $ranking);
712
  if ($vv_data === false) {
713
  $data_to_return = false;
714
  }
@@ -718,7 +714,7 @@ class YasrShortcodesAjax {
718
  }
719
 
720
  if($source === 'author_multi') {
721
- $am_data = YasrRankingData::rankingMulti($request['setid'], $sql_params);
722
  if($am_data === false){
723
  $data_to_return = false;
724
  }
@@ -732,7 +728,7 @@ class YasrShortcodesAjax {
732
  $ranking = ($request['show'] === 'highest') ? $request['show'] : 'most';
733
  $data_to_return['show'] = $ranking;
734
 
735
- $vm_data = YasrRankingData::rankingMultiVV($request['setid'], $ranking, $sql_params);
736
  if($vm_data === false){
737
  $data_to_return = false;
738
  }
207
  * @return string
208
  */
209
  public function vvReturnResponse($post_id, $rating, $result_update_log) {
210
+ $row_exists = YasrDB::visitorVotes($post_id);
211
 
212
  $number_of_votes = $row_exists['number_of_votes'];
213
  $medium_rating = $row_exists['average'];
293
 
294
  $array_to_return['stars_attributes']['span_bottom'] = YasrVisitorVotes::showTextBelowStars($cookie_value, $post_id);
295
 
296
+ $array_visitor_votes = YasrDB::visitorVotes($post_id);
297
 
298
  $array_to_return['number_of_votes'] = $array_visitor_votes['number_of_votes'];
299
  $array_to_return['sum_votes'] = $array_visitor_votes['sum_votes'];
325
  $set_id = (int) $_POST['set_id'];
326
  $nonce = $_POST['nonce'];
327
 
 
 
 
 
328
  if (!is_array($rating)) {
329
  die($this->returnErrorResponse(__('Error with rating', 'yet-another-stars-rating')));
330
  }
530
  die();
531
  }
532
 
533
+ $votes_array = YasrDB::visitorVotes($post_id);
534
  $average_rating = $votes_array['average'];
535
 
536
  $missing_vote = null; //avoid undefined variable
690
  $sql_params = apply_filters('yasr_filter_ranking_request', false, $request);
691
 
692
  if($source === 'overall_rating') {
693
+ $overall_data = YasrDB::rankingOverall($sql_params);
694
  if($overall_data === false){
695
  $data_to_return = false;
696
  }
704
  $ranking = ($request['show'] === 'highest') ? $request['show'] : 'most';
705
  $data_to_return['show'] = $ranking;
706
 
707
+ $vv_data = YasrDB::rankingVV($sql_params, $ranking);
708
  if ($vv_data === false) {
709
  $data_to_return = false;
710
  }
714
  }
715
 
716
  if($source === 'author_multi') {
717
+ $am_data = YasrDB::rankingMulti($request['setid'], $sql_params);
718
  if($am_data === false){
719
  $data_to_return = false;
720
  }
728
  $ranking = ($request['show'] === 'highest') ? $request['show'] : 'most';
729
  $data_to_return['show'] = $ranking;
730
 
731
+ $vm_data = YasrDB::rankingMultiVV($request['setid'], $ranking, $sql_params);
732
  if($vm_data === false){
733
  $data_to_return = false;
734
  }
includes/shortcodes/classes/YasrVisitorMultiSet.php CHANGED
@@ -74,7 +74,7 @@ class YasrVisitorMultiSet extends YasrMultiSet {
74
  //check cookie and assign default values
75
  $this->multisetAttributes();
76
 
77
- $multiset_content = YasrMultiSetData::returnMultisetContent($this->post_id, $this->set_id, true);
78
 
79
  if ($multiset_content === false) {
80
  return $this->returnErrorData('<!-- Yasr Visitor Multi Set Shortcode-->');
74
  //check cookie and assign default values
75
  $this->multisetAttributes();
76
 
77
+ $multiset_content = YasrDB::returnMultisetContent($this->post_id, $this->set_id, true);
78
 
79
  if ($multiset_content === false) {
80
  return $this->returnErrorData('<!-- Yasr Visitor Multi Set Shortcode-->');
includes/shortcodes/classes/YasrVisitorVotes.php CHANGED
@@ -40,7 +40,7 @@ class YasrVisitorVotes extends YasrShortcode {
40
  $this->is_singular = 'false';
41
  }
42
 
43
- $this->unique_id = str_shuffle(uniqid());
44
  $this->ajax_nonce_visitor = wp_create_nonce('yasr_nonce_vv');
45
 
46
  }
@@ -51,7 +51,7 @@ class YasrVisitorVotes extends YasrShortcode {
51
  * @return string|null
52
  */
53
  public function returnShortcode() {
54
- $stored_votes = YasrDatabaseRatings::getVisitorVotes($this->post_id);
55
  $number_of_votes = $stored_votes['number_of_votes'];
56
  $average_rating = $stored_votes['average'];
57
 
@@ -179,8 +179,8 @@ class YasrVisitorVotes extends YasrShortcode {
179
 
180
  //if it is not false_already_voted means it is true_logged
181
  if($stars_enabled !== 'false_already_voted') {
182
- //Check if a logged in user has already rated for this post
183
- $vote_if_user_already_rated = YasrDatabaseRatings::visitorVotesHasUserVoted($post_id);
184
  //...and if vote exists, assign it into rating
185
  if($vote_if_user_already_rated) {
186
  $rating = $vote_if_user_already_rated;
40
  $this->is_singular = 'false';
41
  }
42
 
43
+ $this->unique_id = yasr_return_dom_id();
44
  $this->ajax_nonce_visitor = wp_create_nonce('yasr_nonce_vv');
45
 
46
  }
51
  * @return string|null
52
  */
53
  public function returnShortcode() {
54
+ $stored_votes = YasrDB::visitorVotes($this->post_id);
55
  $number_of_votes = $stored_votes['number_of_votes'];
56
  $average_rating = $stored_votes['average'];
57
 
179
 
180
  //if it is not false_already_voted means it is true_logged
181
  if($stars_enabled !== 'false_already_voted') {
182
+ //Check if a logged-in user has already rated for this post
183
+ $vote_if_user_already_rated = YasrDB::vvCurrentUserRating($post_id);
184
  //...and if vote exists, assign it into rating
185
  if($vote_if_user_already_rated) {
186
  $rating = $vote_if_user_already_rated;
includes/shortcodes/yasr-shortcode-functions.php CHANGED
@@ -214,6 +214,6 @@ function yasr_visitor_multi_set_ranking_callback($atts, $content, $shortcode_tag
214
  add_shortcode('yasr_user_rate_history', 'yasr_users_front_widget_callback');
215
  add_action('wp_ajax_yasr_change_user_log_page_front', 'yasr_users_front_widget_callback');
216
  function yasr_users_front_widget_callback() {
217
- return (new YasrLogDashboardWidget())->userWidgetShortcode();
218
  } //End callback function
219
 
214
  add_shortcode('yasr_user_rate_history', 'yasr_users_front_widget_callback');
215
  add_action('wp_ajax_yasr_change_user_log_page_front', 'yasr_users_front_widget_callback');
216
  function yasr_users_front_widget_callback() {
217
+ return (new YasrLastRatingsWidget())->userWidgetShortcode();
218
  } //End callback function
219
 
includes/yasr-includes-db-functions.php DELETED
@@ -1,75 +0,0 @@
1
- <?php
2
- /*
3
-
4
- Copyright 2014 Dario Curvino (email : d.curvino@gmail.com)
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 2 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>
18
- */
19
-
20
- if (!defined('ABSPATH')) {
21
- exit('You\'re not allowed to see this page');
22
- } // Exit if accessed directly
23
-
24
- /**
25
- * Return the postmeta itemType
26
- *
27
- * @param bool|int $term_id
28
- *
29
- * @return bool|string
30
- */
31
- function yasr_get_itemType($term_id=false) {
32
- $review_types = YASR_SUPPORTED_SCHEMA_TYPES;
33
-
34
- //if term_id is not an int, use get_post_meta
35
- if(!is_int($term_id)) {
36
- $post_id = get_the_ID();
37
- //should be useless, just to be safe
38
- if (!$post_id) {
39
- return false;
40
- }
41
- $result = get_post_meta($post_id, 'yasr_review_type', true);
42
- } else {
43
- $result = get_term_meta($term_id, 'yasr_review_type', true);
44
- }
45
-
46
- if ($result) {
47
- $snippet_type = trim($result);
48
-
49
- //to keep compatibility with version <2.2.3
50
- if($snippet_type === 'Place') {
51
- $snippet_type = 'LocalBusiness';
52
- }
53
- //to keep compatibility with version <2.2.3
54
- if($snippet_type === 'Other') {
55
- $snippet_type = 'BlogPosting';
56
- }
57
- if (!in_array($snippet_type, $review_types, true) ) {
58
- $snippet_type = YASR_ITEMTYPE;
59
- }
60
-
61
- } else {
62
- $snippet_type = YASR_ITEMTYPE;
63
- }
64
-
65
- //to keep compatibility with version <2.2.3
66
- if($snippet_type === 'Place') {
67
- $snippet_type = 'LocalBusiness';
68
- }
69
- //to keep compatibility with version <2.2.3
70
- if($snippet_type === 'Other') {
71
- $snippet_type = 'BlogPosting';
72
- }
73
-
74
- return $snippet_type;
75
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/yasr-includes-functions.php CHANGED
@@ -52,7 +52,7 @@ function yasr_select_itemtype($html_id=false, $name=false, $default_option=false
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
  }
@@ -376,5 +376,20 @@ function yasr_check_svg_image($url) {
376
  return false;
377
  }
378
  return false;
 
379
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  }
52
  sort($itemtypes_array);
53
 
54
  if($default_option === false) {
55
+ $review_type_choosen = YasrDB::getItemType($term_id);
56
  } else {
57
  $review_type_choosen = $default_option;
58
  }
376
  return false;
377
  }
378
  return false;
379
+ }
380
 
381
+ /**
382
+ * This function return a random string to be used in the dom as ID value
383
+ *
384
+ * @author Dario Curvino <@dudo>
385
+ * @since 2.6.8
386
+ *
387
+ * @param string $prefix
388
+ *
389
+ * @return string
390
+ */
391
+ function yasr_return_dom_id ($prefix='') {
392
+ //Do not use $more_entropy param to uniqid() function here, since it can return chars not allowed as ID value
393
+ //To increase likelihood of uniqueness, str_shuffle() is enough for the scope of use
394
+ return esc_html($prefix) . str_shuffle(uniqid());
395
  }
includes/yasr-includes-init.php CHANGED
@@ -34,7 +34,6 @@ define('YASR_MULTI_SET_NAME_TABLE', $wpdb->prefix . 'yasr_multi_set');
34
  define('YASR_MULTI_SET_FIELDS_TABLE', $wpdb->prefix . 'yasr_multi_set_fields');
35
 
36
  require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-functions.php';
37
- require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-db-functions.php';
38
  require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-widgets.php';
39
  require YASR_ABSOLUTE_PATH_INCLUDES . '/shortcodes/yasr-shortcode-functions.php';
40
 
34
  define('YASR_MULTI_SET_FIELDS_TABLE', $wpdb->prefix . 'yasr_multi_set_fields');
35
 
36
  require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-includes-functions.php';
 
37
  require YASR_ABSOLUTE_PATH_INCLUDES . '/yasr-widgets.php';
38
  require YASR_ABSOLUTE_PATH_INCLUDES . '/shortcodes/yasr-shortcode-functions.php';
39
 
public/classes/YasrPublicFilters.php CHANGED
@@ -247,12 +247,12 @@ class YasrPublicFilters {
247
  */
248
  public function filterTitleVV($post_id) {
249
  //returns int
250
- $stored_votes = YasrDatabaseRatings::getVisitorVotes();
251
 
252
  $number_of_votes = $stored_votes['number_of_votes'];
253
  $average_rating = $stored_votes['average'];
254
 
255
- $htmlid = 'yasr-visitor-votes-readonly-rater-' . str_shuffle(uniqid());
256
 
257
  $vv_widget = '<div class="yasr-vv-stars-title-container">';
258
  $vv_widget .= "<div class='yasr-stars-title yasr-rater-stars'
@@ -285,7 +285,7 @@ class YasrPublicFilters {
285
  * @return mixed|void
286
  */
287
  public function filterTitleOV ($post_id) {
288
- $overall_rating = YasrDatabaseRatings::getOverallRating($post_id);
289
 
290
  //first, overall widget contains overall rating
291
  $overall_widget = '';
247
  */
248
  public function filterTitleVV($post_id) {
249
  //returns int
250
+ $stored_votes = YasrDB::visitorVotes();
251
 
252
  $number_of_votes = $stored_votes['number_of_votes'];
253
  $average_rating = $stored_votes['average'];
254
 
255
+ $htmlid = yasr_return_dom_id('yasr-visitor-votes-readonly-rater-');
256
 
257
  $vv_widget = '<div class="yasr-vv-stars-title-container">';
258
  $vv_widget .= "<div class='yasr-stars-title yasr-rater-stars'
285
  * @return mixed|void
286
  */
287
  public function filterTitleOV ($post_id) {
288
+ $overall_rating = YasrDB::overallRating($post_id);
289
 
290
  //first, overall widget contains overall rating
291
  $overall_widget = '';
public/classes/YasrRichSnippets.php CHANGED
@@ -65,7 +65,7 @@ class YasrRichSnippets {
65
  $script_type = '<script type="application/ld+json">';
66
  $end_script_type = '</script>';
67
 
68
- $review_choosen = yasr_get_itemType();
69
 
70
  //Use this hook to write your custom microdata from scratch
71
  //if doesn't exists a filter for yasr_filter_schema_jsonld
@@ -331,7 +331,7 @@ class YasrRichSnippets {
331
  $more_rich_snippet = array();
332
 
333
  //get the select itemType
334
- $review_choosen = yasr_get_itemType();
335
 
336
  if($review_choosen === 'BlogPosting') {
337
  $more_rich_snippet = $this->blogPosting($rich_snippet, $rich_snippet_data);
65
  $script_type = '<script type="application/ld+json">';
66
  $end_script_type = '</script>';
67
 
68
+ $review_choosen = YasrDB::getItemType();
69
 
70
  //Use this hook to write your custom microdata from scratch
71
  //if doesn't exists a filter for yasr_filter_schema_jsonld
331
  $more_rich_snippet = array();
332
 
333
  //get the select itemType
334
+ $review_choosen = YasrDB::getItemType();
335
 
336
  if($review_choosen === 'BlogPosting') {
337
  $more_rich_snippet = $this->blogPosting($rich_snippet, $rich_snippet_data);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Donate link: https://www.paypal.com/donate/?hosted_button_id=SVTAVUF62QZ4W
3
  Tags: rating, rate post, star rating, google rating, block
4
  Requires at least: 4.7
5
  Contributors: Dudo
6
- Tested up to: 6.1
7
- Stable tag: 3.1.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
@@ -119,7 +119,7 @@ More info [here](https://wordpress.org/plugins/yet-another-stars-rating/faq/)
119
  While YASR - Yet Another Stars Rating does not require any coding, it is developer friendly!
120
  It is the first (and for now only) rating plugin that uses REST API.
121
  [Here](https://documenter.getpostman.com/view/12873985/TzJycbVz) you can find the documentation.
122
- Further, it comes with a lot of hooks, you can find more info [here](https://yetanotherstarsrating.com/docs/developers/) .
123
 
124
  == GitHub ==
125
  * [Follow development on GitHub](https://github.com/Dudo1985/yet-another-stars-rating)
@@ -206,6 +206,14 @@ Yes, YASR is 100% fully compatible with PHP 8
206
 
207
  The full changelog can be found in the plugin's directory. Recent entries:
208
 
 
 
 
 
 
 
 
 
209
  = 3.1.5 =
210
  * FIXED: in the editor page, fixed js null error if YASR metabox is not rendered
211
  * FIXED: fixed [offset warning](https://wordpress.org/support/topic/trying-to-access-array-offset-warning/) if no valid image was given
3
  Tags: rating, rate post, star rating, google rating, block
4
  Requires at least: 4.7
5
  Contributors: Dudo
6
+ Tested up to: 6.1.1
7
+ Stable tag: 3.1.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
119
  While YASR - Yet Another Stars Rating does not require any coding, it is developer friendly!
120
  It is the first (and for now only) rating plugin that uses REST API.
121
  [Here](https://documenter.getpostman.com/view/12873985/TzJycbVz) you can find the documentation.
122
+ Further, it comes with a lot of hooks, you can find more info [here](https://github.com/Dudo1985/Yet-Another-Stars-Rating/tree/master/docs) .
123
 
124
  == GitHub ==
125
  * [Follow development on GitHub](https://github.com/Dudo1985/yet-another-stars-rating)
206
 
207
  The full changelog can be found in the plugin's directory. Recent entries:
208
 
209
+ = 3.1.6 =
210
+ * FIXED: [removed warning](https://github.com/Dudo1985/Yet-Another-Stars-Rating/commit/f360dbcd0324483341ffca6ea9bf95b75043673f) returned if PHP 8.1 is used when a rating plugin is imported
211
+ * TWEAKED: classes YasrDatabaseRatings, YasrRankingData and YasrMultiSetData have been deprecated, all the method moved into YasrDB
212
+ * TWEAKED: function yasr_get_itemType has been moved into YasrDB, file yasr-includes-db-functions.php has been deleted
213
+ * TWEAKED: added docs' dir, which contains all the hooks used by YASR
214
+ * TWEAKED: removed dashicons from submenu page name, added links "Contact Us" and "Support"
215
+ * TWEAKED: updated Freemius SDK to version 2.5.3
216
+
217
  = 3.1.5 =
218
  * FIXED: in the editor page, fixed js null error if YASR metabox is not rendered
219
  * FIXED: fixed [offset warning](https://wordpress.org/support/topic/trying-to-access-array-offset-warning/) if no valid image was given
vendor/freemius/wordpress-sdk/assets/css/admin/add-ons.css CHANGED
@@ -1 +1 @@
1
- .fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}#fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner>ul{-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner>ul>li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner .fs-badge.fs-installed-addon-badge{font-size:1.02em;line-height:1.3em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:#adff2f;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.3);box-shadow:1px 1px 1px rgba(0,0,0,.3);text-transform:uppercase;font-size:.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button,#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button-group{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}#TB_window,#TB_window iframe{width:821px !important}#plugin-information .fyi{width:266px !important}#plugin-information #section-holder{margin-right:299px}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description iframe{max-width:100%}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:#adff2f;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid #006400;padding:2px;text-align:center;font-size:.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#f3f3f3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:#adff2f}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button,#plugin-information .fs-dropdown .button-group .button{position:relative;width:auto;top:0;right:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button:focus,#plugin-information .fs-dropdown .button-group .button:focus{z-index:10}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .fs-dropdown-arrow,#plugin-information .fs-dropdown .button-group .fs-dropdown-arrow{border-top:6px solid #fff;border-right:4px solid transparent;border-left:4px solid transparent;top:12px;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button){border-bottom-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button{border-bottom-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button){border-top-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active.up .fs-dropdown-arrow-button{border-top-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list,#plugin-information .fs-dropdown .fs-dropdown-list{position:absolute;right:-1px;top:100%;margin-left:auto;padding:3px 0;border:1px solid #bfbfbf;background-color:#fff;z-index:1;width:230px;text-align:left;-moz-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);-webkit-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12)}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li,#plugin-information .fs-dropdown .fs-dropdown-list li{margin:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li a,#plugin-information .fs-dropdown .fs-dropdown-list li a{display:block;padding:5px 10px;text-decoration:none;text-shadow:none}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover,#plugin-information .fs-dropdown .fs-dropdown-list li:hover{background-color:#0074a3;color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover a,#plugin-information .fs-dropdown .fs-dropdown-list li:hover a{color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown:not(.up) .fs-dropdown-list,#plugin-information .fs-dropdown:not(.up) .fs-dropdown-list{-moz-border-radius:3px 0 3px 3px;-webkit-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.up .fs-dropdown-list,#plugin-information .fs-dropdown.up .fs-dropdown-list{-moz-border-radius:3px 3px 0 3px;-webkit-border-radius:3px 3px 0 3px;border-radius:3px 3px 0 3px}#plugin-information .fs-dropdown .button-group{width:100%}#plugin-information .fs-dropdown .button-group .button{float:none;font-size:14px;font-weight:normal;text-transform:none}#plugin-information .fs-dropdown .fs-dropdown-list{margin-top:1px}#plugin-information .fs-dropdown.up .fs-dropdown-list{top:auto;bottom:100%;margin-bottom:2px}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group{text-align:center;display:table}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button{display:table-cell}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button:not(.fs-dropdown-arrow-button){left:1px;width:100%}#plugin-information-footer>.button,#plugin-information-footer .fs-dropdown{position:relative;top:3px}#plugin-information-footer>.button.left,#plugin-information-footer .fs-dropdown.left{float:left}#plugin-information-footer>.right,#plugin-information-footer .fs-dropdown{float:right}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
1
+ .fs-badge{position:absolute;top:10px;right:0;background:#71ae00;color:#fff;text-transform:uppercase;padding:5px 10px;-moz-border-radius:3px 0 0 3px;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;font-weight:bold;border-right:0;-moz-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);-webkit-box-shadow:0 2px 1px -1px rgba(0,0,0,.3);box-shadow:0 2px 1px -1px rgba(0,0,0,.3)}#fs_addons .fs-cards-list{list-style:none}#fs_addons .fs-cards-list .fs-card{float:left;height:152px;width:310px;padding:0;margin:0 0 30px 30px;font-size:14px;list-style:none;border:1px solid #ddd;cursor:pointer;position:relative}#fs_addons .fs-cards-list .fs-card .fs-overlay{position:absolute;left:0;right:0;bottom:0;top:0;z-index:9}#fs_addons .fs-cards-list .fs-card .fs-inner{background-color:#fff;overflow:hidden;height:100%;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner>ul{-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s;left:0;right:0;top:0;position:absolute}#fs_addons .fs-cards-list .fs-card .fs-inner>ul>li{list-style:none;line-height:18px;padding:0 15px;width:100%;display:block;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner{padding:0;margin:0;line-height:0;display:block;height:100px;background-repeat:repeat-x;background-size:100% 100%;-moz-transition:all,.15s;-o-transition:all,.15s;-ms-transition:all,.15s;-webkit-transition:all,.15s;transition:all,.15s}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-card-banner .fs-badge.fs-installed-addon-badge{font-size:1.02em;line-height:1.3em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-title{margin:10px 0 0 0;height:18px;overflow:hidden;color:#000;white-space:nowrap;text-overflow:ellipsis;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-offer{font-size:.9em}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-description{background-color:#f9f9f9;padding:10px 15px 100px 15px;border-top:1px solid #eee;margin:0 0 10px 0;color:#777}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-tag{position:absolute;top:10px;right:0px;background:#adff2f;display:block;padding:2px 10px;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.3);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.3);box-shadow:1px 1px 1px rgba(0,0,0,.3);text-transform:uppercase;font-size:.9em;font-weight:bold}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button,#fs_addons .fs-cards-list .fs-card .fs-inner .fs-cta .button-group{position:absolute;top:112px;right:10px}@media screen and (min-width: 960px){#fs_addons .fs-cards-list .fs-card:hover .fs-overlay{border:2px solid #29abe1;margin-left:-1px;margin-top:-1px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner ul{top:-100px}#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-title,#fs_addons .fs-cards-list .fs-card:hover .fs-inner .fs-offer{color:#29abe1}}#TB_window,#TB_window iframe{width:821px !important}#plugin-information .fyi{width:266px !important}#plugin-information #section-holder{margin-right:299px;clear:none}#plugin-information #section-description h2,#plugin-information #section-description h3,#plugin-information #section-description p,#plugin-information #section-description b,#plugin-information #section-description i,#plugin-information #section-description blockquote,#plugin-information #section-description li,#plugin-information #section-description ul,#plugin-information #section-description ol{clear:none}#plugin-information #section-description iframe{max-width:100%}#plugin-information #section-description .fs-selling-points{padding-bottom:10px;border-bottom:1px solid #ddd}#plugin-information #section-description .fs-selling-points ul{margin:0}#plugin-information #section-description .fs-selling-points ul li{padding:0;list-style:none outside none}#plugin-information #section-description .fs-selling-points ul li i.dashicons{color:#71ae00;font-size:3em;vertical-align:middle;line-height:30px;float:left;margin:0 0 0 -15px}#plugin-information #section-description .fs-selling-points ul li h3{margin:1em 30px !important}#plugin-information #section-description .fs-screenshots:after{content:"";display:table;clear:both}#plugin-information #section-description .fs-screenshots ul{list-style:none;margin:0}#plugin-information #section-description .fs-screenshots ul li{width:225px;height:225px;float:left;margin-bottom:20px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}#plugin-information #section-description .fs-screenshots ul li a{display:block;width:100%;height:100%;border:1px solid;-moz-box-shadow:1px 1px 1px rgba(0,0,0,.2);-webkit-box-shadow:1px 1px 1px rgba(0,0,0,.2);box-shadow:1px 1px 1px rgba(0,0,0,.2);background-size:cover}#plugin-information #section-description .fs-screenshots ul li.odd{margin-right:20px}#plugin-information .plugin-information-pricing{margin:-16px;border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan h3{margin-top:0;padding:20px;font-size:16px}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper{border-bottom:1px solid #ddd}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab{cursor:pointer;position:relative;padding:0 10px;font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab label{text-transform:uppercase;color:green;background:#adff2f;position:absolute;left:-1px;right:-1px;bottom:100%;border:1px solid #006400;padding:2px;text-align:center;font-size:.9em;line-height:1em}#plugin-information .plugin-information-pricing .fs-plan .nav-tab-wrapper .nav-tab.nav-tab-active{cursor:default;background:#fffeec;border-bottom-color:#fffeec}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle h3{background:#fffeec;margin:0;padding-bottom:0;color:#0073aa}#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .nav-tab-wrapper,#plugin-information .plugin-information-pricing .fs-plan.fs-single-cycle .fs-billing-frequency{display:none}#plugin-information .plugin-information-pricing .fs-plan .fs-pricing-body{background:#fffeec;padding:20px}#plugin-information .plugin-information-pricing .fs-plan .button{width:100%;text-align:center;font-weight:bold;text-transform:uppercase;font-size:1.1em}#plugin-information .plugin-information-pricing .fs-plan label{white-space:nowrap}#plugin-information .plugin-information-pricing .fs-plan var{font-style:normal}#plugin-information .plugin-information-pricing .fs-plan .fs-billing-frequency,#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-align:center;display:block;font-weight:bold;margin-bottom:10px;text-transform:uppercase;background:#f3f3f3;padding:2px;border:1px solid #ccc}#plugin-information .plugin-information-pricing .fs-plan .fs-annual-discount{text-transform:none;color:green;background:#adff2f}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms{font-size:.9em}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms i{float:left;margin:0 0 0 -15px}#plugin-information .plugin-information-pricing .fs-plan ul.fs-trial-terms li{margin:10px 0 0 0}#plugin-information #section-features .fs-features{margin:-20px -26px}#plugin-information #section-features table{width:100%;border-spacing:0;border-collapse:separate}#plugin-information #section-features table thead th{padding:10px 0}#plugin-information #section-features table thead .fs-price{color:#71ae00;font-weight:normal;display:block;text-align:center}#plugin-information #section-features table tbody td{border-top:1px solid #ccc;padding:10px 0;text-align:center;width:100px;color:#71ae00}#plugin-information #section-features table tbody td:first-child{text-align:left;width:auto;color:inherit;padding-left:26px}#plugin-information #section-features table tbody tr.fs-odd td{background:#fefefe}#plugin-information #section-features .dashicons-yes{width:30px;height:30px;font-size:30px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button,#plugin-information .fs-dropdown .button-group .button{position:relative;width:auto;top:0;right:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .button:focus,#plugin-information .fs-dropdown .button-group .button:focus{z-index:10}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .button-group .fs-dropdown-arrow,#plugin-information .fs-dropdown .button-group .fs-dropdown-arrow{border-top:6px solid #fff;border-right:4px solid transparent;border-left:4px solid transparent;top:12px;position:relative}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active:not(.up) .button:not(.fs-dropdown-arrow-button){border-bottom-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active:not(.up) .fs-dropdown-arrow-button{border-bottom-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button),#plugin-information .fs-dropdown.active.up .button:not(.fs-dropdown-arrow-button){border-top-left-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.active.up .fs-dropdown-arrow-button,#plugin-information .fs-dropdown.active.up .fs-dropdown-arrow-button{border-top-right-radius:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list,#plugin-information .fs-dropdown .fs-dropdown-list{position:absolute;right:-1px;top:100%;margin-left:auto;padding:3px 0;border:1px solid #bfbfbf;background-color:#fff;z-index:1;width:230px;text-align:left;-moz-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);-webkit-box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12);box-shadow:0px 2px 4px -1px rgba(0,0,0,.2),0px 4px 5px 0px rgba(0,0,0,.14),0px 1px 10px 0px rgba(0,0,0,.12)}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li,#plugin-information .fs-dropdown .fs-dropdown-list li{margin:0}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li a,#plugin-information .fs-dropdown .fs-dropdown-list li a{display:block;padding:5px 10px;text-decoration:none;text-shadow:none}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover,#plugin-information .fs-dropdown .fs-dropdown-list li:hover{background-color:#0074a3;color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown .fs-dropdown-list li:hover a,#plugin-information .fs-dropdown .fs-dropdown-list li:hover a{color:#fff}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown:not(.up) .fs-dropdown-list,#plugin-information .fs-dropdown:not(.up) .fs-dropdown-list{-moz-border-radius:3px 0 3px 3px;-webkit-border-radius:3px 0 3px 3px;border-radius:3px 0 3px 3px}#fs_addons .fs-cards-list .fs-card .fs-inner .fs-dropdown.up .fs-dropdown-list,#plugin-information .fs-dropdown.up .fs-dropdown-list{-moz-border-radius:3px 3px 0 3px;-webkit-border-radius:3px 3px 0 3px;border-radius:3px 3px 0 3px}#plugin-information .fs-dropdown .button-group{width:100%}#plugin-information .fs-dropdown .button-group .button{float:none;font-size:14px;font-weight:normal;text-transform:none}#plugin-information .fs-dropdown .fs-dropdown-list{margin-top:1px}#plugin-information .fs-dropdown.up .fs-dropdown-list{top:auto;bottom:100%;margin-bottom:2px}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group{text-align:center;display:table}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button{display:table-cell}#plugin-information.wp-core-ui .fs-pricing-body .fs-dropdown .button-group .button:not(.fs-dropdown-arrow-button){left:1px;width:100%}#plugin-information-footer>.button,#plugin-information-footer .fs-dropdown{position:relative;top:3px}#plugin-information-footer>.button.left,#plugin-information-footer .fs-dropdown.left{float:left}#plugin-information-footer>.right,#plugin-information-footer .fs-dropdown{float:right}@media screen and (max-width: 961px){#fs_addons .fs-cards-list .fs-card{height:265px}}
vendor/freemius/wordpress-sdk/includes/class-freemius.php CHANGED
@@ -3648,7 +3648,7 @@
3648
  } else {
3649
  // Add hidden debug page.
3650
  $hook = FS_Admin_Menu_Manager::add_subpage(
3651
- null,
3652
  $title,
3653
  $title,
3654
  'manage_options',
@@ -7315,12 +7315,12 @@
7315
 
7316
  $this->_admin_notices->add_sticky(
7317
  sprintf(
7318
- $this->get_text_inline( 'You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s.', 'pending-activation-message' ),
7319
  '<b>' . $this->get_plugin_name() . '</b>',
7320
  '<b>' . $email . '</b>',
7321
  ( $is_pending_trial ?
7322
  $this->get_text_inline( 'start the trial', 'start-the-trial' ) :
7323
- $this->get_text_inline( 'complete the install', 'complete-the-install' ) )
7324
  ),
7325
  'activation_pending',
7326
  'Thanks!'
@@ -18975,7 +18975,7 @@
18975
  if ( ! $this->has_settings_menu() ) {
18976
  // Add the opt-in page without a menu item.
18977
  $hook = FS_Admin_Menu_Manager::add_subpage(
18978
- null,
18979
  $this->get_plugin_name(),
18980
  $this->get_plugin_name(),
18981
  'manage_options',
@@ -19407,7 +19407,7 @@
19407
  $hook = FS_Admin_Menu_Manager::add_subpage(
19408
  $item['show_submenu'] ?
19409
  $top_level_menu_slug :
19410
- null,
19411
  $item['page_title'],
19412
  $menu_item,
19413
  $capability,
@@ -19422,7 +19422,7 @@
19422
  FS_Admin_Menu_Manager::add_subpage(
19423
  $item['show_submenu'] ?
19424
  $top_level_menu_slug :
19425
- null,
19426
  $item['page_title'],
19427
  $menu_item,
19428
  $capability,
3648
  } else {
3649
  // Add hidden debug page.
3650
  $hook = FS_Admin_Menu_Manager::add_subpage(
3651
+ '',
3652
  $title,
3653
  $title,
3654
  'manage_options',
7315
 
7316
  $this->_admin_notices->add_sticky(
7317
  sprintf(
7318
+ $this->get_text_inline( 'You should receive a confirmation email for %s to your mailbox at %s. Please make sure you click the button in that email to %s.', 'pending-activation-message' ),
7319
  '<b>' . $this->get_plugin_name() . '</b>',
7320
  '<b>' . $email . '</b>',
7321
  ( $is_pending_trial ?
7322
  $this->get_text_inline( 'start the trial', 'start-the-trial' ) :
7323
+ $this->get_text_inline( 'complete the opt-in', 'complete-the-opt-in' ) )
7324
  ),
7325
  'activation_pending',
7326
  'Thanks!'
18975
  if ( ! $this->has_settings_menu() ) {
18976
  // Add the opt-in page without a menu item.
18977
  $hook = FS_Admin_Menu_Manager::add_subpage(
18978
+ '',
18979
  $this->get_plugin_name(),
18980
  $this->get_plugin_name(),
18981
  'manage_options',
19407
  $hook = FS_Admin_Menu_Manager::add_subpage(
19408
  $item['show_submenu'] ?
19409
  $top_level_menu_slug :
19410
+ '',
19411
  $item['page_title'],
19412
  $menu_item,
19413
  $capability,
19422
  FS_Admin_Menu_Manager::add_subpage(
19423
  $item['show_submenu'] ?
19424
  $top_level_menu_slug :
19425
+ '',
19426
  $item['page_title'],
19427
  $menu_item,
19428
  $capability,
vendor/freemius/wordpress-sdk/includes/class-fs-plugin-updater.php CHANGED
@@ -417,7 +417,7 @@
417
 
418
  $themes_update = get_site_transient( 'update_themes' );
419
  if ( ! isset( $themes_update->response[ $theme_basename ] ) ||
420
- empty( $themes_update->response[ $theme_basename ]['package'] )
421
  ) {
422
  return $prepared_themes;
423
  }
@@ -636,7 +636,7 @@
636
  foreach ( $this->_translation_updates as $translation_update ) {
637
  $lang = $translation_update['language'];
638
  if ( ! isset( $current_plugin_translation_updates_map[ $lang ] ) ||
639
- version_compare( $translation_update['version'], $current_plugin_translation_updates_map[ $lang ]['version'], '>' )
640
  ) {
641
  $current_plugin_translation_updates_map[ $lang ] = $translation_update;
642
  }
@@ -660,13 +660,14 @@
660
  * @return object
661
  */
662
  function get_update_details( FS_Plugin_Tag $new_version ) {
663
- $update = new stdClass();
664
- $update->slug = $this->_fs->get_slug();
665
- $update->new_version = $new_version->version;
666
- $update->url = WP_FS__ADDRESS;
667
- $update->package = $new_version->url;
668
- $update->tested = $new_version->tested_up_to_version;
669
- $update->requires = $new_version->requires_platform_version;
 
670
 
671
  $icon = $this->_fs->get_local_icon_url();
672
 
@@ -808,9 +809,9 @@
808
  $basename = $this->_fs->get_plugin_basename();
809
 
810
  if ( ! is_object( $transient_data ) ||
811
- ! isset( $transient_data->response ) ||
812
  ! is_array( $transient_data->response ) ||
813
- empty( $transient_data->response[ $basename ] )
814
  ) {
815
  return;
816
  }
@@ -1095,6 +1096,7 @@ if ( !isset($info->error) ) {
1095
  if ( ! $plugin_in_repo ) {
1096
  $data->last_updated = ! is_null( $new_version->updated ) ? $new_version->updated : $new_version->created;
1097
  $data->requires = $new_version->requires_platform_version;
 
1098
  $data->tested = $new_version->tested_up_to_version;
1099
  }
1100
 
@@ -1148,9 +1150,28 @@ if ( !isset($info->error) ) {
1148
  }
1149
  }
1150
 
 
 
 
 
1151
  return $data;
1152
  }
1153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1154
  /**
1155
  * @author Vova Feldman (@svovaf)
1156
  * @since 1.2.1.7
417
 
418
  $themes_update = get_site_transient( 'update_themes' );
419
  if ( ! isset( $themes_update->response[ $theme_basename ] ) ||
420
+ empty( $themes_update->response[ $theme_basename ]['package'] )
421
  ) {
422
  return $prepared_themes;
423
  }
636
  foreach ( $this->_translation_updates as $translation_update ) {
637
  $lang = $translation_update['language'];
638
  if ( ! isset( $current_plugin_translation_updates_map[ $lang ] ) ||
639
+ version_compare( $translation_update['version'], $current_plugin_translation_updates_map[ $lang ]['version'], '>' )
640
  ) {
641
  $current_plugin_translation_updates_map[ $lang ] = $translation_update;
642
  }
660
  * @return object
661
  */
662
  function get_update_details( FS_Plugin_Tag $new_version ) {
663
+ $update = new stdClass();
664
+ $update->slug = $this->_fs->get_slug();
665
+ $update->new_version = $new_version->version;
666
+ $update->url = WP_FS__ADDRESS;
667
+ $update->package = $new_version->url;
668
+ $update->tested = self::get_tested_wp_version( $new_version->tested_up_to_version );
669
+ $update->requires = $new_version->requires_platform_version;
670
+ $update->requires_php = $new_version->requires_programming_language_version;
671
 
672
  $icon = $this->_fs->get_local_icon_url();
673
 
809
  $basename = $this->_fs->get_plugin_basename();
810
 
811
  if ( ! is_object( $transient_data ) ||
812
+ ! isset( $transient_data->response ) ||
813
  ! is_array( $transient_data->response ) ||
814
+ empty( $transient_data->response[ $basename ] )
815
  ) {
816
  return;
817
  }
1096
  if ( ! $plugin_in_repo ) {
1097
  $data->last_updated = ! is_null( $new_version->updated ) ? $new_version->updated : $new_version->created;
1098
  $data->requires = $new_version->requires_platform_version;
1099
+ $data->requires_php = $new_version->requires_programming_language_version;
1100
  $data->tested = $new_version->tested_up_to_version;
1101
  }
1102
 
1150
  }
1151
  }
1152
 
1153
+ if ( ! empty( $data->tested ) ) {
1154
+ $data->tested = self::get_tested_wp_version( $data->tested );
1155
+ }
1156
+
1157
  return $data;
1158
  }
1159
 
1160
+ /**
1161
+ * @since 2.5.3 If the current WordPress version is a patch of the tested version (e.g., 6.1.2 is a patch of 6.1), then override the tested version with the patch so developers won't need to release a new version just to bump the latest supported WP version.
1162
+ *
1163
+ * @param string|null $tested_up_to
1164
+ *
1165
+ * @return string|null
1166
+ */
1167
+ private static function get_tested_wp_version( $tested_up_to ) {
1168
+ $current_wp_version = get_bloginfo( 'version' );
1169
+
1170
+ return ( ! empty($tested_up_to) && fs_starts_with( $current_wp_version, $tested_up_to . '.' ) ) ?
1171
+ $current_wp_version :
1172
+ $tested_up_to;
1173
+ }
1174
+
1175
  /**
1176
  * @author Vova Feldman (@svovaf)
1177
  * @since 1.2.1.7
vendor/freemius/wordpress-sdk/includes/entities/class-fs-plugin-tag.php CHANGED
@@ -23,6 +23,10 @@
23
  * @var string
24
  */
25
  public $requires_platform_version;
 
 
 
 
26
  /**
27
  * @var string
28
  */
23
  * @var string
24
  */
25
  public $requires_platform_version;
26
+ /**
27
+ * @var string
28
+ */
29
+ public $requires_programming_language_version;
30
  /**
31
  * @var string
32
  */
vendor/freemius/wordpress-sdk/includes/fs-plugin-info-dialog.php CHANGED
@@ -311,6 +311,7 @@
311
  $data->version = $latest->version;
312
  $data->last_updated = $latest->created;
313
  $data->requires = $latest->requires_platform_version;
 
314
  $data->tested = $latest->tested_up_to_version;
315
  } else if ( ! empty( $current_addon_version ) ) {
316
  $data->version = $current_addon_version;
@@ -1344,7 +1345,10 @@
1344
  ?>
1345
  <li>
1346
  <strong><?php fs_esc_html_echo_inline( 'Requires WordPress Version', 'requires-wordpress-version', $api->slug ) ?>
1347
- :</strong> <?php echo esc_html( sprintf( fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires ) ) ?>
 
 
 
1348
  </li>
1349
  <?php
1350
  }
@@ -1356,6 +1360,19 @@
1356
  </li>
1357
  <?php
1358
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
1359
  if ( ! empty( $api->downloaded ) ) {
1360
  ?>
1361
  <li>
@@ -1485,9 +1502,43 @@
1485
  </div>
1486
  <div id="section-holder" class="wrap">
1487
  <?php
1488
- if ( ! empty( $api->tested ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->tested ) ), $api->tested, '>' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1489
  echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been tested with your current version of WordPress.', 'not-tested-warning', $api->slug ) . '</p></div>';
1490
- } else if ( ! empty( $api->requires ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $api->requires ) ), $api->requires, '<' ) ) {
1491
  echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been marked as compatible with your version of WordPress.', 'not-compatible-warning', $api->slug ) . '</p></div>';
1492
  }
1493
 
311
  $data->version = $latest->version;
312
  $data->last_updated = $latest->created;
313
  $data->requires = $latest->requires_platform_version;
314
+ $data->requires_php = $latest->requires_programming_language_version;
315
  $data->tested = $latest->tested_up_to_version;
316
  } else if ( ! empty( $current_addon_version ) ) {
317
  $data->version = $current_addon_version;
1345
  ?>
1346
  <li>
1347
  <strong><?php fs_esc_html_echo_inline( 'Requires WordPress Version', 'requires-wordpress-version', $api->slug ) ?>
1348
+ :</strong> <?php echo esc_html( sprintf(
1349
+ /* translators: %s: Version number. */
1350
+ fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires )
1351
+ ) ?>
1352
  </li>
1353
  <?php
1354
  }
1360
  </li>
1361
  <?php
1362
  }
1363
+ if ( ! empty( $api->requires_php ) ) {
1364
+ ?>
1365
+ <li>
1366
+ <strong><?php fs_esc_html_echo_inline( 'Requires PHP Version', 'requires-php-version', $api->slug ); ?>:</strong>
1367
+ <?php
1368
+ echo esc_html( sprintf(
1369
+ /* translators: %s: Version number. */
1370
+ fs_text_inline( '%s or higher', 'x-or-higher', $api->slug ), $api->requires_php )
1371
+ );
1372
+ ?>
1373
+ </li>
1374
+ <?php
1375
+ }
1376
  if ( ! empty( $api->downloaded ) ) {
1377
  ?>
1378
  <li>
1502
  </div>
1503
  <div id="section-holder" class="wrap">
1504
  <?php
1505
+ $requires_php = isset( $api->requires_php ) ? $api->requires_php : null;
1506
+ $requires_wp = isset( $api->requires ) ? $api->requires : null;
1507
+
1508
+ $compatible_php = empty( $requires_php ) || version_compare( PHP_VERSION, $requires_php, '>=' );
1509
+
1510
+ // Strip off any -alpha, -RC, -beta, -src suffixes.
1511
+ list( $wp_version ) = explode( '-', $GLOBALS['wp_version'] );
1512
+
1513
+ $compatible_wp = empty( $requires_wp ) || version_compare( $wp_version, $requires_wp, '>=' );
1514
+ $tested_wp = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) );
1515
+
1516
+ if ( ! $compatible_php ) {
1517
+ echo '<div class="notice notice-error notice-alt"><p><strong>' . fs_text_inline( 'Error', 'error', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin requires a newer version of PHP.', 'newer-php-required-error', $api->slug );
1518
+
1519
+ if ( current_user_can( 'update_php' ) ) {
1520
+ $wp_get_update_php_url = function_exists( 'wp_get_update_php_url' ) ?
1521
+ wp_get_update_php_url() :
1522
+ 'https://wordpress.org/support/update-php/';
1523
+
1524
+ printf(
1525
+ /* translators: %s: URL to Update PHP page. */
1526
+ ' ' . fs_text_inline( '<a href="%s" target="_blank">Click here to learn more about updating PHP</a>.', 'php-update-learn-more-link', $api->slug ),
1527
+ esc_url( $wp_get_update_php_url )
1528
+ );
1529
+
1530
+ if ( function_exists( 'wp_update_php_annotation' ) ) {
1531
+ wp_update_php_annotation( '</p><p><em>', '</em>' );
1532
+ }
1533
+ } else {
1534
+ echo '</p>';
1535
+ }
1536
+ echo '</div>';
1537
+ }
1538
+
1539
+ if ( ! $tested_wp ) {
1540
  echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been tested with your current version of WordPress.', 'not-tested-warning', $api->slug ) . '</p></div>';
1541
+ } else if ( ! $compatible_wp ) {
1542
  echo '<div class="notice notice-warning"><p>' . '<strong>' . fs_text_inline( 'Warning', 'warning', $api->slug ) . ':</strong> ' . fs_text_inline( 'This plugin has not been marked as compatible with your version of WordPress.', 'not-compatible-warning', $api->slug ) . '</p></div>';
1543
  }
1544
 
vendor/freemius/wordpress-sdk/languages/freemius-cs_CZ.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-da_DK.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-de_DE.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-en.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-es_ES.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-fr_FR.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-he_IL.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-hu_HU.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-it_IT.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-ja.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-nl_NL.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-ru_RU.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-ta.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius-zh_CN.mo CHANGED
Binary file
vendor/freemius/wordpress-sdk/languages/freemius.pot CHANGED
@@ -28,7 +28,7 @@ msgstr ""
28
  msgid "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
29
  msgstr ""
30
 
31
- #: includes/class-freemius.php:1978
32
  msgid "Error"
33
  msgstr ""
34
 
@@ -214,7 +214,7 @@ msgid "Purchase License"
214
  msgstr ""
215
 
216
  #: includes/class-freemius.php:7318, templates/connect.php:216
217
- msgid "You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s."
218
  msgstr ""
219
 
220
  #: includes/class-freemius.php:7322
@@ -222,7 +222,7 @@ msgid "start the trial"
222
  msgstr ""
223
 
224
  #: includes/class-freemius.php:7323, templates/connect.php:220
225
- msgid "complete the install"
226
  msgstr ""
227
 
228
  #: includes/class-freemius.php:7456
@@ -246,7 +246,7 @@ msgstr ""
246
  msgid "The upgrade of %s was successfully completed."
247
  msgstr ""
248
 
249
- #: includes/class-freemius.php:10709, includes/class-fs-plugin-updater.php:1089, includes/class-fs-plugin-updater.php:1284, includes/class-fs-plugin-updater.php:1291, templates/auto-installation.php:32
250
  msgid "Add-On"
251
  msgstr ""
252
 
@@ -708,115 +708,115 @@ msgstr ""
708
  msgid "Opt In"
709
  msgstr ""
710
 
711
- #: includes/class-freemius.php:24933
712
  msgid " The paid version of %1$s is already installed. Please activate it to start benefiting the %2$s features. %3$s"
713
  msgstr ""
714
 
715
- #: includes/class-freemius.php:24943
716
  msgid "Activate %s features"
717
  msgstr ""
718
 
719
- #: includes/class-freemius.php:24956
720
  msgid "Please follow these steps to complete the upgrade"
721
  msgstr ""
722
 
723
- #: includes/class-freemius.php:24960
724
  msgid "Download the latest %s version"
725
  msgstr ""
726
 
727
- #: includes/class-freemius.php:24964
728
  msgid "Upload and activate the downloaded version"
729
  msgstr ""
730
 
731
- #: includes/class-freemius.php:24966
732
  msgid "How to upload and activate?"
733
  msgstr ""
734
 
735
- #: includes/class-freemius.php:25100
736
  msgid "%sClick here%s to choose the sites where you'd like to activate the license on."
737
  msgstr ""
738
 
739
- #: includes/class-freemius.php:25269
740
  msgid "Auto installation only works for opted-in users."
741
  msgstr ""
742
 
743
- #: includes/class-freemius.php:25279, includes/class-freemius.php:25312, includes/class-fs-plugin-updater.php:1263, includes/class-fs-plugin-updater.php:1277
744
  msgid "Invalid module ID."
745
  msgstr ""
746
 
747
- #: includes/class-freemius.php:25288, includes/class-fs-plugin-updater.php:1299
748
  msgid "Premium version already active."
749
  msgstr ""
750
 
751
- #: includes/class-freemius.php:25295
752
  msgid "You do not have a valid license to access the premium version."
753
  msgstr ""
754
 
755
- #: includes/class-freemius.php:25302
756
  msgid "Plugin is a \"Serviceware\" which means it does not have a premium code version."
757
  msgstr ""
758
 
759
- #: includes/class-freemius.php:25320, includes/class-fs-plugin-updater.php:1298
760
  msgid "Premium add-on version already installed."
761
  msgstr ""
762
 
763
- #: includes/class-freemius.php:25674
764
  msgid "View paid features"
765
  msgstr ""
766
 
767
- #: includes/class-freemius.php:25996
768
  msgid "Thank you so much for using %s and its add-ons!"
769
  msgstr ""
770
 
771
- #: includes/class-freemius.php:25997
772
  msgid "Thank you so much for using %s!"
773
  msgstr ""
774
 
775
- #: includes/class-freemius.php:26003
776
  msgid "You've already opted-in to our usage-tracking, which helps us keep improving the %s."
777
  msgstr ""
778
 
779
- #: includes/class-freemius.php:26007
780
  msgid "Thank you so much for using our products!"
781
  msgstr ""
782
 
783
- #: includes/class-freemius.php:26008
784
  msgid "You've already opted-in to our usage-tracking, which helps us keep improving them."
785
  msgstr ""
786
 
787
- #: includes/class-freemius.php:26027
788
  msgid "%s and its add-ons"
789
  msgstr ""
790
 
791
- #: includes/class-freemius.php:26036
792
  msgid "Products"
793
  msgstr ""
794
 
795
- #: includes/class-freemius.php:26043, templates/connect.php:324
796
  msgid "Yes"
797
  msgstr ""
798
 
799
- #: includes/class-freemius.php:26044, templates/connect.php:325
800
  msgid "send me security & feature updates, educational content and offers."
801
  msgstr ""
802
 
803
- #: includes/class-freemius.php:26045, templates/connect.php:330
804
  msgid "No"
805
  msgstr ""
806
 
807
- #: includes/class-freemius.php:26047, templates/connect.php:332
808
  msgid "do %sNOT%s send me security & feature updates, educational content and offers."
809
  msgstr ""
810
 
811
- #: includes/class-freemius.php:26057
812
  msgid "Due to the new %sEU General Data Protection Regulation (GDPR)%s compliance requirements it is required that you provide your explicit consent, again, confirming that you are onboard :-)"
813
  msgstr ""
814
 
815
- #: includes/class-freemius.php:26059, templates/connect.php:339
816
  msgid "Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:"
817
  msgstr ""
818
 
819
- #: includes/class-freemius.php:26341
820
  msgid "License key is empty."
821
  msgstr ""
822
 
@@ -844,314 +844,326 @@ msgstr ""
844
  msgid "Important Upgrade Notice:"
845
  msgstr ""
846
 
847
- #: includes/class-fs-plugin-updater.php:1328
848
  msgid "Installing plugin: %s"
849
  msgstr ""
850
 
851
- #: includes/class-fs-plugin-updater.php:1369
852
  msgid "Unable to connect to the filesystem. Please confirm your credentials."
853
  msgstr ""
854
 
855
- #: includes/class-fs-plugin-updater.php:1551
856
  msgid "The remote plugin package does not contain a folder with the desired slug and renaming did not work."
857
  msgstr ""
858
 
859
- #: includes/fs-plugin-info-dialog.php:541
860
  msgid "Purchase More"
861
  msgstr ""
862
 
863
- #: includes/fs-plugin-info-dialog.php:542, templates/account/partials/addon.php:390
864
  msgctxt "verb"
865
  msgid "Purchase"
866
  msgstr ""
867
 
868
- #: includes/fs-plugin-info-dialog.php:546
869
  msgid "Start my free %s"
870
  msgstr ""
871
 
872
- #: includes/fs-plugin-info-dialog.php:744
873
  msgid "Install Free Version Update Now"
874
  msgstr ""
875
 
876
- #: includes/fs-plugin-info-dialog.php:745, templates/account.php:656
877
  msgid "Install Update Now"
878
  msgstr ""
879
 
880
- #: includes/fs-plugin-info-dialog.php:754
881
  msgid "Install Free Version Now"
882
  msgstr ""
883
 
884
- #: includes/fs-plugin-info-dialog.php:755, templates/add-ons.php:323, templates/auto-installation.php:111, templates/account/partials/addon.php:370, templates/account/partials/addon.php:423
885
  msgid "Install Now"
886
  msgstr ""
887
 
888
- #: includes/fs-plugin-info-dialog.php:771
889
  msgctxt "as download latest version"
890
  msgid "Download Latest Free Version"
891
  msgstr ""
892
 
893
- #: includes/fs-plugin-info-dialog.php:772, templates/account.php:114, templates/add-ons.php:37, templates/account/partials/addon.php:30
894
  msgctxt "as download latest version"
895
  msgid "Download Latest"
896
  msgstr ""
897
 
898
- #: includes/fs-plugin-info-dialog.php:787, templates/add-ons.php:329, templates/account/partials/addon.php:361, templates/account/partials/addon.php:417
899
  msgid "Activate this add-on"
900
  msgstr ""
901
 
902
- #: includes/fs-plugin-info-dialog.php:789, templates/connect.php:446
903
  msgid "Activate Free Version"
904
  msgstr ""
905
 
906
- #: includes/fs-plugin-info-dialog.php:790, templates/account.php:138, templates/add-ons.php:330, templates/account/partials/addon.php:53
907
  msgid "Activate"
908
  msgstr ""
909
 
910
- #: includes/fs-plugin-info-dialog.php:1002
911
  msgctxt "Plugin installer section title"
912
  msgid "Description"
913
  msgstr ""
914
 
915
- #: includes/fs-plugin-info-dialog.php:1003
916
  msgctxt "Plugin installer section title"
917
  msgid "Installation"
918
  msgstr ""
919
 
920
- #: includes/fs-plugin-info-dialog.php:1004
921
  msgctxt "Plugin installer section title"
922
  msgid "FAQ"
923
  msgstr ""
924
 
925
- #: includes/fs-plugin-info-dialog.php:1005, templates/plugin-info/description.php:55
926
  msgid "Screenshots"
927
  msgstr ""
928
 
929
- #: includes/fs-plugin-info-dialog.php:1006
930
  msgctxt "Plugin installer section title"
931
  msgid "Changelog"
932
  msgstr ""
933
 
934
- #: includes/fs-plugin-info-dialog.php:1007
935
  msgctxt "Plugin installer section title"
936
  msgid "Reviews"
937
  msgstr ""
938
 
939
- #: includes/fs-plugin-info-dialog.php:1008
940
  msgctxt "Plugin installer section title"
941
  msgid "Other Notes"
942
  msgstr ""
943
 
944
- #: includes/fs-plugin-info-dialog.php:1023
945
  msgctxt "Plugin installer section title"
946
  msgid "Features & Pricing"
947
  msgstr ""
948
 
949
- #: includes/fs-plugin-info-dialog.php:1033
950
  msgid "Plugin Install"
951
  msgstr ""
952
 
953
- #: includes/fs-plugin-info-dialog.php:1105
954
  msgctxt "e.g. Professional Plan"
955
  msgid "%s Plan"
956
  msgstr ""
957
 
958
- #: includes/fs-plugin-info-dialog.php:1131
959
  msgctxt "e.g. the best product"
960
  msgid "Best"
961
  msgstr ""
962
 
963
- #: includes/fs-plugin-info-dialog.php:1137, includes/fs-plugin-info-dialog.php:1157
964
  msgctxt "as every month"
965
  msgid "Monthly"
966
  msgstr ""
967
 
968
- #: includes/fs-plugin-info-dialog.php:1140
969
  msgctxt "as once a year"
970
  msgid "Annual"
971
  msgstr ""
972
 
973
- #: includes/fs-plugin-info-dialog.php:1143
974
  msgid "Lifetime"
975
  msgstr ""
976
 
977
- #: includes/fs-plugin-info-dialog.php:1157, includes/fs-plugin-info-dialog.php:1159, includes/fs-plugin-info-dialog.php:1161
978
  msgctxt "e.g. billed monthly"
979
  msgid "Billed %s"
980
  msgstr ""
981
 
982
- #: includes/fs-plugin-info-dialog.php:1159
983
  msgctxt "as once a year"
984
  msgid "Annually"
985
  msgstr ""
986
 
987
- #: includes/fs-plugin-info-dialog.php:1161
988
  msgctxt "as once a year"
989
  msgid "Once"
990
  msgstr ""
991
 
992
- #: includes/fs-plugin-info-dialog.php:1167
993
  msgid "Single Site License"
994
  msgstr ""
995
 
996
- #: includes/fs-plugin-info-dialog.php:1169
997
  msgid "Unlimited Licenses"
998
  msgstr ""
999
 
1000
- #: includes/fs-plugin-info-dialog.php:1171
1001
  msgid "Up to %s Sites"
1002
  msgstr ""
1003
 
1004
- #: includes/fs-plugin-info-dialog.php:1181, templates/plugin-info/features.php:82
1005
  msgctxt "as monthly period"
1006
  msgid "mo"
1007
  msgstr ""
1008
 
1009
- #: includes/fs-plugin-info-dialog.php:1188, templates/plugin-info/features.php:80
1010
  msgctxt "as annual period"
1011
  msgid "year"
1012
  msgstr ""
1013
 
1014
- #: includes/fs-plugin-info-dialog.php:1242
1015
  msgctxt "noun"
1016
  msgid "Price"
1017
  msgstr ""
1018
 
1019
- #: includes/fs-plugin-info-dialog.php:1290
1020
  msgid "Save %s"
1021
  msgstr ""
1022
 
1023
- #: includes/fs-plugin-info-dialog.php:1300
1024
  msgid "No commitment for %s - cancel anytime"
1025
  msgstr ""
1026
 
1027
- #: includes/fs-plugin-info-dialog.php:1303
1028
  msgid "After your free %s, pay as little as %s"
1029
  msgstr ""
1030
 
1031
- #: includes/fs-plugin-info-dialog.php:1314
1032
  msgid "Details"
1033
  msgstr ""
1034
 
1035
- #: includes/fs-plugin-info-dialog.php:1318, templates/account.php:125, templates/debug.php:232, templates/debug.php:269, templates/debug.php:514, templates/account/partials/addon.php:41
1036
  msgctxt "product version"
1037
  msgid "Version"
1038
  msgstr ""
1039
 
1040
- #: includes/fs-plugin-info-dialog.php:1325
1041
  msgctxt "as the plugin author"
1042
  msgid "Author"
1043
  msgstr ""
1044
 
1045
- #: includes/fs-plugin-info-dialog.php:1332
1046
  msgid "Last Updated"
1047
  msgstr ""
1048
 
1049
- #: includes/fs-plugin-info-dialog.php:1337, templates/account.php:544
1050
  msgctxt "x-ago"
1051
  msgid "%s ago"
1052
  msgstr ""
1053
 
1054
- #: includes/fs-plugin-info-dialog.php:1346
1055
  msgid "Requires WordPress Version"
1056
  msgstr ""
1057
 
1058
- #: includes/fs-plugin-info-dialog.php:1347
1059
  msgid "%s or higher"
1060
  msgstr ""
1061
 
1062
- #: includes/fs-plugin-info-dialog.php:1354
1063
  msgid "Compatible up to"
1064
  msgstr ""
1065
 
1066
- #: includes/fs-plugin-info-dialog.php:1362
 
 
 
 
1067
  msgid "Downloaded"
1068
  msgstr ""
1069
 
1070
- #: includes/fs-plugin-info-dialog.php:1366
1071
  msgid "%s time"
1072
  msgstr ""
1073
 
1074
- #: includes/fs-plugin-info-dialog.php:1368
1075
  msgid "%s times"
1076
  msgstr ""
1077
 
1078
- #: includes/fs-plugin-info-dialog.php:1379
1079
  msgid "WordPress.org Plugin Page"
1080
  msgstr ""
1081
 
1082
- #: includes/fs-plugin-info-dialog.php:1388
1083
  msgid "Plugin Homepage"
1084
  msgstr ""
1085
 
1086
- #: includes/fs-plugin-info-dialog.php:1397, includes/fs-plugin-info-dialog.php:1481
1087
  msgid "Donate to this plugin"
1088
  msgstr ""
1089
 
1090
- #: includes/fs-plugin-info-dialog.php:1404
1091
  msgid "Average Rating"
1092
  msgstr ""
1093
 
1094
- #: includes/fs-plugin-info-dialog.php:1411
1095
  msgid "based on %s"
1096
  msgstr ""
1097
 
1098
- #: includes/fs-plugin-info-dialog.php:1415
1099
  msgid "%s rating"
1100
  msgstr ""
1101
 
1102
- #: includes/fs-plugin-info-dialog.php:1417
1103
  msgid "%s ratings"
1104
  msgstr ""
1105
 
1106
- #: includes/fs-plugin-info-dialog.php:1432
1107
  msgid "%s star"
1108
  msgstr ""
1109
 
1110
- #: includes/fs-plugin-info-dialog.php:1434
1111
  msgid "%s stars"
1112
  msgstr ""
1113
 
1114
- #: includes/fs-plugin-info-dialog.php:1446
1115
  msgid "Click to see reviews that provided a rating of %s"
1116
  msgstr ""
1117
 
1118
- #: includes/fs-plugin-info-dialog.php:1459
1119
  msgid "Contributors"
1120
  msgstr ""
1121
 
1122
- #: includes/fs-plugin-info-dialog.php:1489, includes/fs-plugin-info-dialog.php:1491
 
 
 
 
 
 
 
 
1123
  msgid "Warning"
1124
  msgstr ""
1125
 
1126
- #: includes/fs-plugin-info-dialog.php:1489
1127
  msgid "This plugin has not been tested with your current version of WordPress."
1128
  msgstr ""
1129
 
1130
- #: includes/fs-plugin-info-dialog.php:1491
1131
  msgid "This plugin has not been marked as compatible with your version of WordPress."
1132
  msgstr ""
1133
 
1134
- #: includes/fs-plugin-info-dialog.php:1510
1135
  msgid "Paid add-on must be deployed to Freemius."
1136
  msgstr ""
1137
 
1138
- #: includes/fs-plugin-info-dialog.php:1511
1139
  msgid "Add-on must be deployed to WordPress.org or Freemius."
1140
  msgstr ""
1141
 
1142
- #: includes/fs-plugin-info-dialog.php:1532
1143
  msgid "Newer Version (%s) Installed"
1144
  msgstr ""
1145
 
1146
- #: includes/fs-plugin-info-dialog.php:1533
1147
  msgid "Newer Free Version (%s) Installed"
1148
  msgstr ""
1149
 
1150
- #: includes/fs-plugin-info-dialog.php:1540
1151
  msgid "Latest Version Installed"
1152
  msgstr ""
1153
 
1154
- #: includes/fs-plugin-info-dialog.php:1541
1155
  msgid "Latest Free Version Installed"
1156
  msgstr ""
1157
 
28
  msgid "Freemius SDK couldn't find the plugin's main file. Please contact sdk@freemius.com with the current error."
29
  msgstr ""
30
 
31
+ #: includes/class-freemius.php:1978, includes/fs-plugin-info-dialog.php:1517
32
  msgid "Error"
33
  msgstr ""
34
 
214
  msgstr ""
215
 
216
  #: includes/class-freemius.php:7318, templates/connect.php:216
217
+ msgid "You should receive a confirmation email for %s to your mailbox at %s. Please make sure you click the button in that email to %s."
218
  msgstr ""
219
 
220
  #: includes/class-freemius.php:7322
222
  msgstr ""
223
 
224
  #: includes/class-freemius.php:7323, templates/connect.php:220
225
+ msgid "complete the opt-in"
226
  msgstr ""
227
 
228
  #: includes/class-freemius.php:7456
246
  msgid "The upgrade of %s was successfully completed."
247
  msgstr ""
248
 
249
+ #: includes/class-freemius.php:10709, includes/class-fs-plugin-updater.php:1090, includes/class-fs-plugin-updater.php:1305, includes/class-fs-plugin-updater.php:1312, templates/auto-installation.php:32
250
  msgid "Add-On"
251
  msgstr ""
252
 
708
  msgid "Opt In"
709
  msgstr ""
710
 
711
+ #: includes/class-freemius.php:24931
712
  msgid " The paid version of %1$s is already installed. Please activate it to start benefiting the %2$s features. %3$s"
713
  msgstr ""
714
 
715
+ #: includes/class-freemius.php:24941
716
  msgid "Activate %s features"
717
  msgstr ""
718
 
719
+ #: includes/class-freemius.php:24954
720
  msgid "Please follow these steps to complete the upgrade"
721
  msgstr ""
722
 
723
+ #: includes/class-freemius.php:24958
724
  msgid "Download the latest %s version"
725
  msgstr ""
726
 
727
+ #: includes/class-freemius.php:24962
728
  msgid "Upload and activate the downloaded version"
729
  msgstr ""
730
 
731
+ #: includes/class-freemius.php:24964
732
  msgid "How to upload and activate?"
733
  msgstr ""
734
 
735
+ #: includes/class-freemius.php:25098
736
  msgid "%sClick here%s to choose the sites where you'd like to activate the license on."
737
  msgstr ""
738
 
739
+ #: includes/class-freemius.php:25267
740
  msgid "Auto installation only works for opted-in users."
741
  msgstr ""
742
 
743
+ #: includes/class-freemius.php:25277, includes/class-freemius.php:25310, includes/class-fs-plugin-updater.php:1284, includes/class-fs-plugin-updater.php:1298
744
  msgid "Invalid module ID."
745
  msgstr ""
746
 
747
+ #: includes/class-freemius.php:25286, includes/class-fs-plugin-updater.php:1320
748
  msgid "Premium version already active."
749
  msgstr ""
750
 
751
+ #: includes/class-freemius.php:25293
752
  msgid "You do not have a valid license to access the premium version."
753
  msgstr ""
754
 
755
+ #: includes/class-freemius.php:25300
756
  msgid "Plugin is a \"Serviceware\" which means it does not have a premium code version."
757
  msgstr ""
758
 
759
+ #: includes/class-freemius.php:25318, includes/class-fs-plugin-updater.php:1319
760
  msgid "Premium add-on version already installed."
761
  msgstr ""
762
 
763
+ #: includes/class-freemius.php:25672
764
  msgid "View paid features"
765
  msgstr ""
766
 
767
+ #: includes/class-freemius.php:25994
768
  msgid "Thank you so much for using %s and its add-ons!"
769
  msgstr ""
770
 
771
+ #: includes/class-freemius.php:25995
772
  msgid "Thank you so much for using %s!"
773
  msgstr ""
774
 
775
+ #: includes/class-freemius.php:26001
776
  msgid "You've already opted-in to our usage-tracking, which helps us keep improving the %s."
777
  msgstr ""
778
 
779
+ #: includes/class-freemius.php:26005
780
  msgid "Thank you so much for using our products!"
781
  msgstr ""
782
 
783
+ #: includes/class-freemius.php:26006
784
  msgid "You've already opted-in to our usage-tracking, which helps us keep improving them."
785
  msgstr ""
786
 
787
+ #: includes/class-freemius.php:26025
788
  msgid "%s and its add-ons"
789
  msgstr ""
790
 
791
+ #: includes/class-freemius.php:26034
792
  msgid "Products"
793
  msgstr ""
794
 
795
+ #: includes/class-freemius.php:26041, templates/connect.php:324
796
  msgid "Yes"
797
  msgstr ""
798
 
799
+ #: includes/class-freemius.php:26042, templates/connect.php:325
800
  msgid "send me security & feature updates, educational content and offers."
801
  msgstr ""
802
 
803
+ #: includes/class-freemius.php:26043, templates/connect.php:330
804
  msgid "No"
805
  msgstr ""
806
 
807
+ #: includes/class-freemius.php:26045, templates/connect.php:332
808
  msgid "do %sNOT%s send me security & feature updates, educational content and offers."
809
  msgstr ""
810
 
811
+ #: includes/class-freemius.php:26055
812
  msgid "Due to the new %sEU General Data Protection Regulation (GDPR)%s compliance requirements it is required that you provide your explicit consent, again, confirming that you are onboard :-)"
813
  msgstr ""
814
 
815
+ #: includes/class-freemius.php:26057, templates/connect.php:339
816
  msgid "Please let us know if you'd like us to contact you for security & feature updates, educational content, and occasional offers:"
817
  msgstr ""
818
 
819
+ #: includes/class-freemius.php:26339
820
  msgid "License key is empty."
821
  msgstr ""
822
 
844
  msgid "Important Upgrade Notice:"
845
  msgstr ""
846
 
847
+ #: includes/class-fs-plugin-updater.php:1349
848
  msgid "Installing plugin: %s"
849
  msgstr ""
850
 
851
+ #: includes/class-fs-plugin-updater.php:1390
852
  msgid "Unable to connect to the filesystem. Please confirm your credentials."
853
  msgstr ""
854
 
855
+ #: includes/class-fs-plugin-updater.php:1572
856
  msgid "The remote plugin package does not contain a folder with the desired slug and renaming did not work."
857
  msgstr ""
858
 
859
+ #: includes/fs-plugin-info-dialog.php:542
860
  msgid "Purchase More"
861
  msgstr ""
862
 
863
+ #: includes/fs-plugin-info-dialog.php:543, templates/account/partials/addon.php:390
864
  msgctxt "verb"
865
  msgid "Purchase"
866
  msgstr ""
867
 
868
+ #: includes/fs-plugin-info-dialog.php:547
869
  msgid "Start my free %s"
870
  msgstr ""
871
 
872
+ #: includes/fs-plugin-info-dialog.php:745
873
  msgid "Install Free Version Update Now"
874
  msgstr ""
875
 
876
+ #: includes/fs-plugin-info-dialog.php:746, templates/account.php:656
877
  msgid "Install Update Now"
878
  msgstr ""
879
 
880
+ #: includes/fs-plugin-info-dialog.php:755
881
  msgid "Install Free Version Now"
882
  msgstr ""
883
 
884
+ #: includes/fs-plugin-info-dialog.php:756, templates/add-ons.php:323, templates/auto-installation.php:111, templates/account/partials/addon.php:370, templates/account/partials/addon.php:423
885
  msgid "Install Now"
886
  msgstr ""
887
 
888
+ #: includes/fs-plugin-info-dialog.php:772
889
  msgctxt "as download latest version"
890
  msgid "Download Latest Free Version"
891
  msgstr ""
892
 
893
+ #: includes/fs-plugin-info-dialog.php:773, templates/account.php:114, templates/add-ons.php:37, templates/account/partials/addon.php:30
894
  msgctxt "as download latest version"
895
  msgid "Download Latest"
896
  msgstr ""
897
 
898
+ #: includes/fs-plugin-info-dialog.php:788, templates/add-ons.php:329, templates/account/partials/addon.php:361, templates/account/partials/addon.php:417
899
  msgid "Activate this add-on"
900
  msgstr ""
901
 
902
+ #: includes/fs-plugin-info-dialog.php:790, templates/connect.php:446
903
  msgid "Activate Free Version"
904
  msgstr ""
905
 
906
+ #: includes/fs-plugin-info-dialog.php:791, templates/account.php:138, templates/add-ons.php:330, templates/account/partials/addon.php:53
907
  msgid "Activate"
908
  msgstr ""
909
 
910
+ #: includes/fs-plugin-info-dialog.php:1003
911
  msgctxt "Plugin installer section title"
912
  msgid "Description"
913
  msgstr ""
914
 
915
+ #: includes/fs-plugin-info-dialog.php:1004
916
  msgctxt "Plugin installer section title"
917
  msgid "Installation"
918
  msgstr ""
919
 
920
+ #: includes/fs-plugin-info-dialog.php:1005
921
  msgctxt "Plugin installer section title"
922
  msgid "FAQ"
923
  msgstr ""
924
 
925
+ #: includes/fs-plugin-info-dialog.php:1006, templates/plugin-info/description.php:55
926
  msgid "Screenshots"
927
  msgstr ""
928
 
929
+ #: includes/fs-plugin-info-dialog.php:1007
930
  msgctxt "Plugin installer section title"
931
  msgid "Changelog"
932
  msgstr ""
933
 
934
+ #: includes/fs-plugin-info-dialog.php:1008
935
  msgctxt "Plugin installer section title"
936
  msgid "Reviews"
937
  msgstr ""
938
 
939
+ #: includes/fs-plugin-info-dialog.php:1009
940
  msgctxt "Plugin installer section title"
941
  msgid "Other Notes"
942
  msgstr ""
943
 
944
+ #: includes/fs-plugin-info-dialog.php:1024
945
  msgctxt "Plugin installer section title"
946
  msgid "Features & Pricing"
947
  msgstr ""
948
 
949
+ #: includes/fs-plugin-info-dialog.php:1034
950
  msgid "Plugin Install"
951
  msgstr ""
952
 
953
+ #: includes/fs-plugin-info-dialog.php:1106
954
  msgctxt "e.g. Professional Plan"
955
  msgid "%s Plan"
956
  msgstr ""
957
 
958
+ #: includes/fs-plugin-info-dialog.php:1132
959
  msgctxt "e.g. the best product"
960
  msgid "Best"
961
  msgstr ""
962
 
963
+ #: includes/fs-plugin-info-dialog.php:1138, includes/fs-plugin-info-dialog.php:1158
964
  msgctxt "as every month"
965
  msgid "Monthly"
966
  msgstr ""
967
 
968
+ #: includes/fs-plugin-info-dialog.php:1141
969
  msgctxt "as once a year"
970
  msgid "Annual"
971
  msgstr ""
972
 
973
+ #: includes/fs-plugin-info-dialog.php:1144
974
  msgid "Lifetime"
975
  msgstr ""
976
 
977
+ #: includes/fs-plugin-info-dialog.php:1158, includes/fs-plugin-info-dialog.php:1160, includes/fs-plugin-info-dialog.php:1162
978
  msgctxt "e.g. billed monthly"
979
  msgid "Billed %s"
980
  msgstr ""
981
 
982
+ #: includes/fs-plugin-info-dialog.php:1160
983
  msgctxt "as once a year"
984
  msgid "Annually"
985
  msgstr ""
986
 
987
+ #: includes/fs-plugin-info-dialog.php:1162
988
  msgctxt "as once a year"
989
  msgid "Once"
990
  msgstr ""
991
 
992
+ #: includes/fs-plugin-info-dialog.php:1168
993
  msgid "Single Site License"
994
  msgstr ""
995
 
996
+ #: includes/fs-plugin-info-dialog.php:1170
997
  msgid "Unlimited Licenses"
998
  msgstr ""
999
 
1000
+ #: includes/fs-plugin-info-dialog.php:1172
1001
  msgid "Up to %s Sites"
1002
  msgstr ""
1003
 
1004
+ #: includes/fs-plugin-info-dialog.php:1182, templates/plugin-info/features.php:82
1005
  msgctxt "as monthly period"
1006
  msgid "mo"
1007
  msgstr ""
1008
 
1009
+ #: includes/fs-plugin-info-dialog.php:1189, templates/plugin-info/features.php:80
1010
  msgctxt "as annual period"
1011
  msgid "year"
1012
  msgstr ""
1013
 
1014
+ #: includes/fs-plugin-info-dialog.php:1243
1015
  msgctxt "noun"
1016
  msgid "Price"
1017
  msgstr ""
1018
 
1019
+ #: includes/fs-plugin-info-dialog.php:1291
1020
  msgid "Save %s"
1021
  msgstr ""
1022
 
1023
+ #: includes/fs-plugin-info-dialog.php:1301
1024
  msgid "No commitment for %s - cancel anytime"
1025
  msgstr ""
1026
 
1027
+ #: includes/fs-plugin-info-dialog.php:1304
1028
  msgid "After your free %s, pay as little as %s"
1029
  msgstr ""
1030
 
1031
+ #: includes/fs-plugin-info-dialog.php:1315
1032
  msgid "Details"
1033
  msgstr ""
1034
 
1035
+ #: includes/fs-plugin-info-dialog.php:1319, templates/account.php:125, templates/debug.php:232, templates/debug.php:269, templates/debug.php:514, templates/account/partials/addon.php:41
1036
  msgctxt "product version"
1037
  msgid "Version"
1038
  msgstr ""
1039
 
1040
+ #: includes/fs-plugin-info-dialog.php:1326
1041
  msgctxt "as the plugin author"
1042
  msgid "Author"
1043
  msgstr ""
1044
 
1045
+ #: includes/fs-plugin-info-dialog.php:1333
1046
  msgid "Last Updated"
1047
  msgstr ""
1048
 
1049
+ #: includes/fs-plugin-info-dialog.php:1338, templates/account.php:544
1050
  msgctxt "x-ago"
1051
  msgid "%s ago"
1052
  msgstr ""
1053
 
1054
+ #: includes/fs-plugin-info-dialog.php:1347
1055
  msgid "Requires WordPress Version"
1056
  msgstr ""
1057
 
1058
+ #: includes/fs-plugin-info-dialog.php:1350, includes/fs-plugin-info-dialog.php:1370
1059
  msgid "%s or higher"
1060
  msgstr ""
1061
 
1062
+ #: includes/fs-plugin-info-dialog.php:1358
1063
  msgid "Compatible up to"
1064
  msgstr ""
1065
 
1066
+ #: includes/fs-plugin-info-dialog.php:1366
1067
+ msgid "Requires PHP Version"
1068
+ msgstr ""
1069
+
1070
+ #: includes/fs-plugin-info-dialog.php:1379
1071
  msgid "Downloaded"
1072
  msgstr ""
1073
 
1074
+ #: includes/fs-plugin-info-dialog.php:1383
1075
  msgid "%s time"
1076
  msgstr ""
1077
 
1078
+ #: includes/fs-plugin-info-dialog.php:1385
1079
  msgid "%s times"
1080
  msgstr ""
1081
 
1082
+ #: includes/fs-plugin-info-dialog.php:1396
1083
  msgid "WordPress.org Plugin Page"
1084
  msgstr ""
1085
 
1086
+ #: includes/fs-plugin-info-dialog.php:1405
1087
  msgid "Plugin Homepage"
1088
  msgstr ""
1089
 
1090
+ #: includes/fs-plugin-info-dialog.php:1414, includes/fs-plugin-info-dialog.php:1498
1091
  msgid "Donate to this plugin"
1092
  msgstr ""
1093
 
1094
+ #: includes/fs-plugin-info-dialog.php:1421
1095
  msgid "Average Rating"
1096
  msgstr ""
1097
 
1098
+ #: includes/fs-plugin-info-dialog.php:1428
1099
  msgid "based on %s"
1100
  msgstr ""
1101
 
1102
+ #: includes/fs-plugin-info-dialog.php:1432
1103
  msgid "%s rating"
1104
  msgstr ""
1105
 
1106
+ #: includes/fs-plugin-info-dialog.php:1434
1107
  msgid "%s ratings"
1108
  msgstr ""
1109
 
1110
+ #: includes/fs-plugin-info-dialog.php:1449
1111
  msgid "%s star"
1112
  msgstr ""
1113
 
1114
+ #: includes/fs-plugin-info-dialog.php:1451
1115
  msgid "%s stars"
1116
  msgstr ""
1117
 
1118
+ #: includes/fs-plugin-info-dialog.php:1463
1119
  msgid "Click to see reviews that provided a rating of %s"
1120
  msgstr ""
1121
 
1122
+ #: includes/fs-plugin-info-dialog.php:1476
1123
  msgid "Contributors"
1124
  msgstr ""
1125
 
1126
+ #: includes/fs-plugin-info-dialog.php:1517
1127
+ msgid "This plugin requires a newer version of PHP."
1128
+ msgstr ""
1129
+
1130
+ #: includes/fs-plugin-info-dialog.php:1526
1131
+ msgid "<a href=\"%s\" target=\"_blank\">Click here to learn more about updating PHP</a>."
1132
+ msgstr ""
1133
+
1134
+ #: includes/fs-plugin-info-dialog.php:1540, includes/fs-plugin-info-dialog.php:1542
1135
  msgid "Warning"
1136
  msgstr ""
1137
 
1138
+ #: includes/fs-plugin-info-dialog.php:1540
1139
  msgid "This plugin has not been tested with your current version of WordPress."
1140
  msgstr ""
1141
 
1142
+ #: includes/fs-plugin-info-dialog.php:1542
1143
  msgid "This plugin has not been marked as compatible with your version of WordPress."
1144
  msgstr ""
1145
 
1146
+ #: includes/fs-plugin-info-dialog.php:1561
1147
  msgid "Paid add-on must be deployed to Freemius."
1148
  msgstr ""
1149
 
1150
+ #: includes/fs-plugin-info-dialog.php:1562
1151
  msgid "Add-on must be deployed to WordPress.org or Freemius."
1152
  msgstr ""
1153
 
1154
+ #: includes/fs-plugin-info-dialog.php:1583
1155
  msgid "Newer Version (%s) Installed"
1156
  msgstr ""
1157
 
1158
+ #: includes/fs-plugin-info-dialog.php:1584
1159
  msgid "Newer Free Version (%s) Installed"
1160
  msgstr ""
1161
 
1162
+ #: includes/fs-plugin-info-dialog.php:1591
1163
  msgid "Latest Version Installed"
1164
  msgstr ""
1165
 
1166
+ #: includes/fs-plugin-info-dialog.php:1592
1167
  msgid "Latest Free Version Installed"
1168
  msgstr ""
1169
 
vendor/freemius/wordpress-sdk/start.php CHANGED
@@ -15,7 +15,7 @@
15
  *
16
  * @var string
17
  */
18
- $this_sdk_version = '2.5.2';
19
 
20
  #region SDK Selection Logic --------------------------------------------------------------------
21
 
15
  *
16
  * @var string
17
  */
18
+ $this_sdk_version = '2.5.3';
19
 
20
  #region SDK Selection Logic --------------------------------------------------------------------
21
 
vendor/freemius/wordpress-sdk/templates/connect.php CHANGED
@@ -213,11 +213,11 @@
213
  $message = $fs->apply_filters( 'pending_activation_message', sprintf(
214
  /* translators: %s: name (e.g. Thanks John!) */
215
  fs_text_inline( 'Thanks %s!', 'thanks-x', $slug ) . '<br>' .
216
- fs_text_inline( 'You should receive an activation email for %s to your mailbox at %s. Please make sure you click the activation button in that email to %s.', 'pending-activation-message', $slug ),
217
  $first_name,
218
  '<b>' . $fs->get_plugin_name() . '</b>',
219
  '<b>' . $current_user->user_email . '</b>',
220
- fs_text_inline( 'complete the install', 'complete-the-install', $slug )
221
  ) );
222
  } else if ( $require_license_key ) {
223
  $button_label = fs_text_inline( 'Activate License', 'activate-license', $slug );
213
  $message = $fs->apply_filters( 'pending_activation_message', sprintf(
214
  /* translators: %s: name (e.g. Thanks John!) */
215
  fs_text_inline( 'Thanks %s!', 'thanks-x', $slug ) . '<br>' .
216
+ fs_text_inline( 'You should receive a confirmation email for %s to your mailbox at %s. Please make sure you click the button in that email to %s.', 'pending-activation-message', $slug ),
217
  $first_name,
218
  '<b>' . $fs->get_plugin_name() . '</b>',
219
  '<b>' . $current_user->user_email . '</b>',
220
+ fs_text_inline( 'complete the opt-in', 'complete-the-opt-in', $slug )
221
  ) );
222
  } else if ( $require_license_key ) {
223
  $button_label = fs_text_inline( 'Activate License', 'activate-license', $slug );
vendor/freemius/wordpress-sdk/templates/plugin-info/description.php CHANGED
@@ -52,7 +52,7 @@
52
  <?php if ( ! empty( $plugin->info->screenshots ) ) : ?>
53
  <?php $screenshots = $plugin->info->screenshots ?>
54
  <div class="fs-screenshots clearfix">
55
- <h2><?php fs_esc_html_echo_inline( 'Screenshots', 'screenshots', $plugin->slug ) ?></h2>
56
  <ul>
57
  <?php $i = 0;
58
  foreach ( $screenshots as $s => $url ) : ?>
52
  <?php if ( ! empty( $plugin->info->screenshots ) ) : ?>
53
  <?php $screenshots = $plugin->info->screenshots ?>
54
  <div class="fs-screenshots clearfix">
55
+ <h3><?php fs_esc_html_echo_inline( 'Screenshots', 'screenshots', $plugin->slug ) ?></h3>
56
  <ul>
57
  <?php $i = 0;
58
  foreach ( $screenshots as $s => $url ) : ?>
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.1.5
8
  * Requires at least: 4.7
9
  * Requires PHP: 5.4
10
  * Author: Dario Curvino
@@ -62,8 +62,8 @@ if ( !function_exists( 'yasr_fs' ) ) {
62
  ),
63
  'menu' => array(
64
  'slug' => 'yasr_settings_page',
65
- 'contact' => false,
66
- 'support' => false,
67
  ),
68
  'is_live' => true,
69
  ) );
@@ -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.1.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__ );
@@ -152,14 +152,14 @@ if ( !function_exists( 'yasr_fs' ) ) {
152
  );
153
  //when blog is deleted
154
  add_filter( 'wpmu_drop_tables', 'yasr_on_delete_blog' );
155
- //this add a link under the plugin name, must be in the main plugin file
156
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'yasr_add_links_below_plugin_name' );
157
  function yasr_add_links_below_plugin_name( $links )
158
  {
159
  $settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=yasr_settings_page' ) ) . '">';
160
  $settings_link .= __( 'Settings', 'yet-another-stars-rating' );
161
  $settings_link .= '</a>';
162
- //array_unshit adds to the begin of array
163
  array_unshift( $links, $settings_link );
164
  return $links;
165
  }
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.1.6
8
  * Requires at least: 4.7
9
  * Requires PHP: 5.4
10
  * Author: Dario Curvino
62
  ),
63
  'menu' => array(
64
  'slug' => 'yasr_settings_page',
65
+ 'contact' => true,
66
+ 'support' => true,
67
  ),
68
  'is_live' => true,
69
  ) );
78
  yasr_fs();
79
  // Signal that SDK was initiated.
80
  do_action( 'yasr_fs_loaded' );
81
+ define( 'YASR_VERSION_NUM', '3.1.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__ );
152
  );
153
  //when blog is deleted
154
  add_filter( 'wpmu_drop_tables', 'yasr_on_delete_blog' );
155
+ //this adds a link under the plugin name, must be in the main plugin file
156
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'yasr_add_links_below_plugin_name' );
157
  function yasr_add_links_below_plugin_name( $links )
158
  {
159
  $settings_link = '<a href="' . esc_url( admin_url( 'options-general.php?page=yasr_settings_page' ) ) . '">';
160
  $settings_link .= __( 'Settings', 'yet-another-stars-rating' );
161
  $settings_link .= '</a>';
162
+ //array_unshit adds to the beginning of array
163
  array_unshift( $links, $settings_link );
164
  return $links;
165
  }