WP Product Review Lite - Version 3.0.2

Version Description

  • 2017-08-24
Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
 
 
 
 
 
 
 
2
  ### v3.0.1 - 2017-08-23
3
  **Changes:**
4
  * Fixed backwards compatibility when using cwppos_show_review.
1
 
2
+ ### v3.0.2 - 2017-08-24
3
+ **Changes:**
4
+ * Fixed fatal error with is_active method.
5
+ * Fixed query reviews class.
6
+ * Fixed widget assets loading when there is no review on the page.
7
+
8
  ### v3.0.1 - 2017-08-23
9
  **Changes:**
10
  * Fixed backwards compatibility when using cwppos_show_review.
assets/css/frontpage.css CHANGED
@@ -1,5 +1,5 @@
1
  /*
2
- Version: 3.0.1
3
  */
4
  #review-statistics {
5
  width: 100%;
1
  /*
2
+ Version: 3.0.2
3
  */
4
  #review-statistics {
5
  width: 100%;
includes/admin/models/class-wppr-query-model.php CHANGED
@@ -126,8 +126,7 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
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
- WHERE
130
- `post_id` IN ( " . $sub_query_posts . " )
131
  GROUP BY `ID`
132
  ) `pivoted_meta`
133
  WHERE `cwp_meta_box_check` = 'Yes'
@@ -137,7 +136,6 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
137
  `cwp_rev_product_name` ASC
138
  LIMIT {$limit}
139
  ";
140
-
141
  $key = hash( 'sha256', $query );
142
  $processed_res = wp_cache_get( $key, 'wppr' );
143
  if ( ! is_array( $processed_res ) ) {
@@ -192,16 +190,24 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
192
  */
193
  private function get_sub_query_posts( $post ) {
194
  $sub_query_conditions = $this->get_sub_query_conditions( $post );
195
-
 
 
 
 
 
 
196
  $sub_query_posts = "
197
- SELECT `ID`
198
- FROM {$this->db->terms} wt
199
- INNER JOIN {$this->db->term_taxonomy} wtt ON wt.term_id = wtt.term_id
200
- INNER JOIN {$this->db->term_relationships} wtr ON wtt.term_taxonomy_id = wtr.term_taxonomy_id
201
- INNER JOIN {$this->db->posts} p ON wtr.object_id = p.ID
202
  WHERE
203
- p.post_type = 'post' AND p.post_status = 'publish'
204
- {$sub_query_conditions}
 
 
 
 
 
 
 
205
  ";
206
 
207
  return $sub_query_posts;
@@ -228,7 +234,7 @@ class WPPR_Query_Model extends WPPR_Model_Abstract {
228
  }
229
 
230
  if ( isset( $post['category_name'] ) && $post['category_name'] != false ) {
231
- $sub_query_conditions .= $this->db->prepare( " AND wt.name = '%%%s%%' ", $post['category_name'] );
232
  }
233
 
234
  return $sub_query_conditions;
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'
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 ) ) {
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;
234
  }
235
 
236
  if ( isset( $post['category_name'] ) && $post['category_name'] != false ) {
237
+ $sub_query_conditions .= $this->db->prepare( " AND wt.slug like '%%%s%%' ", $post['category_name'] );
238
  }
239
 
240
  return $sub_query_conditions;
