Yasr – Yet Another Stars Rating - Version 2.0.2

Version Description

  • TWEAKED: Multisite support!!
  • TWEAKED: In gutenberg editor, now a link for Yasr Sidebar is available
  • FIXED: gutenberg showing "updated failed" in some rare circumstances
Download this release

Release Info

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

Code changes from version 2.0.1 to 2.0.2

js/src/yasr-guten-blocks.js CHANGED
@@ -15,8 +15,6 @@ const yasrSelectSizeSmall = __('Small', 'yet-another-stars-rating');
15
  const yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
16
  const yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
17
 
18
- const yasrDisableAutoInsert = __('Disable auto insert for this post or page?', 'yet-another-stars-rating');
19
-
20
  const yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
21
 
22
  const yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
@@ -174,71 +172,49 @@ registerBlockType(
174
  postIdAttribute = ' postid="' +postId + '"';
175
  }
176
 
177
- class YasrCreateDivRater extends React.Component {
178
 
179
  constructor(props) {
180
  super(props);
181
- //const divOverall = React.createRef();
182
  }
183
 
184
  render () {
185
  return (
186
  <div>
187
- <div id="overall-rater" ref={()=>
188
- raterJs({
189
- starSize: 32,
190
- step: 0.1,
191
- showToolTip: false,
192
- rating: overallRating,
193
- readOnly: false,
194
- element: document.querySelector("#overall-rater"),
195
- rateCallback: function rateCallback(rating, done) {
 
 
196
 
197
- rating = rating.toFixed(1);
198
- rating = parseFloat(rating);
199
 
200
- setAttributes( { overallRatingMeta: rating } );
201
 
202
- this.setRating(rating);
203
 
204
- done();
205
 
 
 
206
  }
207
- })
208
-
209
- }
210
- />
211
-
212
  </div>
 
213
  );
214
  }
215
 
216
  }
217
 
