WP Review - Version 5.0.3

Version Description

Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Review
Version 5.0.3
Comparing to
See all releases

Code changes from version 5.0.2 to 5.0.3

admin/admin.php CHANGED
@@ -35,7 +35,8 @@ function wp_review_admin_style( $hook_suffix ) {
35
 
36
  wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_URI . 'admin/assets/css/admin.css', array( 'wp-color-picker' ) );
37
 
38
- wp_add_inline_style( 'wp-review-admin-style', '.column-wp_review_rating .pro-only-notice { display: none; }' );
 
39
 
40
  wp_enqueue_style( 'magnificPopup', WP_REVIEW_ASSETS . 'css/magnific-popup.css', array(), '1.1.0' );
41
  wp_enqueue_script( 'magnificPopup', WP_REVIEW_ASSETS . 'js/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
35
 
36
  wp_enqueue_style( 'wp-review-admin-style', WP_REVIEW_URI . 'admin/assets/css/admin.css', array( 'wp-color-picker' ) );
37
 
38
+ $inline_css = '.column-wp_review_rating .pro-only-notice, .latestPost-review-wrapper .pro-only-notice { display: none; }';
39
+ wp_add_inline_style( 'wp-review-admin-style', $inline_css );
40
 
41
  wp_enqueue_style( 'magnificPopup', WP_REVIEW_ASSETS . 'css/magnific-popup.css', array(), '1.1.0' );
42
  wp_enqueue_script( 'magnificPopup', WP_REVIEW_ASSETS . 'js/jquery.magnific-popup.min.js', array( 'jquery' ), '1.1.0', true );
admin/metaboxes.php CHANGED
@@ -118,8 +118,8 @@ function wp_review_render_meta_box_item( $post ) {
118
  }
119
 
120
  $global_colors = wp_review_get_global_colors();
121
- $global_color = ! empty( $global_colors['color'] ) ? $global_colors['color'] : '';
122
- $global_inactive_color = ! empty( $global_colors['inactive_color'] ) ? $global_colors['inactive_color'] : '#95bae0';
123
 
124
  /* Retrieve an existing value from the database. */
125
  $custom_colors = get_post_meta( $post->ID, 'wp_review_custom_colors', true );
@@ -143,26 +143,26 @@ function wp_review_render_meta_box_item( $post ) {
143
  $bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
144
 
145
  if ( ! $color ) {
146
- $color = ! empty( $global_colors['color'] ) ? $global_colors['color'] : '';
147
  }
148
  if ( ! $inactive_color ) {
149
- $inactive_color = ! empty( $global_colors['inactive_color'] ) ? $global_colors['inactive_color'] : '#95bae0';
150
  }
151
 
152
  if ( '' == $location ) {
153
  $location = ! empty( $options['location'] ) ? $options['location'] : $default_location;
154
  }
155
  if ( '' == $fontcolor ) {
156
- $fontcolor = ! empty( $global_colors['fontcolor'] ) ? $global_colors['fontcolor'] : '';
157
  }
158
  if ( '' == $bgcolor1 ) {
159
- $bgcolor1 = ! empty( $global_colors['bgcolor1'] ) ? $global_colors['bgcolor1'] : '';
160
  }
161
  if ( '' == $bgcolor2 ) {
162
- $bgcolor2 = ! empty( $global_colors['bgcolor2'] ) ? $global_colors['bgcolor2'] : '';
163
  }
164
  if ( '' == $bordercolor ) {
165
- $bordercolor = ! empty( $global_colors['bordercolor'] ) ? $global_colors['bordercolor'] : '';
166
  }
167
 
168
  $fields = array(
@@ -615,16 +615,26 @@ function wp_review_render_meta_box_desc( $post ) {
615
  <?php
616
  }
617
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
618
  function wp_review_render_meta_box_reviewLinks( $post ) {
619
 
620
  wp_nonce_field( basename( __FILE__ ), 'wp-review-links-options-nonce' );
621
 
622
- function wp_review_get_default_links( $text, $url ) {
623
- return array(
624
- 'text' => $text,
625
- 'url' => $url,
626
- );
627
- }
628
  wp_review_switch_to_main();
629
  $options = get_option( 'wp_review_options' );
630
  if (is_multisite() ) restore_current_blog();
@@ -962,9 +972,9 @@ function wp_review_save_postdata( $post_id, $post ) {
962
  'wp_review_box_template' => filter_input( INPUT_POST, 'wp_review_box_template', FILTER_SANITIZE_STRING ),
963
  );
964
 
965
- $default_colors = wp_review_option( 'colors', array() );
966
- $default_color = ! empty( $default_colors['color'] ) ? $default_colors['color'] : '#333333';
967
- $default_inactive = ! empty( $default_colors['inactive_color'] ) ? $default_colors['inactive_color'] : '#95bae0';
968
 
969
  if ( $meta['wp_review_color'] === $default_color ) {
970
  $meta['wp_review_color'] = '';
@@ -1056,12 +1066,13 @@ function wp_review_clear_query_cache( $post_id, $post ) {
1056
  */
1057
  function wp_review_save_review_items_data( $post_id ) {
1058
  $old = get_post_meta( $post_id, 'wp_review_item', true );
1059
- $global_colors = wp_review_get_global_colors();
1060
- $global_color = ! empty( $global_colors['color'] ) ? $global_colors['color'] : '';
1061
- $global_inactive = ! empty( $global_colors['inactive_color'] ) ? $global_colors['inactive_color'] : '#95bae0';
1062
- $post_color = get_post_meta( $post_id, 'wp_review_color', true );
 
1063
  $post_inactive_color = get_post_meta( $post_id, 'wp_review_inactive_color', true );
1064
- $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1065
 
1066
  if ( ! empty( $_POST['wp_review_item_title'] ) ) {
1067
  $title = $_POST['wp_review_item_title'];
118
  }
119
 
120
  $global_colors = wp_review_get_global_colors();
121
+ $global_color = $global_colors['color'];
122
+ $global_inactive_color = $global_colors['inactive_color'];
123
 
124
  /* Retrieve an existing value from the database. */
125
  $custom_colors = get_post_meta( $post->ID, 'wp_review_custom_colors', true );
143
  $bordercolor = get_post_meta( $post->ID, 'wp_review_bordercolor', true );
144
 
145
  if ( ! $color ) {
146
+ $color = $global_color;
147
  }
148
  if ( ! $inactive_color ) {
149
+ $inactive_color = $global_inactive_color;
150
  }
151
 
152
  if ( '' == $location ) {
153
  $location = ! empty( $options['location'] ) ? $options['location'] : $default_location;
154
  }
155
  if ( '' == $fontcolor ) {
156
+ $fontcolor = $global_colors['fontcolor'];
157
  }
158
  if ( '' == $bgcolor1 ) {
159
+ $bgcolor1 = $global_colors['bgcolor1'];
160
  }
161
  if ( '' == $bgcolor2 ) {
162
+ $bgcolor2 = $global_colors['bgcolor2'];
163
  }
164
  if ( '' == $bordercolor ) {
165
+ $bordercolor = $global_colors['bordercolor'];
166
  }
167
 
168
  $fields = array(
615
  <?php
616
  }
617
 
618
+ /**
619
+ * Maps default link texts and urls.
620
+ *
621
+ * @since 5.0.3 Move this function out of `wp_review_render_meta_box_reviewLinks()`
622
+ *
623
+ * @param string $text Link text.
624
+ * @param string $url Link url.
625
+ * @return array
626
+ */
627
+ function wp_review_get_default_links( $text, $url ) {
628
+ return array(
629
+ 'text' => $text,
630
+ 'url' => $url,
631
+ );
632
+ }
633
+
634
  function wp_review_render_meta_box_reviewLinks( $post ) {
635
 
636
  wp_nonce_field( basename( __FILE__ ), 'wp-review-links-options-nonce' );
637
 
 
 
 
 
 
 
638
  wp_review_switch_to_main();
639
  $options = get_option( 'wp_review_options' );
640
  if (is_multisite() ) restore_current_blog();
972
  'wp_review_box_template' => filter_input( INPUT_POST, 'wp_review_box_template', FILTER_SANITIZE_STRING ),
973
  );
974
 
975
+ $default_colors = wp_review_get_global_colors();
976
+ $default_color = $default_colors['color'];
977
+ $default_inactive = $default_colors['inactive_color'];
978
 
979
  if ( $meta['wp_review_color'] === $default_color ) {
980
  $meta['wp_review_color'] = '';
1066
  */
1067
  function wp_review_save_review_items_data( $post_id ) {
1068
  $old = get_post_meta( $post_id, 'wp_review_item', true );
1069
+ $global_colors = wp_review_get_global_colors();
1070
+ $global_color = $global_colors['color'];
1071
+ $global_inactive = $global_colors['inactive_color'];
1072
+
1073
+ $post_color = get_post_meta( $post_id, 'wp_review_color', true );
1074
  $post_inactive_color = get_post_meta( $post_id, 'wp_review_inactive_color', true );
1075
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
1076
 
1077
  if ( ! empty( $_POST['wp_review_item_title'] ) ) {
1078
  $title = $_POST['wp_review_item_title'];
admin/options/review.php CHANGED
@@ -99,7 +99,7 @@ $link_texts = ! empty( $options['default_link_text'] ) ? $options['default_link_
99
  $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
100
  $location = wp_review_option( 'review_location' );
101
  $color = ! empty( $options['colors']['color'] ) ? $options['colors']['color'] : '';
102
- $inactive_color = ! empty( $options['colors']['inactive_color'] ) ? $options['colors']['inactive_color'] : '#95bae0';
103
  $fontcolor = ! empty( $options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : '';
104
  $bgcolor1 = ! empty( $options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : '';
105
  $bgcolor2 = ! empty( $options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : '';
99
  $link_urls = ! empty( $options['default_link_url'] ) ? $options['default_link_url'] : array();
100
  $location = wp_review_option( 'review_location' );
101
  $color = ! empty( $options['colors']['color'] ) ? $options['colors']['color'] : '';
102
+ $inactive_color = ! empty( $options['colors']['inactive_color'] ) ? $options['colors']['inactive_color'] : '';
103
  $fontcolor = ! empty( $options['colors']['fontcolor'] ) ? $options['colors']['fontcolor'] : '';
104
  $bgcolor1 = ! empty( $options['colors']['bgcolor1'] ) ? $options['colors']['bgcolor1'] : '';
105
  $bgcolor2 = ! empty( $options['colors']['bgcolor2'] ) ? $options['colors']['bgcolor2'] : '';
includes/functions.php CHANGED
@@ -62,8 +62,8 @@ function wp_review_get_global_colors() {
62
  $default_colors = wp_review_get_default_colors();
63
  $fields = array( 'color', 'inactive_color', 'fontcolor', 'bgcolor1', 'bgcolor2', 'bordercolor' );
64
  foreach ( $fields as $key ) {
65
- if ( empty( $colors[ $key ] && ! empty( $default_colors[ $key ] ) ) ) {
66
- $colors[ $key ] = $default_colors[ $key ];
67
  }
68
  }
69
  return $colors;
@@ -2416,13 +2416,13 @@ function wp_review_get_review_items( $post_id = null ) {
2416
  return '';
2417
  }
2418
 
2419
- $global_colors = wp_review_get_global_colors();
2420
- $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
2421
- $post_color = get_post_meta( $post_id, 'wp_review_color', true );
2422
  $post_inactive_color = get_post_meta( $post_id, 'wp_review_inactive_color', true );
2423
 
2424
- $default_color = $custom_colors && $post_color ? $post_color : ( ! empty( $global_colors['color'] ) ? $global_colors['color'] : '' );
2425
- $default_inactive = $custom_colors && $post_inactive_color ? $post_inactive_color : ( ! empty( $global_colors['inactive_color'] ) ? $global_colors['inactive_color'] : '#95bae0' );
2426
  foreach ( $items as $index => $item ) {
2427
  if ( empty( $item['id'] ) || is_numeric( $item['id'] ) ) {
2428
  $items[ $index ]['id'] = sanitize_title( $item['wp_review_item_title'] ) . '_' . wp_generate_password( 6 );
@@ -2597,7 +2597,7 @@ function wp_review_get_reviews_query( $type, $options ) {
2597
  }
2598
 
2599
  $query_args['ignore_sticky_posts'] = true;
2600
- $query_args['post_type'] = 'post';
2601
  $query_args['post_status'] = 'publish';
2602
  $query_args['posts_per_page'] = intval( $options['post_num'] );
2603
  $query_args['paged'] = intval( $options['page'] );
62
  $default_colors = wp_review_get_default_colors();
63
  $fields = array( 'color', 'inactive_color', 'fontcolor', 'bgcolor1', 'bgcolor2', 'bordercolor' );
64
  foreach ( $fields as $key ) {
65
+ if ( empty( $colors[ $key ] ) ) {
66
+ $colors[ $key ] = isset( $default_colors[ $key ] ) ? $default_colors[ $key ] : '';
67
  }
68
  }
69
  return $colors;
2416
  return '';
2417
  }
2418
 
2419
+ $global_colors = wp_review_get_global_colors();
2420
+ $custom_colors = get_post_meta( $post_id, 'wp_review_custom_colors', true );
2421
+ $post_color = get_post_meta( $post_id, 'wp_review_color', true );
2422
  $post_inactive_color = get_post_meta( $post_id, 'wp_review_inactive_color', true );
2423
 
2424
+ $default_color = $custom_colors && $post_color ? $post_color : $global_colors['color'];
2425
+ $default_inactive = $custom_colors && $post_inactive_color ? $post_inactive_color : $global_colors['inactive_color'];
2426
  foreach ( $items as $index => $item ) {
2427
  if ( empty( $item['id'] ) || is_numeric( $item['id'] ) ) {
2428
  $items[ $index ]['id'] = sanitize_title( $item['wp_review_item_title'] ) . '_' . wp_generate_password( 6 );
2597
  }
2598
 
2599
  $query_args['ignore_sticky_posts'] = true;
2600
+ $query_args['post_type'] = isset( $options['post_type'] ) ? $options['post_type'] : 'post';
2601
  $query_args['post_status'] = 'publish';
2602
  $query_args['posts_per_page'] = intval( $options['post_num'] );
2603
  $query_args['paged'] = intval( $options['page'] );
includes/widgets/class-wp-review-tab-widget.php CHANGED
@@ -412,8 +412,9 @@ class WP_Review_Tab_Widget extends WP_Widget {
412
 
413
  // Normal tabs.
414
  $query_args = array(
415
- 'post_num' => $post_num,
416
- 'page' => $page,
 
417
  'review_type' => $review_type,
418
  'clear_cache' => ! empty( $args['clear_cache'] ),
419
  );
412
 
413
  // Normal tabs.
414
  $query_args = array(
415
+ 'post_type' => 'any',
416
+ 'post_num' => $post_num,
417
+ 'page' => $page,
418
  'review_type' => $review_type,
419
  'clear_cache' => ! empty( $args['clear_cache'] ),
420
  );
rating-types/percentage-output.php CHANGED
@@ -24,7 +24,7 @@ if ( ! empty( $rating['args']['class'] ) ) {
24
  $class .= ' ' . sanitize_html_class( $rating['args']['class'] );
25
  }
26
 
27
- $inactive_color = ! empty( $rating['colors']['inactive_color'] ) ? $rating['colors']['inactive_color'] : '#95bae0';
28
  $bar_text_color = ! empty( $rating['colors']['bar_text_color'] ) ? $rating['colors']['bar_text_color'] : $rating['colors']['bgcolor1'];
29
  ?>
30
  <div class="<?php echo esc_attr( $class ); ?>">
24
  $class .= ' ' . sanitize_html_class( $rating['args']['class'] );
25
  }
26
 
27
+ $inactive_color = ! empty( $rating['colors']['inactive_color'] ) ? $rating['colors']['inactive_color'] : '';
28
  $bar_text_color = ! empty( $rating['colors']['bar_text_color'] ) ? $rating['colors']['bar_text_color'] : $rating['colors']['bgcolor1'];
29
  ?>
30
  <div class="<?php echo esc_attr( $class ); ?>">
rating-types/point-output.php CHANGED
@@ -22,7 +22,7 @@ if ( ! empty( $rating['args']['class'] ) ) {
22
  $class .= ' ' . sanitize_html_class( $rating['args']['class'] );
23
  }
24
 
25
- $inactive_color = ! empty( $rating['colors']['inactive_color'] ) ? $rating['colors']['inactive_color'] : '#95bae0';
26
  $bar_text_color = ! empty( $rating['colors']['bar_text_color'] ) ? $rating['colors']['bar_text_color'] : $rating['colors']['bgcolor1'];
27
  ?>
28
  <div class="<?php echo esc_attr( $class ); ?>">
22
  $class .= ' ' . sanitize_html_class( $rating['args']['class'] );
23
  }
24
 
25
+ $inactive_color = ! empty( $rating['colors']['inactive_color'] ) ? $rating['colors']['inactive_color'] : '';
26
  $bar_text_color = ! empty( $rating['colors']['bar_text_color'] ) ? $rating['colors']['bar_text_color'] : $rating['colors']['bgcolor1'];
27
  ?>
28
  <div class="<?php echo esc_attr( $class ); ?>">
rating-types/star-output.php CHANGED
@@ -21,7 +21,7 @@ if ( ! empty( $rating['args']['class'] ) ) {
21
 
22
  $rating_icon = wp_review_get_rating_icon();
23
  $rating_image = wp_review_get_rating_image();
24
- $inactive_color = ! empty( $rating['colors']['inactive_color'] ) ? $rating['colors']['inactive_color'] : '#95bae0';
25
  $rating_value = isset( $rating['value'] ) ? floatval( $rating['value'] ) : 0;
26
  $rating_color = isset( $rating['color'] ) ? $rating['color'] : '';
27
  ?>
21
 
22
  $rating_icon = wp_review_get_rating_icon();
23
  $rating_image = wp_review_get_rating_image();
24
+ $inactive_color = ! empty( $rating['colors']['inactive_color'] ) ? $rating['colors']['inactive_color'] : '';
25
  $rating_value = isset( $rating['value'] ) ? floatval( $rating['value'] ) : 0;
26
  $rating_color = isset( $rating['color'] ) ? $rating['color'] : '';
27
  ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/plugins/wp-review/
4
  Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
5
  Requires at least: 4.0
6
  Tested up to: 4.9.8
7
- Stable tag: 5.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -103,6 +103,12 @@ Please disable all plugins and check if rating is working properly. Then you can
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
 
106
  = v5.0.2 (Sep 14, 2018) =
107
  * Fixed JS Console error on the settings page
108
  * Fixed PHP errors if someone downgrades from premium to free version
4
  Tags: review, wp review, rating, wp rating, user rating, google rating, star rating, product review
5
  Requires at least: 4.0
6
  Tested up to: 4.9.8
7
+ Stable tag: 5.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
103
 
104
  == Changelog ==
105
 
106
+ = v5.0.3 (Sep 17, 2018) =
107
+ * Fixed PHP notice relates to inactive color
108
+ * Fixed wrong inactive color in the review box
109
+ * Fixed custom post types not showing in the review widget
110
+ * Fixed 500 error happening with the Gutenberg
111
+
112
  = v5.0.2 (Sep 14, 2018) =
113
  * Fixed JS Console error on the settings page
114
  * Fixed PHP errors if someone downgrades from premium to free version
wp-review.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Review
4
  * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
  * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
- * Version: 5.0.2
7
  * Author: MyThemesShop
8
  * Author URI: http://mythemeshop.com/
9
  * Text Domain: wp-review
@@ -45,7 +45,7 @@ if ( version_compare( phpversion(), '5.6', '<' ) ) {
45
  }
46
 
47
  /* Plugin version */
48
- define( 'WP_REVIEW_PLUGIN_VERSION', '5.0.2' );
49
 
50
  /* Sets the custom db table name. */
51
  define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );
3
  * Plugin Name: WP Review
4
  * Plugin URI: http://mythemeshop.com/plugins/wp-review/
5
  * Description: Create reviews! Choose from stars, percentages or points for review scores. Supports Retina Display, WPMU and Unlimited Color Schemes.
6
+ * Version: 5.0.3
7
  * Author: MyThemesShop
8
  * Author URI: http://mythemeshop.com/
9
  * Text Domain: wp-review
45
  }
46
 
47
  /* Plugin version */
48
+ define( 'WP_REVIEW_PLUGIN_VERSION', '5.0.3' );
49
 
50
  /* Sets the custom db table name. */
51
  define( 'MTS_WP_REVIEW_DB_TABLE', 'mts_wp_reviews' );