includes/admin/models/class-wppr-review-model.php CHANGED
@@ -446,6 +446,7 @@ class WPPR_Review_Model extends WPPR_Model_Abstract {
446
  'id' => $this->get_ID(),
447
  'name' => $this->get_name(),
448
  'price' => $this->get_price(),
 
449
  'currency' => $this->get_currency(),
450
  'click' => $this->get_click(),
451
  'image' => array(
446
  'id' => $this->get_ID(),
447
  'name' => $this->get_name(),
448
  'price' => $this->get_price(),
449
+ 'price_raw' => $this->get_price_raw(),
450
  'currency' => $this->get_currency(),
451
  'click' => $this->get_click(),
452
  'image' => array(
includes/admin/widgets/abstract/class-wppr-widget-abstract.php CHANGED
@@ -21,10 +21,14 @@ class WPPR_Widget_Abstract extends WP_Widget {
21
  * @since 3.0.0
22
  * @access public
23
  */
24
- public function assets() {
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
  }
29
 
30
  /**
@@ -50,13 +54,13 @@ class WPPR_Widget_Abstract extends WP_Widget {
50
  } else {
51
  $instance['show_image'] = false;
52
  }
53
- // @codingStandardsIgnoreStart
54
  if ( $instance['cwp_tp_category'] == 'All' ) { $instance['cwp_tp_category'] = ''; }
55
  if ( ! isset( $instance['cwp_tp_buynow'] ) ) { $instance['cwp_tp_buynow'] = __( 'Buy Now', 'wp-product-review' ); }
56
  if ( ! isset( $instance['cwp_tp_readreview'] ) ) { $instance['cwp_tp_readreview'] = __( 'Read Review', 'wp-product-review' ); }
57
  if ( ! isset( $instance['cwp_tp_layout'] ) ) { $instance['cwp_tp_layout'] = 'default.php'; }
58
  if ( ! isset( $instance['cwp_tp_rating_type'] ) ) { $instance['cwp_tp_rating_type'] = 'round'; }
59
- // @codingStandardsIgnoreEnd
60
 
61
  return $instance;
62
  }
21
  * @since 3.0.0
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
  }
33
 
34
  /**
54
  } else {
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;
66
  }
includes/admin/widgets/class-wppr-latest-products-widget.php CHANGED
@@ -40,35 +40,15 @@ class WPPR_Latest_Products_Widget extends WPPR_Widget_Abstract {
40
  register_widget( 'WPPR_Latest_Products_Widget' );
41
  }
42
 
43
- /**
44
- * Method for loading admin widget assets.
45
- *
46
- * @since 3.0.0
47
- * @access public
48
- */
49
- public function adminAssets() {
50
- if ( is_admin() ) {
51
- wp_enqueue_style( WPPR_SLUG . '-widget-admin-css', WPPR_URL . '/assets/css/cwppos-widget-admin.css', array(), WPPR_LITE_VERSION );
52
-
53
- wp_register_script( WPPR_SLUG . '-widget-script-latest', WPPR_URL . '/assets/js/widget-latest.js', array(), WPPR_LITE_VERSION );
54
- wp_localize_script(
55
- WPPR_SLUG . '-widget-script-latest', 'wppr_widget_localized_data', array(
56
- 'widgetName' => $this->id_base,
57
- 'imageCheckbox' => $this->get_field_id( 'show_image' ),
58
- 'ratingSelect' => $this->get_field_id( 'cwp_tp_rating_type' ),
59
- )
60
- );
61
- wp_enqueue_script( WPPR_SLUG . '-widget-script-latest' );
62
- }
63
- }
64
-
65
  /**
66
  * Method for displaying the widget on the front end.
67
  *
68
  * @since 3.0.0
69
  * @access public
70
- * @param array $args Arguments for this method.
71
- * @param array $instance Instance array for the widget.
 
 
72
  * @return mixed
73
  */
74
  public function widget( $args, $instance ) {
@@ -76,21 +56,28 @@ class WPPR_Latest_Products_Widget extends WPPR_Widget_Abstract {
76
 
77
  $instance = parent::widget( $args, $instance );
78
 
79
- $reviews = new WPPR_Query_Model();
80
- $post = array();
81
  if ( isset( $instance['cwp_tp_category'] ) && trim( $instance['cwp_tp_category'] ) != '' ) {
82
  $post['category_name'] = $instance['cwp_tp_category'];
83
  }
84
- $order = array();
85
  $order['date'] = 'DESC';
86
 
87
  $results = $reviews->find( $post, $instance['no_items'], array(), $order );
 
 
 
 
88
 
 
 
89
  // before and after widget arguments are defined by themes
90
  echo $args['before_widget'];
91
 
92
  if ( ! empty( $instance['title'] ) ) {
93
- echo $args['before_title'] . $instance['title'] . $args['after_title']; }
 
94
 
95
  include WPPR_PATH . '/includes/public/layouts/widget/' . $instance['cwp_tp_layout'];
96
 
@@ -102,15 +89,39 @@ class WPPR_Latest_Products_Widget extends WPPR_Widget_Abstract {
102
  *
103
  * @since 3.0.0
104
  * @access public
105
- * @param array $instance The instance array for this widget.
 
 
106
  * @return mixed
107
  */
108
  public function form( $instance ) {
109
  $this->adminAssets();
110
 
111
- $instance = parent::form( $instance );
112
  $instance['title'] = __( 'Latest Products', 'wp-product-review' );
113
 
114
  include( WPPR_PATH . '/includes/admin/layouts/widget-admin-tpl.php' );
115
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  }
40
  register_widget( 'WPPR_Latest_Products_Widget' );
41
  }
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  /**
44
  * Method for displaying the widget on the front end.
45
  *
46
  * @since 3.0.0
47
  * @access public
48
+ *
49
+ * @param array $args Arguments for this method.
50
+ * @param array $instance Instance array for the widget.
51
+ *
52
  * @return mixed
53
  */
54
  public function widget( $args, $instance ) {
56
 
57
  $instance = parent::widget( $args, $instance );
58
 
59
+ $reviews = new WPPR_Query_Model();
60
+ $post = array();
61
  if ( isset( $instance['cwp_tp_category'] ) && trim( $instance['cwp_tp_category'] ) != '' ) {
62
  $post['category_name'] = $instance['cwp_tp_category'];
63
  }
64
+ $order = array();
65
  $order['date'] = 'DESC';
66
 
67
  $results = $reviews->find( $post, $instance['no_items'], array(), $order );
68
+ if ( ! empty( $results ) ) {
69
+ $first = reset( $results );
70
+ $first = isset( $first['ID'] ) ? $first['ID'] : 0;
71
+ $review = new WPPR_Review_Model( $first );
72
 
73
+ $this->assets( $review );
74
+ }
75
  // before and after widget arguments are defined by themes
76
  echo $args['before_widget'];
77
 
78
  if ( ! empty( $instance['title'] ) ) {
79
+ echo $args['before_title'] . $instance['title'] . $args['after_title'];
80
+ }
81
 
82
  include WPPR_PATH . '/includes/public/layouts/widget/' . $instance['cwp_tp_layout'];
83
 
89
  *
90
  * @since 3.0.0
91
  * @access public
92
+ *
93
+ * @param array $instance The instance array for this widget.
94
+ *
95
  * @return mixed
96
  */
97
  public function form( $instance ) {
98
  $this->adminAssets();
99
 
100
+ $instance = parent::form( $instance );
101
  $instance['title'] = __( 'Latest Products', 'wp-product-review' );
102
 
103
  include( WPPR_PATH . '/includes/admin/layouts/widget-admin-tpl.php' );
104
  }
105
+
106
+ /**
107
+ * Method for loading admin widget assets.
108
+ *
109
+ * @since 3.0.0
110
+ * @access public
111
+ */
112
+ public function adminAssets() {
113
+ if ( is_admin() ) {
114
+ wp_enqueue_style( WPPR_SLUG . '-widget-admin-css', WPPR_URL . '/assets/css/cwppos-widget-admin.css', array(), WPPR_LITE_VERSION );
115
+
116
+ wp_register_script( WPPR_SLUG . '-widget-script-latest', WPPR_URL . '/assets/js/widget-latest.js', array(), WPPR_LITE_VERSION );
117
+ wp_localize_script(
118
+ WPPR_SLUG . '-widget-script-latest', 'wppr_widget_localized_data', array(
119
+ 'widgetName' => $this->id_base,
120
+ 'imageCheckbox' => $this->get_field_id( 'show_image' ),
121
+ 'ratingSelect' => $this->get_field_id( 'cwp_tp_rating_type' ),
122
+ )
123
+ );
124
+ wp_enqueue_script( WPPR_SLUG . '-widget-script-latest' );
125
+ }
126
+ }
127
  }
includes/admin/widgets/class-wppr-top-products-widget.php CHANGED
@@ -66,12 +66,11 @@ class WPPR_Top_Products_Widget extends WPPR_Widget_Abstract {
66
  * @return mixed
67
  */
68
  public function widget( $args, $instance ) {
69
- $this->assets();
70
 
71
  $instance = parent::widget( $args, $instance );
72
 
73
- $reviews = new WPPR_Query_Model();
74
- $post = array();
75
  if ( isset( $instance['cwp_tp_category'] ) && trim( $instance['cwp_tp_category'] ) != '' ) {
76
  $post['category_name'] = $instance['cwp_tp_category'];
77
  }
@@ -79,7 +78,13 @@ class WPPR_Top_Products_Widget extends WPPR_Widget_Abstract {
79
  $order['rating'] = 'DESC';
80
 
81
  $results = $reviews->find( $post, $instance['no_items'], array(), $order );
 
 
 
 
82
 
 
 
83
  // before and after widget arguments are defined by themes
84
  echo $args['before_widget'];
85
 
66
  * @return mixed
67
  */
68
  public function widget( $args, $instance ) {
 
69
 
70
  $instance = parent::widget( $args, $instance );
71
 
72
+ $reviews = new WPPR_Query_Model();
73
+ $post = array();
74
  if ( isset( $instance['cwp_tp_category'] ) && trim( $instance['cwp_tp_category'] ) != '' ) {
75
  $post['category_name'] = $instance['cwp_tp_category'];
76
  }
78
  $order['rating'] = 'DESC';
79
 
80
  $results = $reviews->find( $post, $instance['no_items'], array(), $order );
81
+ if ( ! empty( $results ) ) {
82
+ $first = reset( $results );
83
+ $first = isset( $first['ID'] ) ? $first['ID'] : 0;
84
+ $review = new WPPR_Review_Model( $first );
85
 
86
+ $this->assets( $review );
87
+ }
88
  // before and after widget arguments are defined by themes
89
  echo $args['before_widget'];
90
 
includes/class-wppr.php CHANGED
@@ -34,7 +34,7 @@ class WPPR {
34
  *
35
  * @since 3.0.0
36
  * @access protected
37
- * @var WPPR_Loader $loader Maintains and registers all hooks for the plugin.
38
  */
39
  protected $loader;
40
 
@@ -43,7 +43,7 @@ class WPPR {
43
  *
44
  * @since 3.0.0
45
  * @access protected
46
- * @var string $plugin_name The string used to uniquely identify this plugin.
47
  */
48
  protected $plugin_name;
49
 
@@ -52,7 +52,7 @@ class WPPR {
52
  *
53
  * @since 3.0.0
54
  * @access protected
55
- * @var string $version The current version of the plugin.
56
  */
57
  protected $version;
58
 
@@ -67,7 +67,7 @@ class WPPR {
67
  */
68
  public function __construct() {
69
  $this->plugin_name = 'wppr';
70
- $this->version = '3.0.1';
71
 
72
  $this->load_dependencies();
73
  $this->set_locale();
@@ -136,6 +136,27 @@ class WPPR {
136
  $this->loader->add_action( 'widgets_init', $plugin_widget_top, 'register' );
137
  }
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  /**
140
  * Register all of the hooks related to the public-facing functionality
141
  * of the plugin.
@@ -147,11 +168,15 @@ class WPPR {
147
 
148
  $plugin_public = new WPPR_Public( $this->get_plugin_name(), $this->get_version() );
149
 
 
 
 
 
 
150
  $this->loader->add_action( 'wp', $plugin_public, 'setup_post' );
151
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'load_review_assets' );
152
  $this->loader->add_action( 'comment_form_logged_in_after', $plugin_public, 'add_comment_fields' );
153
  $this->loader->add_action( 'comment_form_after_fields', $plugin_public, 'add_comment_fields' );
154
- $this->loader->add_action( 'comment_post', $plugin_public, 'save_comment_fields',1 );
155
  $this->loader->add_filter( 'comment_text', $plugin_public, 'show_comment_ratings' );
156
 
157
  $currentTheme = wp_get_theme();
@@ -170,17 +195,6 @@ class WPPR {
170
  $this->loader->run();
171
  }
172
 
173
- /**
174
- * The name of the plugin used to uniquely identify it within the context of
175
- * WordPress and to define internationalization functionality.
176
- *
177
- * @since 3.0.0
178
- * @return string The name of the plugin.
179
- */
180
- public function get_plugin_name() {
181
- return $this->plugin_name;
182
- }
183
-
184
  /**
185
  * The reference to the class that orchestrates the hooks with the plugin.
186
  *
@@ -191,14 +205,4 @@ class WPPR {
191
  return $this->loader;
192
  }
193
 
194
- /**
195
- * Retrieve the version number of the plugin.
196
- *
197
- * @since 3.0.0
198
- * @return string The version number of the plugin.
199
- */
200
- public function get_version() {
201
- return $this->version;
202
- }
203
-
204
  }
34
  *
35
  * @since 3.0.0
36
  * @access protected
37
+ * @var WPPR_Loader $loader Maintains and registers all hooks for the plugin.
38
  */
39
  protected $loader;
40
 
43
  *
44
  * @since 3.0.0
45
  * @access protected
46
+ * @var string $plugin_name The string used to uniquely identify this plugin.
47
  */
48
  protected $plugin_name;
49
 
52
  *
53
  * @since 3.0.0
54
  * @access protected
55
+ * @var string $version The current version of the plugin.
56
  */
57
  protected $version;
58
 
67
  */
68
  public function __construct() {
69
  $this->plugin_name = 'wppr';
70
+ $this->version = '3.0.2';
71
 
72
  $this->load_dependencies();
73
  $this->set_locale();
136
  $this->loader->add_action( 'widgets_init', $plugin_widget_top, 'register' );
137
  }
138
 
139
+ /**
140
+ * The name of the plugin used to uniquely identify it within the context of
141
+ * WordPress and to define internationalization functionality.
142
+ *
143
+ * @since 3.0.0
144
+ * @return string The name of the plugin.
145
+ */
146
+ public function get_plugin_name() {
147
+ return $this->plugin_name;
148
+ }
149
+
150
+ /**
151
+ * Retrieve the version number of the plugin.
152
+ *
153
+ * @since 3.0.0
154
+ * @return string The version number of the plugin.
155
+ */
156
+ public function get_version() {
157
+ return $this->version;
158
+ }
159
+
160
  /**
161
  * Register all of the hooks related to the public-facing functionality
162
  * of the plugin.
168
 
169
  $plugin_public = new WPPR_Public( $this->get_plugin_name(), $this->get_version() );
170
 
171
+ $this->loader->add_action( 'comment_post', $plugin_public, 'save_comment_fields', 1 );
172
+
173
+ if ( is_admin() ) {
174
+ return;
175
+ }
176
  $this->loader->add_action( 'wp', $plugin_public, 'setup_post' );
177
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'load_review_assets' );
178
  $this->loader->add_action( 'comment_form_logged_in_after', $plugin_public, 'add_comment_fields' );
179
  $this->loader->add_action( 'comment_form_after_fields', $plugin_public, 'add_comment_fields' );
 
180
  $this->loader->add_filter( 'comment_text', $plugin_public, 'show_comment_ratings' );
181
 
182
  $currentTheme = wp_get_theme();
195
  $this->loader->run();
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
198
  /**
199
  * The reference to the class that orchestrates the hooks with the plugin.
200
  *
205
  return $this->loader;
206
  }
207
 
 
 
 
 
 
 
 
 
 
 
208
  }
includes/public/class-wppr-public.php CHANGED
@@ -60,7 +60,6 @@ class Wppr_Public {
60
  public function __construct( $plugin_name, $version ) {
61
  $this->plugin_name = $plugin_name;
62
  $this->version = $version;
63
-
64
  }
65
 
66
  /**
@@ -121,7 +120,7 @@ class Wppr_Public {
121
 
122
  global $content_width;
123
  if ( $review->wppr_get_option( 'cwppos_widget_size' ) != '' ) {
124
- $width = $options_model->wppr_get_option( 'cwppos_widget_size' );
125
  } else {
126
  $width = $content_width;
127
  }
@@ -289,7 +288,7 @@ class Wppr_Public {
289
  */
290
  public function display_on_front( $content ) {
291
 
292
- if ( $this->review->is_active() ) {
293
  $output = '';
294
  $visual = 'full';
295
  $review_object = $this->review;
60
  public function __construct( $plugin_name, $version ) {
61
  $this->plugin_name = $plugin_name;
62
  $this->version = $version;
 
63
  }
64
 
65
  /**
120
 
121
  global $content_width;
122
  if ( $review->wppr_get_option( 'cwppos_widget_size' ) != '' ) {
123
+ $width = $review->wppr_get_option( 'cwppos_widget_size' );
124
  } else {
125
  $width = $content_width;
126
  }
288
  */
289
  public function display_on_front( $content ) {
290
 
291
+ if ( $this->review->is_active() && is_singular() ) {
292
  $output = '';
293
  $visual = 'full';
294
  $review_object = $this->review;
includes/public/layouts/default-tpl.php CHANGED
@@ -16,7 +16,7 @@ if ( $sub_title_info != '' ) {
16
  $is_disabled = apply_filters( 'wppr_disable_price_richsnippet', false );
17
  if ( ! $is_disabled ) {
18
  $sub_title_info = '<span>
19
- <span>' . $review['currency'] . $review['price'] . '</span>
20
  </span>';
21
  }
22
  }
16
  $is_disabled = apply_filters( 'wppr_disable_price_richsnippet', false );
17
  if ( ! $is_disabled ) {
18
  $sub_title_info = '<span>
19
+ <span>' . esc_html( $review['price_raw'] ) . '</span>
20
  </span>';
21
  }
22
  }
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.0\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/wp-product-review/issues\n"
7
- "POT-Creation-Date: 2017-08-23 21:03:52+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,7 +24,7 @@ msgstr ""
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
 
27
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:78
28
  msgid "10"
29
  msgstr ""
30
 
@@ -500,18 +500,18 @@ msgstr ""
500
  msgid "Display Product Image :"
501
  msgstr ""
502
 
503
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:55
504
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:94
505
  msgid "Buy Now"
506
  msgstr ""
507
 
508
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:56
509
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:98
510
  msgid "Read Review"
511
  msgstr ""
512
 
513
- #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:74
514
- #: includes/admin/widgets/class-wppr-latest-products-widget.php:112
515
  msgid "Latest Products"
516
  msgstr ""
517
 
@@ -531,7 +531,7 @@ msgstr ""
531
  msgid "This widget displays the top products based on their rating."
532
  msgstr ""
533
 
534
- #: includes/admin/widgets/class-wppr-top-products-widget.php:108
535
  msgid "Top Products"
536
  msgstr ""
537
 
2
  # This file is distributed under the no.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP Product Review Lite 3.0.1\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Codeinwp/wp-product-review/issues\n"
7
+ "POT-Creation-Date: 2017-08-24 13:46:47+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:82
28
  msgid "10"
29
  msgstr ""
30
 
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:98
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:102
510
  msgid "Read Review"
511
  msgstr ""
512
 
513
+ #: includes/admin/widgets/abstract/class-wppr-widget-abstract.php:78
514
+ #: includes/admin/widgets/class-wppr-latest-products-widget.php:101
515
  msgid "Latest Products"
516
  msgstr ""
517
 
531
  msgid "This widget displays the top products based on their rating."
532
  msgstr ""
533
 
534
+ #: includes/admin/widgets/class-wppr-top-products-widget.php:113
535
  msgid "Top Products"
536
  msgstr ""
537
 
readme.txt CHANGED
@@ -67,6 +67,13 @@ 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.1 - 2017-08-23 =
71
 
72
  * Fixed backwards compatibility when using cwppos_show_review.
@@ -313,7 +320,7 @@ Following are the steps to install the WP Product Review
313
  5. You should see WP Product Review Plugin listed. If not, with your FTP program, check the folder to see if it is installed. If it isn?t, upload the file(s) again. If it is, delete the files and upload them again.
314
  6. To turn the WP Product Review on, click Activate.
315
  7. Check your Administration Panels or WordPress blog to see if the Plugin is working.
316
- 8. You can change the plugin options from Tweet Old Posts under settings menu.
317
 
318
  Alternatively you can also follow the following steps to install the WP Product Review plugin
319
 
@@ -322,9 +329,7 @@ Alternatively you can also follow the following steps to install the WP Product
322
  3. Browse the location and select the WP Product Review Plugin and click install now.
323
  4. To turn the WP Product Review Plugin on, click Activate.
324
  5. Check your Administration Panels or WordPress blog to see if the Plugin is working.
325
- 6. You can change the plugin options from Tweet Old Posts under settings menu.
326
-
327
- == Frequently Asked Questions ==
328
 
329
  == Frequently Asked Questions ==
330
 
67
  * fr_FR translation by Jacques Soule of http://wordpress-pour-vous.com/
68
 
69
  == Changelog ==
70
+ = 3.0.2 - 2017-08-24 =
71
+
72
+ * Fixed fatal error with is_active method.
73
+ * Fixed query reviews class.
74
+ * Fixed widget assets loading when there is no review on the page.
75
+
76
+
77
  = 3.0.1 - 2017-08-23 =
78
 
79
  * Fixed backwards compatibility when using cwppos_show_review.
320
  5. You should see WP Product Review Plugin listed. If not, with your FTP program, check the folder to see if it is installed. If it isn?t, upload the file(s) again. If it is, delete the files and upload them again.
321
  6. To turn the WP Product Review on, click Activate.
322
  7. Check your Administration Panels or WordPress blog to see if the Plugin is working.
323
+ 8. You can change the plugin options from WP Product Review under settings menu.
324
 
325
  Alternatively you can also follow the following steps to install the WP Product Review plugin
326
 
329
  3. Browse the location and select the WP Product Review Plugin and click install now.
330
  4. To turn the WP Product Review Plugin on, click Activate.
331
  5. Check your Administration Panels or WordPress blog to see if the Plugin is working.
332
+ 6. You can change the plugin options from WP Product Review under settings menu.
 
 
333
 
334
  == Frequently Asked Questions ==
335
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit5c40f2e3ddcf212342e20cb9e9c96f85::getLoader();
4
 
5
  require_once __DIR__ . '/composer' . '/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitc22c4ded80f60354ba9b7b9e965c89c8::getLoader();
vendor/autoload_52.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
- return ComposerAutoloaderInit5984f4155cc8f9e07970778dcc0ab425::getLoader();
4
 
5
  require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
6
 
7
+ return ComposerAutoloaderInitb2a7c3d6798cbe15aaa8346ad44aa415::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit5c40f2e3ddcf212342e20cb9e9c96f85
6
  {
7
  private static $loader;
8
 
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit5c40f2e3ddcf212342e20cb9e9c96f85
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit5c40f2e3ddcf212342e20cb9e9c96f85', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5c40f2e3ddcf212342e20cb9e9c96f85', 'loadClassLoader'));
25
 
26
  $map = require __DIR__ . '/autoload_namespaces.php';
27
  foreach ($map as $namespace => $path) {
@@ -42,14 +42,14 @@ class ComposerAutoloaderInit5c40f2e3ddcf212342e20cb9e9c96f85
42
 
43
  $includeFiles = require __DIR__ . '/autoload_files.php';
44
  foreach ($includeFiles as $fileIdentifier => $file) {
45
- composerRequire5c40f2e3ddcf212342e20cb9e9c96f85($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
- function composerRequire5c40f2e3ddcf212342e20cb9e9c96f85($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 ComposerAutoloaderInitc22c4ded80f60354ba9b7b9e965c89c8
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitc22c4ded80f60354ba9b7b9e965c89c8', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitc22c4ded80f60354ba9b7b9e965c89c8', '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
+ composerRequirec22c4ded80f60354ba9b7b9e965c89c8($fileIdentifier, $file);
46
  }
47
 
48
  return $loader;
49
  }
50
  }
51
 
52
+ function composerRequirec22c4ded80f60354ba9b7b9e965c89c8($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 ComposerAutoloaderInit5984f4155cc8f9e07970778dcc0ab425 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
@@ -19,9 +19,9 @@ class ComposerAutoloaderInit5984f4155cc8f9e07970778dcc0ab425 {
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit5984f4155cc8f9e07970778dcc0ab425', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit5984f4155cc8f9e07970778dcc0ab425', '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 ComposerAutoloaderInitb2a7c3d6798cbe15aaa8346ad44aa415 {
6
  private static $loader;
7
 
8
  public static function loadClassLoader($class) {
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitb2a7c3d6798cbe15aaa8346ad44aa415', 'loadClassLoader'), true /*, true */);
23
  self::$loader = $loader = new xrstf_Composer52_ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitb2a7c3d6798cbe15aaa8346ad44aa415', 'loadClassLoader'));
25
 
26
  $vendorDir = dirname(dirname(__FILE__));
27
  $baseDir = dirname($vendorDir);
wp-product-review.php CHANGED
@@ -9,13 +9,13 @@
9
  *
10
  * @link https://themeisle.com/
11
  * @since 3.0.0
12
- * @package Wppr
13
  *
14
  * @wordpress-plugin
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.1
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.1' );
71
  define( 'WPPR_PATH', dirname( __FILE__ ) );
72
  define( 'WPPR_SLUG', 'wppr' );
73
  define( 'WPPR_UPSELL_LINK', 'https://themeisle.com/plugins/wp-product-review/' );
@@ -81,12 +81,20 @@ function run_wppr() {
81
  if ( is_readable( $vendor_file ) ) {
82
  require_once $vendor_file;
83
  }
84
- add_filter(
85
- 'themeisle_sdk_products', function ( $products ) {
86
- $products[] = __FILE__;
87
- return $products;
88
- }
89
- );
 
 
 
 
 
 
 
 
90
  }
91
 
92
  require( 'class-wppr-autoloader.php' );
9
  *
10
  * @link https://themeisle.com/
11
  * @since 3.0.0
12
+ * @package WPPR
13
  *
14
  * @wordpress-plugin
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.2
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.0.2' );
71
  define( 'WPPR_PATH', dirname( __FILE__ ) );
72
  define( 'WPPR_SLUG', 'wppr' );
73
  define( 'WPPR_UPSELL_LINK', 'https://themeisle.com/plugins/wp-product-review/' );
81
  if ( is_readable( $vendor_file ) ) {
82
  require_once $vendor_file;
83
  }
84
+ add_filter( 'themeisle_sdk_products', 'wppr_lite_register_sdk' );
85
+ }
86
+
87
+ /**
88
+ * Register product to sdk.
89
+ *
90
+ * @param array $products Array of products.
91
+ *
92
+ * @return array Products registered to sdk.
93
+ */
94
+ function wppr_lite_register_sdk( $products ) {
95
+ $products[] = __FILE__;
96
+
97
+ return $products;
98
  }
99
 
100
  require( 'class-wppr-autoloader.php' );