218
- function YasrDivRatingOverall (props) {
219
-
220
- const yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
221
- const yasrLoading = __("Loading, please wait",'yet-another-stars-rating');
222
- const hideLoaderOverall = {display: 'none'};
223
-
224
- return (
225
- <div>
226
- {yasrOverallRateThis}
227
- <YasrCreateDivRater />
228
-
229
- <span id="loader-overall-rating" style={hideLoaderOverall}>
230
- {yasrLoading} <img src={yasrCommonDataAdmin.loaderHtml} />
231
- </span>
232
-
233
- <div id="yasr-rateit-overall-value" >
234
- </div>
235
-
236
- </div>
237
-
238
- );
239
-
240
- }
241
-
242
  function YasrPrintSelectSize () {
243
  return (
244
  <form>
15
  const yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
16
  const yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
17
 
 
 
18
  const yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
19
 
20
  const yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
172
  postIdAttribute = ' postid="' +postId + '"';
173
  }
174
 
175
+ class YasrDivRatingOverall extends React.Component {
176
 
177
  constructor(props) {
178
  super(props);
179
+ this.yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
180
  }
181
 
182
  render () {
183
  return (
184
  <div>
185
+ {this.yasrOverallRateThis}
186
+ <div>
187
+ <div id="overall-rater" ref={()=>
188
+ raterJs({
189
+ starSize: 32,
190
+ step: 0.1,
191
+ showToolTip: false,
192
+ rating: overallRating,
193
+ readOnly: false,
194
+ element: document.querySelector("#overall-rater"),
195
+ rateCallback: function rateCallback(rating, done) {
196
 
197
+ rating = rating.toFixed(1);
198
+ rating = parseFloat(rating);
199
 
200
+ setAttributes( { overallRatingMeta: rating } );
201
 
202
+ this.setRating(rating);
203
 
204
+ done();
205
 
206
+ }
207
+ })
208
  }
209
+ />
210
+ </div>
 
 
 
211
  </div>
212
+
213
  );
214
  }
215
 
216
  }
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  function YasrPrintSelectSize () {
219
  return (
220
  <form>
js/src/yasr-guten-panel.js CHANGED
@@ -1,5 +1,5 @@
1
  const {registerPlugin} = wp.plugins;
2
- const {PluginSidebar} = wp.editPost;
3
  const {TextControl, PanelBody, PanelRow} = wp.components;
4
  const {BlockControls,InspectorControls} = wp.editor;
5
 
@@ -11,50 +11,62 @@ const yasrSetItemTypeRecipe = __('Recipe', 'yet-another-stars-rating');
11
  const yasrSetItemTypeOther = __('Other', 'yet-another-stars-rating');
12
 
13
 
14
- function YasrSideBarAutoInsert (props) {
15
 
16
- let isThisPostExluded = wp.data.select('core/editor').getCurrentPost().meta.yasr_auto_insert_disabled;
17
- let isThisPostExludedCheckbox = false;
 
 
 
 
 
 
 
18
 
19
- if (isThisPostExluded === 'yes') {
20
- isThisPostExludedCheckbox = true;
 
21
  }
22
 
23
- return (
24
- <div className="yasr-guten-block-panel-center">
25
- <label><span>{yasrDisableAutoInsert}</span></label>
26
- <div className="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
27
- <input type="checkbox"
28
- name="yasr_auto_insert_disabled"
29
- className="yasr-onoffswitch-checkbox"
30
- value="yes"
31
- id="yasr-auto-insert-disabled-switch"
32
- defaultChecked={isThisPostExludedCheckbox}
33
- onChange={YasrUpdatePostMetaAutoInsert}
34
- />
35
- <label className="yasr-onoffswitch-label" htmlFor="yasr-auto-insert-disabled-switch">
36
- <span className="yasr-onoffswitch-inner"></span>
37
- <span className="yasr-onoffswitch-switch"></span>
38
- </label>
39
- </div>
40
- <hr />
41
- </div>
42
- );
43
- }
44
 
45
- function YasrUpdatePostMetaAutoInsert(event) {
46
- const target = event.target;
47
- const value = target.type === 'checkbox' ? target.checked : target.value;
48
 
49
- let isThisPostExcluded = value;
50
 
51
- if (isThisPostExcluded === true) {
52
- wp.data.dispatch( 'core/editor' ).editPost(
53
- { meta: { yasr_auto_insert_disabled: 'yes' } }
54
- );
55
- } else {
56
- wp.data.dispatch( 'core/editor' ).editPost(
57
- { meta: { yasr_auto_insert_disabled: 'no' } }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  );
59
  }
60
 
@@ -63,7 +75,7 @@ function YasrUpdatePostMetaAutoInsert(event) {
63
  class YasrSideBarSelectSnippets extends React.Component {
64
 
65
  constructor(props) {
66
- super();
67
 
68
  //at the begin, get the default type
69
  let snippetType = yasrConstantGutenberg.defaultItemType;
@@ -77,13 +89,13 @@ class YasrSideBarSelectSnippets extends React.Component {
77
  snippetType = postMetaItemType;
78
  }
79
 
80
- this.state = {value: snippetType};
81
 
82
  this.yasrSetItemType = this.yasrSetItemType.bind(this);
83
  }
84
 
85
  yasrSetItemType(event) {
86
- this.setState({value: event.target.value});
87
 
88
  wp.data.dispatch( 'core/editor' ).editPost(
89
  { meta: { yasr_review_type: event.target.value } }
@@ -95,7 +107,7 @@ class YasrSideBarSelectSnippets extends React.Component {
95
  <div className="yasr-guten-block-panel-center">
96
  <label><span>{yasrSelectSnippetTitle}</span></label>
97
  <form>
98
- <select value={this.state.value} onChange={this.yasrSetItemType}>
99
  <option value="Product">{yasrSetItemTypeProduct}</option>
100
  <option value="Place">{yasrSetItemTypePlace}</option>
101
  <option value="Recipe">{yasrSetItemTypeRecipe}</option>
@@ -107,23 +119,37 @@ class YasrSideBarSelectSnippets extends React.Component {
107
  }
108
  }
109
 
110
- function yasrSidebar (props) {
111
 
112
- let yasrAutoInsertEnabled = false;
 
 
 
 
 
 
 
 
 
 
113
 
114
- //this is not for the post, but from settings
115
- if(yasrConstantGutenberg.autoInsert !== 'disabled') {
116
- yasrAutoInsertEnabled = true;
117
  }
118
 
119
- return (
120
- <PluginSidebar name="yasr-guten-sidebar" title="YASR Settings">
121
- <PanelBody>
122
- {yasrAutoInsertEnabled && <YasrSideBarAutoInsert/> }
123
- <YasrSideBarSelectSnippets/>
124
- </PanelBody>
125
- </PluginSidebar>
126
- );
 
 
 
 
 
 
 
127
  }
128
 
129
 
1
  const {registerPlugin} = wp.plugins;
2
+ const {PluginSidebar, PluginSidebarMoreMenuItem} = wp.editPost;
3
  const {TextControl, PanelBody, PanelRow} = wp.components;
4
  const {BlockControls,InspectorControls} = wp.editor;
5
 
11
  const yasrSetItemTypeOther = __('Other', 'yet-another-stars-rating');
12
 
13
 
14
+ class YasrSideBarAutoInsert extends React.Component {
15
 
16
+ constructor(props) {
17
+ super(props);
18
+
19
+ let isThisPostExluded = wp.data.select('core/editor').getCurrentPost().meta.yasr_auto_insert_disabled;
20
+ let isThisPostExludedCheckbox = false;
21
+
22
+ if (isThisPostExluded === 'yes') {
23
+ isThisPostExludedCheckbox = true;
24
+ }
25
 
26
+ this.state = {postExcluded: isThisPostExludedCheckbox};
27
+
28
+ this.yasrUpdatePostMetaAutoInsert = this.yasrUpdatePostMetaAutoInsert.bind(this);
29
  }
30
 
31
+ yasrUpdatePostMetaAutoInsert(event) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
+ const target = event.target;
34
+ const postExcluded = target.type === 'checkbox' ? target.checked : target.value;
 
35
 
36
+ this.setState({postExcluded: postExcluded});
37
 
38
+ if (postExcluded === true) {
39
+ wp.data.dispatch('core/editor').editPost(
40
+ { meta: { yasr_auto_insert_disabled: 'yes' } }
41
+ );
42
+ } else {
43
+ wp.data.dispatch('core/editor').editPost(
44
+ { meta: { yasr_auto_insert_disabled: 'no' } }
45
+ );
46
+ }
47
+
48
+ }
49
+
50
+ render () {
51
+ return (
52
+ <div className="yasr-guten-block-panel-center">
53
+ <label><span>{yasrDisableAutoInsert}</span></label>
54
+ <div className="yasr-onoffswitch-big" id="yasr-switcher-disable-auto-insert">
55
+ <input type="checkbox"
56
+ name="yasr_auto_insert_disabled"
57
+ className="yasr-onoffswitch-checkbox"
58
+ value="yes"
59
+ id="yasr-auto-insert-disabled-switch"
60
+ defaultChecked={this.state.postExcluded}
61
+ onChange={this.yasrUpdatePostMetaAutoInsert}
62
+ />
63
+ <label className="yasr-onoffswitch-label" htmlFor="yasr-auto-insert-disabled-switch">
64
+ <span className="yasr-onoffswitch-inner"></span>
65
+ <span className="yasr-onoffswitch-switch"></span>
66
+ </label>
67
+ </div>
68
+ <hr/>
69
+ </div>
70
  );
71
  }
72
 
75
  class YasrSideBarSelectSnippets extends React.Component {
76
 
77
  constructor(props) {
78
+ super(props);
79
 
80
  //at the begin, get the default type
81
  let snippetType = yasrConstantGutenberg.defaultItemType;
89
  snippetType = postMetaItemType;
90
  }
91
 
92
+ this.state = {snippet: snippetType};
93
 
94
  this.yasrSetItemType = this.yasrSetItemType.bind(this);
95
  }
96
 
97
  yasrSetItemType(event) {
98
+ this.setState({snippet: event.target.value});
99
 
100
  wp.data.dispatch( 'core/editor' ).editPost(
101
  { meta: { yasr_review_type: event.target.value } }
107
  <div className="yasr-guten-block-panel-center">
108
  <label><span>{yasrSelectSnippetTitle}</span></label>
109
  <form>
110
+ <select value={this.state.snippet} onChange={this.yasrSetItemType}>
111
  <option value="Product">{yasrSetItemTypeProduct}</option>
112
  <option value="Place">{yasrSetItemTypePlace}</option>
113
  <option value="Recipe">{yasrSetItemTypeRecipe}</option>
119
  }
120
  }
121
 
122
+ class yasrSidebar extends React.Component {
123
 
124
+ constructor(props) {
125
+ super(props);
126
+
127
+ let yasrAutoInsertEnabled = false;
128
+
129
+ //this is not for the post, but from settings
130
+ if (yasrConstantGutenberg.autoInsert !== 'disabled') {
131
+ yasrAutoInsertEnabled = true;
132
+ }
133
+
134
+ this.state = {yasrAutoInsertEnabled: yasrAutoInsertEnabled};
135
 
 
 
 
136
  }
137
 
138
+ render() {
139
+ return (
140
+ <Fragment>
141
+ <PluginSidebarMoreMenuItem name="my-plugin-sidebar" type="sidebar" target="yasr-guten-sidebar" >
142
+ { __( 'YASR post settings', 'yet-another-stars-rating' ) }
143
+ </PluginSidebarMoreMenuItem>
144
+ <PluginSidebar name="yasr-guten-sidebar" title="YASR Settings">
145
+ <PanelBody>
146
+ {this.state.yasrAutoInsertEnabled && <YasrSideBarAutoInsert/>}
147
+ <YasrSideBarSelectSnippets/>
148
+ </PanelBody>
149
+ </PluginSidebar>
150
+ </Fragment>
151
+ );
152
+ }
153
  }
154
 
155
 
js/yasr-guten-blocks.js CHANGED
@@ -29,8 +29,6 @@ var yasrSelectSizeSmall = __('Small', 'yet-another-stars-rating');
29
  var yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
30
  var yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
31
 
32
- var yasrDisableAutoInsert = __('Disable auto insert for this post or page?', 'yet-another-stars-rating');
33
-
34
  var yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
35
 
36
  var yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
@@ -196,73 +194,58 @@ registerBlockType('yet-another-stars-rating/yasr-overall-rating', {
196
  postIdAttribute = ' postid="' + postId + '"';
197
  }
198
 
199
- var YasrCreateDivRater = function (_React$Component) {
200
- _inherits(YasrCreateDivRater, _React$Component);
 
 
 
201
 
202
- function YasrCreateDivRater(props) {
203
- _classCallCheck(this, YasrCreateDivRater);
204
 
205
- return _possibleConstructorReturn(this, (YasrCreateDivRater.__proto__ || Object.getPrototypeOf(YasrCreateDivRater)).call(this, props));
206
- //const divOverall = React.createRef();
207
  }
208
 
209
- _createClass(YasrCreateDivRater, [{
210
  key: 'render',
211
  value: function render() {
212
  return React.createElement(
213
  'div',
214
  null,
215
- React.createElement('div', { id: 'overall-rater', ref: function ref() {
216
- return raterJs({
217
- starSize: 32,
218
- step: 0.1,
219
- showToolTip: false,
220
- rating: overallRating,
221
- readOnly: false,
222
- element: document.querySelector("#overall-rater"),
223
- rateCallback: function rateCallback(rating, done) {
224
-
225
- rating = rating.toFixed(1);
226
- rating = parseFloat(rating);
227
-
228
- setAttributes({ overallRatingMeta: rating });
229
-
230
- this.setRating(rating);
231
-
232
- done();
233
- }
234
- });
235
- }
236
- })
 
 
 
 
 
237
  );
238
  }
239
  }]);
240
 
241
- return YasrCreateDivRater;
242
  }(React.Component);
243
 
244
- function YasrDivRatingOverall(props) {
245
-
246
- var yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
247
- var yasrLoading = __("Loading, please wait", 'yet-another-stars-rating');
248
- var hideLoaderOverall = { display: 'none' };
249
-
250
- return React.createElement(
251
- 'div',
252
- null,
253
- yasrOverallRateThis,
254
- React.createElement(YasrCreateDivRater, null),
255
- React.createElement(
256
- 'span',
257
- { id: 'loader-overall-rating', style: hideLoaderOverall },
258
- yasrLoading,
259
- ' ',
260
- React.createElement('img', { src: yasrCommonDataAdmin.loaderHtml })
261
- ),
262
- React.createElement('div', { id: 'yasr-rateit-overall-value' })
263
- );
264
- }
265
-
266
  function YasrPrintSelectSize() {
267
  return React.createElement(
268
  'form',
29
  var yasrSelectSizeMedium = __('Medium', 'yet-another-stars-rating');
30
  var yasrSelectSizeLarge = __('Large', 'yet-another-stars-rating');
31
 
 
 
32
  var yasrLeaveThisBlankText = __('Leave this blank if you don\'t know what you\'re doing.', 'yet-another-stars-rating');
33
 
34
  var yasrOverallDescription = __('Remember: only the post author can rate here.', 'yet-another-stars-rating');
194
  postIdAttribute = ' postid="' + postId + '"';
195
  }
196
 
197
+ var YasrDivRatingOverall = function (_React$Component) {
198
+ _inherits(YasrDivRatingOverall, _React$Component);
199
+
200
+ function YasrDivRatingOverall(props) {
201
+ _classCallCheck(this, YasrDivRatingOverall);
202
 
203
+ var _this = _possibleConstructorReturn(this, (YasrDivRatingOverall.__proto__ || Object.getPrototypeOf(YasrDivRatingOverall)).call(this, props));
 
204
 
205
+ _this.yasrOverallRateThis = __("Rate this article / item", 'yet-another-stars-rating');
206
+ return _this;
207
  }
208
 
209
+ _createClass(YasrDivRatingOverall, [{
210
  key: 'render',
211
  value: function render() {
212
  return React.createElement(
213
  'div',
214
  null,
215
+ this.yasrOverallRateThis,
216
+ React.createElement(
217
+ 'div',
218
+ null,
219
+ React.createElement('div', { id: 'overall-rater', ref: function ref() {
220
+ return raterJs({
221
+ starSize: 32,
222
+ step: 0.1,
223
+ showToolTip: false,
224
+ rating: overallRating,
225
+ readOnly: false,
226
+ element: document.querySelector("#overall-rater"),
227
+ rateCallback: function rateCallback(rating, done) {
228
+
229
+ rating = rating.toFixed(1);
230
+ rating = parseFloat(rating);
231
+
232
+ setAttributes({ overallRatingMeta: rating });
233
+
234
+ this.setRating(rating);
235
+
236
+ done();
237
+ }
238
+ });
239
+ }
240
+ })
241
+ )
242
  );
243
  }
244
  }]);
245
 
246
+ return YasrDivRatingOverall;
247
  }(React.Component);
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  function YasrPrintSelectSize() {
250
  return React.createElement(
251
  'form',
js/yasr-guten-panel.js CHANGED
@@ -7,7 +7,9 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
7
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8
 
9
  var registerPlugin = wp.plugins.registerPlugin;
10
- var PluginSidebar = wp.editPost.PluginSidebar;
 
 
11
  var _wp$components = wp.components,
12
  TextControl = _wp$components.TextControl,
13
  PanelBody = _wp$components.PanelBody,
@@ -24,70 +26,91 @@ var yasrSetItemTypePlace = __('Place', 'yet-another-stars-rating');
24
  var yasrSetItemTypeRecipe = __('Recipe', 'yet-another-stars-rating');
25
  var yasrSetItemTypeOther = __('Other', 'yet-another-stars-rating');
26
 
27
- function YasrSideBarAutoInsert(props) {
 
28
 
29
- var isThisPostExluded = wp.data.select('core/editor').getCurrentPost().meta.yasr_auto_insert_disabled;
30
- var isThisPostExludedCheckbox = false;
31
 
32
- if (isThisPostExluded === 'yes') {
33
- isThisPostExludedCheckbox = true;
34
- }
35
 
36
- return React.createElement(
37
- 'div',
38
- { className: 'yasr-guten-block-panel-center' },
39
- React.createElement(
40
- 'label',
41
- null,
42
- React.createElement(
43
- 'span',
44
- null,
45
- yasrDisableAutoInsert
46
- )
47
- ),
48
- React.createElement(
49
- 'div',
50
- { className: 'yasr-onoffswitch-big', id: 'yasr-switcher-disable-auto-insert' },
51
- React.createElement('input', { type: 'checkbox',
52
- name: 'yasr_auto_insert_disabled',
53
- className: 'yasr-onoffswitch-checkbox',
54
- value: 'yes',
55
- id: 'yasr-auto-insert-disabled-switch',
56
- defaultChecked: isThisPostExludedCheckbox,
57
- onChange: YasrUpdatePostMetaAutoInsert
58
- }),
59
- React.createElement(
60
- 'label',
61
- { className: 'yasr-onoffswitch-label', htmlFor: 'yasr-auto-insert-disabled-switch' },
62
- React.createElement('span', { className: 'yasr-onoffswitch-inner' }),
63
- React.createElement('span', { className: 'yasr-onoffswitch-switch' })
64
- )
65
- ),
66
- React.createElement('hr', null)
67
- );
68
- }
69
-
70
- function YasrUpdatePostMetaAutoInsert(event) {
71
- var target = event.target;
72
- var value = target.type === 'checkbox' ? target.checked : target.value;
73
-
74
- var isThisPostExcluded = value;
75
-
76
- if (isThisPostExcluded === true) {
77
- wp.data.dispatch('core/editor').editPost({ meta: { yasr_auto_insert_disabled: 'yes' } });
78
- } else {
79
- wp.data.dispatch('core/editor').editPost({ meta: { yasr_auto_insert_disabled: 'no' } });
80
  }
81
- }
82
 
83
- var YasrSideBarSelectSnippets = function (_React$Component) {
84
- _inherits(YasrSideBarSelectSnippets, _React$Component);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  function YasrSideBarSelectSnippets(props) {
87
  _classCallCheck(this, YasrSideBarSelectSnippets);
88
 
89
  //at the begin, get the default type
90
- var _this = _possibleConstructorReturn(this, (YasrSideBarSelectSnippets.__proto__ || Object.getPrototypeOf(YasrSideBarSelectSnippets)).call(this));
91
 
92
  var snippetType = yasrConstantGutenberg.defaultItemType;
93
 
@@ -99,16 +122,16 @@ var YasrSideBarSelectSnippets = function (_React$Component) {
99
  snippetType = postMetaItemType;
100
  }
101
 
102
- _this.state = { value: snippetType };
103
 
104
- _this.yasrSetItemType = _this.yasrSetItemType.bind(_this);
105
- return _this;
106
  }
107
 
108
  _createClass(YasrSideBarSelectSnippets, [{
109
  key: 'yasrSetItemType',
110
  value: function yasrSetItemType(event) {
111
- this.setState({ value: event.target.value });
112
 
113
  wp.data.dispatch('core/editor').editPost({ meta: { yasr_review_type: event.target.value } });
114
  }
@@ -132,7 +155,7 @@ var YasrSideBarSelectSnippets = function (_React$Component) {
132
  null,
133
  React.createElement(
134
  'select',
135
- { value: this.state.value, onChange: this.yasrSetItemType },
136
  React.createElement(
137
  'option',
138
  { value: 'Product' },
@@ -162,28 +185,57 @@ var YasrSideBarSelectSnippets = function (_React$Component) {
162
  return YasrSideBarSelectSnippets;
163
  }(React.Component);
164
 
165
- function yasrSidebar(props) {
 
 
 
 
 
 
166
 
167
- var yasrAutoInsertEnabled = false;
168
 
169
- //this is not for the post, but from settings
170
- if (yasrConstantGutenberg.autoInsert !== 'disabled') {
171
- yasrAutoInsertEnabled = true;
 
 
 
 
 
172
  }
173
 
174
- return React.createElement(
175
- PluginSidebar,
176
- { name: 'yasr-guten-sidebar', title: 'YASR Settings' },
177
- React.createElement(
178
- PanelBody,
179
- null,
180
- yasrAutoInsertEnabled && React.createElement(YasrSideBarAutoInsert, null),
181
- React.createElement(YasrSideBarSelectSnippets, null)
182
- )
183
- );
184
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
 
186
  // Our custom sidebar
 
 
187
  registerPlugin('yasr-sidebar', {
188
  icon: 'star-half',
189
  title: __('Yasr: Page Settings', 'yet-another-stars-rating'),
7
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8
 
9
  var registerPlugin = wp.plugins.registerPlugin;
10
+ var _wp$editPost = wp.editPost,
11
+ PluginSidebar = _wp$editPost.PluginSidebar,
12
+ PluginSidebarMoreMenuItem = _wp$editPost.PluginSidebarMoreMenuItem;
13
  var _wp$components = wp.components,
14
  TextControl = _wp$components.TextControl,
15
  PanelBody = _wp$components.PanelBody,
26
  var yasrSetItemTypeRecipe = __('Recipe', 'yet-another-stars-rating');
27
  var yasrSetItemTypeOther = __('Other', 'yet-another-stars-rating');
28
 
29
+ var YasrSideBarAutoInsert = function (_React$Component) {
30
+ _inherits(YasrSideBarAutoInsert, _React$Component);
31
 
32
+ function YasrSideBarAutoInsert(props) {
33
+ _classCallCheck(this, YasrSideBarAutoInsert);
34
 
35
+ var _this = _possibleConstructorReturn(this, (YasrSideBarAutoInsert.__proto__ || Object.getPrototypeOf(YasrSideBarAutoInsert)).call(this, props));
 
 
36
 
37
+ var isThisPostExluded = wp.data.select('core/editor').getCurrentPost().meta.yasr_auto_insert_disabled;
38
+ var isThisPostExludedCheckbox = false;
39
+
40
+ if (isThisPostExluded === 'yes') {
41
+ isThisPostExludedCheckbox = true;
42
+ }
43
+
44
+ _this.state = { postExcluded: isThisPostExludedCheckbox };
45
+
46
+ _this.yasrUpdatePostMetaAutoInsert = _this.yasrUpdatePostMetaAutoInsert.bind(_this);
47
+ return _this;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
 
49
 
50
+ _createClass(YasrSideBarAutoInsert, [{
51
+ key: 'yasrUpdatePostMetaAutoInsert',
52
+ value: function yasrUpdatePostMetaAutoInsert(event) {
53
+
54
+ var target = event.target;
55
+ var postExcluded = target.type === 'checkbox' ? target.checked : target.value;
56
+
57
+ this.setState({ postExcluded: postExcluded });
58
+
59
+ if (postExcluded === true) {
60
+ wp.data.dispatch('core/editor').editPost({ meta: { yasr_auto_insert_disabled: 'yes' } });
61
+ } else {
62
+ wp.data.dispatch('core/editor').editPost({ meta: { yasr_auto_insert_disabled: 'no' } });
63
+ }
64
+ }
65
+ }, {
66
+ key: 'render',
67
+ value: function render() {
68
+ return React.createElement(
69
+ 'div',
70
+ { className: 'yasr-guten-block-panel-center' },
71
+ React.createElement(
72
+ 'label',
73
+ null,
74
+ React.createElement(
75
+ 'span',
76
+ null,
77
+ yasrDisableAutoInsert
78
+ )
79
+ ),
80
+ React.createElement(
81
+ 'div',
82
+ { className: 'yasr-onoffswitch-big', id: 'yasr-switcher-disable-auto-insert' },
83
+ React.createElement('input', { type: 'checkbox',
84
+ name: 'yasr_auto_insert_disabled',
85
+ className: 'yasr-onoffswitch-checkbox',
86
+ value: 'yes',
87
+ id: 'yasr-auto-insert-disabled-switch',
88
+ defaultChecked: this.state.postExcluded,
89
+ onChange: this.yasrUpdatePostMetaAutoInsert
90
+ }),
91
+ React.createElement(
92
+ 'label',
93
+ { className: 'yasr-onoffswitch-label', htmlFor: 'yasr-auto-insert-disabled-switch' },
94
+ React.createElement('span', { className: 'yasr-onoffswitch-inner' }),
95
+ React.createElement('span', { className: 'yasr-onoffswitch-switch' })
96
+ )
97
+ ),
98
+ React.createElement('hr', null)
99
+ );
100
+ }
101
+ }]);
102
+
103
+ return YasrSideBarAutoInsert;
104
+ }(React.Component);
105
+
106
+ var YasrSideBarSelectSnippets = function (_React$Component2) {
107
+ _inherits(YasrSideBarSelectSnippets, _React$Component2);
108
 
109
  function YasrSideBarSelectSnippets(props) {
110
  _classCallCheck(this, YasrSideBarSelectSnippets);
111
 
112
  //at the begin, get the default type
113
+ var _this2 = _possibleConstructorReturn(this, (YasrSideBarSelectSnippets.__proto__ || Object.getPrototypeOf(YasrSideBarSelectSnippets)).call(this, props));
114
 
115
  var snippetType = yasrConstantGutenberg.defaultItemType;
116
 
122
  snippetType = postMetaItemType;
123
  }
124
 
125
+ _this2.state = { snippet: snippetType };
126
 
127
+ _this2.yasrSetItemType = _this2.yasrSetItemType.bind(_this2);
128
+ return _this2;
129
  }
130
 
131
  _createClass(YasrSideBarSelectSnippets, [{
132
  key: 'yasrSetItemType',
133
  value: function yasrSetItemType(event) {
134
+ this.setState({ snippet: event.target.value });
135
 
136
  wp.data.dispatch('core/editor').editPost({ meta: { yasr_review_type: event.target.value } });
137
  }
155
  null,
156
  React.createElement(
157
  'select',
158
+ { value: this.state.snippet, onChange: this.yasrSetItemType },
159
  React.createElement(
160
  'option',
161
  { value: 'Product' },
185
  return YasrSideBarSelectSnippets;
186
  }(React.Component);
187
 
188
+ var yasrSidebar = function (_React$Component3) {
189
+ _inherits(yasrSidebar, _React$Component3);
190
+
191
+ function yasrSidebar(props) {
192
+ _classCallCheck(this, yasrSidebar);
193
+
194
+ var _this3 = _possibleConstructorReturn(this, (yasrSidebar.__proto__ || Object.getPrototypeOf(yasrSidebar)).call(this, props));
195
 
196
+ var yasrAutoInsertEnabled = false;
197
 
198
+ //this is not for the post, but from settings
199
+ if (yasrConstantGutenberg.autoInsert !== 'disabled') {
200
+ yasrAutoInsertEnabled = true;
201
+ }
202
+
203
+ _this3.state = { yasrAutoInsertEnabled: yasrAutoInsertEnabled };
204
+
205
+ return _this3;
206
  }
207
 
208
+ _createClass(yasrSidebar, [{
209
+ key: 'render',
210
+ value: function render() {
211
+ return React.createElement(
212
+ Fragment,
213
+ null,
214
+ React.createElement(
215
+ PluginSidebarMoreMenuItem,
216
+ { name: 'my-plugin-sidebar', type: 'sidebar', target: 'yasr-guten-sidebar' },
217
+ __('YASR post settings', 'yet-another-stars-rating')
218
+ ),
219
+ React.createElement(
220
+ PluginSidebar,
221
+ { name: 'yasr-guten-sidebar', title: 'YASR Settings' },
222
+ React.createElement(
223
+ PanelBody,
224
+ null,
225
+ this.state.yasrAutoInsertEnabled && React.createElement(YasrSideBarAutoInsert, null),
226
+ React.createElement(YasrSideBarSelectSnippets, null)
227
+ )
228
+ )
229
+ );
230
+ }
231
+ }]);
232
+
233
+ return yasrSidebar;
234
+ }(React.Component);
235
 
236
  // Our custom sidebar
237
+
238
+
239
  registerPlugin('yasr-sidebar', {
240
  icon: 'star-half',
241
  title: __('Yasr: Page Settings', 'yet-another-stars-rating'),
lib/yasr-db-functions.php CHANGED
@@ -23,7 +23,66 @@ if (!defined('ABSPATH')) {
23
  } // Exit if accessed directly
24
 
25
  /****** Install yasr functions ******/
26
- function yasr_install() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  global $wpdb; //Database wordpress object
28
 
29
  $prefix = $wpdb->prefix . 'yasr_'; //Table prefix
@@ -80,51 +139,37 @@ function yasr_install() {
80
  dbDelta($sql_yasr_multi_set_fields);
81
  dbDelta($sql_yasr_multi_value_table);
82
  dbDelta($sql_yasr_log_table);
 
83
 
 
 
 
 
 
 
 
 
84
 
85
- //Write default option settings
86
- $option = get_option('yasr_general_options');
87
-
88
- if (!$option) {
89
- $option = array();
90
- $option['auto_insert_enabled'] = 0;
91
- $option['auto_insert_what'] = 'overall_rating';
92
- $option['auto_insert_where'] = 'top';
93
- $option['auto_insert_size'] = 'large';
94
- $option['auto_insert_exclude_pages'] = 'yes';
95
- $option['auto_insert_custom_post_only'] = 'no';
96
- $option['show_overall_in_loop'] = 'disabled';
97
- $option['show_visitor_votes_in_loop'] = 'disabled';
98
- $option['text_before_stars'] = 0;
99
- $option['enable_ip'] = 'no';
100
- $option['snippet'] = 'overall_rating';
101
- $option['snippet_itemtype'] = 'Product';
102
- $option['blogposting_organization_name'] = get_bloginfo('name');
103
- $option['blogposting_organization_logo'] = get_site_icon_url();
104
- $option['allowed_user'] = 'allow_anonymous';
105
- $option['metabox_overall_rating'] = 'stars'; //This is not in settings page but in overall rating metabox
106
- $option['visitors_stats'] = 'yes';
107
-
108
- add_option("yasr_general_options", $option); //Write here the default value if there is not option
109
-
110
- //Style set options
111
- $style_options = array();
112
- $style_options['scheme_color_multiset'] = 'light';
113
- $style_options['stars_set_free'] = 'flat';
114
 
115
- add_option("yasr_style_options", $style_options);
 
116
 
117
- //multi set options
118
- $multi_set_options = array();
119
- $multi_set_options['show_average'] = 'yes';
120
 
121
- add_option("yasr_multiset_options", $multi_set_options);
 
 
 
122
 
123
- }
 
 
 
124
 
 
125
  }
126
 
127
-
128
  /*
129
  * Get overall rating from yasr_votes table used in
130
  * yasr_add_filter_for_schema(), yasr_get_id_value_callback()
@@ -393,7 +438,7 @@ function yasr_get_visitor_votes($post_id = false, $create_transient = true) {
393
  }
394
 
395
  if (!$post_id) {
396
- return;
397
  }
398
 
399
  $post_id = (int)$post_id;
@@ -440,7 +485,7 @@ function yasr_check_if_user_already_voted($post_id = false) {
440
  }
441
 
442
  if (!$post_id || !$user_id) {
443
- exit();
444
  }
445
 
446
  $rating = $wpdb->get_var(
23
  } // Exit if accessed directly
24
 
25
  /****** Install yasr functions ******/
26
+ function yasr_on_activation_install($network_wide) {
27
+ global $wpdb; //Database wordpress object
28
+
29
+ // Creating tables for all blogs in a WordPress Multisite installation
30
+ if ( is_multisite() && $network_wide ) {
31
+ // Get all blogs in the network and activate plugin on each one
32
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
33
+ foreach ( $blog_ids as $blog_id ) {
34
+ switch_to_blog( $blog_id );
35
+ yasr_create_tables();
36
+ restore_current_blog();
37
+ }
38
+ } else {
39
+ yasr_create_tables();
40
+ }
41
+
42
+ //Write default option settings
43
+ $option = get_option('yasr_general_options');
44
+
45
+ if (!$option) {
46
+ $option = array();
47
+ $option['auto_insert_enabled'] = 0;
48
+ $option['auto_insert_what'] = 'overall_rating';
49
+ $option['auto_insert_where'] = 'top';
50
+ $option['auto_insert_size'] = 'large';
51
+ $option['auto_insert_exclude_pages'] = 'yes';
52
+ $option['auto_insert_custom_post_only'] = 'no';
53
+ $option['show_overall_in_loop'] = 'disabled';
54
+ $option['show_visitor_votes_in_loop'] = 'disabled';
55
+ $option['text_before_stars'] = 0;
56
+ $option['enable_ip'] = 'no';
57
+ $option['snippet'] = 'overall_rating';
58
+ $option['snippet_itemtype'] = 'Product';
59
+ $option['blogposting_organization_name'] = get_bloginfo('name');
60
+ $option['blogposting_organization_logo'] = get_site_icon_url();
61
+ $option['allowed_user'] = 'allow_anonymous';
62
+ $option['metabox_overall_rating'] = 'stars'; //This is not in settings page but in overall rating metabox
63
+ $option['visitors_stats'] = 'yes';
64
+
65
+ add_option("yasr_general_options", $option); //Write here the default value if there is not option
66
+
67
+ //Style set options
68
+ $style_options = array();
69
+ $style_options['scheme_color_multiset'] = 'light';
70
+ $style_options['stars_set_free'] = 'flat';
71
+
72
+ add_option("yasr_style_options", $style_options);
73
+
74
+ //multi set options
75
+ $multi_set_options = array();
76
+ $multi_set_options['show_average'] = 'yes';
77
+
78
+ add_option("yasr_multiset_options", $multi_set_options);
79
+
80
+ }
81
+
82
+ }
83
+
84
+ function yasr_create_tables () {
85
+
86
  global $wpdb; //Database wordpress object
87
 
88
  $prefix = $wpdb->prefix . 'yasr_'; //Table prefix
139
  dbDelta($sql_yasr_multi_set_fields);
140
  dbDelta($sql_yasr_multi_value_table);
141
  dbDelta($sql_yasr_log_table);
142
+ }
143
 
144
+ //action is in the main file
145
+ function yasr_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
146
+ if ( is_plugin_active_for_network( 'yet-another-stars-rating/yet-another-stars-rating.php' ) ) {
147
+ switch_to_blog( $blog_id );
148
+ yasr_create_tables();
149
+ restore_current_blog();
150
+ }
151
+ }
152
 
153
+ // Deleting the table whenever a blog is deleted
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
 
155
+ function yasr_on_delete_blog($tables) {
156
+ global $wpdb;
157
 
158
+ $prefix = $wpdb->prefix . 'yasr_'; //Table prefix
 
 
159
 
160
+ $yasr_multi_set_table = $prefix . 'multi_set';
161
+ $yasr_multi_set_fields = $prefix . 'multi_set_fields';
162
+ $yasr_multi_values_table = $prefix . 'multi_values';
163
+ $yasr_log_table = $prefix . 'log';
164
 
165
+ $tables[] = $yasr_multi_set_table;
166
+ $tables[] = $yasr_multi_set_fields;
167
+ $tables[] = $yasr_multi_values_table;
168
+ $tables[] = $yasr_log_table;
169
 
170
+ return $tables;
171
  }
172
 
 
173
  /*
174
  * Get overall rating from yasr_votes table used in
175
  * yasr_add_filter_for_schema(), yasr_get_id_value_callback()
438
  }
439
 
440
  if (!$post_id) {
441
+ return false;
442
  }
443
 
444
  $post_id = (int)$post_id;
485
  }
486
 
487
  if (!$post_id || !$user_id) {
488
+ return false;
489
  }
490
 
491
  $rating = $wpdb->get_var(
lib/yasr-shortcode-functions.php CHANGED
@@ -97,11 +97,11 @@ function shortcode_overall_rating_callback ($atts) {
97
 
98
  /****** Add shortcode for user vote ******/
99
 
100
- add_shortcode ('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
101
 
102
  function shortcode_visitor_votes_callback($atts) {
103
 
104
- if (YASR_SHOW_OVERALL_IN_LOOP === 'disabled' && !is_singular() && is_main_query()) {
105
  return null;
106
  }
107
 
97
 
98
  /****** Add shortcode for user vote ******/
99
 
100
+ add_shortcode('yasr_visitor_votes', 'shortcode_visitor_votes_callback');
101
 
102
  function shortcode_visitor_votes_callback($atts) {
103
 
104
+ if (YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'disabled' && !is_singular() && is_main_query()) {
105
  return null;
106
  }
107
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 4.3.0
5
  Contributors: Dudo
6
  Tested up to: 5.2.2
7
  Requires PHP: 5.3
8
- Stable tag: 2.0.1
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
@@ -133,6 +133,11 @@ If doesn't, it's suggested to ask in a SEO oriented forum.
133
 
134
  The full changelog can be found in the plugin's directory. Recent entries:
135
 
 
 
 
 
 
136
  = 2.0.1 =
137
  * TWEAKED: changed code in yasr-shortcode-functions.php to support php version < 7
138
 
5
  Contributors: Dudo
6
  Tested up to: 5.2.2
7
  Requires PHP: 5.3
8
+ Stable tag: 2.0.2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Boost the way people interact with your website, e-commerce or blog with an easy and intuitive WordPress rating system!
133
 
134
  The full changelog can be found in the plugin's directory. Recent entries:
135
 
136
+ = 2.0.2 =
137
+ * TWEAKED: Multisite support!!
138
+ * TWEAKED: In gutenberg editor, now a link for Yasr Sidebar is available
139
+ * FIXED: gutenberg showing "updated failed" in some rare circumstances
140
+
141
  = 2.0.1 =
142
  * TWEAKED: changed code in yasr-shortcode-functions.php to support php version < 7
143
 
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: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
- * Version: 2.0.1
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
@@ -76,7 +76,7 @@ if ( !function_exists( 'yasr_fs' ) ) {
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
- define( 'YASR_VERSION_NUM', '2.0.1' );
80
  //Plugin relative path
81
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
  //Plugin RELATIVE PATH without slashes (just the directory's name)
@@ -211,15 +211,24 @@ if ( !function_exists( 'yasr_fs' ) ) {
211
  global $yasr_plugin_imported ;
212
  //Run this only on plugin activation (doesn't work on update)
213
  register_activation_hook( __FILE__, 'yasr_on_activation' );
214
- function yasr_on_activation()
215
  {
216
  global $yasr_version_installed ;
217
  //If this is a fresh new installation
218
  if ( !$yasr_version_installed ) {
219
- yasr_install();
220
  }
221
  }
222
 
 
 
 
 
 
 
 
 
 
223
  /****** backward compatibility functions ******/
224
  add_action( 'plugins_loaded', 'yasr_update_version' );
225
  function yasr_update_version()
@@ -230,12 +239,8 @@ if ( !function_exists( 'yasr_fs' ) ) {
230
  global $wpdb ;
231
  global $yasr_version_installed ;
232
  global $yasr_stored_options ;
233
- if ($yasr_version_installed && $yasr_version_installed < '1.7.3') {
234
- $wpdb->query("ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE .
235
- " CHANGE field_name field_name varchar(40)
236
- COLLATE 'utf8_unicode_ci' NOT NULL
237
- AFTER parent_set_id;
238
- ");
239
  }
240
 
241
  if ( $yasr_version_installed && $yasr_version_installed < '1.6.5' ) {
4
  * Plugin Name: Yet Another Stars Rating
5
  * Plugin URI: http://wordpress.org/plugins/yet-another-stars-rating/
6
  * Description: Yasr - Yet Another Stars Rating is a powerful way to add SEO-friendly user-generated reviews and testimonials to your website posts, pages and CPT, without affecting its speed.
7
+ * Version: 2.0.2
8
  * Author: Dario Curvino
9
  * Author URI: https://dariocurvino.it/
10
  * Text Domain: yet-another-stars-rating
76
  yasr_fs();
77
  // Signal that SDK was initiated.
78
  do_action( 'yasr_fs_loaded' );
79
+ define( 'YASR_VERSION_NUM', '2.0.2' );
80
  //Plugin relative path
81
  define( "YASR_ABSOLUTE_PATH", dirname( __FILE__ ) );
82
  //Plugin RELATIVE PATH without slashes (just the directory's name)
211
  global $yasr_plugin_imported ;
212
  //Run this only on plugin activation (doesn't work on update)
213
  register_activation_hook( __FILE__, 'yasr_on_activation' );
214
+ function yasr_on_activation( $network_wide )
215
  {
216
  global $yasr_version_installed ;
217
  //If this is a fresh new installation
218
  if ( !$yasr_version_installed ) {
219
+ yasr_on_activation_install( $network_wide );
220
  }
221
  }
222
 
223
+ //this is called when in multisite a new blog is added
224
+ add_action(
225
+ 'wpmu_new_blog',
226
+ 'yasr_on_create_blog',
227
+ 10,
228
+ 6
229
+ );
230
+ //when blog is deleted
231
+ add_filter( 'wpmu_drop_tables', 'yasr_on_delete_blog' );
232
  /****** backward compatibility functions ******/
233
  add_action( 'plugins_loaded', 'yasr_update_version' );
234
  function yasr_update_version()
239
  global $wpdb ;
240
  global $yasr_version_installed ;
241
  global $yasr_stored_options ;
242
+ if ( $yasr_version_installed && $yasr_version_installed < '1.7.3' ) {
243
+ $wpdb->query( "ALTER TABLE " . YASR_MULTI_SET_FIELDS_TABLE . " CHANGE field_name field_name varchar(40) \n COLLATE 'utf8_unicode_ci' NOT NULL \n AFTER parent_set_id;\n " );
 
 
 
 
244
  }
245
 
246
  if ( $yasr_version_installed && $yasr_version_installed < '1.6.5' ) {