Widgets for Google Reviews - Version 9.6.1

Version Description

Download this release

Release Info

Developer trustindex
Plugin Icon 128x128 Widgets for Google Reviews
Version 9.6.1
Comparing to
See all releases

Code changes from version 9.6 to 9.6.1

readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: google, google places reviews, reviews, widget, google business, review, t
5
  Requires at least: 3.0.1
6
  Tested up to: 6.1
7
  Requires PHP: 5.2
8
- Stable tag: 9.6
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
  Plugin Name: Widgets for Google Reviews
@@ -14,7 +14,7 @@ Plugin URI: https://wordpress.org/plugins/wp-reviews-plugin-for-google/
14
  Author: Trustindex.io <support@trustindex.io>
15
  Author URI: https://www.trustindex.io/
16
  Text Domain: wp-reviews-plugin-for-google
17
- Version: 9.6
18
 
19
  Embed Google reviews fast and easily into your WordPress site. Increase SEO, trust and sales using Google reviews.
20
 
5
  Requires at least: 3.0.1
6
  Tested up to: 6.1
7
  Requires PHP: 5.2
8
+ Stable tag: 9.6.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
  Plugin Name: Widgets for Google Reviews
14
  Author: Trustindex.io <support@trustindex.io>
15
  Author URI: https://www.trustindex.io/
16
  Text Domain: wp-reviews-plugin-for-google
17
+ Version: 9.6.1
18
 
19
  Embed Google reviews fast and easily into your WordPress site. Increase SEO, trust and sales using Google reviews.
20
 
