Version Description
- Improve: reduce reviewer avatars size
- Improve: added option for image lazy loading
Download this release
Release Info
Developer | widgetpack |
Plugin | Google Reviews Widget |
Version | 1.7.3 |
Comparing to | |
See all releases |
Code changes from version 1.7.2 to 1.7.3
- grw-options.php +18 -0
- grw-reviews-helper.php +10 -3
- grw-reviews.php +7 -2
- grw-widget.php +3 -1
- grw.php +3 -3
- readme.txt +6 -2
- static/js/blazy.min.js +6 -0
- static/js/rplg.js +12 -1
grw-options.php
CHANGED
@@ -81,6 +81,24 @@
|
|
81 |
</div>
|
82 |
</div>
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
<div class="form-group">
|
85 |
<div class="col-sm-12">
|
86 |
<label>
|
81 |
</div>
|
82 |
</div>
|
83 |
|
84 |
+
<div class="form-group">
|
85 |
+
<div class="col-sm-12">
|
86 |
+
<label>
|
87 |
+
<input id="<?php echo $this->get_field_id('reduce_avatars_size'); ?>" name="<?php echo $this->get_field_name('reduce_avatars_size'); ?>" type="checkbox" value="1" <?php checked('1', $reduce_avatars_size); ?> class="form-control" />
|
88 |
+
<?php echo grw_i('Reduce avatars size'); ?>
|
89 |
+
</label>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<div class="form-group">
|
94 |
+
<div class="col-sm-12">
|
95 |
+
<label>
|
96 |
+
<input id="<?php echo $this->get_field_id('lazy_load_img'); ?>" name="<?php echo $this->get_field_name('lazy_load_img'); ?>" type="checkbox" value="1" <?php checked('1', $lazy_load_img); ?> class="form-control" />
|
97 |
+
<?php echo grw_i('Lazy load images'); ?>
|
98 |
+
</label>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
<div class="form-group">
|
103 |
<div class="col-sm-12">
|
104 |
<label>
|
grw-reviews-helper.php
CHANGED
@@ -22,7 +22,7 @@ function grw_place($rating, $place, $place_img, $reviews, $dark_theme, $show_pow
|
|
22 |
<?php
|
23 |
}
|
24 |
|
25 |
-
function grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination) {
|
26 |
?>
|
27 |
<div class="wp-google-reviews">
|
28 |
<?php
|
@@ -42,13 +42,16 @@ function grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination)
|
|
42 |
} else {
|
43 |
$profile_photo_url = GRW_GOOGLE_AVATAR;
|
44 |
}
|
|
|
|
|
|
|
|
|
45 |
?>
|
46 |
-
<img src="<?php echo $profile_photo_url ?>" alt="<?php echo $review->author_name ?>" onerror="if(this.src!='<?php echo GRW_GOOGLE_AVATAR; ?>')this.src='<?php echo GRW_GOOGLE_AVATAR; ?>';">
|
47 |
</div>
|
48 |
<div class="wp-google-right">
|
49 |
<?php
|
50 |
if (strlen($review->author_url) > 0) {
|
51 |
-
grw_anchor($review->author_url, 'wp-google-name', $review->author_name,
|
52 |
} else {
|
53 |
if (strlen($review->author_name) > 0) {
|
54 |
$author_name = $review->author_name;
|
@@ -128,4 +131,8 @@ function grw_trim_text($text, $size) {
|
|
128 |
function grw_anchor($url, $class, $text, $open_link, $nofollow_link) {
|
129 |
?><a href="<?php echo $url; ?>" class="<?php echo $class; ?>" <?php if ($open_link) { ?>target="_blank"<?php } ?> <?php if ($nofollow_link) { ?>rel="nofollow"<?php } ?>><?php echo $text; ?></a><?php
|
130 |
}
|
|
|
|
|
|
|
|
|
131 |
?>
|
22 |
<?php
|
23 |
}
|
24 |
|
25 |
+
function grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination, $reduce_avatars_size, $open_link, $nofollow_link, $lazy_load_img) {
|
26 |
?>
|
27 |
<div class="wp-google-reviews">
|
28 |
<?php
|
42 |
} else {
|
43 |
$profile_photo_url = GRW_GOOGLE_AVATAR;
|
44 |
}
|
45 |
+
if ($reduce_avatars_size) {
|
46 |
+
$profile_photo_url = str_replace('s128', 's50', $profile_photo_url);
|
47 |
+
}
|
48 |
+
grw_image($profile_photo_url, $review->author_name, $lazy_load_img, GRW_GOOGLE_AVATAR);
|
49 |
?>
|
|
|
50 |
</div>
|
51 |
<div class="wp-google-right">
|
52 |
<?php
|
53 |
if (strlen($review->author_url) > 0) {
|
54 |
+
grw_anchor($review->author_url, 'wp-google-name', $review->author_name, $open_link, $nofollow_link);
|
55 |
} else {
|
56 |
if (strlen($review->author_name) > 0) {
|
57 |
$author_name = $review->author_name;
|
131 |
function grw_anchor($url, $class, $text, $open_link, $nofollow_link) {
|
132 |
?><a href="<?php echo $url; ?>" class="<?php echo $class; ?>" <?php if ($open_link) { ?>target="_blank"<?php } ?> <?php if ($nofollow_link) { ?>rel="nofollow"<?php } ?>><?php echo $text; ?></a><?php
|
133 |
}
|
134 |
+
|
135 |
+
function grw_image($src, $alt, $lazy, $def_ava = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', $atts = '') {
|
136 |
+
?><img <?php if ($lazy) { ?>src="<?php echo $def_ava; ?>" data-<?php } ?>src="<?php echo $src; ?>" class="rplg-review-avatar<?php if ($lazy) { ?> rplg-blazy<?php } ?>" alt="<?php echo $alt; ?>" onerror="if(this.src!='<?php echo $def_ava; ?>')this.src='<?php echo $def_ava; ?>';" <?php echo $atts; ?>><?php
|
137 |
+
}
|
138 |
?>
|
grw-reviews.php
CHANGED
@@ -2,6 +2,11 @@
|
|
2 |
wp_register_script('rplg_js', plugins_url('/static/js/rplg.js', __FILE__));
|
3 |
wp_enqueue_script('rplg_js', plugins_url('/static/js/rplg.js', __FILE__));
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
include_once(dirname(__FILE__) . '/grw-reviews-helper.php');
|
6 |
|
7 |
$reviews_where = '';
|
@@ -71,7 +76,7 @@ if (is_numeric($max_height)) {
|
|
71 |
<div class="wp-google-body"></div>
|
72 |
<div class="wp-google-content">
|
73 |
<div class="wp-google-content-inner">
|
74 |
-
<?php grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination); ?>
|
75 |
</div>
|
76 |
</div>
|
77 |
<div class="wp-google-footer">
|
@@ -89,7 +94,7 @@ if (is_numeric($max_height)) {
|
|
89 |
<?php grw_place($rating, $place, $place_img, $reviews, $dark_theme); ?>
|
90 |
</div>
|
91 |
<div class="wp-google-content-inner">
|
92 |
-
<?php grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination); ?>
|
93 |
</div>
|
94 |
</div>
|
95 |
</div>
|
2 |
wp_register_script('rplg_js', plugins_url('/static/js/rplg.js', __FILE__));
|
3 |
wp_enqueue_script('rplg_js', plugins_url('/static/js/rplg.js', __FILE__));
|
4 |
|
5 |
+
if ($lazy_load_img) {
|
6 |
+
wp_register_script('rplg_blazy', plugins_url('/static/js/blazy.min.js', __FILE__));
|
7 |
+
wp_enqueue_script('rplg_blazy', plugins_url('/static/js/blazy.min.js', __FILE__));
|
8 |
+
}
|
9 |
+
|
10 |
include_once(dirname(__FILE__) . '/grw-reviews-helper.php');
|
11 |
|
12 |
$reviews_where = '';
|
76 |
<div class="wp-google-body"></div>
|
77 |
<div class="wp-google-content">
|
78 |
<div class="wp-google-content-inner">
|
79 |
+
<?php grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination, $reduce_avatars_size, $open_link, $nofollow_link, $lazy_load_img); ?>
|
80 |
</div>
|
81 |
</div>
|
82 |
<div class="wp-google-footer">
|
94 |
<?php grw_place($rating, $place, $place_img, $reviews, $dark_theme); ?>
|
95 |
</div>
|
96 |
<div class="wp-google-content-inner">
|
97 |
+
<?php grw_place_reviews($place, $reviews, $place_id, $text_size, $pagination, $reduce_avatars_size, $open_link, $nofollow_link, $lazy_load_img); ?>
|
98 |
</div>
|
99 |
</div>
|
100 |
</div>
|
grw-widget.php
CHANGED
@@ -22,12 +22,14 @@ class Goog_Reviews_Widget extends WP_Widget {
|
|
22 |
'text_size' => '120',
|
23 |
'dark_theme' => '',
|
24 |
'view_mode' => 'list',
|
25 |
-
'pagination' => '',
|
26 |
'max_width' => '',
|
27 |
'max_height' => '',
|
28 |
'centered' => false,
|
|
|
29 |
'open_link' => true,
|
30 |
'nofollow_link' => true,
|
|
|
31 |
'reviews_lang' => '',
|
32 |
);
|
33 |
|
22 |
'text_size' => '120',
|
23 |
'dark_theme' => '',
|
24 |
'view_mode' => 'list',
|
25 |
+
'pagination' => '5',
|
26 |
'max_width' => '',
|
27 |
'max_height' => '',
|
28 |
'centered' => false,
|
29 |
+
'reduce_avatars_size' => true,
|
30 |
'open_link' => true,
|
31 |
'nofollow_link' => true,
|
32 |
+
'lazy_load_img' => true,
|
33 |
'reviews_lang' => '',
|
34 |
);
|
35 |
|
grw.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Reviews Widget
|
|
4 |
Plugin URI: https://richplugins.com/business-reviews-bundle-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.7.
|
8 |
Author URI: https://richplugins.com
|
9 |
*/
|
10 |
|
@@ -13,9 +13,9 @@ 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.7.
|
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/
|
19 |
define('GRW_PLUGIN_URL', plugins_url(basename(plugin_dir_path(__FILE__ )), basename(__FILE__)));
|
20 |
|
21 |
function grw_options() {
|
4 |
Plugin URI: https://richplugins.com/business-reviews-bundle-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.7.3
|
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.7.3');
|
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/s50-c/114307615494839964028.jpg');
|
19 |
define('GRW_PLUGIN_URL', plugins_url(basename(plugin_dir_path(__FILE__ )), basename(__FILE__)));
|
20 |
|
21 |
function grw_options() {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://richplugins.com/business-reviews-bundle-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: 5.1
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,7 +18,7 @@ This plugin display Google Business Reviews on your websites in sidebar widget.
|
|
18 |
|
19 |
[youtube https://www.youtube.com/watch?v=YccWFCkz6H4]
|
20 |
|
21 |
-
[Online demo](
|
22 |
|
23 |
= Plugin Features =
|
24 |
|
@@ -74,6 +74,10 @@ Why limit your reviews to just Google Reviews? Check out our other free reviews
|
|
74 |
|
75 |
== Changelog ==
|
76 |
|
|
|
|
|
|
|
|
|
77 |
= 1.7.2 =
|
78 |
* Update readme and links to the business version
|
79 |
|
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: 5.1
|
7 |
+
Stable tag: 1.7.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
18 |
|
19 |
[youtube https://www.youtube.com/watch?v=YccWFCkz6H4]
|
20 |
|
21 |
+
[Online demo](https://richplugins.com/demos/)
|
22 |
|
23 |
= Plugin Features =
|
24 |
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.7.3 =
|
78 |
+
* Improve: reduce reviewer avatars size
|
79 |
+
* Improve: added option for image lazy loading
|
80 |
+
|
81 |
= 1.7.2 =
|
82 |
* Update readme and links to the business version
|
83 |
|
static/js/blazy.min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
hey, [be]Lazy.js - v1.8.2 - 2016.10.25
|
3 |
+
A fast, small and dependency free lazy load script (https://github.com/dinbror/blazy)
|
4 |
+
(c) Bjoern Klinggaard - @bklinggaard - http://dinbror.dk/blazy
|
5 |
+
*/
|
6 |
+
(function(q,m){"function"===typeof define&&define.amd?define(m):"object"===typeof exports?module.exports=m():q.Blazy=m()})(this,function(){function q(b){var c=b._util;c.elements=E(b.options);c.count=c.elements.length;c.destroyed&&(c.destroyed=!1,b.options.container&&l(b.options.container,function(a){n(a,"scroll",c.validateT)}),n(window,"resize",c.saveViewportOffsetT),n(window,"resize",c.validateT),n(window,"scroll",c.validateT));m(b)}function m(b){for(var c=b._util,a=0;a<c.count;a++){var d=c.elements[a],e;a:{var g=d;e=b.options;var p=g.getBoundingClientRect();if(e.container&&y&&(g=g.closest(e.containerClass))){g=g.getBoundingClientRect();e=r(g,f)?r(p,{top:g.top-e.offset,right:g.right+e.offset,bottom:g.bottom+e.offset,left:g.left-e.offset}):!1;break a}e=r(p,f)}if(e||t(d,b.options.successClass))b.load(d),c.elements.splice(a,1),c.count--,a--}0===c.count&&b.destroy()}function r(b,c){return b.right>=c.left&&b.bottom>=c.top&&b.left<=c.right&&b.top<=c.bottom}function z(b,c,a){if(!t(b,a.successClass)&&(c||a.loadInvisible||0<b.offsetWidth&&0<b.offsetHeight))if(c=b.getAttribute(u)||b.getAttribute(a.src)){c=c.split(a.separator);var d=c[A&&1<c.length?1:0],e=b.getAttribute(a.srcset),g="img"===b.nodeName.toLowerCase(),p=(c=b.parentNode)&&"picture"===c.nodeName.toLowerCase();if(g||void 0===b.src){var h=new Image,w=function(){a.error&&a.error(b,"invalid");v(b,a.errorClass);k(h,"error",w);k(h,"load",f)},f=function(){g?p||B(b,d,e):b.style.backgroundImage='url("'+d+'")';x(b,a);k(h,"load",f);k(h,"error",w)};p&&(h=b,l(c.getElementsByTagName("source"),function(b){var c=a.srcset,e=b.getAttribute(c);e&&(b.setAttribute("srcset",e),b.removeAttribute(c))}));n(h,"error",w);n(h,"load",f);B(h,d,e)}else b.src=d,x(b,a)}else"video"===b.nodeName.toLowerCase()?(l(b.getElementsByTagName("source"),function(b){var c=a.src,e=b.getAttribute(c);e&&(b.setAttribute("src",e),b.removeAttribute(c))}),b.load(),x(b,a)):(a.error&&a.error(b,"missing"),v(b,a.errorClass))}function x(b,c){v(b,c.successClass);c.success&&c.success(b);b.removeAttribute(c.src);b.removeAttribute(c.srcset);l(c.breakpoints,function(a){b.removeAttribute(a.src)})}function B(b,c,a){a&&b.setAttribute("srcset",a);b.src=c}function t(b,c){return-1!==(" "+b.className+" ").indexOf(" "+c+" ")}function v(b,c){t(b,c)||(b.className+=" "+c)}function E(b){var c=[];b=b.root.querySelectorAll(b.selector);for(var a=b.length;a--;c.unshift(b[a]));return c}function C(b){f.bottom=(window.innerHeight||document.documentElement.clientHeight)+b;f.right=(window.innerWidth||document.documentElement.clientWidth)+b}function n(b,c,a){b.attachEvent?b.attachEvent&&b.attachEvent("on"+c,a):b.addEventListener(c,a,{capture:!1,passive:!0})}function k(b,c,a){b.detachEvent?b.detachEvent&&b.detachEvent("on"+c,a):b.removeEventListener(c,a,{capture:!1,passive:!0})}function l(b,c){if(b&&c)for(var a=b.length,d=0;d<a&&!1!==c(b[d],d);d++);}function D(b,c,a){var d=0;return function(){var e=+new Date;e-d<c||(d=e,b.apply(a,arguments))}}var u,f,A,y;return function(b){if(!document.querySelectorAll){var c=document.createStyleSheet();document.querySelectorAll=function(a,b,d,h,f){f=document.all;b=[];a=a.replace(/\[for\b/gi,"[htmlFor").split(",");for(d=a.length;d--;){c.addRule(a[d],"k:v");for(h=f.length;h--;)f[h].currentStyle.k&&b.push(f[h]);c.removeRule(0)}return b}}var a=this,d=a._util={};d.elements=[];d.destroyed=!0;a.options=b||{};a.options.error=a.options.error||!1;a.options.offset=a.options.offset||100;a.options.root=a.options.root||document;a.options.success=a.options.success||!1;a.options.selector=a.options.selector||".b-lazy";a.options.separator=a.options.separator||"|";a.options.containerClass=a.options.container;a.options.container=a.options.containerClass?document.querySelectorAll(a.options.containerClass):!1;a.options.errorClass=a.options.errorClass||"b-error";a.options.breakpoints=a.options.breakpoints||!1;a.options.loadInvisible=a.options.loadInvisible||!1;a.options.successClass=a.options.successClass||"b-loaded";a.options.validateDelay=a.options.validateDelay||25;a.options.saveViewportOffsetDelay=a.options.saveViewportOffsetDelay||50;a.options.srcset=a.options.srcset||"data-srcset";a.options.src=u=a.options.src||"data-src";y=Element.prototype.closest;A=1<window.devicePixelRatio;f={};f.top=0-a.options.offset;f.left=0-a.options.offset;a.revalidate=function(){q(a)};a.load=function(a,b){var c=this.options;void 0===a.length?z(a,b,c):l(a,function(a){z(a,b,c)})};a.destroy=function(){var a=this._util;this.options.container&&l(this.options.container,function(b){k(b,"scroll",a.validateT)});k(window,"scroll",a.validateT);k(window,"resize",a.validateT);k(window,"resize",a.saveViewportOffsetT);a.count=0;a.elements.length=0;a.destroyed=!0};d.validateT=D(function(){m(a)},a.options.validateDelay,a);d.saveViewportOffsetT=D(function(){C(a.options.offset)},a.options.saveViewportOffsetDelay,a);C(a.options.offset);l(a.options.breakpoints,function(a){if(a.width>=window.screen.width)return u=a.src,!1});setTimeout(function(){q(a)})}});
|
static/js/rplg.js
CHANGED
@@ -41,6 +41,7 @@ function rplg_next_reviews(name, pagin) {
|
|
41 |
if (reviews.length < 1) {
|
42 |
parent.removeChild(this);
|
43 |
}
|
|
|
44 |
return false;
|
45 |
}
|
46 |
|
@@ -75,7 +76,17 @@ function _rplg_timeago(els) {
|
|
75 |
}
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
document.addEventListener('DOMContentLoaded', function() {
|
79 |
_rplg_timeago(document.querySelectorAll('.wpac [data-time]'));
|
80 |
-
|
81 |
});
|
41 |
if (reviews.length < 1) {
|
42 |
parent.removeChild(this);
|
43 |
}
|
44 |
+
window.rplg_blazy && window.rplg_blazy.revalidate();
|
45 |
return false;
|
46 |
}
|
47 |
|
76 |
}
|
77 |
}
|
78 |
|
79 |
+
function _rplg_init_blazy(attempts) {
|
80 |
+
if (!window.Blazy) {
|
81 |
+
if (attempts > 0) {
|
82 |
+
setTimeout(function() { _rplg_init_blazy(attempts - 1); }, 200);
|
83 |
+
}
|
84 |
+
return;
|
85 |
+
}
|
86 |
+
window.rplg_blazy = new Blazy({selector: 'img.rplg-blazy'});
|
87 |
+
}
|
88 |
+
|
89 |
document.addEventListener('DOMContentLoaded', function() {
|
90 |
_rplg_timeago(document.querySelectorAll('.wpac [data-time]'));
|
91 |
+
_rplg_init_blazy(10);
|
92 |
});
|