WP Product Review Lite - Version 3.1.0

Version Description

  • 2017-09-22
Download this release

Release Info

Developer codeinwp
Plugin Icon WP Product Review Lite
Version 3.1.0
Comparing to
See all releases

Code changes from version 3.0.12 to 3.1.0

CHANGELOG.md CHANGED
@@ -1,4 +1,11 @@
1
 
 
 
 
 
 
 
 
2
  ### v3.0.12 - 2017-09-17
3
  **Changes:**
4
  * Fix for review box issues.
1
 
2
+ ### v3.1.0 - 2017-09-22
3
+ **Changes:**
4
+ * Fix for some edge cases when the review box was gone.
5
+ * Improvements assets loading, removed redundant files.
6
+ * Improvements perfomance of review query.
7
+ * Various bug fixes reported by clients.
8
+
9
  ### v3.0.12 - 2017-09-17
10
  **Changes:**
11
  * Fix for review box issues.
assets/css/frontpage.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 3.0.12
3
  */
4
  #review-statistics {
5
  width: 100%;
@@ -270,6 +270,10 @@
270
  margin-top: 10px;
271
  }
272
 
 
 
 
 
273
  #review-statistics .review-wrap-up .review-wu-left .rev-wu-image {
274
  float: left;
275
  overflow: hidden;
1
  /*
2
+ Version: 3.1.0
3
  */
4
  #review-statistics {
5
  width: 100%;
270
  margin-top: 10px;
271
  }
272
 
273
+ .wppr-review-container.wppr-review-no-pros.wppr-review-no-cons #review-statistics .review-wrap-up .review-wu-left {
274
+ width: 100%;
275
+ }
276
+
277
  #review-statistics .review-wrap-up .review-wu-left .rev-wu-image {
278
  float: left;
279
  overflow: hidden;