tabs/my_reviews.php CHANGED
@@ -137,7 +137,7 @@ $download_timestamp = get_option($trustindex_pm_google->get_option_name('downloa
137
  <input type="hidden" id="ti-noreg-page-id" value="<?php echo esc_attr($page_details['id']); ?>" />
138
  <input type="hidden" id="ti-noreg-webhook-url" value="<?php echo $trustindex_pm_google->get_webhook_url(); ?>" />
139
  <input type="hidden" id="ti-noreg-email" value="<?php echo get_option('admin_email'); ?>" />
140
- <input type="hidden" id="ti-noreg-version" value="9.6" />
141
  <?php if(isset($page_details['access_token'])): ?>
142
  <input type="hidden" id="ti-noreg-access-token" value="<?php echo esc_attr($page_details['access_token']); ?>" />
143
  <?php endif; ?>
137
  <input type="hidden" id="ti-noreg-page-id" value="<?php echo esc_attr($page_details['id']); ?>" />
138
  <input type="hidden" id="ti-noreg-webhook-url" value="<?php echo $trustindex_pm_google->get_webhook_url(); ?>" />
139
  <input type="hidden" id="ti-noreg-email" value="<?php echo get_option('admin_email'); ?>" />
140
+ <input type="hidden" id="ti-noreg-version" value="9.6.1" />
141
  <?php if(isset($page_details['access_token'])): ?>
142
  <input type="hidden" id="ti-noreg-access-token" value="<?php echo esc_attr($page_details['access_token']); ?>" />
143
  <?php endif; ?>
tabs/setup_no_reg.php CHANGED
@@ -122,7 +122,7 @@ update_option($trustindex_pm_google->get_option_name('review-download-token'), $
122
  <input type="hidden" id="ti-noreg-connect-token" name="ti-noreg-connect-token" value="<?php echo $review_download_token; ?>" />
123
  <input type="hidden" id="ti-noreg-webhook-url" value="<?php echo $trustindex_pm_google->get_webhook_url(); ?>" />
124
  <input type="hidden" id="ti-noreg-email" value="<?php echo get_option('admin_email'); ?>" />
125
- <input type="hidden" id="ti-noreg-version" value="9.6" />
126
  <input type="hidden" id="ti-noreg-review-download" name="review_download" value="0" />
127
  <input type="hidden" id="ti-noreg-review-request-id" name="review_request_id" value="" />
128
  <input type="hidden" id="ti-noreg-manual-download" name="manual_download" value=0 />
@@ -180,9 +180,14 @@ if($id != 54 && in_array($template['type'], [ 'badge', 'button', 'floating', 'po
180
  {
181
  $class_name = 'ti-half-width';
182
  }
 
 
 
 
 
183
  ?>
184
  <div class="<?php echo esc_attr($class_name); ?>">
185
- <div class="ti-box ti-preview-boxes" data-layout-id="<?php echo esc_attr($id); ?>" data-set-id="light-background">
186
  <div class="ti-header">
187
  <span class="ti-header-layout-text">
188
  <?php echo TrustindexPlugin_google::___('Layout'); ?>:
@@ -192,7 +197,7 @@ $class_name = 'ti-half-width';
192
  <div class="clear"></div>
193
  </div>
194
  <div class="preview">
195
- <?php echo str_replace('ti-widget ti-disabled', 'ti-widget', $trustindex_pm_google->get_noreg_list_reviews(null, true, $id, 'light-background', true, true)); ?>
196
  </div>
197
  </div>
198
  </div>
@@ -345,7 +350,7 @@ $widget_has_reviews = !in_array($widget_type, [ 'button', 'badge' ]) || in_array
345
  <label><?php echo TrustindexPlugin_google::___("Hide reviews without comments"); ?></label>
346
  </span>
347
  <?php endif; ?>
348
- <?php if(!in_array($style_id, [ 11, 17, 18, 21, 24, 25, 26, 27, 28, 29, 30, 35, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 ]) && TrustindexPlugin_google::$widget_styles[$scss_set]['_vars']['dots'] !== 'true'): ?>
349
  <span class="ti-checkbox row">
350
  <input type="checkbox" name="no-rating-text" value="1" <?php if($no_rating_text): ?>checked<?php endif;?>>
351
  <label><?php echo TrustindexPlugin_google::___("Hide rating text"); ?></label>
122
  <input type="hidden" id="ti-noreg-connect-token" name="ti-noreg-connect-token" value="<?php echo $review_download_token; ?>" />
123
  <input type="hidden" id="ti-noreg-webhook-url" value="<?php echo $trustindex_pm_google->get_webhook_url(); ?>" />
124
  <input type="hidden" id="ti-noreg-email" value="<?php echo get_option('admin_email'); ?>" />
125
+ <input type="hidden" id="ti-noreg-version" value="9.6.1" />
126
  <input type="hidden" id="ti-noreg-review-download" name="review_download" value="0" />
127
  <input type="hidden" id="ti-noreg-review-request-id" name="review_request_id" value="" />
128
  <input type="hidden" id="ti-noreg-manual-download" name="manual_download" value=0 />
180
  {
181
  $class_name = 'ti-half-width';
182
  }
183
+ $set = 'light-background';
184
+ if(in_array($template['type'], [ 'badge', 'button' ]))
185
+ {
186
+ $set = 'drop-shadow';
187
+ }
188
  ?>
189
  <div class="<?php echo esc_attr($class_name); ?>">
190
+ <div class="ti-box ti-preview-boxes" data-layout-id="<?php echo esc_attr($id); ?>" data-set-id="<?php echo $set; ?>">
191
  <div class="ti-header">
192
  <span class="ti-header-layout-text">
193
  <?php echo TrustindexPlugin_google::___('Layout'); ?>:
197
  <div class="clear"></div>
198
  </div>
199
  <div class="preview">
200
+ <?php echo str_replace('ti-widget ti-disabled', 'ti-widget', $trustindex_pm_google->get_noreg_list_reviews(null, true, $id, $set, true, true)); ?>
201
  </div>
202
  </div>
203
  </div>
350
  <label><?php echo TrustindexPlugin_google::___("Hide reviews without comments"); ?></label>
351
  </span>
352
  <?php endif; ?>
353
+ <?php if(!in_array($style_id, [ 11, 12, 17, 18, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30, 35, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 ]) && TrustindexPlugin_google::$widget_styles[$scss_set]['_vars']['dots'] !== 'true'): ?>
354
  <span class="ti-checkbox row">
355
  <input type="checkbox" name="no-rating-text" value="1" <?php if($no_rating_text): ?>checked<?php endif;?>>
356
  <label><?php echo TrustindexPlugin_google::___("Hide rating text"); ?></label>
tabs/troubleshooting.php CHANGED
@@ -39,7 +39,7 @@ exit;
39
  }
40
  $yes_icon = '<span class="dashicons dashicons-yes-alt"></span>';
41
  $no_icon = '<span class="dashicons dashicons-dismiss"></span>';
42
- $plugin_updated = ($trustindex_pm_google->get_plugin_current_version() <= "9.6");
43
  $css_inline = get_option($trustindex_pm_google->get_option_name('load-css-inline'), 0);
44
  $css = get_option($trustindex_pm_google->get_option_name('css-content'));
45
  ?>
39
  }
40
  $yes_icon = '<span class="dashicons dashicons-yes-alt"></span>';
41
  $no_icon = '<span class="dashicons dashicons-dismiss"></span>';
42
+ $plugin_updated = ($trustindex_pm_google->get_plugin_current_version() <= "9.6.1");
43
  $css_inline = get_option($trustindex_pm_google->get_option_name('load-css-inline'), 0);
44
  $css = get_option($trustindex_pm_google->get_option_name('css-content'));
45
  ?>
trustindex-plugin.class.php CHANGED
@@ -414,10 +414,22 @@ return 'trustindex';
414
  }
415
  public function init_shortcode()
416
  {
417
- if (!shortcode_exists($this->get_shortcode_name()))
 
 
418
  {
419
- add_shortcode( $this->get_shortcode_name(), [$this, 'shortcode_func'] );
 
 
 
 
 
 
 
 
420
  }
 
 
421
  }
422
  public function shortcode_func($atts)
423
  {
@@ -447,7 +459,7 @@ $chosed_platform_slug = $this->plugin_slugs[ $force_platform ];
447
  $current_platform_slug = $this->plugin_slugs[ $this->shortname ];
448
  $file_path = preg_replace('/[^\/\\\\]+([\\\\\/]trustindex-plugin\.class\.php)/', $chosed_platform_slug . '$1', $file_path);
449
  }
450
- $chosed_platform = new self($force_platform, $file_path, "do-not-care-9.6", "do-not-care-Widgets for Google Reviews", "do-not-care-Google");
451
  if(!$chosed_platform->is_noreg_linked())
452
  {
453
  return $this->error_box_for_admins(self::___('You have to connect your business (%s)!', [$force_platform]));
@@ -4464,7 +4476,7 @@ array_push($class_appends, $free_css_class);
4464
  }
4465
  if($class_appends)
4466
  {
4467
- $content = preg_replace('/class="(ti-widget[^\'"]*)" data-layout-id=/', 'class="$1 '. implode(' ', $class_appends) .'" data-layout-id=', $content);
4468
  }
4469
  if(!$only_preview)
4470
  {
@@ -4497,6 +4509,7 @@ if(isset($matches[1]))
4497
  $reviewContent = "";
4498
  if($array['reviews'] && count($array['reviews'])) foreach($array['reviews'] as $r)
4499
  {
 
4500
  $date = "&nbsp;";
4501
  if($r->date && $r->date != '0000-00-00')
4502
  {
@@ -4590,7 +4603,7 @@ $date,
4590
  $this->getReviewHtml($r),
4591
  $rating_content,
4592
  round($r->original_rating),
4593
- 'data-empty="'. (empty($r->text) ? 1 : 0) .'" class="ti-review-item'
4594
  ], $matches[1]);
4595
  $reviewContent = str_replace('<div></div>', '', $reviewContent);
4596
  }
@@ -4662,11 +4675,11 @@ $array['content'] = str_replace('img/platform/logo-hu', 'img/platform/logo', $ar
4662
  $array['content'] = str_replace('platform/'. ucfirst($this->getShortName()) .'/logo-hu', 'platform/'. ucfirst($this->getShortName()) .'/logo', $array['content']);
4663
  }
4664
  }
4665
- if(in_array($array['style_id'], [24, 25, 26, 27, 28, 29, 35]))
4666
  {
4667
  if($this->shortname == 'google')
4668
  {
4669
- $array['content'] = str_replace('%footer_link%', $array['style_id'] == 26 ? $this->getReviewWriteUrl() : $this->getReviewPageUrl(), $array['content']);
4670
  }
4671
  else
4672
  {
@@ -4677,7 +4690,7 @@ else
4677
  {
4678
  $array['content'] = preg_replace('/<a href=[\'"]%footer_link%[\'"][^>]*>(.+)<\/a>/mU', '$1', $array['content']);
4679
  }
4680
- if($array['no_rating_text'] && $array['style_id'] != 11)
4681
  {
4682
  if(in_array($array['style_id'], [6, 7]))
4683
  {
@@ -4692,11 +4705,14 @@ else
4692
  $array['content'] = preg_replace('/<div class="ti-rating-text">.*<\/div>/mU', '', $array['content']);
4693
  }
4694
  }
 
 
4695
  preg_match('/src="([^"]+logo[^\.]*\.svg)"/m', $array['content'], $matches);
4696
  if(isset($matches[1]) && !empty($matches[1]))
4697
  {
4698
  $array['content'] = str_replace($matches[0], $matches[0] . ' width="150" height="25"', $array['content']);
4699
  }
 
4700
  return $array['content'];
4701
  }
4702
  public function isDarkLogo($layout_id, $color_schema)
414
  }
415
  public function init_shortcode()
416
  {
417
+ $tag = $this->get_shortcode_name();
418
+ $current_version = floatval($this->version);
419
+ if(shortcode_exists($tag))
420
  {
421
+ $inited_version = floatval(get_option('trustindex-core-shortcode-inited', 0));
422
+ if(!$inited_version || $inited_version <= $current_version)
423
+ {
424
+ remove_shortcode($tag);
425
+ }
426
+ else
427
+ {
428
+ return false;
429
+ }
430
  }
431
+ update_option('trustindex-core-shortcode-inited', $current_version, false);
432
+ add_shortcode($tag, [ $this, 'shortcode_func' ]);
433
  }
434
  public function shortcode_func($atts)
435
  {
459
  $current_platform_slug = $this->plugin_slugs[ $this->shortname ];
460
  $file_path = preg_replace('/[^\/\\\\]+([\\\\\/]trustindex-plugin\.class\.php)/', $chosed_platform_slug . '$1', $file_path);
461
  }
462
+ $chosed_platform = new self($force_platform, $file_path, "do-not-care-9.6.1", "do-not-care-Widgets for Google Reviews", "do-not-care-Google");
463
  if(!$chosed_platform->is_noreg_linked())
464
  {
465
  return $this->error_box_for_admins(self::___('You have to connect your business (%s)!', [$force_platform]));
4476
  }
4477
  if($class_appends)
4478
  {
4479
+ $content = str_replace('" data-layout-id=', ' '. implode(' ', $class_appends) .'" data-layout-id=', $content);
4480
  }
4481
  if(!$only_preview)
4482
  {
4509
  $reviewContent = "";
4510
  if($array['reviews'] && count($array['reviews'])) foreach($array['reviews'] as $r)
4511
  {
4512
+ $custom_attributes = 'data-empty="'. (empty($r->text) ? 1 : 0) .'"';
4513
  $date = "&nbsp;";
4514
  if($r->date && $r->date != '0000-00-00')
4515
  {
4603
  $this->getReviewHtml($r),
4604
  $rating_content,
4605
  round($r->original_rating),
4606
+ $custom_attributes . ' class="ti-review-item'
4607
  ], $matches[1]);
4608
  $reviewContent = str_replace('<div></div>', '', $reviewContent);
4609
  }
4675
  $array['content'] = str_replace('platform/'. ucfirst($this->getShortName()) .'/logo-hu', 'platform/'. ucfirst($this->getShortName()) .'/logo', $array['content']);
4676
  }
4677
  }
