Google Reviews Widget - Version 1.6

Version Description

  • Feature: Added pagination
  • Feature: Get business photo for place
  • Feature: Added maximum width and height options
  • Improve: Added compatibility with WP multisite
  • Improve: Added checking of Google API key
  • Bugfix: change DB.google_review.language size to 10 characters
  • Bugfix: corrected time ago messages
Download this release

Release Info

Developer richplugins
Plugin Icon 128x128 Google Reviews Widget
Version 1.6
Comparing to
See all releases

Code changes from version 1.5.9 to 1.6

grw-options.php CHANGED
@@ -37,18 +37,10 @@
37
  </label>
38
  </div>
39
  </div>
40
- <div class="form-group rplg-disabled">
41
  <div class="col-sm-12">
42
- <?php echo grw_i('Pagination'); ?>
43
- <select class="form-control" disabled >
44
- <option value=""><?php echo grw_i('Disable'); ?></option>
45
- <option value="10"><?php echo grw_i('10'); ?></option>
46
- <option value="5"><?php echo grw_i('5'); ?></option>
47
- <option value="4"><?php echo grw_i('4'); ?></option>
48
- <option value="3"><?php echo grw_i('3'); ?></option>
49
- <option value="2"><?php echo grw_i('2'); ?></option>
50
- <option value="1"><?php echo grw_i('1'); ?></option>
51
- </select>
52
  </div>
53
  </div>
54
  <div class="form-group rplg-disabled">
@@ -155,30 +147,26 @@
155
  </select>
156
  </div>
157
  </div>
158
- <div class="form-group">
159
- <div class="rplg-pro">
160
- <?php echo grw_i('<b>Slider</b>, <b>Grid</b>, <b>Badge</b> themes and other features are available in Google Reviews Business plugin: '); ?>
161
- <a href="https://richplugins.com/google-reviews-pro-wordpress-plugin" target="_blank">
162
- <?php echo grw_i('Upgrade to Business'); ?>
163
- </a>
164
- </div>
165
- </div>
166
- <?php if (isset($max_width)) { ?>
167
  <div class="form-group">
168
  <div class="col-sm-12">
169
  <label for="<?php echo $this->get_field_id('max_width'); ?>"><?php echo grw_i('Maximum width'); ?></label>
170
- <input id="<?php echo $this->get_field_id('max_width'); ?>" name="<?php echo $this->get_field_name('max_width'); ?>" class="form-control" type="text" placeholder="for instance: 300px" />
171
  </div>
172
  </div>
173
- <?php } ?>
174
- <?php if (isset($max_height)) { ?>
175
  <div class="form-group">
176
  <div class="col-sm-12">
177
  <label for="<?php echo $this->get_field_id('max_height'); ?>"><?php echo grw_i('Maximum height'); ?></label>
178
- <input id="<?php echo $this->get_field_id('max_height'); ?>" name="<?php echo $this->get_field_name('max_height'); ?>" class="form-control" type="text" placeholder="for instance: 500px" />
 
 
 
 
 
 
 
 
179
  </div>
180
  </div>
181
- <?php } ?>
182
  </div>
183
 
184
  <!-- Slider Options -->
37
  </label>
38
  </div>
39
  </div>
40
+ <div class="form-group">
41
  <div class="col-sm-12">
42
+ <label><?php echo grw_i('Pagination'); ?></label>
43
+ <input type="text" id="<?php echo $this->get_field_id('pagination'); ?>" name="<?php echo $this->get_field_name('pagination'); ?>" value="<?php echo $pagination; ?>" placeholder="5" class="form-control"/>
 
 
 
 
 
 
 
 
44
  </div>
45
  </div>
46
  <div class="form-group rplg-disabled">
147
  </select>
148
  </div>
149
  </div>
 
 
 
 
 
 
 
 
 
150
  <div class="form-group">
151
  <div class="col-sm-12">
152
  <label for="<?php echo $this->get_field_id('max_width'); ?>"><?php echo grw_i('Maximum width'); ?></label>
153
+ <input id="<?php echo $this->get_field_id('max_width'); ?>" name="<?php echo $this->get_field_name('max_width'); ?>" value="<?php echo $max_width; ?>" class="form-control" type="text" placeholder="for instance: 300px" />
154
  </div>
155
  </div>
 
 
156
  <div class="form-group">
157
  <div class="col-sm-12">
158
  <label for="<?php echo $this->get_field_id('max_height'); ?>"><?php echo grw_i('Maximum height'); ?></label>
159
+ <input id="<?php echo $this->get_field_id('max_height'); ?>" name="<?php echo $this->get_field_name('max_height'); ?>" value="<?php echo $max_height; ?>" class="form-control" type="text" placeholder="for instance: 500px" />
160
+ </div>
161
+ </div>
162
+ <div class="form-group">
163
+ <div class="rplg-pro">
164
+ <?php echo grw_i('<b>Slider</b>, <b>Grid</b>, <b>Badge</b> themes and other features are available in Google Reviews Business plugin: '); ?>
165
+ <a href="https://richplugins.com/google-reviews-pro-wordpress-plugin" target="_blank">
166
+ <?php echo grw_i('Upgrade to Business'); ?>
167
+ </a>
168
  </div>
169
  </div>
 
170
  </div>
171
 
172
  <!-- Slider Options -->
grw-reviews-helper.php CHANGED
@@ -2,9 +2,7 @@
2
  function grw_place($rating, $place, $reviews, $dark_theme, $show_powered = true) {
3
  ?>
4
  <div class="wp-google-left">
5
- <?php
6
- $place_img = $place->icon;
7
- ?>
8
  <img src="<?php echo $place_img; ?>" alt="<?php echo $place->name; ?>">
9
  </div>
10
  <div class="wp-google-right">
@@ -25,7 +23,7 @@ function grw_place($rating, $place, $reviews, $dark_theme, $show_powered = true)
25
  <?php
26
  }
27
 