assets/js/admin-review.js CHANGED
@@ -11,8 +11,8 @@ jQuery( document ).ready(function(){
11
  wp.media.frame.open();
12
  return;
13
  }
14
- var mtitle = "Add a product image to the review";
15
- var mbutton = "Attach the image ";
16
 
17
  meta_image_frame = wp.media.frames.meta_image_frame = wp.media({
18
  title: mtitle,
11
  wp.media.frame.open();
12
  return;
13
  }
14
+ var mtitle = editor_vars.image_title ;
15
+ var mbutton = editor_vars.image_button;
16
 
17
  meta_image_frame = wp.media.frames.meta_image_frame = wp.media({
18
  title: mtitle,
assets/js/admin.js CHANGED
@@ -1,48 +1,42 @@
1
  /* jshint ignore:start */
2
- jQuery( document ).ready(function ($) {
3
-
4
- jQuery("#cwp_container").fadeIn(200);
5
-
6
- jQuery(".subo-color-picker").wpColorPicker({ change: function(event, ui){
7
- var color = ui.color.toCSS();
8
-
9
- var id = jQuery(this).attr('id').replace('_color_selector', '');
10
-
11
-
12
- jQuery("#"+id+"_color").val(color);
13
- }} );
14
 
15
- update_nav( $( "#wppr_top_tabs .wppr-nav-tab:first" ) );
16
- $( "#wppr_top_tabs" ).on('click', '.wppr-nav-tab', function () {
17
- update_nav( $( this ) );
18
  return false;
19
  })
20
- function update_nav(obj) {
21
 
22
- var tab = obj.attr( 'data-tab' );
23
- var id = obj.find( 'a' ).attr( 'href' );
24
- $( '.wppr-nav-tab' ).removeClass( 'active' );
25
- obj.addClass( 'active' );
26
- $( '.wppr-tab-content' ).hide();
27
- $( id ).show();
 
28
  }
29
  });
30
 
31
- jQuery( "document" ).ready(function() {
32
-
33
- jQuery( '.cwp_save' ).on('click', function(){
34
  var $btn = jQuery(this);
35
- $btn.parent().find( '.spinner' ).addClass( 'is-active' );
36
  $btn.addClass('disabled');
37
- var form_data = jQuery( '#wppr-settings' ).serializeArray()
38
  var data = {
39
  'action': 'update_options',
40
  'cwppos_options': form_data
41
  };
42
-
43
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
44
- jQuery.post(ajaxurl, data, function(response) {
45
- $btn.parent().find( '.spinner' ).removeClass( 'is-active' );
46
  $btn.removeClass('disabled');
47
  });
48
  });
1
  /* jshint ignore:start */
2
+ jQuery(document).ready(function ($) {
3
+ jQuery(".subo-color-picker").wpColorPicker({
4
+ change: function (event, ui) {
5
+ var color = ui.color.toCSS();
6
+ var id = jQuery(this).attr('id').replace('_color_selector', '');
7
+ jQuery("#" + id + "_color").val(color);
8
+ }
9
+ });
 
 
 
 
10
 
11
+ update_nav($("#wppr_top_tabs .wppr-nav-tab:first"));
12
+ $("#wppr_top_tabs").on('click', '.wppr-nav-tab', function () {
13
+ update_nav($(this));
14
  return false;
15
  })
 
16
 
17
+ function update_nav(obj) {
18
+ var tab = obj.attr('data-tab');
19
+ var id = obj.find('a').attr('href');
20
+ $('.wppr-nav-tab').removeClass('active');
21
+ obj.addClass('active');
22
+ $('.wppr-tab-content').hide();
23
+ $(id).show();
24
  }
25
  });
26
 
27
+ jQuery("document").ready(function () {
28
+ jQuery('.cwp_save').on('click', function () {
 
29
  var $btn = jQuery(this);
30
+ $btn.parent().find('.spinner').addClass('is-active');
31
  $btn.addClass('disabled');
32
+ var form_data = jQuery('#wppr-settings').serializeArray()
33
  var data = {
34
  'action': 'update_options',
35
  'cwppos_options': form_data
36
  };
 
37
  // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
38
+ jQuery.post(ajaxurl, data, function (response) {
39
+ $btn.parent().find('.spinner').removeClass('is-active');
40
  $btn.removeClass('disabled');
41
  });
42
  });
assets/js/cwp-pointers.js DELETED
@@ -1,30 +0,0 @@
1
- /* jshint ignore:start */
2
- (function ($, cwpp){
3
-
4
- $( document ).ready( function() {
5
-
6
- var timeout;
7
-
8
- $( "#cwp_product_affiliate_link" ).on("keyup", function(e){
9
- if ($( this ).val().indexOf( "amazon" ) != -1) {
10
- $( "#wppr_product_affiliate_link_upsell" ).show();
11
- timeout = setTimeout( function(){wppr_open_pointer( 0 );}, 1000 );
12
- }
13
- });
14
-
15
- function wppr_open_pointer(i) {
16
- pointer = cwpp.pointers.pointers[i];
17
- options = $.extend( pointer.options, {
18
- close: function() {
19
- $.post( ajaxurl, {
20
- pointer: pointer.pointer_id,
21
- action: 'wppr-dismiss-amazon-link'
22
- });
23
- }
24
- });
25
-
26
- $( pointer.target ).pointer( options ).pointer( 'open' );
27
- clearTimeout( timeout );
28
- }
29
- });
30
- })(jQuery, cwpp)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/main.js CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Main JavaScript File
4
  */
5
- jQuery( document ).ready(function($) {
6
 
7
- var initPieChart = function() {
8
- returnColor = function(percent) {
9
  if (percent > 0 && percent <= 25) {
10
  return c1;
11
  } else if (percent > 25 && percent <= 50) {
@@ -16,34 +16,45 @@ jQuery( document ).ready(function($) {
16
  return c4;
17
  }
18
  };
19
- if (typeof trackcolor != 'undefined') {
20
  trackColorRight = trackcolor.toUpperCase();
21
  } else {
22
  trackColorRight = '#ebebeb';
23
  }
24
-
25
- p_image_width = $( '.review-wrap-up .rev-wu-image' ).width();
26
- if (p_image_width == 0 || p_image_width == null) { p_image_width = 50;
27
- }
28
- $( '.cwp-review-percentage' ).cwp_easyPieChart({
29
- barColor: function(percent) {
30
- return returnColor( percent );
31
- },
32
- trackColor: trackColorRight,
33
- scaleColor: false,
34
- lineCap: 'butt',
35
- rotate: 0,
36
- lineWidth: 15 * Math.min( p_image_width,150 ) / 140,
37
- animate: 1,
38
- size : Math.min( p_image_width,150 ) * 0.8,
39
- onStep: function(value) {
40
- var c = returnColor( value );
41
-
42
- this.$el.find( 'span' ).text( ~~value / 10 );
43
- this.$el.find( 'span' ).css({
44
- color: c
45
- });
46
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  });
48
  };
49
 
@@ -51,50 +62,50 @@ jQuery( document ).ready(function($) {
51
 
52
  function wuReview() {
53
 
54
- if ( ! (typeof(cwpCustomBarIcon) === "undefined") && ! (cwpCustomBarIcon === "") && isSetToPro) {
55
- $( ".rev-option" ).each(function() {
56
- var grade = $( this ).attr( "data-value" );
57
- $( this ).addClass( "customBarIcon" );
58
- var x = 10;
59
- if ($( this ).children( "ul" ).find( "li" ).length == 0) {
60
  for (var i = 0; i < x; i++) {
61
- $( this ).children( "ul" ).append( "<li><i class='fa fa-fw'>&" + cwpCustomBarIcon + "</i></li>" );
62
  }
63
  }
64
- $( this ).children( "ul" ).children( "li:nth-child(-n+" + Math.ceil( grade / 10 ) + ")" ).css( "color", returnColor( grade ) );
65
- $( this ).children( "div" ).children( "span" ).text( grade / 10 + "/10" );
66
  });
67
  } else {
68
- $( ".rev-option" ).each(function() {
69
- var grade = $( this ).attr( "data-value" );
70
- var x = 10;
71
- if ($( this ).children( "ul" ).find( "li" ).length == 0) {
72
  for (var i = 0; i < x; i++) {
73
- $( this ).children( "ul" ).append( "<li style='margin-right: 2%;'></li>" );
74
  }
75
  }
76
- $( this ).children( "ul" ).children( "li:nth-child(-n+" + Math.ceil( grade / 10 ) + ")" ).css( "background", returnColor( grade ) );
77
- $( this ).children( "div" ).children( "span" ).text( grade / 10 + "/10" );
78
- });
79
  }
80
 
81
  }
82
 
83
- $( ".comment-meta-option .comment-meta-grade" ).each(function() {
84
- var theBarWidth = (100 * parseFloat( $( this ).css( 'width' ) ) / parseFloat( $( this ).parent().css( 'width' ) ));
85
- $( this ).css( "background", returnColor( theBarWidth ) );
86
  });
87
 
88
  wuReview();
89
 
90
- $( ".wppr-comment-meta-slider" ).each(function() {
91
- var comm_meta_input = $( this ).parent( ".wppr-comment-form-meta" ).children( "input" );
92
- $( this ).slider({
93
  min: 0,
94
  max: 100,
95
  value: 4,
96
- slide: function(event, ui) {
97
- $( comm_meta_input ).val( ui.value / 10 );
98
  }
99
  });
100
  });
2
  /**
3
  * Main JavaScript File
4
  */
5
+ jQuery(document).ready(function ($) {
6
 
7
+ var initPieChart = function () {
8
+ returnColor = function (percent) {
9
  if (percent > 0 && percent <= 25) {
10
  return c1;
11
  } else if (percent > 25 && percent <= 50) {
16
  return c4;
17
  }
18
  };
19
+ if (typeof trackcolor !== 'undefined') {
20
  trackColorRight = trackcolor.toUpperCase();
21
  } else {
22
  trackColorRight = '#ebebeb';
23
  }
24
+ jQuery('.review-wu-grade, .review-grade-widget').each(function () {
25
+ var box = $(this);
26
+ var rating = box.find('.cwp-review-percentage');
27
+ var box_width = rating.attr('data-box-size');;
28
+ box_width = parseInt(box_width);
29
+ if (isNaN(box_width)) {
30
+ var p_image_width = box.closest('.review-wrap-up').find('.rev-wu-image').width();
31
+ if (p_image_width == 0 || p_image_width == null) {
32
+ p_image_width = 50;
33
+ }
34
+ box_width = p_image_width;
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
+ var line_width = 15 * Math.min(box_width, 150) / 140;
37
+ box_width = Math.min(box_width, 150) * 0.8;
38
+ rating.cwp_easyPieChart({
39
+ barColor: function (percent) {
40
+ return returnColor(percent);
41
+ },
42
+ trackColor: trackColorRight,
43
+ scaleColor: false,
44
+ lineCap: 'butt',
45
+ rotate: 0,
46
+ lineWidth: line_width,
47
+ animate: 1,
48
+ size: box_width,
49
+ onStep: function (value) {
50
+ var c = returnColor(value);
51
+
52
+ this.$el.find('span').text(~~value / 10);
53
+ this.$el.find('span').css({
54
+ color: c
55
+ });
56
+ }
57
+ });
58
  });
59
  };
60
 
62
 
63
  function wuReview() {
64
 
65
+ if (!(typeof(cwpCustomBarIcon) === "undefined") && !(cwpCustomBarIcon === "") && isSetToPro) {
66
+ $(".rev-option").each(function () {
67
+ var grade = $(this).attr("data-value");
68
+ $(this).addClass("customBarIcon");
69
+ var x = 10;
70
+ if ($(this).children("ul").find("li").length == 0) {
71
  for (var i = 0; i < x; i++) {
72
+ $(this).children("ul").append("<li><i class='fa fa-fw'>&" + cwpCustomBarIcon + "</i></li>");
73
  }
74
  }
75
+ $(this).children("ul").children("li:nth-child(-n+" + Math.ceil(grade / 10) + ")").css("color", returnColor(grade));
76
+ $(this).children("div").children("span").text(grade / 10 + "/10");
77
  });
78
  } else {
79
+ $(".rev-option").each(function () {
80
+ var grade = $(this).attr("data-value");
81
+ var x = 10;
82
+ if ($(this).children("ul").find("li").length == 0) {
83
  for (var i = 0; i < x; i++) {
84
+ $(this).children("ul").append("<li style='margin-right: 2%;'></li>");
85
  }
86
  }
87
+ $(this).children("ul").children("li:nth-child(-n+" + Math.ceil(grade / 10) + ")").css("background", returnColor(grade));
88
+ $(this).children("div").children("span").text(grade / 10 + "/10");
89
+ });
90
  }
91
 
92
  }
93
 
94
+ $(".comment-meta-option .comment-meta-grade").each(function () {
95
+ var theBarWidth = (100 * parseFloat($(this).css('width')) / parseFloat($(this).parent().css('width')));
96
+ $(this).css("background", returnColor(theBarWidth));
97
  });
98
 
99
  wuReview();
100
 
101
+ $(".wppr-comment-meta-slider").each(function () {
102
+ var comm_meta_input = $(this).parent(".wppr-comment-form-meta").children("input");
103
+ $(this).slider({
104
  min: 0,
105
  max: 100,
106
  value: 4,
107
+ slide: function (event, ui) {
108
+ $(comm_meta_input).val(ui.value / 10);
109
  }
110
  });
111
  });
assets/js/tipsy.js DELETED
@@ -1,267 +0,0 @@
1
- /* jshint ignore:start */
2
- // tipsy, facebook style tooltips for jquery
3
- // version 1.0.0a
4
- // (c) 2008-2010 jason frame [jason@onehackoranother.com]
5
- // released under the MIT license
6
- (function($) {
7
-
8
- function maybeCall(thing, ctx) {
9
- return (typeof thing == 'function') ? (thing.call( ctx )) : thing;
10
- };
11
-
12
- function isElementInDOM(ele) {
13
- while (ele = ele.parentNode) {
14
- if (ele == document) { return true;
15
- }
16
- }
17
- return false;
18
- };
19
-
20
- function Tipsy(element, options) {
21
- this.$element = $( element );
22
- this.options = options;
23
- this.enabled = true;
24
- this.fixTitle();
25
- };
26
-
27
- Tipsy.prototype = {
28
- show: function() {
29
- var title = this.getTitle();
30
- if (title && this.enabled) {
31
- var $tip = this.tip();
32
-
33
- $tip.find( '.tipsy-inner' )[this.options.html ? 'html' : 'text'](title);
34
- $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
35
- $tip.remove().css( {top: 0, left: 0, visibility: 'hidden', display: 'block'} ).prependTo( document.body );
36
-
37
- var pos = $.extend({}, this.$element.offset(), {
38
- width: this.$element[0].offsetWidth,
39
- height: this.$element[0].offsetHeight
40
- });
41
-
42
- var actualWidth = $tip[0].offsetWidth,
43
- actualHeight = $tip[0].offsetHeight,
44
- gravity = maybeCall( this.options.gravity, this.$element[0] );
45
-
46
- var tp;
47
- switch (gravity.charAt( 0 )) {
48
- case 'n':
49
- tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
50
- break;
51
- case 's':
52
- tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
53
- break;
54
- case 'e':
55
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
56
- break;
57
- case 'w':
58
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
59
- break;
60
- }
61
-
62
- if (gravity.length == 2) {
63
- if (gravity.charAt( 1 ) == 'w') {
64
- tp.left = pos.left + pos.width / 2 - 15;
65
- } else {
66
- tp.left = pos.left + pos.width / 2 - actualWidth + 15;
67
- }
68
- }
69
-
70
- $tip.css( tp ).addClass( 'tipsy-' + gravity );
71
- $tip.find( '.tipsy-arrow' )[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt( 0 );
72
- if (this.options.className) {
73
- $tip.addClass( maybeCall( this.options.className, this.$element[0] ) );
74
- }
75
-
76
- if (this.options.fade) {
77
- $tip.stop().css( {opacity: 0, display: 'block', visibility: 'visible'} ).animate( {opacity: this.options.opacity} );
78
- } else {
79
- $tip.css( {visibility: 'visible', opacity: this.options.opacity} );
80
- }
81
- }// End if().
82
- },
83
-
84
- hide: function() {
85
- if (this.options.fade) {
86
- this.tip().stop().fadeOut( function() { $( this ).remove(); } );
87
- } else {
88
- this.tip().remove();
89
- }
90
- },
91
-
92
- fixTitle: function() {
93
- var $e = this.$element;
94
- if ($e.attr( 'title' ) || typeof($e.attr( 'original-title' )) != 'string') {
95
- $e.attr( 'original-title', $e.attr( 'title' ) || '' ).removeAttr( 'title' );
96
- }
97
- },
98
-
99
- getTitle: function() {
100
- var title, $e = this.$element, o = this.options;
101
- this.fixTitle();
102
- var title, o = this.options;
103
- if (typeof o.title == 'string') {
104
- title = $e.attr( o.title == 'title' ? 'original-title' : o.title );
105
- } else if (typeof o.title == 'function') {
106
- title = o.title.call( $e[0] );
107
- }
108
- title = ('' + title).replace( /(^\s*|\s*$)/, "" );
109
- return title || o.fallback;
110
- },
111
-
112
- tip: function() {
113
- if ( ! this.$tip) {
114
- this.$tip = $( '<div class="tipsy"></div>' ).html( '<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>' );
115
- this.$tip.data( 'tipsy-pointee', this.$element[0] );
116
- }
117
- return this.$tip;
118
- },
119
-
120
- validate: function() {
121
- if ( ! this.$element[0].parentNode) {
122
- this.hide();
123
- this.$element = null;
124
- this.options = null;
125
- }
126
- },
127
-
128
- enable: function() { this.enabled = true; },
129
- disable: function() { this.enabled = false; },
130
- toggleEnabled: function() { this.enabled = ! this.enabled; }
131
- };
132
-
133
- $.fn.tipsy = function(options) {
134
-
135
- if (options === true) {
136
- return this.data( 'tipsy' );
137
- } else if (typeof options == 'string') {
138
- var tipsy = this.data( 'tipsy' );
139
- if (tipsy) { tipsy[options]();
140
- }
141
- return this;
142
- }
143
-
144
- options = $.extend( {}, $.fn.tipsy.defaults, options );
145
-
146
- function get(ele) {
147
- var tipsy = $.data( ele, 'tipsy' );
148
- if ( ! tipsy) {
149
- tipsy = new Tipsy( ele, $.fn.tipsy.elementOptions( ele, options ) );
150
- $.data( ele, 'tipsy', tipsy );
151
- }
152
- return tipsy;
153
- }
154
-
155
- function enter() {
156
- var tipsy = get( this );
157
- tipsy.hoverState = 'in';
158
- if (options.delayIn == 0) {
159
- tipsy.show();
160
- } else {
161
- tipsy.fixTitle();
162
- setTimeout( function() { if (tipsy.hoverState == 'in') { tipsy.show();
163
- } }, options.delayIn );
164
- }
165
- };
166
-
167
- function leave() {
168
- var tipsy = get( this );
169
- tipsy.hoverState = 'out';
170
- if (options.delayOut == 0) {
171
- tipsy.hide();
172
- } else {
173
- setTimeout( function() { if (tipsy.hoverState == 'out') { tipsy.hide();
174
- } }, options.delayOut );
175
- }
176
- };
177
-
178
- if ( ! options.live) { this.each( function() { get( this ); } );
179
- }
180
-
181
- if (options.trigger != 'manual') {
182
- var binder = options.live ? 'live' : 'bind',
183
- eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
184
- eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
185
- this[binder](eventIn, enter)[binder](eventOut, leave);
186
- }
187
-
188
- return this;
189
-
190
- };
191
-
192
- $.fn.tipsy.defaults = {
193
- className: null,
194
- delayIn: 0,
195
- delayOut: 0,
196
- fade: false,
197
- fallback: '',
198
- gravity: 'n',
199
- html: false,
200
- live: false,
201
- offset: 0,
202
- opacity: 0.8,
203
- title: 'title',
204
- trigger: 'hover'
205
- };
206
-
207
- $.fn.tipsy.revalidate = function() {
208
- $( '.tipsy' ).each(function() {
209
- var pointee = $.data( this, 'tipsy-pointee' );
210
- if ( ! pointee || ! isElementInDOM( pointee )) {
211
- $( this ).remove();
212
- }
213
- });
214
- };
215
-
216
- // Overwrite this method to provide options on a per-element basis.
217
- // For example, you could store the gravity in a 'tipsy-gravity' attribute:
218
- // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
219
- // (remember - do not modify 'options' in place!)
220
- $.fn.tipsy.elementOptions = function(ele, options) {
221
- return $.metadata ? $.extend( {}, options, $( ele ).metadata() ) : options;
222
- };
223
-
224
- $.fn.tipsy.autoNS = function() {
225
- return $( this ).offset().top > ($( document ).scrollTop() + $( window ).height() / 2) ? 's' : 'n';
226
- };
227
-
228
- $.fn.tipsy.autoWE = function() {
229
- return $( this ).offset().left > ($( document ).scrollLeft() + $( window ).width() / 2) ? 'e' : 'w';
230
- };
231
-
232
- /**
233
- * yields a closure of the supplied parameters, producing a function that takes
234
- * no arguments and is suitable for use as an autogravity function like so:
235
- *
236
- * @param margin (int) - distance from the viewable region edge that an
237
- * element should be before setting its tooltip's gravity to be away
238
- * from that edge.
239
- * @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
240
- * if there are no viewable region edges effecting the tooltip's
241
- * gravity. It will try to vary from this minimally, for example,
242
- * if 'sw' is preferred and an element is near the right viewable
243
- * region edge, but not the top edge, it will set the gravity for
244
- * that element's tooltip to be 'se', preserving the southern
245
- * component.
246
- */
247
- $.fn.tipsy.autoBounds = function(margin, prefer) {
248
- return function() {
249
- var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
250
- boundTop = $( document ).scrollTop() + margin,
251
- boundLeft = $( document ).scrollLeft() + margin,
252
- $this = $( this );
253
-
254
- if ($this.offset().top < boundTop) { dir.ns = 'n';
255
- }
256
- if ($this.offset().left < boundLeft) { dir.ew = 'w';
257
- }
258
- if ($( window ).width() + $( document ).scrollLeft() - $this.offset().left < margin) { dir.ew = 'e';
259
- }
260
- if ($( window ).height() + $( document ).scrollTop() - $this.offset().top < margin) { dir.ns = 's';
261
- }
262
-
263
- return dir.ns + (dir.ew ? dir.ew : '');
264
- }
265
- };
266
-
267
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/widget-admin.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* jshint ignore:start */
2
+ (function ($, w) {
3
+ $(document).ready(function () {
4
+ var widget_selector = $('.widget');
5
+ if (widget_selector.length > 0) {
6
+ widget_selector.each(function () {
7
+ var id = $(this).attr("id")
8
+ for(name in wppr_widget.names){
9
+ if (id.indexOf(wppr_widget.names[name]) !== -1) {
10
+ toggleCustomFields(true, id);
11
+ }
12
+ }
13
+
14
+ });
15
+ } else {
16
+ toggleCustomFields(true, "wpcontent");
17
+ }
18
+ });
19
+
20
+ function toggleCustomFields(deflt, widgetID) {
21
+ var val = getWidgetStyle(widgetID);
22
+ if (val === "default.php") {
23
+ $("#" + widgetID).find(".wppr-customField").hide();
24
+ } else {
25
+ $("#" + widgetID).find(".wppr-customField").show();
26
+ }
27
+
28
+ addListeners(widgetID);
29
+ }
30
+
31
+ $(document).on('widget-updated widget-added', function (e, w) {
32
+ toggleCustomFields(true, w[0]["id"]);
33
+ });
34
+
35
+ function addListeners(widgetID) {
36
+ var widget = $("#" + widgetID);
37
+ widget.find("input.wppr-stylestyle").on("click", function (e) {
38
+ toggleCustomFields(false, widgetID);
39
+ });
40
+ widget.find("label.wppr-stylestyle").hover(function (e) {
41
+ var img = $("#" + $(this).attr("for") + "img");
42
+ img.show();
43
+ img.css('position', 'absolute');
44
+ img.css('width', '100%');
45
+ }, function (e) {
46
+ $("#" + $(this).attr("for") + "img").hide();
47
+ });
48
+ }
49
+
50
+ function getWidgetStyle(id) {
51
+ var name = $("#" + id).find("input:radio.wppr-stylestyle").attr("name");
52
+ return $("input:radio[name='" + name + "']:checked").val();
53
+ }
54
+
55
+ })(jQuery, wppr_widget);
assets/js/widget-latest.js DELETED
@@ -1,51 +0,0 @@
1
- /* jshint ignore:start */
2
- (function($, w){
3
-
4
- $( document ).ready(function(){
5
- if ($( ".widget" ).length > 0) {
6
- $( ".widget" ).each(function(){
7
- if ($( this ).attr( "id" ).indexOf( w.widgetName.toLowerCase() ) != -1) {
8
- toggleCustomFields( true, $( this ).attr( "id" ) );
9
- }
10
- });
11
- } else {
12
- toggleCustomFields( true, "wpcontent" );
13
- }
14
- });
15
-
16
- function toggleCustomFields(deflt, widgetID){
17
- var val = getWidgetStyle( widgetID );
18
- if (val == "default.php") {
19
- $( "#" + widgetID ).find( ".wppr-customField" ).hide();
20
- } else {
21
- $( "#" + widgetID ).find( ".wppr-customField" ).show();
22
- if ( ! deflt) { $( "#" + widgetID ).find( "#" + w.imageCheckbox ).prop( "checked", true );
23
- }
24
- }
25
-
26
- addListeners( widgetID );
27
- }
28
-
29
- $( document ).on('widget-updated widget-added', function(e, w){
30
- toggleCustomFields( true, w[0]["id"] );
31
- });
32
-
33
- function addListeners(widgetID){
34
- $( "#" + widgetID ).find( "input.wppr-stylestyle" ).on("click", function(e){
35
- toggleCustomFields( false, widgetID );
36
- });
37
- $( "#" + widgetID ).find( "label.wppr-stylestyle" ).hover(function(e){
38
- $( "#" + $( this ).attr( "for" ) + "img" ).show();
39
- $( "#" + $( this ).attr( "for" ) + "img" ).css('position','absolute');
40
- $( "#" + $( this ).attr( "for" ) + "img" ).css('width','100%');
41
- }, function(e){
42
- $( "#" + $( this ).attr( "for" ) + "img" ).hide();
43
- });
44
- }
45
-
46
- function getWidgetStyle(id){
47
- var name = $( "#" + id ).find( "input:radio.wppr-stylestyle" ).attr( "name" );
48
- return $( "input:radio[name='" + name + "']:checked" ).val();
49
- }
50
-
51
- })(jQuery, wppr_widget_localized_data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/widget-top.js DELETED
@@ -1,51 +0,0 @@
1
- /* jshint ignore:start */
2
- (function($, w){
3
-
4
- $( document ).ready(function(){
5
- if ($( ".widget" ).length > 0) {
6
- $( ".widget" ).each(function(){
7
- if ($( this ).attr( "id" ).indexOf( w.widgetName.toLowerCase() ) != -1) {
8
- toggleCustomFields( true, $( this ).attr( "id" ) );
9
- }
10
- });
11
- } else {
12
- toggleCustomFields( true, "wpcontent" );
13
- }
14
- });
15
-
16
- function toggleCustomFields(deflt, widgetID){
17
- var val = getWidgetStyle( widgetID );
18
- if (val == "default.php") {
19
- $( "#" + widgetID ).find( ".wppr-customField" ).hide();
20
- } else {
21
- $( "#" + widgetID ).find( ".wppr-customField" ).show();
22
- if ( ! deflt) { $( "#" + widgetID ).find( "#" + w.imageCheckbox ).prop( "checked", true );
23
- }
24
- }
25
-
26
- addListeners( widgetID );
27
- }
28
-
29
- $( document ).on('widget-updated widget-added', function(e, w){
30
- toggleCustomFields( true, w[0]["id"] );
31
- });
32
-
33
- function addListeners(widgetID){
34
- $( "#" + widgetID ).find( "input.wppr-stylestyle" ).on("click", function(e){
35
- toggleCustomFields( false, widgetID );
36
- });
37
- $( "#" + widgetID ).find( "label.wppr-stylestyle" ).hover(function(e){
38
- $( "#" + $( this ).attr( "for" ) + "img" ).show();
39
- $( "#" + $( this ).attr( "for" ) + "img" ).css('position','absolute');
40
- $( "#" + $( this ).attr( "for" ) + "img" ).css('width','100%');
41
- }, function(e){
42
- $( "#" + $( this ).attr( "for" ) + "img" ).hide();
43
- });
44
- }
45
-
46
- function getWidgetStyle(id){
47
- var name = $( "#" + id ).find( "input:radio.wppr-stylestyle" ).attr( "name" );
48
- return $( "input:radio[name='" + name + "']:checked" ).val();
49
- }
50
-
51
- })(jQuery, wppr_widget_localized_data);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/class-wppr-admin.php CHANGED
@@ -109,7 +109,6 @@ class WPPR_Admin {
109
  */
110
 
111
  if ( $hook == 'toplevel_page_wppr' ) {
112
- wp_enqueue_script( $this->plugin_name . '-tiplsy-js', WPPR_URL . '/assets/js/tipsy.js', array( 'jquery' ), $this->version );
113
  wp_enqueue_script(
114
  $this->plugin_name . '-admin-js', WPPR_URL . '/assets/js/admin.js',
115
  array(
109
  */
110
 
111
  if ( $hook == 'toplevel_page_wppr' ) {
 
112
  wp_enqueue_script(
113
  $this->plugin_name . '-admin-js', WPPR_URL . '/assets/js/admin.js',
114
  array(
includes/admin/class-wppr-editor.php CHANGED
@@ -19,7 +19,7 @@ class WPPR_Editor {
19
  *
20
  * @since 3.0.0
21
  * @access private
22
- * @var string $plugin_name The ID of this plugin.
23
  */
24
  private $plugin_name;
25
 
@@ -28,7 +28,7 @@ class WPPR_Editor {
28
  *
29
  * @since 3.0.0
30
  * @access private
31
- * @var string $version The current version of this plugin.
32
  */
33
  private $version;
34
 
@@ -36,13 +36,14 @@ class WPPR_Editor {
36
  * Initialize the class and set its properties.
37
  *
38
  * @since 3.0.0
39
- * @param string $plugin_name The name of this plugin.
40
- * @param string $version The version of this plugin.
 
41
  */
42
  public function __construct( $plugin_name, $version ) {
43
 
44
  $this->plugin_name = $plugin_name;
45
- $this->version = $version;
46
 
47
  }
48
 
@@ -66,7 +67,8 @@ class WPPR_Editor {
66
  *
67
  * @since 3.0.0
68
  * @access public
69
- * @param WP_Post $post The post object.
 
70
  */
71
  public function render_metabox( $post ) {
72
  $editor = $this->get_editor_name( $post );
@@ -80,7 +82,9 @@ class WPPR_Editor {
80
  *
81
  * @since 3.0.0
82
  * @access public
83
- * @param WP_Post $post The post object.
 
 
84
  * @return WPPR_Editor_Abstract
85
  */
86
  private function get_editor_name( $post ) {
@@ -99,7 +103,8 @@ class WPPR_Editor {
99
  *
100
  * @since 3.0.0
101
  * @access public
102
- * @param WP_Post $post The post object.
 
103
  */
104
  public function load_assets( $post ) {
105
  global $post;
@@ -110,7 +115,10 @@ class WPPR_Editor {
110
  if ( isset( $assets['js'] ) ) {
111
  foreach ( $assets['js'] as $handle => $data ) {
112
  if ( isset( $data['path'] ) ) {
113
- wp_enqueue_script( 'wppr-' . $handle . '-css', $data['path'], $data['required'], $this->version, true );
 
 
 
114
  }
115
  }
116
  }
@@ -131,7 +139,8 @@ class WPPR_Editor {
131
  *
132
  * @since 3.0.0
133
  * @access public
134
- * @param int $post_id The post ID.
 
135
  */
136
  public function editor_save( $post_id ) {
137
  $editor = $this->get_editor_name( get_post( $post_id ) );
19
  *
20
  * @since 3.0.0
21
  * @access private
22
+ * @var string $plugin_name The ID of this plugin.
23
  */
24
  private $plugin_name;
25
 
28
  *
29
  * @since 3.0.0
30
  * @access private
31
+ * @var string $version The current version of this plugin.
32
  */
33
  private $version;
34
 
36
  * Initialize the class and set its properties.
37
  *
38
  * @since 3.0.0
39
+ *
40
+ * @param string $plugin_name The name of this plugin.
41
+ * @param string $version The version of this plugin.
42
  */
43
  public function __construct( $plugin_name, $version ) {
44
 
45
  $this->plugin_name = $plugin_name;
46
+ $this->version = $version;
47
 
48
  }
49
 
67
  *
68
  * @since 3.0.0
69
  * @access public
70
+ *
71
+ * @param WP_Post $post The post object.
72
  */
73
  public function render_metabox( $post ) {
74
  $editor = $this->get_editor_name( $post );
82
  *
83
  * @since 3.0.0
84
  * @access public
85
+ *
86
+ * @param WP_Post $post The post object.
87
+ *
88
  * @return WPPR_Editor_Abstract
89
  */
90
  private function get_editor_name( $post ) {
103
  *
104
  * @since 3.0.0
105
  * @access public
106
+ *
107
+ * @param WP_Post $post The post object.
108
  */
109
  public function load_assets( $post ) {
110
  global $post;
115
  if ( isset( $assets['js'] ) ) {
116
  foreach ( $assets['js'] as $handle => $data ) {
117
  if ( isset( $data['path'] ) ) {
118
+ wp_enqueue_script( 'wppr-' . $handle . '-js', $data['path'], $data['required'], $this->version, true );
119
+ }
120
+ if ( isset( $data['vars'] ) ) {
121
+ wp_localize_script( 'wppr-' . $handle . '-js', $handle . '_vars', $data['vars'] );
122
  }
123
  }
124
  }
139
  *
140
  * @since 3.0.0
141
  * @access public
142
+ *
143
+ * @param int $post_id The post ID.
144
  */
145
  public function editor_save( $post_id ) {
146
  $editor = $this->get_editor_name( get_post( $post_id ) );
includes/admin/class-wppr-global-settings.php CHANGED
@@ -70,7 +70,7 @@ class WPPR_Global_Settings {
70
  'cwppos_show_reviewbox' => array(
71
  'id' => 'review_position',
72
  'name' => __( 'Position of the review box', 'wp-product-review' ),
73
- 'description' => __( 'You can choose manually and use : <?php echo cwppos_show_review(\'postid\'); ?> or you can get the Product in post add-on and use :[P_REVIEW post_id=3067 visual=\'full\']', 'wp-product-review' ),
74
  'type' => 'select',
75
  'options' => array(
76
  'yes' => __( 'After content', 'wp-product-review' ),
70
  'cwppos_show_reviewbox' => array(
71
  'id' => 'review_position',
72
  'name' => __( 'Position of the review box', 'wp-product-review' ),
73
+ 'description' => __( 'You display the review using the shortcode available in the pro version <code> [P_REVIEW post_id=3067 visual=\'full\']</code>', 'wp-product-review' ),
74
  'type' => 'select',
75
  'options' => array(
76
  'yes' => __( 'After content', 'wp-product-review' ),
includes/admin/models/class-wppr-editor-model.php CHANGED
@@ -259,9 +259,13 @@ class WPPR_Editor_Model extends WPPR_Model_Abstract {
259
  ),
260
  ),
261
  'js' => array(
262
- 'default-editor' => array(
263
  'path' => WPPR_URL . '/assets/js/admin-review.js',
264
  'required' => array( 'jquery' ),
 
 
 
 
265
  ),
266
  ),
267
  );
259
  ),
260
  ),
261
  'js' => array(
262
+ 'editor' => array(
263
  'path' => WPPR_URL . '/assets/js/admin-review.js',
264
  'required' => array( 'jquery' ),
265
+ 'vars' => array(
266
+ 'image_title' => __( 'Add a product image to the review', 'wp-product-review' ),
267
+ 'image_button' => __( 'Attach the image', 'wp-product-review' ),
268
+ ),
269
  ),
270
  ),
271
  );
includes/admin/models/class-wppr-query-model.php CHANGED
@@ -53,20 +53,23 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
53
  }
54
 
55
  /**
56
- * Utility method to return a product by ID.
57
  *
58
  * @since 2.0.0
59
  * @access public
60
  *
61
- * @param int $post_id The post ID.
 
 
 
62
  *
63
  * @return array
64
  */
65
- public function find_by_id( $post_id ) {
66
  return $this->find(
67
  array(
68
- 'post_id' => $post_id,
69
- )
70
  );
71
  }
72
 
@@ -85,9 +88,9 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
85
  */
86
  public function find(
87
  $post = array(
88
- 'post_id' => false,
89
  'category_id' => false,
90
  'category_name' => false,
 
91
  ),
92
  $limit = 20,
93
  $filter = array(
@@ -98,84 +101,56 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
98
  $order = array(
99
  'rating' => false,
100
  'price' => false,
 
101
  )
102
  ) {
103
-
104
  if ( ! is_numeric( $limit ) && $limit >= 0 ) {
105
  $limit = 20;
106
  }
107
-
 
 
108
  $sub_query_posts = $this->get_sub_query_posts( $post );
109
 
110
- $order_by = $this->get_order_by( $order );
111
-
112
- $conditions = $this->get_query_conditions( $filter );
113
-
114
- $query = "
115
- SELECT * FROM (
116
- SELECT
117
- `post_id` AS 'ID',
118
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_meta_box_check', `meta_value`, '' ) SEPARATOR '' ) AS 'cwp_meta_box_check',
119
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_rev_product_name', `meta_value`, '' ) SEPARATOR '' ) AS 'cwp_rev_product_name',
120
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_image_link', `meta_value`, '' ) SEPARATOR '' ) AS 'cwp_image_link',
121
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_rev_product_image', `meta_value`, '' ) SEPARATOR '' ) AS 'cwp_rev_product_image',
122
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_rev_price', FORMAT( `meta_value`, 2 ), '' ) SEPARATOR '' ) AS 'cwp_rev_price',
123
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'wppr_rating', `meta_value`, '' ) SEPARATOR '' ) AS 'wppr_rating',
124
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'wppr_pros', `meta_value`, '' ) SEPARATOR '' ) AS 'wppr_pros',
125
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'wppr_cons', `meta_value`, '' ) SEPARATOR '' ) AS 'wppr_cons',
126
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'wppr_options', `meta_value`, '' ) SEPARATOR '' ) AS 'wppr_options',
127
- GROUP_CONCAT( DISTINCT IF( `meta_key` = 'wppr_links', `meta_value`, '' ) SEPARATOR '' ) AS 'wppr_links'
128
- FROM {$this->db->postmeta}
129
- {$sub_query_posts}
130
- GROUP BY `ID`
131
- ) `pivoted_meta`
132
- WHERE `cwp_meta_box_check` = 'Yes'
133
- {$conditions}
 
 
134
  ORDER BY
135
  {$order_by}
136
- `cwp_rev_product_name` ASC
137
  LIMIT {$limit}
138
  ";
139
- $key = hash( 'sha256', $query );
140
- $processed_res = wp_cache_get( $key, 'wppr' );
141
- if ( ! is_array( $processed_res ) ) {
142
  $results = $this->db->get_results( $query, ARRAY_A );
143
-
144
- $processed_res = array();
145
- foreach ( $results as $row ) {
146
-
147
- $row['wppr_pros'] = maybe_unserialize( $row['wppr_pros'] );
148
- $row['wppr_cons'] = maybe_unserialize( $row['wppr_cons'] );
149
- $row['wppr_options'] = maybe_unserialize( $row['wppr_options'] );
150
- $row['wppr_links'] = maybe_unserialize( $row['wppr_links'] );
151
-
152
- if ( empty( $row['wppr_options'] ) || $row['wppr_options'] == '' ) {
153
- $this->review = new WPPR_Review_Model( $row['ID'] );
154
- $row['wppr_options'] = $this->review->get_options();
155
- }
156
-
157
- if ( empty( $row['wppr_pros'] ) || $row['wppr_pros'] == '' ) {
158
- $this->review = new WPPR_Review_Model( $row['ID'] );
159
- $row['wppr_pros'] = $this->review->get_pros();
160
- }
161
-
162
- if ( empty( $row['wppr_cons'] ) || $row['wppr_cons'] == '' ) {
163
- $this->review = new WPPR_Review_Model( $row['ID'] );
164
- $row['wppr_cons'] = $this->review->get_cons();
165
- }
166
-
167
- if ( empty( $row['wppr_links'] ) || $row['wppr_links'] == '' ) {
168
- $this->review = new WPPR_Review_Model( $row['ID'] );
169
- $row['wppr_links'] = $this->review->get_links();
170
- }
171
-
172
- $processed_res[] = $row;
173
- }
174
-
175
- wp_cache_set( $key, $processed_res, 'wppr', ( 60 * 60 ) );
176
  }// End if().
177
 
178
- return $processed_res;
179
  }
180
 
181
  /**
@@ -189,55 +164,16 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
189
  * @return string
190
  */
191
  private function get_sub_query_posts( $post ) {
192
- $sub_query_conditions = $this->get_sub_query_conditions( $post );
193
- $sub_selection_query = '';
194
- if ( ! empty( $sub_query_conditions ) ) {
195
- $sub_selection_query = "INNER JOIN {$this->db->term_relationships } wtr ON wtr.object_id = p.ID
 
196
  INNER JOIN {$this->db->term_taxonomy} wtt on wtt.term_taxonomy_id = wtr.term_taxonomy_id
197
  INNER JOIN {$this->db->terms} wt
198
  ON wt.term_id = wtt.term_id";
199
- }
200
- $sub_query_posts = "
201
- WHERE
202
- `post_id` IN (
203
- SELECT `ID`
204
- FROM {$this->db->posts} p
205
- {$sub_selection_query}
206
- WHERE
207
- ( p.post_type = 'post' or
208
- p.post_type = 'page' ) AND p.post_status = 'publish'
209
- {$sub_query_conditions}
210
- )
211
- ";
212
 
213
- return $sub_query_posts;
214
- }
215
-
216
- /**
217
- * Build the sub query conditions.
218
- *
219
- * @since 2.0.0
220
- * @access private
221
- *
222
- * @param array|false $post The post data to filter by.
223
- *
224
- * @return string
225
- */
226
- private function get_sub_query_conditions( $post ) {
227
- $sub_query_conditions = '';
228
- if ( isset( $post['post_id'] ) && $post['post_id'] != false && is_numeric( $post['post_id'] ) && $post['post_id'] > 0 ) {
229
- $sub_query_conditions .= $this->db->prepare( " AND p.ID = '%d' ", $post['post_id'] );
230
- }
231
-
232
- if ( isset( $post['category_id'] ) && $post['category_id'] != false && is_numeric( $post['category_id'] ) && $post['category_id'] > 0 ) {
233
- $sub_query_conditions .= $this->db->prepare( " AND wt.term_id = '%d' ", $post['category_id'] );
234
- }
235
-
236
- if ( isset( $post['category_name'] ) && $post['category_name'] != false ) {
237
- $sub_query_conditions .= $this->db->prepare( ' AND wt.slug = %s ', $post['category_name'] );
238
- }
239
-
240
- return $sub_query_conditions;
241
  }
242
 
243
  /**
@@ -253,14 +189,14 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
253
  private function get_order_by( $order ) {
254
  $order_by = '';
255
  if ( isset( $order['rating'] ) && in_array( $order['rating'], array( 'ASC', 'DESC' ) ) ) {
256
- $order_by .= "`wppr_rating` {$order['rating']}, ";
257
  }
258
 
259
  if ( isset( $order['price'] ) && in_array( $order['price'], array( 'ASC', 'DESC' ) ) ) {
260
- $order_by .= "`cwp_rev_price` {$order['price']}, ";
261
  }
262
  if ( isset( $order['date'] ) && in_array( $order['date'], array( 'ASC', 'DESC' ) ) ) {
263
- $order_by .= "`ID` {$order['date']}, ";
264
  }
265
 
266
  return $order_by;
@@ -272,46 +208,58 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
272
  * @since 2.0.0
273
  * @access private
274
  *
275
- * @param array|false $filter The fields to filter data by.
 
276
  *
277
- * @return string
278
  */
279
- private function get_query_conditions( $filter ) {
280
- $conditions = '';
 
281
  if ( isset( $filter['name'] ) && $filter['name'] != false ) {
282
- $conditions .= $this->db->prepare( " AND `cwp_rev_product_name` LIKE '%%%s%%' ", $filter['name'] );
283
  }
284
 
 
285
  if ( isset( $filter['price'] ) && $filter['price'] != false && is_numeric( $filter['price'] ) ) {
286
- $conditions .= $this->db->prepare( " AND `cwp_rev_price` = FORMAT( '%d', 2 ) ", $filter['price'] );
287
  }
288
-
289
  if ( isset( $filter['rating'] ) && $filter['rating'] != false && is_numeric( $filter['rating'] ) ) {
290
- $conditions .= $this->db->prepare( " AND `wppr_rating` = FORMAT( '%d', 2 ) ", $filter['rating'] );
291
  }
292
 
293
  return $conditions;
294
  }
295
 
296
  /**
297
- * Utility method to return products by category ID.
298
  *
299
  * @since 2.0.0
300
- * @access public
301
  *
302
- * @param int $cat_id The category ID.
303
- * @param int $limit Optional. The results limit.
304
- * @param array|false $filter Optional. The filter array.
305
- * @param array|false $order Optional. The order array.
306
  *
307
- * @return array
308
  */
309
- public function find_by_cat_id( $cat_id, $limit = 20, $filter = array(), $order = array() ) {
310
- return $this->find(
311
- array(
312
- 'category_id' => $cat_id,
313
- ), $limit, $filter, $order
314
- );
 
 
 
 
 
 
 
 
 
 
 
 
315
  }
316
 
317
  /**
53
  }
54
 
55
  /**
56
+ * Utility method to return products by category ID.
57
  *
58
  * @since 2.0.0
59
  * @access public
60
  *
61
+ * @param int $cat_id The category ID.
62
+ * @param int $limit Optional. The results limit.
63
+ * @param array|false $filter Optional. The filter array.
64
+ * @param array|false $order Optional. The order array.
65
  *
66
  * @return array
67
  */
68
+ public function find_by_cat_id( $cat_id, $limit = 20, $filter = array(), $order = array() ) {
69
  return $this->find(
70
  array(
71
+ 'category_id' => $cat_id,
72
+ ), $limit, $filter, $order
73
  );
74
  }
75
 
88
  */
89
  public function find(
90
  $post = array(
 
91
  'category_id' => false,
92
  'category_name' => false,
93
+ 'post_type' => array( 'post', 'page' ),
94
  ),
95
  $limit = 20,
96
  $filter = array(
101
  $order = array(
102
  'rating' => false,
103
  'price' => false,
104
+ 'date' => false,
105
  )
106
  ) {
 
107
  if ( ! is_numeric( $limit ) && $limit >= 0 ) {
108
  $limit = 20;
109
  }
110
+ if ( ! isset( $post['post_type'] ) ) {
111
+ $post['post_type'] = array( 'post', 'page' );
112
+ }
113
  $sub_query_posts = $this->get_sub_query_posts( $post );
114
 
115
+ $order_by = $this->get_order_by( $order );
116
+ $conditions = $this->get_query_conditions( $post, $filter );
117
+ $conditions_where = '';
118
+ if ( isset( $conditions['where'] ) ) {
119
+ $conditions_where = $conditions['where'];
120
+ }
121
+ $conditions_having = '';
122
+ if ( isset( $conditions['having'] ) ) {
123
+ $conditions_having = $conditions['having'];
124
+ }
125
+ $query = "
126
+ SELECT
127
+ ID,
128
+ post_date,
129
+ GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_meta_box_check', `meta_value`, '' ) SEPARATOR '' ) AS 'check',
130
+ GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_rev_product_name', `meta_value`, '' ) SEPARATOR '' ) AS 'name',
131
+ GROUP_CONCAT( DISTINCT IF( `meta_key` = 'cwp_rev_price', FORMAT( `meta_value`, 2 ), '' ) SEPARATOR '' ) AS 'price',
132
+ GROUP_CONCAT( DISTINCT IF( `meta_key` = 'wppr_rating', FORMAT( `meta_value`, 2 ), '' ) SEPARATOR '' ) AS 'rating'
133
+ FROM {$this->db->postmeta} m INNER JOIN {$this->db->posts} p on p.ID = m.post_ID
134
+
135
+ {$sub_query_posts}
136
+ where p.post_status = 'publish'
137
+ {$conditions_where}
138
+ GROUP BY `ID`
139
+ HAVING `check` = 'Yes'
140
+ {$conditions_having}
141
  ORDER BY
142
  {$order_by}
143
+ `name` ASC
144
  LIMIT {$limit}
145
  ";
146
+ $key = hash( 'sha256', $query );
147
+ $results = wp_cache_get( $key, 'wppr' );
148
+ if ( ! is_array( $results ) ) {
149
  $results = $this->db->get_results( $query, ARRAY_A );
150
+ wp_cache_set( $key, $results, 'wppr', ( 60 * 60 ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  }// End if().
152
 
153
+ return $results;
154
  }
155
 
156
  /**
164
  * @return string
165
  */
166
  private function get_sub_query_posts( $post ) {
167
+ // TODO Build validation methods for category name and id and reuse them here and in get_sub_query_conditions method.
168
+ if ( ! isset( $post['category_name'] ) && ! isset( $post['category_id'] ) ) {
169
+ return '';
170
+ }
171
+ $sub_selection_query = "INNER JOIN {$this->db->term_relationships } wtr ON wtr.object_id = p.ID
172
  INNER JOIN {$this->db->term_taxonomy} wtt on wtt.term_taxonomy_id = wtr.term_taxonomy_id
173
  INNER JOIN {$this->db->terms} wt
174
  ON wt.term_id = wtt.term_id";
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
176
+ return $sub_selection_query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  }
178
 
179
  /**
189
  private function get_order_by( $order ) {
190
  $order_by = '';
191
  if ( isset( $order['rating'] ) && in_array( $order['rating'], array( 'ASC', 'DESC' ) ) ) {
192
+ $order_by .= "`rating` {$order['rating']}, ";
193
  }
194
 
195
  if ( isset( $order['price'] ) && in_array( $order['price'], array( 'ASC', 'DESC' ) ) ) {
196
+ $order_by .= "`price` {$order['price']}, ";
197
  }
198
  if ( isset( $order['date'] ) && in_array( $order['date'], array( 'ASC', 'DESC' ) ) ) {
199
+ $order_by .= "`post_date` {$order['date']}, ";
200
  }
201
 
202
  return $order_by;
208
  * @since 2.0.0
209
  * @access private
210
  *
211
+ * @param array|false $post The fields to filter data by.
212
+ * @param array|false $filter The post details to filter data by.
213
  *
214
+ * @return array
215
  */
216
+ private function get_query_conditions( $post, $filter ) {
217
+ $conditions = array( 'where' => '', 'having' => '' );
218
+ $conditions['where'] = $this->get_sub_query_conditions( $post );
219
  if ( isset( $filter['name'] ) && $filter['name'] != false ) {
220
+ $conditions['having'] .= $this->db->prepare( ' AND `name` LIKE %s ', '%' . $filter['name'] . '%' );
221
  }
222
 
223
+ // TODO comparision arguments for price filter.
224
  if ( isset( $filter['price'] ) && $filter['price'] != false && is_numeric( $filter['price'] ) ) {
225
+ $conditions['having'] .= $this->db->prepare( ' AND `price` > FORMAT( %d, 2 ) ', $filter['price'] );
226
  }
227
+ // TODO comparision arguments for rating filter.
228
  if ( isset( $filter['rating'] ) && $filter['rating'] != false && is_numeric( $filter['rating'] ) ) {
229
+ $conditions['having'] .= $this->db->prepare( ' AND `rating` > %f ', $filter['rating'] );
230
  }
231
 
232
  return $conditions;
233
  }
234
 
235
  /**
236
+ * Build the sub query conditions.
237
  *
238
  * @since 2.0.0
239
+ * @access private
240
  *
241
+ * @param array|false $post The post data to filter by.
 
 
 
242
  *
243
+ * @return string
244
  */
245
+ private function get_sub_query_conditions( $post ) {
246
+ $sub_query_conditions = '';
247
+ if ( isset( $post['category_id'] ) && $post['category_id'] != false && is_numeric( $post['category_id'] ) && $post['category_id'] > 0 ) {
248
+ $sub_query_conditions .= $this->db->prepare( " AND wt.term_id = '%d' ", $post['category_id'] );
249
+ }
250
+
251
+ if ( isset( $post['category_name'] ) && $post['category_name'] != false ) {
252
+ $sub_query_conditions .= $this->db->prepare( ' AND wt.slug = %s ', $post['category_name'] );
253
+ }
254
+ // TODO Check against available post_types.
255
+ if ( isset( $post['post_type'] ) && is_array( $post['post_type'] ) ) {
256
+ $filter_post_type = array_fill( 0, count( $post['post_type'] ), ' p.post_type = %s ' );
257
+ $filter_post_type = implode( ' OR ', $filter_post_type );
258
+ $filter_post_type = ' AND ( ' . $filter_post_type . ' ) ';
259
+ $sub_query_conditions .= $this->db->prepare( $filter_post_type, $post['post_type'] );
260
+ }
261
+
262
+ return $sub_query_conditions;
263
  }
264
 
265
  /**
includes/admin/models/class-wppr-review-model.php CHANGED
@@ -1070,8 +1070,31 @@ class WPPR_Review_Model extends WPPR_Model_Abstract {
1070
  if ( ! $this->is_active() ) {
1071
  return '';
1072
  }
 
 
 
 
1073
 
1074
- return apply_filters( 'wppr_excerpt', wp_strip_all_tags( preg_replace( '/<!-- Start WPPR Review -->[\s\S]*?<!-- End WPPR Review -->/', '', do_shortcode( get_post_field( 'post_content', $this->get_ID() ) ) ) ), $this->ID, $this );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1075
  }
1076
 
1077
  /**
1070
  if ( ! $this->is_active() ) {
1071
  return '';
1072
  }
1073
+ $content = get_post_field( 'post_content', $this->get_ID() );
1074
+ if ( empty( $content ) ) {
1075
+ return '';
1076
+ }
1077
 
1078
+ /**
1079
+ * Prevent infinite loop by removing the wppr shortcodes from content.
1080
+ */
1081
+ $wppr_shortcodes = apply_filters(
1082
+ 'wppr_shortcodes', array(
1083
+ 'P_REVIEW' => '',
1084
+ 'wpr_landing' => '',
1085
+ 'wpr_listing' => '',
1086
+ )
1087
+ );
1088
+ global $shortcode_tags;
1089
+ $temp_shortcode_tags = $shortcode_tags;
1090
+ $shortcode_tags = $wppr_shortcodes;
1091
+ $regex = '/' . get_shortcode_regex() . '/s';
1092
+ $shortcode_tags = $temp_shortcode_tags;
1093
+ $content = preg_replace( $regex, '', $content );
1094
+ $content = do_shortcode( $content );
1095
+ $content = wp_strip_all_tags( $content );
1096
+
1097
+ return apply_filters( 'wppr_content', $content, $this->ID, $this );
1098
  }
1099
 
1100
  /**
includes/admin/widgets/abstract/class-wppr-widget-abstract.php CHANGED
@@ -13,7 +13,7 @@
13
  * Class WPPR_Widget_Abstract
14
  */
15
  class WPPR_Widget_Abstract extends WP_Widget {
16
- const RESTRICT_TITLE_CHARS = 100;
17
 
18
  /**
19
  * Method to load assets required for front end display.
@@ -22,11 +22,11 @@ class WPPR_Widget_Abstract extends WP_Widget {
22
  * @access public
23
  */
24
  public function assets( $review_object ) {
25
- wp_enqueue_style( WPPR_SLUG . '-pac-widget-stylesheet', WPPR_URL . '/assets/css/cwppos-widget.css', array(), WPPR_LITE_VERSION );
26
- wp_enqueue_style( WPPR_SLUG . '-widget-stylesheet-one', WPPR_URL . '/assets/css/cwppos-widget-style1.css', array(), WPPR_LITE_VERSION );
27
- wp_enqueue_style( WPPR_SLUG . '-widget-rating', WPPR_URL . '/assets/css/cwppos-widget-rating.css', array(), WPPR_LITE_VERSION );
28
- $plugin = new WPPR();
29
- $public = new Wppr_Public( $plugin->get_plugin_name(), $plugin->get_version() );
30
 
31
  $public->load_review_assets( $review_object );
32
  }
@@ -36,13 +36,15 @@ class WPPR_Widget_Abstract extends WP_Widget {
36
  *
37
  * @since 3.0.0
38
  * @access public
39
- * @param array $args Arguments for this method.
40
- * @param array $instance Instance array for the widget.
 
 
41
  * @return array
42
  */
43
  public function widget( $args, $instance ) {
44
- $instance['title'] = apply_filters( 'widget_title', $instance['title'] );
45
- $instance['no_items'] = apply_filters( 'widget_content', $instance['no_items'] );
46
  $instance['cwp_tp_category'] = apply_filters( 'widget_content', $instance['cwp_tp_category'] );
47
  if ( isset( $instance['title_type'] ) ) {
48
  $instance['post_type'] = apply_filters( 'widget_content', $instance['title_type'] );
@@ -55,11 +57,22 @@ class WPPR_Widget_Abstract extends WP_Widget {
55
  $instance['show_image'] = false;
56
  }
57
  // @codingStandardsIgnoreStart
58
- if ( $instance['cwp_tp_category'] == 'All' ) { $instance['cwp_tp_category'] = ''; }
59
- if ( ! isset( $instance['cwp_tp_buynow'] ) ) { $instance['cwp_tp_buynow'] = __( 'Buy Now', 'wp-product-review' ); }
60
- if ( ! isset( $instance['cwp_tp_readreview'] ) ) { $instance['cwp_tp_readreview'] = __( 'Read Review', 'wp-product-review' ); }
61
- if ( ! isset( $instance['cwp_tp_layout'] ) ) { $instance['cwp_tp_layout'] = 'default.php'; }
62
- if ( ! isset( $instance['cwp_tp_rating_type'] ) ) { $instance['cwp_tp_rating_type'] = 'round'; }
 
 
 
 
 
 
 
 
 
 
 
63
  // @codingStandardsIgnoreEnd
64
 
65
  return $instance;
@@ -70,7 +83,9 @@ class WPPR_Widget_Abstract extends WP_Widget {
70
  *
71
  * @since 3.0.0
72
  * @access public
73
- * @param array $instance The instance array for this widget.
 
 
74
  * @return array
75
  */
76
  public function form( $instance ) {
@@ -100,7 +115,7 @@ class WPPR_Widget_Abstract extends WP_Widget {
100
  }
101
 
102
  if ( ! isset( $instance['cwp_tp_layout'] ) ) {
103
- $instance['cwp_tp_layout'] = 'default.php';
104
  }
105
 
106
  if ( $instance['cwp_tp_layout'] == 'default.php' ) {
@@ -122,8 +137,10 @@ class WPPR_Widget_Abstract extends WP_Widget {
122
  *
123
  * @since 3.0.0
124
  * @access public
125
- * @param array $new_instance The new instance array for the widget.
126
- * @param array $old_instance The old instance array of the widget.
 
 
127
  * @return array
128
  */
129
  public function update( $new_instance, $old_instance ) {
@@ -136,15 +153,34 @@ class WPPR_Widget_Abstract extends WP_Widget {
136
 
137
  $instance['cwp_tp_category'] = ( ! empty( $new_instance['cwp_tp_category'] ) ) ? strip_tags( $new_instance['cwp_tp_category'] ) : '';
138
 
139
- $instance['title_type'] = ( isset( $new_instance['title_type'] ) ) ? (bool) $new_instance['title_type'] : false ;
140
- $instance['show_image'] = ( isset( $new_instance['show_image'] ) ) ? (bool) $new_instance['show_image'] : false ;
141
 
142
- $instance['cwp_tp_buynow'] = ( ! empty( $new_instance['cwp_tp_buynow'] ) ) ? strip_tags( $new_instance['cwp_tp_buynow'] ) : '';
143
- $instance['cwp_tp_readreview'] = ( ! empty( $new_instance['cwp_tp_readreview'] ) ) ? strip_tags( $new_instance['cwp_tp_readreview'] ) : '';
144
- $instance['cwp_tp_layout'] = ( ! empty( $new_instance['cwp_tp_layout'] ) ) ? strip_tags( $new_instance['cwp_tp_layout'] ) : '';
145
  $instance['cwp_tp_rating_type'] = ( ! empty( $new_instance['cwp_tp_rating_type'] ) ) ? strip_tags( $new_instance['cwp_tp_rating_type'] ) : '';
146
 
147
  return $instance;
148
  }
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
13
  * Class WPPR_Widget_Abstract
14
  */
15
  class WPPR_Widget_Abstract extends WP_Widget {
16
+ const RESTRICT_TITLE_CHARS = 100;
17
 
18
  /**
19
  * Method to load assets required for front end display.
22
  * @access public
23
  */
24
  public function assets( $review_object ) {
25
+ wp_enqueue_style( WPPR_SLUG . '-pac-widget-stylesheet', WPPR_URL . '/assets/css/cwppos-widget.css', array(), WPPR_LITE_VERSION );
26
+ wp_enqueue_style( WPPR_SLUG . '-widget-stylesheet-one', WPPR_URL . '/assets/css/cwppos-widget-style1.css', array(), WPPR_LITE_VERSION );
27
+ wp_enqueue_style( WPPR_SLUG . '-widget-rating', WPPR_URL . '/assets/css/cwppos-widget-rating.css', array(), WPPR_LITE_VERSION );
28
+ $plugin = new WPPR();
29
+ $public = new Wppr_Public( $plugin->get_plugin_name(), $plugin->get_version() );
30
 
31
  $public->load_review_assets( $review_object );
32
  }
36
  *
37
  * @since 3.0.0
38
  * @access public
39
+ *
40
+ * @param array $args Arguments for this method.
41
+ * @param array $instance Instance array for the widget.
42
+ *
43
  * @return array
44
  */
45
  public function widget( $args, $instance ) {
46
+ $instance['title'] = apply_filters( 'widget_title', $instance['title'] );
47
+ $instance['no_items'] = apply_filters( 'widget_content', $instance['no_items'] );
48
  $instance['cwp_tp_category'] = apply_filters( 'widget_content', $instance['cwp_tp_category'] );
49
  if ( isset( $instance['title_type'] ) ) {
50
  $instance['post_type'] = apply_filters( 'widget_content', $instance['title_type'] );
57
  $instance['show_image'] = false;
58
  }
59
  // @codingStandardsIgnoreStart
60
+ if ( $instance['cwp_tp_category'] == 'All' ) {
61
+ $instance['cwp_tp_category'] = '';
62
+ }
63
+ if ( ! isset( $instance['cwp_tp_buynow'] ) ) {
64
+ $instance['cwp_tp_buynow'] = __( 'Buy Now', 'wp-product-review' );
65
+ }
66
+ if ( ! isset( $instance['cwp_tp_readreview'] ) ) {
67
+ $instance['cwp_tp_readreview'] = __( 'Read Review', 'wp-product-review' );
68
+ }
69
+ if ( ! isset( $instance['cwp_tp_layout'] ) ) {
70
+ $instance['cwp_tp_layout'] = 'default.php';
71
+ }
72
+ if ( ! isset( $instance['cwp_tp_rating_type'] ) ) {
73
+ $instance['cwp_tp_rating_type'] = 'round';
74
+ }
75
+
76
  // @codingStandardsIgnoreEnd
77
 
78
  return $instance;
83
  *
84
  * @since 3.0.0
85
  * @access public
86
+ *
87
+ * @param array $instance The instance array for this widget.
88
+ *
89
  * @return array
90
  */
91
  public function form( $instance ) {
115
  }
116
 
117
  if ( ! isset( $instance['cwp_tp_layout'] ) ) {
118
+ $instance['cwp_tp_layout'] = 'default.php';
119
  }
120
 
121
  if ( $instance['cwp_tp_layout'] == 'default.php' ) {
137
  *
138
  * @since 3.0.0
139
  * @access public
140
+ *
141
+ * @param array $new_instance The new instance array for the widget.
142
+ * @param array $old_instance The old instance array of the widget.
143
+ *
144
  * @return array
145
  */
146
  public function update( $new_instance, $old_instance ) {
153
 
154
  $instance['cwp_tp_category'] = ( ! empty( $new_instance['cwp_tp_category'] ) ) ? strip_tags( $new_instance['cwp_tp_category'] ) : '';
155
 
156
+ $instance['title_type'] = ( isset( $new_instance['title_type'] ) ) ? (bool) $new_instance['title_type'] : false;
157
+ $instance['show_image'] = ( isset( $new_instance['show_image'] ) ) ? (bool) $new_instance['show_image'] : false;
158
 
159
+ $instance['cwp_tp_buynow'] = ( ! empty( $new_instance['cwp_tp_buynow'] ) ) ? strip_tags( $new_instance['cwp_tp_buynow'] ) : '';
160
+ $instance['cwp_tp_readreview'] = ( ! empty( $new_instance['cwp_tp_readreview'] ) ) ? strip_tags( $new_instance['cwp_tp_readreview'] ) : '';
161
+ $instance['cwp_tp_layout'] = ( ! empty( $new_instance['cwp_tp_layout'] ) ) ? strip_tags( $new_instance['cwp_tp_layout'] ) : '';
162
  $instance['cwp_tp_rating_type'] = ( ! empty( $new_instance['cwp_tp_rating_type'] ) ) ? strip_tags( $new_instance['cwp_tp_rating_type'] ) : '';
163
 
164
  return $instance;
165
  }
166
 
167
+ /**
168
+ * Method for loading admin widget assets.
169
+ *
170
+ * @since 3.0.0
171
+ * @access public
172
+ */
173
+ public function adminAssets() {
174
+ if ( is_admin() ) {
175
+ wp_enqueue_style( WPPR_SLUG . '-widget-admin-css', WPPR_URL . '/assets/css/cwppos-widget-admin.css', array(), WPPR_LITE_VERSION );
176
+
177
+ wp_register_script( WPPR_SLUG . '-widget-script', WPPR_URL . '/assets/js/widget-admin.js', array(), WPPR_LITE_VERSION );
178
+ wp_localize_script(
179
+ WPPR_SLUG . '-widget-script', 'wppr_widget', array(
180
+ 'names' => array( 'cwp_top_products_widget', 'cwp_latest_products_widget' ),
181
+ )
182
+ );
183
+ wp_enqueue_script( WPPR_SLUG . '-widget-script' );
184
+ }
185
+ }
186
  }
includes/admin/widgets/class-wppr-latest-products-widget.php CHANGED
@@ -108,25 +108,4 @@ class WPPR_Latest_Products_Widget extends WPPR_Widget_Abstract {
108
  include( WPPR_PATH . '/includes/admin/layouts/widget-admin-tpl.php' );
109
  }
110
 
111
- /**
112
- * Method for loading admin widget assets.
113
- *
114
- * @since 3.0.0
115
- * @access public
116
- */
117
- public function adminAssets() {
118
- if ( is_admin() ) {
119
- wp_enqueue_style( WPPR_SLUG . '-widget-admin-css', WPPR_URL . '/assets/css/cwppos-widget-admin.css', array(), WPPR_LITE_VERSION );
120
-
121
- wp_register_script( WPPR_SLUG . '-widget-script-latest', WPPR_URL . '/assets/js/widget-latest.js', array(), WPPR_LITE_VERSION );
122
- wp_localize_script(
123
- WPPR_SLUG . '-widget-script-latest', 'wppr_widget_localized_data', array(
124
- 'widgetName' => $this->id_base,
125
- 'imageCheckbox' => $this->get_field_id( 'show_image' ),
126
- 'ratingSelect' => $this->get_field_id( 'cwp_tp_rating_type' ),
127
- )
128
- );
129
- wp_enqueue_script( WPPR_SLUG . '-widget-script-latest' );
130
- }
131
- }
132
  }
108
  include( WPPR_PATH . '/includes/admin/layouts/widget-admin-tpl.php' );
109
  }
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
includes/admin/widgets/class-wppr-top-products-widget.php CHANGED
@@ -122,25 +122,5 @@ class WPPR_Top_Products_Widget extends WPPR_Widget_Abstract {
122
  include( WPPR_PATH . '/includes/admin/layouts/widget-admin-tpl.php' );
123
  }
124
 
125
- /**
126
- * Method for loading admin widget assets.
127
- *
128
- * @since 3.0.0
129
- * @access public
130
- */
131
- public function adminAssets() {
132
- if ( is_admin() ) {
133
- wp_enqueue_style( WPPR_SLUG . '-widget-admin-css', WPPR_URL . '/assets/css/cwppos-widget-admin.css', array(), WPPR_LITE_VERSION );
134
 
135
- wp_register_script( WPPR_SLUG . '-widget-script-top', WPPR_URL . '/assets/js/widget-top.js', array(), WPPR_LITE_VERSION );
136
- wp_localize_script(
137
- WPPR_SLUG . '-widget-script-top', 'wppr_widget_localized_data', array(
138
- 'widgetName' => $this->id_base,
139
- 'imageCheckbox' => $this->get_field_id( 'show_image' ),
140
- 'ratingSelect' => $this->get_field_id( 'cwp_tp_rating_type' ),
141
- )
142
- );
143
- wp_enqueue_script( WPPR_SLUG . '-widget-script-top' );
144
- }
145
- }
146
  }
122
  include( WPPR_PATH . '/includes/admin/layouts/widget-admin-tpl.php' );
123
  }
124
 
 
 
 
 
 
 
 
 
 
125
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
includes/class-wppr-template.php CHANGED
@@ -64,7 +64,7 @@ class WPPR_Template {
64
  $content = wp_cache_get( $cache_key, 'wppr' );
65
  if ( empty( $content ) ) {
66
  ob_start();
67
- require_once( $location );
68
  $content = ob_get_contents();
69
  ob_end_clean();
70
 
64
  $content = wp_cache_get( $cache_key, 'wppr' );
65
  if ( empty( $content ) ) {
66
  ob_start();
67
+ require( $location );
68
  $content = ob_get_contents();
69
  ob_end_clean();
70
 
includes/class-wppr.php CHANGED
@@ -67,7 +67,7 @@ class WPPR {
67
  */
68
  public function __construct() {
69
  $this->plugin_name = 'wppr';
70
- $this->version = '3.0.12';
71
 
72
  $this->load_dependencies();
73
  $this->set_locale();
67
  */
68
  public function __construct() {
69
  $this->plugin_name = 'wppr';
70
+ $this->version = '3.1.0';
71
 
72
  $this->load_dependencies();
73
  $this->set_locale();
includes/legacy.php CHANGED
@@ -16,8 +16,6 @@
16
  * @return string The review string.
17
  */
18
  function cwppos_show_review( $post_id ) {
19
- $model = new WPPR_Query_Model();
20
- $model->find();
21
  $plugin = new WPPR();
22
  $review_object = new WPPR_Review_Model( $post_id );
23
  $public = new Wppr_Public( $plugin->get_plugin_name(), $plugin->get_version() );
16
  * @return string The review string.
17
  */
18
  function cwppos_show_review( $post_id ) {
 
 
19
  $plugin = new WPPR();
20
  $review_object = new WPPR_Review_Model( $post_id );
21
  $public = new Wppr_Public( $plugin->get_plugin_name(), $plugin->get_version() );
includes/public/layouts/default.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * WP Prodact Review front page layout.
4
  *
5
  * @package WPPR
6
  * @subpackage Layouts
@@ -25,7 +25,13 @@ if ( $review_object->get_click() == 'image' ) {
25
  $lightbox = 'data-lightbox="' . esc_url( $review_object->get_small_thumbnail() ) . '"';
26
  $image_link = $review_object->get_image();
27
  }
 
 
 
 
28
  ?>
 
 
29
  <section id="review-statistics" class="article-section">
30
  <div class="review-wrap-up cwpr_clearfix">
31
  <div class="cwpr-review-top cwpr_clearfix">
@@ -53,78 +59,90 @@ if ( $review_object->get_click() == 'image' ) {
53
  </div><!-- end .chart -->
54
  </div><!-- end .review-wu-grade -->
55
  <div class="review-wu-bars">
56
- <?php
57
- foreach ( $review_object->get_options() as $option ) {
58
- ?>
59
- <div class="rev-option" data-value="<?php echo $option['value']; ?>">
60
- <div class="cwpr_clearfix">
61
- <h3><?php echo esc_html( apply_filters( 'wppr_option_name_html', $option['name'] ) ); ?></h3>
62
- <span><?php echo esc_html( round( $option['value'] / 10 ) ); ?>/10 </span>
63
- </div>
64
- <ul class="cwpr_clearfix"></ul>
65
- </div>
66
  <?php
67
- }
 
 
 
 
 
 
 
 
 
 
68
  ?>
69
  </div><!-- end .review-wu-bars -->
70
  </div><!-- end .review-wu-left -->
71
- <div class="review-wu-right">
72
- <div class="pros">
73
- <h2>
74
- <?php
75
- echo esc_html(
76
- apply_filters(
77
- 'wppr_review_pros_text', $review_object->wppr_get_option(
78
- 'cwppos_pros_text'
79
- )
80
- )
81
- );
82
- ?>
83
- </h2>
84
- <ul>
85
- <?php
86
- foreach ( $review_object->get_pros() as $pro ) {
87
- ?>
88
- <li><?php echo esc_html( $pro ); ?></li>
89
- <?php
90
- }
91
- ?>
92
- </ul>
93
- </div><!-- end .pros -->
94
- <div class="cons">
95
- <h2>
 
 
96
  <?php
97
- echo esc_html(
98
- apply_filters(
99
- 'wppr_review_cons_text', $review_object->wppr_get_option(
100
- 'cwppos_cons_text'
101
- )
102
- )
103
- );
104
- ?>
105
- </h2>
106
- <ul>
107
- <?php
108
- foreach ( $review_object->get_cons() as $con ) {
109
- ?>
 
 
 
 
 
 
 
 
110
 
111
- <li><?php echo esc_html( $con ); ?></li>
 
 
112
 
113
- <?php } ?>
114
- </ul>
115
- </div>
116
- </div><!-- end .review-wu-right -->
117
  </div><!-- end .review-wrap-up -->
118
  </section>
119
- <?php
120
- foreach ( $links as $title => $link ) {
121
- if ( ! empty( $title ) && ! empty( $link ) ) {
122
- ?>
123
- <div class="<?php echo esc_attr( $multiple_affiliates_class ); ?>">
124
- <a href="<?php echo esc_url( $link ); ?>" rel="nofollow"
125
- target="_blank"><span><?php echo esc_html( $title ); ?></span> </a>
126
- </div><!-- end .affiliate-button -->
127
- <?php
 
128
  }
129
- }
130
-
1
  <?php
2
  /**
3
+ * WPPR front page layout.
4
  *
5
  * @package WPPR
6
  * @subpackage Layouts
25
  $lightbox = 'data-lightbox="' . esc_url( $review_object->get_small_thumbnail() ) . '"';
26
  $image_link = $review_object->get_image();
27
  }
28
+
29
+ $pros = $review_object->get_pros();
30
+ $cons = $review_object->get_cons();
31
+
32
  ?>
33
+ <div id="wppr-review-<?php echo $review_object->get_ID(); ?>"
34
+ class="wppr-review-container <?php echo( empty( $pros ) ? 'wppr-review-no-pros' : '' ); ?> <?php echo( empty( $cons ) ? 'wppr-review-no-cons' : '' ); ?>">
35
  <section id="review-statistics" class="article-section">
36
  <div class="review-wrap-up cwpr_clearfix">
37
  <div class="cwpr-review-top cwpr_clearfix">
59
  </div><!-- end .chart -->
60
  </div><!-- end .review-wu-grade -->
61
  <div class="review-wu-bars">
 
 
 
 
 
 
 
 
 
 
62
  <?php
63
+ foreach ( $review_object->get_options() as $option ) {
64
+ ?>
65
+ <div class="rev-option" data-value="<?php echo $option['value']; ?>">
66
+ <div class="cwpr_clearfix">
67
+ <h3><?php echo esc_html( apply_filters( 'wppr_option_name_html', $option['name'] ) ); ?></h3>
68
+ <span><?php echo esc_html( round( $option['value'] / 10 ) ); ?>/10 </span>
69
+ </div>
70
+ <ul class="cwpr_clearfix"></ul>
71
+ </div>
72
+ <?php
73
+ }
74
  ?>
75
  </div><!-- end .review-wu-bars -->
76
  </div><!-- end .review-wu-left -->
77
+ <?php
78
+ if ( ! empty( $pros ) || ! empty( $cons ) ) :
79
+ ?>
80
+ <div class="review-wu-right">
81
+ <?php if ( ! empty( $pros ) ) : ?>
82
+ <div class="pros">
83
+ <h2>
84
+ <?php
85
+ echo esc_html(
86
+ apply_filters(
87
+ 'wppr_review_pros_text', $review_object->wppr_get_option(
88
+ 'cwppos_pros_text'
89
+ )
90
+ )
91
+ );
92
+ ?>
93
+ </h2>
94
+ <ul>
95
+ <?php
96
+ foreach ( $pros as $pro ) {
97
+ ?>
98
+ <li><?php echo esc_html( $pro ); ?></li>
99
+ <?php
100
+ }
101
+ ?>
102
+ </ul>
103
+ </div><!-- end .pros -->
104
  <?php
105
+ endif;
106
+ if ( ! empty( $cons ) ) :
107
+ ?>
108
+ <div class="cons">
109
+ <h2>
110
+ <?php
111
+ echo esc_html(
112
+ apply_filters(
113
+ 'wppr_review_cons_text', $review_object->wppr_get_option(
114
+ 'cwppos_cons_text'
115
+ )
116
+ )
117
+ );
118
+ ?>
119
+ </h2>
120
+ <ul>
121
+ <?php
122
+ foreach ( $cons as $con ) {
123
+ ?>
124
+
125
+ <li><?php echo esc_html( $con ); ?></li>
126
 
127
+ <?php } ?>
128
+ </ul>
129
+ </div>
130
 
131
+ <?php endif; ?>
132
+ </div><!-- end .review-wu-right -->
133
+ <?php endif; ?>
 
134
  </div><!-- end .review-wrap-up -->
135
  </section>
136
+ <?php
137
+ foreach ( $links as $title => $link ) {
138
+ if ( ! empty( $title ) && ! empty( $link ) ) {
139
+ ?>
140
+ <div class="<?php echo esc_attr( $multiple_affiliates_class ); ?>">
141
+ <a href="<?php echo esc_url( $link ); ?>" rel="nofollow"
142
+ target="_blank"><span><?php echo esc_html( $title ); ?></span> </a>
143
+ </div><!-- end .affiliate-button -->
144
+ <?php
145
+ }
146
  }
147
+ ?>
148
+ </div>
languages/wp-product-review.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the no.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP Product Review Lite 3.0.9\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/wp-product-review/issues\n"
7
- "POT-Creation-Date: 2017-09-07 13:50:28+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,27 +24,27 @@ msgstr ""
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:79
28
  msgid "10"
29
  msgstr ""
30
 
31
- #: includes/admin/class-wppr-admin.php:132
32
  msgid "WP Product Review"
33
  msgstr ""
34
 
35
- #: includes/admin/class-wppr-admin.php:132
36
  msgid "Product Review"
37
  msgstr ""
38
 
39
- #: includes/admin/class-wppr-admin.php:139
40
  msgid "More Features"
41
  msgstr ""
42
 
43
- #: includes/admin/class-wppr-admin.php:139
44
  msgid "More Features "
45
  msgstr ""
46
 
47
- #: includes/admin/class-wppr-editor.php:57
48
  msgid "Product Review Extra Settings"
49
  msgstr ""
50
 
@@ -70,9 +70,8 @@ msgstr ""
70
 
71
  #: includes/admin/class-wppr-global-settings.php:73
72
  msgid ""
73
- "You can choose manually and use : <?php echo cwppos_show_review('postid'); "
74
- "?> or you can get the Product in post add-on and use :[P_REVIEW "
75
- "post_id=3067 visual='full']"
76
  msgstr ""
77
 
78
  #: includes/admin/class-wppr-global-settings.php:76
@@ -500,13 +499,21 @@ msgstr ""
500
  msgid "Display Product Image :"
501
  msgstr ""
502
 
503
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:59
504
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:95
 
 
 
 
 
 
 
 
505
  msgid "Buy Now"
506
  msgstr ""
507
 
508
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:60
509
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:99
510
  msgid "Read Review"
511
  msgstr ""
512
 
@@ -518,7 +525,7 @@ msgstr ""
518
  msgid "This widget displays the latest products based on their rating."
519
  msgstr ""
520
 
521
- #: includes/admin/widgets/class-wppr-latest-products-widget.php:97
522
  msgid "Latest Products"
523
  msgstr ""
524
 
@@ -530,7 +537,7 @@ msgstr ""
530
  msgid "This widget displays the top products based on their rating."
531
  msgstr ""
532
 
533
- #: includes/admin/widgets/class-wppr-top-products-widget.php:112
534
  msgid "Top Products"
535
  msgstr ""
536
 
2
  # This file is distributed under the no.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP Product Review Lite 3.0.12\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/wp-product-review/issues\n"
7
+ "POT-Creation-Date: 2017-09-22 12:33:07+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
+ #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:94
28
  msgid "10"
29
  msgstr ""
30
 
31
+ #: includes/admin/class-wppr-admin.php:131
32
  msgid "WP Product Review"
33
  msgstr ""
34
 
35
+ #: includes/admin/class-wppr-admin.php:131
36
  msgid "Product Review"
37
  msgstr ""
38
 
39
+ #: includes/admin/class-wppr-admin.php:138
40
  msgid "More Features"
41
  msgstr ""
42
 
43
+ #: includes/admin/class-wppr-admin.php:138
44
  msgid "More Features "
45
  msgstr ""
46
 
47
+ #: includes/admin/class-wppr-editor.php:58
48
  msgid "Product Review Extra Settings"
49
  msgstr ""
50
 
70
 
71
  #: includes/admin/class-wppr-global-settings.php:73
72
  msgid ""
73
+ "You display the review using the shortcode available in the pro version "
74
+ "<code> [P_REVIEW post_id=3067 visual='full']</code>"
 
75
  msgstr ""
76
 
77
  #: includes/admin/class-wppr-global-settings.php:76
499
  msgid "Display Product Image :"
500
  msgstr ""
501
 
502
+ #: includes/admin/models/class-wppr-editor-model.php:266
503
+ msgid "Add a product image to the review"
504
+ msgstr ""
505
+
506
+ #: includes/admin/models/class-wppr-editor-model.php:267
507
+ msgid "Attach the image"
508
+ msgstr ""
509
+
510
+ #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:64
511
+ #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:110
512
  msgid "Buy Now"
513
  msgstr ""
514
 
515
+ #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:67
516
+ #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:114
517
  msgid "Read Review"
518
  msgstr ""
519
 
525
  msgid "This widget displays the latest products based on their rating."
526
  msgstr ""
527
 
528
+ #: includes/admin/widgets/class-wppr-latest-products-widget.php:103
529
  msgid "Latest Products"
530
  msgstr ""
531
 
537
  msgid "This widget displays the top products based on their rating."
538
  msgstr ""
539
 
540
+ #: includes/admin/widgets/class-wppr-top-products-widget.php:118
541
  msgid "Top Products"
542
  msgstr ""
543
 
readme.txt CHANGED
@@ -67,6 +67,14 @@ If you wanna learn more about the <a href="http://www.codeinwp.com/blog/fastest-
67
  * fr_FR translation by Jacques Soule of http://wordpress-pour-vous.com/
68
 
69
  == Changelog ==
 
 
 
 
 
 
 
 
70
  = 3.0.12 - 2017-09-17 =
71
 
72
  * Fix for review box issues.
67
  * fr_FR translation by Jacques Soule of http://wordpress-pour-vous.com/
68
 
69
  == Changelog ==
70
+ = 3.1.0 - 2017-09-22 =
71
+
72
+ * Fix for some edge cases when the review box was gone.
73
+ * Improvements assets loading, removed redundant files.
74
+ * Improvements perfomance of review query.
75
+ * Various bug fixes reported by clients.
76
+
77
+
78
  = 3.0.12 - 2017-09-17 =
79
 
80
  * Fix for review box issues.
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit680dac0f915f2d29de14b79a96411159::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitbe7a15632f2c4db5c700871b54200d84::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit30e5c089b136b85b686719059c6620ec::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInit9b24882ae844c9dc599896d1806a28e4::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit680dac0f915f2d29de14b79a96411159
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit680dac0f915f2d29de14b79a96411159
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit680dac0f915f2d29de14b79a96411159', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit680dac0f915f2d29de14b79a96411159', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit680dac0f915f2d29de14b79a96411159
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequire680dac0f915f2d29de14b79a96411159($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequire680dac0f915f2d29de14b79a96411159($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitbe7a15632f2c4db5c700871b54200d84
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitbe7a15632f2c4db5c700871b54200d84', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitbe7a15632f2c4db5c700871b54200d84', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
+ composerRequirebe7a15632f2c4db5c700871b54200d84($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
+ function composerRequirebe7a15632f2c4db5c700871b54200d84($fileIdentifier, $file)
53
  {
54
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
55
  require $file;
vendor/composer/autoload_real_52.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
- class ComposerAutoloaderInit30e5c089b136b85b686719059c6620ec {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit30e5c089b136b85b686719059c6620ec {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit30e5c089b136b85b686719059c6620ec', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit30e5c089b136b85b686719059c6620ec', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
2
 
3
  // autoload_real_52.php generated by xrstf/composer-php52
4
 
5
+ class ComposerAutoloaderInit9b24882ae844c9dc599896d1806a28e4 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit9b24882ae844c9dc599896d1806a28e4', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit9b24882ae844c9dc599896d1806a28e4', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
wp-product-review.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: WP Product Review Lite
16
  * Plugin URI: https://themeisle.com/plugins/wp-product-review/
17
  * Description: The highest rated and most complete review plugin, now with rich snippets support. Easily turn your basic posts into in-depth reviews.
18
- * Version: 3.0.12
19
  * Author: ThemeIsle
20
  * Author URI: https://themeisle.com/
21
  * Requires at least: 3.5
@@ -67,7 +67,7 @@ register_deactivation_hook( __FILE__, 'deactivate_wppr' );
67
  */
68
  function run_wppr() {
69
 
70
- define( 'WPPR_LITE_VERSION', '3.0.12' );
71
  define( 'WPPR_PATH', dirname( __FILE__ ) );
72
  define( 'WPPR_SLUG', 'wppr' );
73
  define( 'WPPR_UPSELL_LINK', 'https://themeisle.com/plugins/wp-product-review/' );
15
  * Plugin Name: WP Product Review Lite
16
  * Plugin URI: https://themeisle.com/plugins/wp-product-review/
17
  * Description: The highest rated and most complete review plugin, now with rich snippets support. Easily turn your basic posts into in-depth reviews.
18
+ * Version: 3.1.0
19
  * Author: ThemeIsle
20
  * Author URI: https://themeisle.com/
21
  * Requires at least: 3.5
67
  */
68
  function run_wppr() {
69
 
70
+ define( 'WPPR_LITE_VERSION', '3.1.0' );
71
  define( 'WPPR_PATH', dirname( __FILE__ ) );
72
  define( 'WPPR_SLUG', 'wppr' );
73
  define( 'WPPR_UPSELL_LINK', 'https://themeisle.com/plugins/wp-product-review/' );