4678
+ if(in_array($array['style_id'], [11, 12, 20, 22, 24, 25, 26, 27, 28, 29, 35, 55, 56, 57, 58, 59, 60, 61, 62]))
4679
  {
4680
  if($this->shortname == 'google')
4681
  {
4682
+ $array['content'] = str_replace('%footer_link%', in_array($array['style_id'], [ 26, 59 ]) ? $this->getReviewWriteUrl() : $this->getReviewPageUrl(), $array['content']);
4683
  }
4684
  else
4685
  {
4690
  {
4691
  $array['content'] = preg_replace('/<a href=[\'"]%footer_link%[\'"][^>]*>(.+)<\/a>/mU', '$1', $array['content']);
4692
  }
4693
+ if($array['no_rating_text'] && !in_array($array['style_id'], [ 11, 12, 20, 22, 55, 56, 57, 58 ]))
4694
  {
4695
  if(in_array($array['style_id'], [6, 7]))
4696
  {
4705
  $array['content'] = preg_replace('/<div class="ti-rating-text">.*<\/div>/mU', '', $array['content']);
4706
  }
4707
  }
4708
+ if(!in_array($array['style_id'], [ 53, 54 ]))
4709
+ {
4710
  preg_match('/src="([^"]+logo[^\.]*\.svg)"/m', $array['content'], $matches);
4711
  if(isset($matches[1]) && !empty($matches[1]))
4712
  {
4713
  $array['content'] = str_replace($matches[0], $matches[0] . ' width="150" height="25"', $array['content']);
4714
  }
4715
+ }
4716
  return $array['content'];
4717
  }
4718
  public function isDarkLogo($layout_id, $color_schema)
uninstall.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
  require_once plugin_dir_path( __FILE__ ) . 'trustindex-plugin.class.php';
3
- $trustindex_pm_google = new TrustindexPlugin_google("google", __FILE__, "9.6", "Widgets for Google Reviews", "Google");
4
  $trustindex_pm_google->uninstall();
5
  ?>
1
  <?php
2
  require_once plugin_dir_path( __FILE__ ) . 'trustindex-plugin.class.php';
3
+ $trustindex_pm_google = new TrustindexPlugin_google("google", __FILE__, "9.6.1", "Widgets for Google Reviews", "Google");
4
  $trustindex_pm_google->uninstall();
5
  ?>
wp-reviews-plugin-for-google.php CHANGED
@@ -9,7 +9,7 @@ Author: Trustindex.io <support@trustindex.io>
9
  Author URI: https://www.trustindex.io/
10
  Contributors: trustindex
11
  License: GPLv2 or later
12
- Version: 9.6
13
  Text Domain: wp-reviews-plugin-for-google
14
  Domain Path: /languages/
15
  Donate link: https://www.trustindex.io/prices/
@@ -19,7 +19,7 @@ Copyright 2019 Trustindex Kft (email: support@trustindex.io)
19
  */
20
  defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
21
  require_once plugin_dir_path( __FILE__ ) . 'trustindex-plugin.class.php';
22
- $trustindex_pm_google = new TrustindexPlugin_google("google", __FILE__, "9.6", "Widgets for Google Reviews", "Google");
23
  register_activation_hook(__FILE__, array($trustindex_pm_google, 'activate'));
24
  register_deactivation_hook(__FILE__, array($trustindex_pm_google, 'deactivate'));
25
  add_action('admin_menu', array($trustindex_pm_google, 'add_setting_menu'), 10);
@@ -37,7 +37,7 @@ global $trustindex_pm_google;
37
  if(!isset($trustindex_pm_google) || is_null($trustindex_pm_google))
38
  {
39
  require_once plugin_dir_path( __FILE__ ) . 'trustindex-plugin.class.php';
40
- $trustindex_pm_google = new TrustindexPlugin_google("google", __FILE__, "9.6", "Widgets for Google Reviews", "Google");
41
  }
42
  $path = wp_upload_dir()['baseurl'] .'/'. $trustindex_pm_google->getCssFile(true);
43
  if(is_ssl())
9
  Author URI: https://www.trustindex.io/
10
  Contributors: trustindex
11
  License: GPLv2 or later
12
+ Version: 9.6.1
13
  Text Domain: wp-reviews-plugin-for-google
14
  Domain Path: /languages/
15
  Donate link: https://www.trustindex.io/prices/
19
  */
20
  defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
21
  require_once plugin_dir_path( __FILE__ ) . 'trustindex-plugin.class.php';
22
+ $trustindex_pm_google = new TrustindexPlugin_google("google", __FILE__, "9.6.1", "Widgets for Google Reviews", "Google");
23
  register_activation_hook(__FILE__, array($trustindex_pm_google, 'activate'));
24
  register_deactivation_hook(__FILE__, array($trustindex_pm_google, 'deactivate'));
25
  add_action('admin_menu', array($trustindex_pm_google, 'add_setting_menu'), 10);
37
  if(!isset($trustindex_pm_google) || is_null($trustindex_pm_google))
38
  {
39
  require_once plugin_dir_path( __FILE__ ) . 'trustindex-plugin.class.php';
40
+ $trustindex_pm_google = new TrustindexPlugin_google("google", __FILE__, "9.6.1", "Widgets for Google Reviews", "Google");
41
  }
42
  $path = wp_upload_dir()['baseurl'] .'/'. $trustindex_pm_google->getCssFile(true);
43
  if(is_ssl())