28
- function grw_place_reviews($place, $reviews, $place_id, $text_size) {
29
  ?>
30
  <div class="wp-google-reviews">
31
  <?php
@@ -33,8 +31,11 @@ function grw_place_reviews($place, $reviews, $place_id, $text_size) {
33
  if (count($reviews) > 0) {
34
  $i = 0;
35
  foreach ($reviews as $review) {
 
 
 
36
  ?>
37
- <div class="wp-google-review">
38
  <div class="wp-google-left">
39
  <?php
40
  if (strlen($review->profile_photo_url) > 0) {
@@ -70,8 +71,14 @@ function grw_place_reviews($place, $reviews, $place_id, $text_size) {
70
  }
71
  ?>
72
  </div>
73
- <?php $seeAllReviews = grw_i('See All Reviews'); grw_anchor($place->url, 'wp-google-url', $seeAllReviews, true, true); ?>
74
- <?php
 
 
 
 
 
 
75
  }
76
 
77
  function grw_stars($rating) {
2
  function grw_place($rating, $place, $reviews, $dark_theme, $show_powered = true) {
3
  ?>
4
  <div class="wp-google-left">
5
+ <?php $place_img = strlen($place->photo) > 0 ? $place->photo : $place->icon; ?>
 
 
6
  <img src="<?php echo $place_img; ?>" alt="<?php echo $place->name; ?>">
7
  </div>
8
  <div class="wp-google-right">
23
  <?php
24
  }
25
 
26
+ function grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination) {
27
  ?>
28
  <div class="wp-google-reviews">
29
  <?php
31
  if (count($reviews) > 0) {
32
  $i = 0;
33
  foreach ($reviews as $review) {
34
+ if ($pagination > 0 && $pagination <= $i++) {
35
+ $hr = true;
36
+ }
37
  ?>
38
+ <div class="wp-google-review<?php if ($hr) { ?> wp-google-hide<?php } ?>">
39
  <div class="wp-google-left">
40
  <?php
41
  if (strlen($review->profile_photo_url) > 0) {
71
  }
72
  ?>
73
  </div>
74
+ <?php if ($pagination > 0 && $hr) { ?>
75
+ <a class="wp-google-url" href="#" onclick="return rplg_next_reviews.call(this, 'google', <?php echo $pagination; ?>);">
76
+ <?php echo grw_i('Next Reviews'); ?>
77
+ </a>
78
+ <?php } else {
79
+ $seeAllReviews = grw_i('See All Reviews');
80
+ grw_anchor($place->url, 'wp-google-url', $seeAllReviews, true, true);
81
+ }
82
  }
83
 
84
  function grw_stars($rating) {
grw-reviews.php CHANGED
@@ -63,7 +63,7 @@ $rating = number_format((float)$rating, 1, '.', '');
63
  <div class="wp-google-body"></div>
64
  <div class="wp-google-content">
65
  <div class="wp-google-content-inner">
66
- <?php grw_place_reviews($place, $reviews, $place_id, $text_size); ?>
67
  </div>
68
  </div>
69
  <div class="wp-google-footer">
@@ -75,13 +75,13 @@ $rating = number_format((float)$rating, 1, '.', '');
75
 
76
  <?php } else { ?>
77
 
78
- <div class="wp-gr wpac">
79
  <div class="wp-google-list<?php if ($dark_theme) { ?> wp-dark<?php } ?>">
80
  <div class="wp-google-place">
81
  <?php grw_place($rating, $place, $reviews, $dark_theme); ?>
82
  </div>
83
  <div class="wp-google-content-inner">
84
- <?php grw_place_reviews($place, $reviews, $place_id, $text_size); ?>
85
  </div>
86
  </div>
87
  </div>
63
  <div class="wp-google-body"></div>
64
  <div class="wp-google-content">
65
  <div class="wp-google-content-inner">
66
+ <?php grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination); ?>
67
  </div>
68
  </div>
69
  <div class="wp-google-footer">
75
 
76
  <?php } else { ?>
77
 
78
+ <div class="wp-gr wpac" style="<?php if (isset($max_width) && strlen($max_width) > 0) { ?>max-width:<?php echo $max_width;?>!important;<?php } ?><?php if (isset($max_height) && strlen($max_height) > 0) { ?>max-height:<?php echo $max_height;?>!important;overflow-y:auto!important;<?php } ?>">
79
  <div class="wp-google-list<?php if ($dark_theme) { ?> wp-dark<?php } ?>">
80
  <div class="wp-google-place">
81
  <?php grw_place($rating, $place, $reviews, $dark_theme); ?>
82
  </div>
83
  <div class="wp-google-content-inner">
84
+ <?php grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination); ?>
85
  </div>
86
  </div>
87
  </div>
grw-setting.php CHANGED
@@ -42,12 +42,7 @@ if (!empty($_POST)) {
42
 
43
  // Reset
44
  if (isset($_POST['reset'])) {
45
- foreach (grw_options() as $opt) {
46
- delete_option($opt);
47
- }
48
- if (isset($_POST['reset_db'])) {
49
- grw_reset_db();
50
- }
51
  unset($_POST);
52
  ?>
53
  <div class="wrap">
@@ -114,23 +109,38 @@ if (isset($_POST['grw_active']) && isset($_GET['grw_active'])) {
114
  }
115
 
116
  if (isset($_POST['grw_setting'])) {
117
- update_option('grw_google_api_key', $_POST['grw_google_api_key']);
118
  update_option('grw_language', $_POST['grw_language']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
  if (isset($_POST['grw_install_db'])) {
122
  grw_install_db();
123
  }
124
 
 
 
 
 
 
 
125
  wp_enqueue_script('jquery');
126
 
127
  wp_register_script('twitter_bootstrap3_js', plugins_url('/static/js/bootstrap.min.js', __FILE__));
128
  wp_enqueue_script('twitter_bootstrap3_js', plugins_url('/static/js/bootstrap.min.js', __FILE__));
129
- wp_register_style('twitter_bootstrap3_css', plugins_url('/static/css/bootstrap.min.css', __FILE__));
130
- wp_enqueue_style('twitter_bootstrap3_css', plugins_url('/static/css/bootstrap.min.css', __FILE__));
131
-
132
- wp_register_style('grw_setting_css', plugins_url('/static/css/grw-setting.css', __FILE__));
133
- wp_enqueue_style('grw_setting_css', plugins_url('/static/css/grw-setting.css', __FILE__));
134
 
135
  $grw_enabled = get_option('grw_active') == '1';
136
  $grw_google_api_key = get_option('grw_google_api_key');
@@ -141,10 +151,10 @@ $grw_language = get_option('grw_language');
141
  <div class="grw-setting container-fluid">
142
  <img src="<?php echo GRW_PLUGIN_URL . '/static/img/google.png'; ?>" alt="Google">
143
  <ul class="nav nav-tabs" role="tablist">
144
- <li role="presentation" class="active">
145
  <a href="#about" aria-controls="about" role="tab" data-toggle="tab"><?php echo grw_i('About'); ?></a>
146
  </li>
147
- <li role="presentation">
148
  <a href="#setting" aria-controls="setting" role="tab" data-toggle="tab"><?php echo grw_i('Setting'); ?></a>
149
  </li>
150
  <li role="presentation">
@@ -155,7 +165,7 @@ $grw_language = get_option('grw_language');
155
  </li>
156
  </ul>
157
  <div class="tab-content">
158
- <div role="tabpanel" class="tab-pane active" id="about">
159
  <div class="row">
160
  <div class="col-sm-6">
161
  <h4><?php echo grw_i('Google Reviews Widget for WordPress'); ?></h4>
@@ -235,7 +245,7 @@ $grw_language = get_option('grw_language');
235
  <p>* Moderation G+ reviews</p>
236
  <p>* Priority support</p>
237
  </div>
238
- <div role="tabpanel" class="tab-pane" id="setting">
239
  <h4><?php echo grw_i('Google Reviews Widget Setting'); ?></h4>
240
  <!-- Configuration form -->
241
  <form method="POST" enctype="multipart/form-data">
@@ -243,6 +253,12 @@ $grw_language = get_option('grw_language');
243
  <div class="form-group">
244
  <label class="control-label" for="grw_google_api_key"><?php echo grw_i('Google API Places Key'); ?></label>
245
  <input class="form-control" type="text" id="grw_google_api_key" name="grw_google_api_key" value="<?php echo esc_attr($grw_google_api_key); ?>">
 
 
 
 
 
 
246
  <small>
247
  Instruction to get Google Places API server key:<br>
248
  1. Go to <a href="https://developers.google.com/places/web-service/get-api-key" target="_blank">Google Places API</a><br>
42
 
43
  // Reset
44
  if (isset($_POST['reset'])) {
45
+ grw_reset(isset($_POST['reset_db']));
 
 
 
 
 
46
  unset($_POST);
47
  ?>
48
  <div class="wrap">
109
  }
110
 
111
  if (isset($_POST['grw_setting'])) {
 
112
  update_option('grw_language', $_POST['grw_language']);
113
+
114
+ $grw_google_api_key = $_POST['grw_google_api_key'];
115
+ if (strlen($grw_google_api_key) > 0) {
116
+ $test_url = "https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ3TH9CwFZwokRIvNO1SP0WLg&key=" . $grw_google_api_key;
117
+ $test_response = rplg_urlopen($test_url);
118
+ $test_response_data = $test_response['data'];
119
+ $test_response_json = rplg_json_decode($test_response_data);
120
+ if (isset($test_response_json->error_message) && strlen($test_response_json->error_message) > 0) {
121
+ $grw_google_api_key_error = $test_response_json->error_message;
122
+ }
123
+ update_option('grw_google_api_key', $grw_google_api_key);
124
+ }
125
+ $grw_setting_page = true;
126
+ } else {
127
+ $grw_setting_page = false;
128
  }
129
 
130
  if (isset($_POST['grw_install_db'])) {
131
  grw_install_db();
132
  }
133
 
134
+ wp_register_style('twitter_bootstrap3_css', plugins_url('/static/css/bootstrap.min.css', __FILE__));
135
+ wp_enqueue_style('twitter_bootstrap3_css', plugins_url('/static/css/bootstrap.min.css', __FILE__));
136
+
137
+ wp_register_style('rplg_setting_css', plugins_url('/static/css/rplg-setting.css', __FILE__));
138
+ wp_enqueue_style('rplg_setting_css', plugins_url('/static/css/rplg-setting.css', __FILE__));
139
+
140
  wp_enqueue_script('jquery');
141
 
142
  wp_register_script('twitter_bootstrap3_js', plugins_url('/static/js/bootstrap.min.js', __FILE__));
143
  wp_enqueue_script('twitter_bootstrap3_js', plugins_url('/static/js/bootstrap.min.js', __FILE__));
 
 
 
 
 
144
 
145
  $grw_enabled = get_option('grw_active') == '1';
146
  $grw_google_api_key = get_option('grw_google_api_key');
151
  <div class="grw-setting container-fluid">
152
  <img src="<?php echo GRW_PLUGIN_URL . '/static/img/google.png'; ?>" alt="Google">
153
  <ul class="nav nav-tabs" role="tablist">
154
+ <li role="presentation"<?php if (!$grw_setting_page) { ?> class="active"<?php } ?>>
155
  <a href="#about" aria-controls="about" role="tab" data-toggle="tab"><?php echo grw_i('About'); ?></a>
156
  </li>
157
+ <li role="presentation"<?php if ($grw_setting_page) { ?> class="active"<?php } ?>>
158
  <a href="#setting" aria-controls="setting" role="tab" data-toggle="tab"><?php echo grw_i('Setting'); ?></a>
159
  </li>
160
  <li role="presentation">
165
  </li>
166
  </ul>
167
  <div class="tab-content">
168
+ <div role="tabpanel" class="tab-pane<?php if (!$grw_setting_page) { ?> active<?php } ?>" id="about">
169
  <div class="row">
170
  <div class="col-sm-6">
171
  <h4><?php echo grw_i('Google Reviews Widget for WordPress'); ?></h4>
245
  <p>* Moderation G+ reviews</p>
246
  <p>* Priority support</p>
247
  </div>
248
+ <div role="tabpanel" class="tab-pane<?php if ($grw_setting_page) { ?> active<?php } ?>" id="setting">
249
  <h4><?php echo grw_i('Google Reviews Widget Setting'); ?></h4>
250
  <!-- Configuration form -->
251
  <form method="POST" enctype="multipart/form-data">
253
  <div class="form-group">
254
  <label class="control-label" for="grw_google_api_key"><?php echo grw_i('Google API Places Key'); ?></label>
255
  <input class="form-control" type="text" id="grw_google_api_key" name="grw_google_api_key" value="<?php echo esc_attr($grw_google_api_key); ?>">
256
+ <?php if (isset($grw_google_api_key_error)) {?>
257
+ <div class="alert alert-dismissible alert-danger">
258
+ The Google API Key is wrong, error message: <?php echo $grw_google_api_key_error; ?><br>
259
+ Please get the correct key by instruction below ↓
260
+ </div>
261
+ <?php } ?>
262
  <small>
263
  Instruction to get Google Places API server key:<br>
264
  1. Go to <a href="https://developers.google.com/places/web-service/get-api-key" target="_blank">Google Places API</a><br>
grw-widget.php CHANGED
@@ -21,6 +21,9 @@ class Goog_Reviews_Widget extends WP_Widget {
21
  'text_size' => '',
22
  'dark_theme' => '',
23
  'view_mode' => '',
 
 
 
24
  'open_link' => true,
25
  'nofollow_link' => true,
26
  'reviews_lang' => '',
@@ -48,25 +51,21 @@ class Goog_Reviews_Widget extends WP_Widget {
48
  function grw_widget_scripts($hook) {
49
  if ($hook == 'widgets.php' || ($hook == 'customize.php' && defined('SITEORIGIN_PANELS_VERSION'))) {
50
 
 
 
 
51
  wp_enqueue_script('jquery');
52
 
53
  wp_register_script('wpac_js', plugins_url('/static/js/wpac.js', __FILE__));
54
  wp_enqueue_script('wpac_js', plugins_url('/static/js/wpac.js', __FILE__));
55
 
56
- $finder_vars = array(
 
57
  'GOOGLE_AVATAR' => GRW_GOOGLE_AVATAR,
58
  'handlerUrl' => admin_url('options-general.php?page=grw'),
59
  'actionPrefix' => 'grw'
60
- );
61
- wp_register_script('grw_finder_js', plugins_url('/static/js/grw-finder.js', __FILE__));
62
- wp_localize_script('grw_finder_js', 'grwVars', $finder_vars );
63
  wp_enqueue_script('grw_finder_js', plugins_url('/static/js/grw-finder.js', __FILE__));
64
-
65
- wp_register_style('grw_widget_css', plugins_url('/static/css/grw-widget.css', __FILE__));
66
- wp_enqueue_style('grw_widget_css', plugins_url('/static/css/grw-widget.css', __FILE__));
67
-
68
- wp_register_style('rplg_css', plugins_url('/static/css/rplg.css', __FILE__));
69
- wp_enqueue_style('rplg_css', plugins_url('/static/css/rplg.css', __FILE__));
70
  }
71
  }
72
 
21
  'text_size' => '',
22
  'dark_theme' => '',
23
  'view_mode' => '',
24
+ 'pagination' => '',
25
+ 'max_width' => '',
26
+ 'max_height' => '',
27
  'open_link' => true,
28
  'nofollow_link' => true,
29
  'reviews_lang' => '',
51
  function grw_widget_scripts($hook) {
52
  if ($hook == 'widgets.php' || ($hook == 'customize.php' && defined('SITEORIGIN_PANELS_VERSION'))) {
53
 
54
+ wp_register_style('rplg_wp_css', plugins_url('/static/css/rplg-wp.css', __FILE__));
55
+ wp_enqueue_style('rplg_wp_css', plugins_url('/static/css/rplg-wp.css', __FILE__));
56
+
57
  wp_enqueue_script('jquery');
58
 
59
  wp_register_script('wpac_js', plugins_url('/static/js/wpac.js', __FILE__));
60
  wp_enqueue_script('wpac_js', plugins_url('/static/js/wpac.js', __FILE__));
61
 
62
+ wp_register_script('grw_finder_js', plugins_url('/static/js/grw-finder.js', __FILE__));
63
+ wp_localize_script('grw_finder_js', 'grwVars', array(
64
  'GOOGLE_AVATAR' => GRW_GOOGLE_AVATAR,
65
  'handlerUrl' => admin_url('options-general.php?page=grw'),
66
  'actionPrefix' => 'grw'
67
+ ));
 
 
68
  wp_enqueue_script('grw_finder_js', plugins_url('/static/js/grw-finder.js', __FILE__));
 
 
 
 
 
 
69
  }
70
  }
71
 
grw.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Reviews Widget
4
  Plugin URI: https://richplugins.com/google-reviews-pro-wordpress-plugin
5
  Description: Instantly Google Places Reviews on your website to increase user confidence and SEO.
6
  Author: RichPlugins <support@richplugins.com>
7
- Version: 1.5.9
8
  Author URI: https://richplugins.com
9
  */
10
 
@@ -13,7 +13,7 @@ require(ABSPATH . 'wp-includes/version.php');
13
  include_once(dirname(__FILE__) . '/api/urlopen.php');
14
  include_once(dirname(__FILE__) . '/helper/debug.php');
15
 
16
- define('GRW_VERSION', '1.5.9');
17
  define('GRW_GOOGLE_PLACE_API', 'https://maps.googleapis.com/maps/api/place/');
18
  define('GRW_GOOGLE_AVATAR', 'https://lh3.googleusercontent.com/-8hepWJzFXpE/AAAAAAAAAAI/AAAAAAAAAAA/I80WzYfIxCQ/s64-c/114307615494839964028.jpg');
19
  define('GRW_PLUGIN_URL', plugins_url(basename(plugin_dir_path(__FILE__ )), basename(__FILE__)));
@@ -81,14 +81,14 @@ function grw_plugin_row_meta($input, $file) {
81
  add_filter('plugin_row_meta', 'grw_plugin_row_meta', 10, 2);
82
 
83
  /*-------------------------------- Database --------------------------------*/
84
- function grw_activation() {
85
  if (grw_does_need_update()) {
86
- grw_install();
87
  }
88
  }
89
  register_activation_hook(__FILE__, 'grw_activation');
90
 
91
- function grw_install($allow_db_install=true) {
92
  global $wpdb, $userdata;
93
 
94
  $version = (string)get_option('grw_version');
@@ -97,7 +97,17 @@ function grw_install($allow_db_install=true) {
97
  }
98
 
99
  if ($allow_db_install) {
100
- grw_install_db($version);
 
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
  if (version_compare($version, GRW_VERSION, '=')) {
@@ -114,43 +124,70 @@ function grw_install_db() {
114
 
115
  $charset_collate = $wpdb->get_charset_collate();
116
 
117
- $wpdb->query("CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "grp_google_place (".
118
- "id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,".
119
- "place_id VARCHAR(80) NOT NULL,".
120
- "name VARCHAR(255) NOT NULL,".
121
- "photo VARCHAR(255),".
122
- "icon VARCHAR(255),".
123
- "address VARCHAR(255),".
124
- "rating DOUBLE PRECISION,".
125
- "url VARCHAR(255),".
126
- "website VARCHAR(255),".
127
- "updated BIGINT(20),".
128
- "PRIMARY KEY (`id`),".
129
- "UNIQUE INDEX grp_place_id (`place_id`)".
130
- ") " . $charset_collate . ";");
131
-
132
- $wpdb->query("CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "grp_google_review (".
133
- "id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,".
134
- "google_place_id BIGINT(20) UNSIGNED NOT NULL,".
135
- "hash VARCHAR(40) NOT NULL,".
136
- "rating INTEGER NOT NULL,".
137
- "text VARCHAR(10000),".
138
- "time INTEGER NOT NULL,".
139
- "language VARCHAR(2),".
140
- "author_name VARCHAR(255),".
141
- "author_url VARCHAR(255),".
142
- "profile_photo_url VARCHAR(255),".
143
- "PRIMARY KEY (`id`),".
144
- "UNIQUE INDEX grp_google_review_hash (`hash`),".
145
- "INDEX grp_google_place_id (`google_place_id`)".
146
- ") " . $charset_collate . ";");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
 
149
- function grw_reset_db() {
150
  global $wpdb;
151
 
152
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "grp_google_place;");
153
- $wpdb->query("DROP TABLE " . $wpdb->prefix . "grp_google_review;");
 
 
 
 
 
154
  }
155
 
156
  /*-------------------------------- Request --------------------------------*/
@@ -198,10 +235,14 @@ function grw_request_handler() {
198
 
199
  $response_data = $response['data'];
200
  $response_json = rplg_json_decode($response_data);
 
201
 
 
 
 
202
  }
203
  header('Content-type: text/javascript');
204
- echo json_encode($response_json->results);
205
  die();
206
  }
207
  break;
@@ -219,7 +260,11 @@ function grw_request_handler() {
219
 
220
  $response_data = $response['data'];
221
  $response_json = rplg_json_decode($response_data);
 
222
 
 
 
 
223
  }
224
  header('Content-type: text/javascript');
225
  echo json_encode($response_json->result);
@@ -264,12 +309,16 @@ function grw_save_reviews($place, $min_filter = 0) {
264
 
265
  $google_place_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "grp_google_place WHERE place_id = %s", $place->place_id));
266
  if ($google_place_id) {
267
- $wpdb->update($wpdb->prefix . 'grp_google_place', array('name' => $place->name, 'rating' => $place->rating), array('ID' => $google_place_id));
 
 
 
 
268
  } else {
269
  $wpdb->insert($wpdb->prefix . 'grp_google_place', array(
270
  'place_id' => $place->place_id,
271
  'name' => $place->name,
272
- //'photo' => $place->photo,
273
  'icon' => $place->icon,
274
  'address' => $place->formatted_address,
275
  'rating' => isset($place->rating) ? $place->rating : null,
@@ -323,8 +372,7 @@ function grw_enabled() {
323
  }
324
 
325
  function grw_api_url($placeid, $reviews_lang = '') {
326
- $grw_google_api_key = get_option('grw_google_api_key');
327
- $url = GRW_GOOGLE_PLACE_API . 'details/json?placeid=' . $placeid . '&key=' . $grw_google_api_key;
328
 
329
  $grw_language = strlen($reviews_lang) > 0 ? $reviews_lang : get_option('grw_language');
330
  if (strlen($grw_language) > 0) {
@@ -333,6 +381,26 @@ function grw_api_url($placeid, $reviews_lang = '') {
333
  return $url;
334
  }
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
 
337
  function grw_does_need_update() {
338
  $version = (string)get_option('grw_version');
4
  Plugin URI: https://richplugins.com/google-reviews-pro-wordpress-plugin
5
  Description: Instantly Google Places Reviews on your website to increase user confidence and SEO.
6
  Author: RichPlugins <support@richplugins.com>
7
+ Version: 1.6
8
  Author URI: https://richplugins.com
9
  */
10
 
13
  include_once(dirname(__FILE__) . '/api/urlopen.php');
14
  include_once(dirname(__FILE__) . '/helper/debug.php');
15
 
16
+ define('GRW_VERSION', '1.6');
17
  define('GRW_GOOGLE_PLACE_API', 'https://maps.googleapis.com/maps/api/place/');
18
  define('GRW_GOOGLE_AVATAR', 'https://lh3.googleusercontent.com/-8hepWJzFXpE/AAAAAAAAAAI/AAAAAAAAAAA/I80WzYfIxCQ/s64-c/114307615494839964028.jpg');
19
  define('GRW_PLUGIN_URL', plugins_url(basename(plugin_dir_path(__FILE__ )), basename(__FILE__)));
81
  add_filter('plugin_row_meta', 'grw_plugin_row_meta', 10, 2);
82
 
83
  /*-------------------------------- Database --------------------------------*/
84
+ function grw_activation($network_wide) {
85
  if (grw_does_need_update()) {
86
+ grw_install($network_wide);
87
  }
88
  }
89
  register_activation_hook(__FILE__, 'grw_activation');
90
 
91
+ function grw_install($network_wide, $allow_db_install=true) {
92
  global $wpdb, $userdata;
93
 
94
  $version = (string)get_option('grw_version');
97
  }
98
 
99
  if ($allow_db_install) {
100
+ if (function_exists('is_multisite') && is_multisite() && $network_wide) {
101
+ $current_blog_id = get_current_blog_id();
102
+ $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
103
+ foreach ($blog_ids as $blog_id) {
104
+ switch_to_blog($blog_id);
105
+ grw_install_db();
106
+ }
107
+ switch_to_blog($current_blog_id);
108
+ } else {
109
+ grw_install_db();
110
+ }
111
  }
112
 
113
  if (version_compare($version, GRW_VERSION, '=')) {
124
 
125
  $charset_collate = $wpdb->get_charset_collate();
126
 
127
+ $sql = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "grp_google_place (".
128
+ "id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,".
129
+ "place_id VARCHAR(80) NOT NULL,".
130
+ "name VARCHAR(255) NOT NULL,".
131
+ "photo VARCHAR(255),".
132
+ "icon VARCHAR(255),".
133
+ "address VARCHAR(255),".
134
+ "rating DOUBLE PRECISION,".
135
+ "url VARCHAR(255),".
136
+ "website VARCHAR(255),".
137
+ "updated BIGINT(20),".
138
+ "PRIMARY KEY (`id`),".
139
+ "UNIQUE INDEX grp_place_id (`place_id`)".
140
+ ") " . $charset_collate . ";";
141
+
142
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
143
+
144
+ dbDelta($sql);
145
+
146
+ $sql = "CREATE TABLE IF NOT EXISTS " . $wpdb->prefix . "grp_google_review (".
147
+ "id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,".
148
+ "google_place_id BIGINT(20) UNSIGNED NOT NULL,".
149
+ "hash VARCHAR(40) NOT NULL,".
150
+ "rating INTEGER NOT NULL,".
151
+ "text VARCHAR(10000),".
152
+ "time INTEGER NOT NULL,".
153
+ "language VARCHAR(10),".
154
+ "author_name VARCHAR(255),".
155
+ "author_url VARCHAR(255),".
156
+ "profile_photo_url VARCHAR(255),".
157
+ "PRIMARY KEY (`id`),".
158
+ "UNIQUE INDEX grp_google_review_hash (`hash`),".
159
+ "INDEX grp_google_place_id (`google_place_id`)".
160
+ ") " . $charset_collate . ";";
161
+
162
+ dbDelta($sql);
163
+ }
164
+
165
+ function grw_reset($reset_db) {
166
+ global $wpdb;
167
+
168
+ if (function_exists('is_multisite') && is_multisite()) {
169
+ $current_blog_id = get_current_blog_id();
170
+ $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
171
+ foreach ($blog_ids as $blog_id) {
172
+ switch_to_blog($blog_id);
173
+ grw_reset_data($reset_db);
174
+ }
175
+ switch_to_blog($current_blog_id);
176
+ } else {
177
+ grw_reset_data($reset_db);
178
+ }
179
  }
180
 
181
+ function grw_reset_data($reset_db) {
182
  global $wpdb;
183
 
184
+ foreach (grw_options() as $opt) {
185
+ delete_option($opt);
186
+ }
187
+ if ($reset_db) {
188
+ $wpdb->query("DROP TABLE " . $wpdb->prefix . "grp_google_place;");
189
+ $wpdb->query("DROP TABLE " . $wpdb->prefix . "grp_google_review;");
190
+ }
191
  }
192
 
193
  /*-------------------------------- Request --------------------------------*/
235
 
236
  $response_data = $response['data'];
237
  $response_json = rplg_json_decode($response_data);
238
+ $response_results = $response_json->results;
239
 
240
+ foreach ($response_results as $result) {
241
+ $result->business_photo = grw_business_avatar($result);
242
+ }
243
  }
244
  header('Content-type: text/javascript');
245
+ echo json_encode($response_results);
246
  die();
247
  }
248
  break;
260
 
261
  $response_data = $response['data'];
262
  $response_json = rplg_json_decode($response_data);
263
+ $response_result = $response_json->result;
264
 
265
+ if (isset($response_result)) {
266
+ $response_result->business_photo = grw_business_avatar($response_result);
267
+ }
268
  }
269
  header('Content-type: text/javascript');
270
  echo json_encode($response_json->result);
309
 
310
  $google_place_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM " . $wpdb->prefix . "grp_google_place WHERE place_id = %s", $place->place_id));
311
  if ($google_place_id) {
312
+ $wpdb->update($wpdb->prefix . 'grp_google_place', array(
313
+ 'name' => $place->name,
314
+ 'photo' => grw_business_avatar($place),
315
+ 'rating' => $place->rating
316
+ ), array('ID' => $google_place_id));
317
  } else {
318
  $wpdb->insert($wpdb->prefix . 'grp_google_place', array(
319
  'place_id' => $place->place_id,
320
  'name' => $place->name,
321
+ 'photo' => grw_business_avatar($place),
322
  'icon' => $place->icon,
323
  'address' => $place->formatted_address,
324
  'rating' => isset($place->rating) ? $place->rating : null,
372
  }
373
 
374
  function grw_api_url($placeid, $reviews_lang = '') {
375
+ $url = GRW_GOOGLE_PLACE_API . 'details/json?placeid=' . $placeid . '&key=' . get_option('grw_google_api_key');
 
376
 
377
  $grw_language = strlen($reviews_lang) > 0 ? $reviews_lang : get_option('grw_language');
378
  if (strlen($grw_language) > 0) {
381
  return $url;
382
  }
383
 
384
+ function grw_business_avatar($response_result_json) {
385
+ if (isset($response_result_json->photos)) {
386
+ $request_url = add_query_arg(
387
+ array(
388
+ 'photoreference' => $response_result_json->photos[0]->photo_reference,
389
+ 'key' => get_option('grw_google_api_key'),
390
+ 'maxwidth' => '300',
391
+ 'maxheight' => '300',
392
+ ),
393
+ 'https://maps.googleapis.com/maps/api/place/photo'
394
+ );
395
+ $response = rplg_urlopen($request_url);
396
+ foreach ($response['headers'] as $header) {
397
+ if (strpos($header, 'Location: ') !== false) {
398
+ return str_replace('Location: ', '', $header);
399
+ }
400
+ }
401
+ }
402
+ return null;
403
+ }
404
 
405
  function grw_does_need_update() {
406
  $version = (string)get_option('grw_version');
languages/grw-it_IT.mo ADDED
Binary file
languages/grw-it_IT.po ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Language: it_IT\n"
4
+ "MIME-Version: 1.0\n"
5
+ "Content-Type: text/plain; charset=UTF-8\n"
6
+ "Content-Transfer-Encoding: 8bit\n"
7
+ "X-Generator: Poedit 1.8.11\n"
8
+ "Project-Id-Version: \n"
9
+ "POT-Creation-Date: \n"
10
+ "PO-Revision-Date: \n"
11
+ "Last-Translator: \n"
12
+ "Language-Team: \n"
13
+
14
+ msgid "Google Rating"
15
+ msgstr "Valutazione di Google"
16
+
17
+ msgid "See All Reviews"
18
+ msgstr "Guarda tutte le recensioni"
19
+
20
+ msgid "Google User"
21
+ msgstr "Utente di Google"
22
+
23
+ msgid "read more"
24
+ msgstr "leggi di più"
25
+
26
+ msgid "Next Reviews"
27
+ msgstr "Altre recensioni"
28
+
29
+ msgid "Write a review"
30
+ msgstr "Scrivi una recensione"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://richplugins.com/google-reviews-pro-wordpress-plugin
4
  Tags: google, reviews, google reviews, google places, google places reviews, testimonials, google review widget, google business reviews, slider, google review, review, google place review, google map reviews, google reviews pro, facebook reviews, facebook page reviews, yelp reviews, yelp business reviews
5
  Requires at least: 2.8
6
  Tested up to: 4.9
7
- Stable tag: 1.5.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -73,6 +73,15 @@ Why limit your reviews to just Google Reviews? Check out our other free business
73
 
74
  == Changelog ==
75
 
 
 
 
 
 
 
 
 
 
76
  = 1.5.9 =
77
  * Fixed incorrect messages in the time library
78
  * Added Italian language (it_IT)
4
  Tags: google, reviews, google reviews, google places, google places reviews, testimonials, google review widget, google business reviews, slider, google review, review, google place review, google map reviews, google reviews pro, facebook reviews, facebook page reviews, yelp reviews, yelp business reviews
5
  Requires at least: 2.8
6
  Tested up to: 4.9
7
+ Stable tag: 1.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
73
 
74
  == Changelog ==
75
 
76
+ = 1.6 =
77
+ * Feature: Added pagination
78
+ * Feature: Get business photo for place
79
+ * Feature: Added maximum width and height options
80
+ * Improve: Added compatibility with WP multisite
81
+ * Improve: Added checking of Google API key
82
+ * Bugfix: change DB.google_review.language size to 10 characters
83
+ * Bugfix: corrected time ago messages
84
+
85
  = 1.5.9 =
86
  * Fixed incorrect messages in the time library
87
  * Added Italian language (it_IT)
static/css/grw-widget.css DELETED
@@ -1,164 +0,0 @@
1
- /*-------------------------------- widget options --------------------------------*/
2
- .grw-step {
3
- display: inline-block;
4
- width: 20px;
5
- line-height: 20px;
6
- padding: 2px;
7
- margin: 0 6px 0 0;
8
- text-align: center;
9
- background: #ffe045;
10
- border-radius: 50%;
11
- }
12
-
13
- .grw-places, .grw-reviews {
14
- max-height: 200px;
15
- overflow: auto;
16
- border: 1px solid #f3f3f3;
17
- }
18
-
19
- .grw-place {
20
- margin: 0;
21
- padding: 6px;
22
- cursor: pointer;
23
- }
24
-
25
- .grw-place img {
26
- border: none;
27
- float: left;
28
- height: 40px;
29
- margin-right: 5px;
30
- width: 40px;
31
- width: 20px;
32
- height: 20px;
33
- border-radius: 50%;
34
- }
35
-
36
- .grw-place .media-body {
37
- overflow: hidden;
38
- }
39
-
40
- .grw-place .media-heading {
41
- margin: 0;
42
- padding-right: 6px;
43
- font-size: 13px;
44
- font-weight: bold;
45
- }
46
-
47
- .grw-place .grw-grating {
48
- font-size: 12px;
49
- font-weight: 700;
50
- color: #e7711b;
51
- margin: 0 6px 0 0;
52
- }
53
-
54
- .grw-place .grw-gstars {
55
- padding-left: 7px;
56
- }
57
-
58
- .grw-place small {
59
- display: block;
60
- font-size: 11px;
61
- overflow: hidden;
62
- white-space: nowrap;
63
- text-overflow: ellipsis;
64
- }
65
-
66
- .grw-place:hover {
67
- background-color: #fafafa;
68
- }
69
-
70
- .grw-place.grw-active {
71
- background-color: #eee;
72
- }
73
-
74
- .grw-place .grw-gtime {
75
- color: #999;
76
- font-size: 13px;
77
- text-decoration: none;
78
- }
79
-
80
- .grw-place .grw-gtext {
81
- color: #222;
82
- font-size: 13px;
83
- line-height: 18px;
84
- max-width: 100%;
85
- overflow: hidden;
86
- white-space: pre-wrap;
87
- }
88
-
89
- .grw-five-reviews-note {
90
- margin: 4px 0;
91
- color: #d32323;
92
- text-align: center;
93
- }
94
-
95
- .grw-save-reviews-container {
96
- position: relative;
97
- }
98
-
99
- .grw-tooltip {
100
- position: absolute;
101
- top: 40px;
102
- right: 0;
103
- width: 100%;
104
- color: #333;
105
- outline: none;
106
- border: 1px solid #ccc;
107
- border-color: rgba(0,0,0,.2);
108
- -webkit-border-radius: 2px;
109
- border-radius: 2px;
110
- opacity: 0;
111
- z-index: 99999;
112
- background: #ffe045;
113
- box-shadow: 0 2px 10px rgba(0,0,0,.2);
114
- transition: all .5s ease-in-out;
115
- }
116
-
117
- .grw-tooltip.grw-tooltip-visible {
118
- opacity: 1;
119
- }
120
-
121
- .grw-tooltip .grw-corn1 {
122
- position: absolute;
123
- top: -9px;
124
- right: 16px;
125
- height: 0;
126
- width: 0;
127
- z-index: 1;
128
- border-color: transparent;
129
- border-style: dashed dashed solid;
130
- border-width: 0 8.5px 8.5px;
131
- border-bottom-color: #ccc;
132
- border-bottom-color: rgba(0,0,0,.2);
133
- }
134
-
135
- .grw-tooltip .grw-corn2 {
136
- position: absolute;
137
- top: -8px;
138
- right: 16px;
139
- height: 0;
140
- width: 0;
141
- z-index: 1;
142
- border-color: transparent;
143
- border-bottom-color: #ffe045;
144
- border-style: dashed dashed solid;
145
- border-width: 0 8.5px 8.5px;
146
- }
147
-
148
- .grw-tooltip .grw-text {
149
- padding: 10px;
150
- }
151
-
152
- .grw-tooltip .grw-close {
153
- position: absolute;
154
- top: 6px;
155
- right: 6px;
156
- color: #777;
157
- padding: 2px;
158
- font-size: 22px;
159
- cursor: pointer;
160
- }
161
-
162
- .grw-tooltip .grw-close:hover {
163
- color: #444;
164
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/css/{grw-setting.css → rplg-setting.css} RENAMED
@@ -18,16 +18,30 @@ a:hover {
18
  max-width: 400px;
19
  }
20
 
21
- .grw-setting {
 
 
 
 
 
 
 
 
 
 
 
 
22
  position: relative;
23
  margin: 20px 0 0;
24
  }
25
 
26
- .nav-tabs {
27
- margin: 13px 0 0;
 
 
28
  }
29
 
30
- .version {
31
  position: absolute;
32
  top: 6px;
33
  right: 16px;
@@ -46,23 +60,15 @@ a:hover {
46
  background-color: #999;
47
  }
48
 
49
- .version.pro {
50
  background-color: #00bf54;
51
  }
52
 
53
- .version.business {
54
  background-color: #2196f3;
55
  }
56
 
57
- .twitter > iframe {
58
- vertical-align: bottom !important;
59
- }
60
-
61
- .googleplus > div {
62
- vertical-align: bottom !important;
63
- }
64
-
65
- .grw-shortcode {
66
  width: 100%;
67
  overflow: auto;
68
  border: 0;
@@ -76,6 +82,59 @@ a:hover {
76
  box-shadow: none !important;
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  .bs-sidebar.affix {
80
  position: static
81
  }
@@ -154,45 +213,4 @@ a:hover {
154
  .bs-sidebar.affix,.bs-sidebar.affix-bottom {
155
  width:263px
156
  }
157
- }
158
-
159
- #doc h2, #doc h3, #doc h4, #doc h5 {
160
- padding-top: 40px;
161
- }
162
-
163
- #doc h4:first-child {
164
- padding-top: 0;
165
- }
166
-
167
- #setting input[type="text"], #setting select {
168
- height: 30px;
169
- width: 400px;
170
- padding: 4px;
171
- background: #fff;
172
- box-shadow: none;
173
- border: 1px solid #ccc;
174
- }
175
-
176
- #setting .alert {
177
- max-width: 500px;
178
- word-wrap: break-word;
179
- }
180
-
181
- input[type="checkbox"] {
182
- margin-right: 6px;
183
- vertical-align: baseline !important;
184
- }
185
-
186
- input[type="checkbox"]:checked:before {
187
- margin: 0 !important;
188
- }
189
-
190
- #mod .wp-places,
191
- #mod .wp-reviews {
192
- max-height: none;
193
- border: none;
194
- }
195
-
196
- #shortcode .form {
197
- min-height: 335px;
198
  }
18
  max-width: 400px;
19
  }
20
 
21
+ .nav-tabs {
22
+ margin: 13px 0 0;
23
+ }
24
+
25
+ .twitter > iframe {
26
+ vertical-align: bottom !important;
27
+ }
28
+
29
+ .googleplus > div {
30
+ vertical-align: bottom !important;
31
+ }
32
+
33
+ .rplg-setting {
34
  position: relative;
35
  margin: 20px 0 0;
36
  }
37
 
38
+ .rplg-setting-facebook {
39
+ color: #4267b2;
40
+ font-size: 28px;
41
+ font-weight: 600;
42
  }
43
 
44
+ .rplg-version {
45
  position: absolute;
46
  top: 6px;
47
  right: 16px;
60
  background-color: #999;
61
  }
62
 
63
+ .rplg-version.rplg-pro {
64
  background-color: #00bf54;
65
  }
66
 
67
+ .rplg-version.rplg-business {
68
  background-color: #2196f3;
69
  }
70
 
71
+ .rplg-shortcode {
 
 
 
 
 
 
 
 
72
  width: 100%;
73
  overflow: auto;
74
  border: 0;
82
  box-shadow: none !important;
83
  }
84
 
85
+ #setting input[type="text"], #setting select {
86
+ height: 30px;
87
+ width: 400px;
88
+ padding: 4px;
89
+ background: #fff;
90
+ box-shadow: none;
91
+ border: 1px solid #ccc;
92
+ }
93
+
94
+ #setting .alert {
95
+ max-width: 500px;
96
+ word-wrap: break-word;
97
+ }
98
+
99
+ input[type="checkbox"] {
100
+ margin-right: 6px;
101
+ vertical-align: baseline !important;
102
+ }
103
+
104
+ input[type="checkbox"]:checked:before {
105
+ margin: 0 !important;
106
+ }
107
+
108
+ #shortcode .form {
109
+ min-height: 335px;
110
+ }
111
+
112
+ #shortcode input[type="text"] {
113
+ height: 30px;
114
+ width: 100%;
115
+ padding: 4px;
116
+ }
117
+
118
+ #shortcode textarea {
119
+ width: 100%;
120
+ min-height: 287px;
121
+ font-size: 13px;
122
+ }
123
+
124
+ #mod .wp-places,
125
+ #mod .wp-reviews {
126
+ max-height: none;
127
+ border: none;
128
+ }
129
+
130
+ #doc h2, #doc h3, #doc h4, #doc h5 {
131
+ padding-top: 40px;
132
+ }
133
+
134
+ #doc h4:first-child {
135
+ padding-top: 0;
136
+ }
137
+
138
  .bs-sidebar.affix {
139
  position: static
140
  }
213
  .bs-sidebar.affix,.bs-sidebar.affix-bottom {
214
  width:263px
215
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  }
static/css/rplg-wp.css ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*-------------------------------- WP overrides --------------------------------*/
2
+ .widget-content input[type="text"],
3
+ .widget-content select,
4
+ .widget-content button {
5
+ border-spacing: 0;
6
+ width: 100%;
7
+ clear: both;
8
+ }
9
+
10
+ .widget-content .form-group {
11
+ margin: 10px 0 0;
12
+ }
13
+
14
+ .widget-content .form-group label {
15
+ vertical-align: baseline;
16
+ }
17
+
18
+ .widget-content .form-group img {
19
+ vertical-align: middle;
20
+ }
21
+
22
+ .widget-control-actions {
23
+ position: relative;
24
+ }
25
+
26
+ /*-------------------------------- Commons --------------------------------*/
27
+ .rplg-widget {
28
+ margin: 10px 0;
29
+ }
30
+
31
+ .rplg-options-toggle {
32
+ padding: 10px;
33
+ margin: 10px 0 0;
34
+ cursor: pointer;
35
+ border: 1px solid #dbdbdb;
36
+ background: #eee url('../img/button-down-black.svg') no-repeat right;
37
+ }
38
+
39
+ .rplg-options {
40
+ padding: 0px 4px;
41
+ }
42
+
43
+ .rplg-disabled label,
44
+ .rplg-disabled small {
45
+ opacity: .7;
46
+ }
47
+
48
+ .rplg-pro {
49
+ color: #fff;
50
+ padding: 6px;
51
+ border-radius: 3px;
52
+ background: #00bf54;
53
+ }
54
+
55
+ .rplg-pro a {
56
+ color: #fff;
57
+ text-decoration: underline;
58
+ }
59
+
60
+ /*-------------------------------- google finder --------------------------------*/
61
+ .grw-step {
62
+ display: inline-block;
63
+ width: 20px;
64
+ line-height: 20px;
65
+ padding: 2px;
66
+ margin: 0 6px 0 0;
67
+ text-align: center;
68
+ background: #ffe045;
69
+ border-radius: 50%;
70
+ }
71
+
72
+ #shortcode .grw-step,
73
+ #shortcode .yrw-step {
74
+ width: 28px;
75
+ padding: 4px;
76
+ }
77
+
78
+ .grw-places, .grw-reviews {
79
+ max-height: 200px;
80
+ overflow: auto;
81
+ border: 1px solid #f3f3f3;
82
+ }
83
+
84
+ .grw-place {
85
+ margin: 0;
86
+ padding: 6px;
87
+ cursor: pointer;
88
+ }
89
+
90
+ .grw-place img {
91
+ border: none;
92
+ float: left;
93
+ height: 40px;
94
+ margin-right: 5px;
95
+ width: 40px;
96
+ width: 20px;
97
+ height: 20px;
98
+ border-radius: 50%;
99
+ }
100
+
101
+ .grw-place .media-body {
102
+ overflow: hidden;
103
+ }
104
+
105
+ .grw-place .media-heading {
106
+ margin: 0;
107
+ padding-right: 6px;
108
+ font-size: 13px;
109
+ font-weight: bold;
110
+ }
111
+
112
+ .grw-place .grw-grating {
113
+ font-size: 12px;
114
+ font-weight: 700;
115
+ color: #e7711b;
116
+ margin: 0 6px 0 0;
117
+ }
118
+
119
+ .grw-place .grw-gstars {
120
+ padding-left: 7px;
121
+ }
122
+
123
+ .grw-place small {
124
+ display: block;
125
+ font-size: 11px;
126
+ overflow: hidden;
127
+ white-space: nowrap;
128
+ text-overflow: ellipsis;
129
+ }
130
+
131
+ .grw-place:hover {
132
+ background-color: #fafafa;
133
+ }
134
+
135
+ .grw-place.grw-active {
136
+ background-color: #eee;
137
+ }
138
+
139
+ .grw-place .grw-gtime {
140
+ color: #999;
141
+ font-size: 13px;
142
+ text-decoration: none;
143
+ }
144
+
145
+ .grw-place .grw-gtext {
146
+ color: #222;
147
+ font-size: 13px;
148
+ line-height: 18px;
149
+ max-width: 100%;
150
+ overflow: hidden;
151
+ white-space: pre-wrap;
152
+ }
153
+
154
+ .grw-five-reviews-note {
155
+ margin: 4px 0;
156
+ color: #d32323;
157
+ text-align: center;
158
+ }
159
+
160
+ .grw-save-reviews-container {
161
+ position: relative;
162
+ }
163
+
164
+ .grw-tooltip {
165
+ position: absolute;
166
+ top: 40px;
167
+ right: 0;
168
+ width: 100%;
169
+ color: #333;
170
+ outline: none;
171
+ border: 1px solid #ccc;
172
+ border-color: rgba(0,0,0,.2);
173
+ -webkit-border-radius: 2px;
174
+ border-radius: 2px;
175
+ opacity: 0;
176
+ z-index: 99999;
177
+ background: #ffe045;
178
+ box-shadow: 0 2px 10px rgba(0,0,0,.2);
179
+ transition: all .5s ease-in-out;
180
+ }
181
+
182
+ .grw-tooltip.grw-tooltip-visible {
183
+ opacity: 1;
184
+ }
185
+
186
+ .grw-tooltip .grw-corn1 {
187
+ position: absolute;
188
+ top: -9px;
189
+ right: 16px;
190
+ height: 0;
191
+ width: 0;
192
+ z-index: 1;
193
+ border-color: transparent;
194
+ border-style: dashed dashed solid;
195
+ border-width: 0 8.5px 8.5px;
196
+ border-bottom-color: #ccc;
197
+ border-bottom-color: rgba(0,0,0,.2);
198
+ }
199
+
200
+ .grw-tooltip .grw-corn2 {
201
+ position: absolute;
202
+ top: -8px;
203
+ right: 16px;
204
+ height: 0;
205
+ width: 0;
206
+ z-index: 1;
207
+ border-color: transparent;
208
+ border-bottom-color: #ffe045;
209
+ border-style: dashed dashed solid;
210
+ border-width: 0 8.5px 8.5px;
211
+ }
212
+
213
+ .grw-tooltip .grw-text {
214
+ padding: 10px;
215
+ }
216
+
217
+ .grw-tooltip .grw-close {
218
+ position: absolute;
219
+ top: 6px;
220
+ right: 6px;
221
+ color: #777;
222
+ padding: 2px;
223
+ font-size: 22px;
224
+ cursor: pointer;
225
+ }
226
+
227
+ .grw-tooltip .grw-close:hover {
228
+ color: #444;
229
+ }
230
+
231
+ /*-------------------------------- yelp finder --------------------------------*/
232
+ .yrw-step {
233
+ display: inline-block;
234
+ width: 20px;
235
+ line-height: 20px;
236
+ padding: 2px;
237
+ margin: 0 6px 0 0;
238
+ text-align: center;
239
+ background: #ffe045;
240
+ border-radius: 50%;
241
+ }
242
+
243
+ .yrw-businesses, .yrw-reviews {
244
+ max-height: 200px;
245
+ overflow: auto;
246
+ border: 1px solid #f3f3f3;
247
+ }
248
+
249
+ .yrw-business {
250
+ margin: 0;
251
+ padding: 6px;
252
+ cursor: pointer;
253
+ }
254
+
255
+ .yrw-business img {
256
+ border: none;
257
+ float: left;
258
+ height: 40px;
259
+ margin-right: 5px;
260
+ width: 40px;
261
+ width: 20px;
262
+ height: 20px;
263
+ }
264
+
265
+ .yrw-business .media-body {
266
+ overflow: hidden;
267
+ }
268
+
269
+ .yrw-business .media-heading {
270
+ margin: 0;
271
+ padding-right: 6px;
272
+ font-size: 13px;
273
+ font-weight: bold;
274
+ }
275
+
276
+ .yrw-business .yrw-yrating {
277
+ font-size: 12px;
278
+ font-weight: 700;
279
+ color: #d32323;
280
+ margin: 0 6px 0 0;
281
+ }
282
+
283
+ .yrw-business .yrw-ystars {
284
+ padding-left: 7px;
285
+ }
286
+
287
+ .yrw-business small {
288
+ display: block;
289
+ font-size: 11px;
290
+ overflow: hidden;
291
+ white-space: nowrap;
292
+ text-overflow: ellipsis;
293
+ }
294
+
295
+ .yrw-business:hover {
296
+ background-color: #fafafa;
297
+ }
298
+
299
+ .yrw-business.yrw-active {
300
+ background-color: #eee;
301
+ }
302
+
303
+ .yrw-business .yrw-ytime {
304
+ color: #999;
305
+ font-size: 13px;
306
+ text-decoration: none;
307
+ }
308
+
309
+ .yrw-business .yrw-ytext {
310
+ color: #222;
311
+ font-size: 13px;
312
+ line-height: 18px;
313
+ max-width: 100%;
314
+ overflow: hidden;
315
+ white-space: pre-wrap;
316
+ }
317
+
318
+ .yrw-three-reviews-note {
319
+ margin: 4px 0;
320
+ color: #d32323;
321
+ text-align: center;
322
+ }
323
+
324
+ .yrw-tooltip {
325
+ position: absolute;
326
+ top: 44px;
327
+ right: 0;
328
+ width: 100%;
329
+ color: #333;
330
+ outline: none;
331
+ border: 1px solid #ccc;
332
+ border-color: rgba(0,0,0,.2);
333
+ -webkit-border-radius: 2px;
334
+ border-radius: 2px;
335
+ opacity: 0;
336
+ z-index: 99999;
337
+ background: #ffe045;
338
+ box-shadow: 0 2px 10px rgba(0,0,0,.2);
339
+ transition: all .5s ease-in-out;
340
+ }
341
+
342
+ .yrw-tooltip.yrw-tooltip-visible {
343
+ opacity: 1;
344
+ }
345
+
346
+ .yrw-tooltip .yrw-corn1 {
347
+ position: absolute;
348
+ top: -9px;
349
+ right: 16px;
350
+ height: 0;
351
+ width: 0;
352
+ z-index: 1;
353
+ border-color: transparent;
354
+ border-style: dashed dashed solid;
355
+ border-width: 0 8.5px 8.5px;
356
+ border-bottom-color: #ccc;
357
+ border-bottom-color: rgba(0,0,0,.2);
358
+ }
359
+
360
+ .yrw-tooltip .yrw-corn2 {
361
+ position: absolute;
362
+ top: -8px;
363
+ right: 16px;
364
+ height: 0;
365
+ width: 0;
366
+ z-index: 1;
367
+ border-color: transparent;
368
+ border-bottom-color: #ffe045;
369
+ border-style: dashed dashed solid;
370
+ border-width: 0 8.5px 8.5px;
371
+ }
372
+
373
+ .yrw-tooltip .yrw-text {
374
+ padding: 10px;
375
+ }
376
+
377
+ .yrw-tooltip .yrw-close {
378
+ position: absolute;
379
+ top: 6px;
380
+ right: 6px;
381
+ color: #777;
382
+ padding: 2px;
383
+ font-size: 22px;
384
+ cursor: pointer;
385
+ }
386
+
387
+ .yrw-tooltip .yrw-close:hover {
388
+ color: #444;
389
+ }
390
+
391
+ /*-------------------------------- facebook finder --------------------------------*/
392
+ .fbrev-connect {
393
+ color: #fff;
394
+ padding: 5px;
395
+ border: none;
396
+ background: #4080ff;
397
+ cursor: pointer;
398
+ }
399
+
400
+ .fbrev-connect:hover {
401
+ background: #405fff;
402
+ }
403
+
404
+ #shortcode .fbrev-connect {
405
+ margin-top: 15px;
406
+ }
407
+
408
+ .fbrev-pages .fbrev-page {
409
+ margin: 4px 0;
410
+ padding: 6px;
411
+ border: 1px solid #eee;
412
+ border-radius: 3px;
413
+ cursor: pointer;
414
+ }
415
+
416
+ .fbrev-pages .fbrev-page.active, .fbrev-page:hover {
417
+ background: #eee;
418
+ }
419
+
420
+ .fbrev-pages .fbrev-page-photo {
421
+ width: 32px;
422
+ height: 32px;
423
+ border-radius: 50%;
424
+ vertical-align: middle;
425
+ box-shadow: 0 0 2px rgba(0,0,0,.12),0 2px 4px rgba(0,0,0,.24);
426
+ }
427
+
428
+ .fbrev-pages .fbrev-page-name {
429
+ display: inline-block;
430
+ margin: 4px 16px;
431
+ }
static/css/rplg.css DELETED
@@ -1,58 +0,0 @@
1
- /*-------------------------------- WP overrides --------------------------------*/
2
- .widget-content input[type="text"],
3
- .widget-content select,
4
- .widget-content button {
5
- border-spacing: 0;
6
- width: 100%;
7
- clear: both;
8
- }
9
-
10
- .widget-content .form-group {
11
- margin: 10px 0 0;
12
- }
13
-
14
- .widget-content .form-group label {
15
- vertical-align: baseline;
16
- }
17
-
18
- .widget-content .form-group img {
19
- vertical-align: middle;
20
- }
21
-
22
- .widget-control-actions {
23
- position: relative;
24
- }
25
-
26
- /*-------------------------------- Commons --------------------------------*/
27
- .rplg-widget {
28
- margin: 10px 0;
29
- }
30
-
31
- .rplg-options-toggle {
32
- padding: 10px;
33
- margin: 10px 0 0;
34
- cursor: pointer;
35
- border: 1px solid #dbdbdb;
36
- background: #eee url('../img/button-down-black.svg') no-repeat right;
37
- }
38
-
39
- .rplg-options {
40
- padding: 0px 4px;
41
- }
42
-
43
- .rplg-disabled label,
44
- .rplg-disabled small {
45
- opacity: .7;
46
- }
47
-
48
- .rplg-pro {
49
- color: #fff;
50
- padding: 6px;
51
- border-radius: 3px;
52
- background: #00bf54;
53
- }
54
-
55
- .rplg-pro a {
56
- color: #fff;
57
- text-decoration: underline;
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/js/grw-finder.js CHANGED
@@ -15,15 +15,24 @@ function grw_init(data) {
15
  return false;
16
  }
17
 
 
 
 
 
18
  if (/^ChIJ.*$/.test(queryEl.value)) {
19
  jQuery.get(grw_request_url('reviews'), {
20
  placeid: queryEl.value,
21
  grw_wpnonce: jQuery('#grw_nonce').val()
22
  }, function(place) {
 
 
23
  grw_addPlaces(el, [place], data.cb);
24
  }, 'json');
25
  } else {
26
- grw_textsearch(el, queryEl.value, data.cb);
 
 
 
27
  }
28
  return false;
29
  });
@@ -163,12 +172,13 @@ function grw_jquery_init(el, cb) {
163
  });
164
  }
165
 
166
- function grw_textsearch(el, query, cb) {
167
  jQuery.get(grw_request_url('search'), {
168
  query: query,
169
  grw_wpnonce: jQuery('#grw_nonce').val()
170
  }, function(places) {
171
- grw_addPlaces(el, places, cb);
 
172
  }, 'json');
173
  }
174
 
@@ -286,7 +296,7 @@ function grw_saveReviews(el, place, cb) {
286
  function grw_renderPlace(place) {
287
  return '' +
288
  '<div class="media-left">' +
289
- '<img class="media-object" src="' + place.icon + '" alt="' + place.name + '" style="width:32px;height:32px;">' +
290
  '</div>' +
291
  '<div class="media-body">' +
292
  '<h5 class="media-heading">' + place.name + '</h5>' +
15
  return false;
16
  }
17
 
18
+ searchBtnText = searchBtn.innerHTML;
19
+ searchBtn.disabled = true;
20
+ searchBtn.innerHTML = 'Please wait...';
21
+
22
  if (/^ChIJ.*$/.test(queryEl.value)) {
23
  jQuery.get(grw_request_url('reviews'), {
24
  placeid: queryEl.value,
25
  grw_wpnonce: jQuery('#grw_nonce').val()
26
  }, function(place) {
27
+ searchBtn.disabled = false;
28
+ searchBtn.innerHTML = searchBtnText;
29
  grw_addPlaces(el, [place], data.cb);
30
  }, 'json');
31
  } else {
32
+ grw_textsearch(el, queryEl.value, data.cb, function() {
33
+ searchBtn.disabled = false;
34
+ searchBtn.innerHTML = searchBtnText;
35
+ });
36
  }
37
  return false;
38
  });
172
  });
173
  }
174
 
175
+ function grw_textsearch(el, query, dataCb, cb) {
176
  jQuery.get(grw_request_url('search'), {
177
  query: query,
178
  grw_wpnonce: jQuery('#grw_nonce').val()
179
  }, function(places) {
180
+ cb && cb();
181
+ grw_addPlaces(el, places, dataCb);
182
  }, 'json');
183
  }
184
 
296
  function grw_renderPlace(place) {
297
  return '' +
298
  '<div class="media-left">' +
299
+ '<img class="media-object" src="' + (place.business_photo || place.icon) + '" alt="' + place.name + '" style="width:32px;height:32px;">' +
300
  '</div>' +
301
  '<div class="media-body">' +
302
  '<h5 class="media-heading">' + place.name + '</h5>' +