PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / trunk
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar vtrunk
3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 All 156 releases
notificationx / includes / Extensions / Google / GoogleReviews.php

GoogleReviews.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar trunk, at includes/Extensions/Google/GoogleReviews.php

196 lines 9.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * GoogleReviews Extension
4 *
5 * @package NotificationX\Extensions
6 */
7
8 namespace NotificationX\Extensions\Google;
9
10 use NotificationX\GetInstance;
11 use NotificationX\Extensions\Extension;
12
13 /**
14 * GoogleReviews Extension
15 * @method static GoogleReviews get_instance($args = null)
16 */
17 class GoogleReviews extends Extension {
18 /**
19 * Instance of GoogleReviews
20 *
21 * @var GoogleReviews
22 */
23 use GetInstance;
24
25 public $priority = 5;
26 public $id = 'google_reviews';
27 public $img = NOTIFICATIONX_ADMIN_URL . 'images/extensions/sources/google-rating.png';
28 public $doc_link = 'https://notificationx.com/docs/google-reviews-with-notificationx/
29 ';
30 public $types = 'reviews';
31 public $module = 'modules_google_reviews';
32 public $module_priority = 20;
33 public $default_theme = 'google_reviews_total-rated';
34 public $is_pro = true;
35 public $link_type = 'map_page';
36
37 /**
38 * Initially Invoked when initialized.
39 */
40 public function __construct(){
41 parent::__construct();
42 }
43
44 public function init_extension()
45 {
46 $this->title = __('Google Reviews', 'notificationx');
47 $this->module_title = __('Google Reviews', 'notificationx');
48 $this->themes = [
49 'total-rated' => [
50 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/total-rated.png',
51 'image_shape' => 'square',
52 'show_notification_image' => 'greview_icon',
53 'template' => [
54 'first_param' => 'tag_rated',
55 'custom_first_param' => __('Someone', 'notificationx'),
56 'second_param' => __('people rated', 'notificationx'),
57 'third_param' => 'tag_place_name',
58 'custom_third_param' => __('Anonymous Place', 'notificationx'),
59 'fourth_param' => 'tag_rating',
60 'custom_fourth_param' => __('Some time ago', 'notificationx'),
61 ],
62 ],
63 'reviewed' => [
64 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/reviewed.png',
65 'image_shape' => 'circle',
66 'show_notification_image' => 'greview_avatar',
67 'template' => [
68 'first_param' => 'tag_username',
69 'custom_first_param' => __('Someone', 'notificationx'),
70 'second_param' => __('just reviewed', 'notificationx'),
71 'third_param' => 'tag_place_name',
72 'custom_third_param' => __('Anonymous Place', 'notificationx'),
73 'fourth_param' => 'tag_rating',
74 'custom_fourth_param' => __('Some time ago', 'notificationx'),
75 ]
76 ],
77 'review-comment' => [
78 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/review-with-comment.jpg',
79 'image_shape' => 'rounded',
80 'show_notification_image' => 'greview_avatar',
81 'template' => [
82 'first_param' => 'tag_username',
83 'custom_first_param' => __('Someone', 'notificationx'),
84 'second_param' => __('just reviewed', 'notificationx'),
85 'third_param' => 'tag_place_review',
86 'custom_third_param' => __('Anonymous Place', 'notificationx'),
87 'fourth_param' => 'tag_time',
88 'custom_fourth_param' => __('Some time ago', 'notificationx'),
89 ]
90 ],
91 'review-comment-2' => [
92 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/review-with-comment-2.jpg',
93 'image_shape' => 'circle',
94 'show_notification_image' => 'greview_avatar',
95 'template' => [
96 'first_param' => 'tag_username',
97 'custom_first_param' => __('Someone', 'notificationx'),
98 'second_param' => __('just reviewed', 'notificationx'),
99 'third_param' => 'tag_place_review',
100 'custom_third_param' => __('Anonymous Place', 'notificationx'),
101 'fourth_param' => 'tag_time',
102 'custom_fourth_param' => '',
103 ]
104 ],
105 'review-comment-3' => [
106 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/wporg/review-with-comment-3.jpg',
107 'image_shape' => 'circle',
108 'show_notification_image' => 'greview_avatar',
109 'template' => [
110 'first_param' => 'tag_username',
111 'custom_first_param' => __('Someone', 'notificationx'),
112 'second_param' => __('just reviewed', 'notificationx'),
113 'third_param' => 'tag_place_review',
114 'custom_third_param' => __('Anonymous Place', 'notificationx'),
115 'fourth_param' => 'tag_time',
116 'custom_fourth_param' => __('Some time ago', 'notificationx'),
117 ]
118 ],
119 'maps_theme' => array(
120 'is_pro' => true,
121 'source' => NOTIFICATIONX_ADMIN_URL . 'images/extensions/themes/pro/google-review-map.png',
122 'image_shape' => 'square',
123 'show_notification_image' => 'greview_map_image',
124 'template' => [
125 'first_param' => 'tag_rated',
126 'custom_first_param' => __('Someone', 'notificationx'),
127 'second_param' => __('people rated', 'notificationx'),
128 'third_param' => 'tag_place_name',
129 'custom_third_param' => __('Anonymous Place', 'notificationx'),
130 'fourth_param' => 'tag_rating',
131 'custom_fourth_param' => __('Some time ago', 'notificationx'),
132 ],
133 ),
134 ];
135
136 $this->templates = [
137 "{$this->id}_template_new" => [
138 'first_param' => [
139 'tag_username' => __('Username', 'notificationx'),
140 'tag_rated' => __('Rated', 'notificationx'),
141 ],
142 'third_param' => [
143 'tag_place_name' => __('Place Name', 'notificationx'),
144 'tag_place_review' => __('Review', 'notificationx'),
145 ],
146 'fourth_param' => [
147 'tag_rating' => __('Rating', 'notificationx'),
148 'tag_time' => __('Definite Time', 'notificationx'),
149 ],
150 '_themes' => [
151 "{$this->id}_maps_theme",
152 "{$this->id}_total-rated",
153 "{$this->id}_reviewed",
154 "{$this->id}_review-comment",
155 "{$this->id}_review-comment-2",
156 "{$this->id}_review-comment-3",
157 ],
158 ],
159 ];
160 $this->popup = [
161 "denyButtonText" => __("<a href='https://notificationx.com/docs/google-reviews-with-notificationx/
162 ' target='_blank'>More Info</a>", "notificationx"),
163 "confirmButtonText" => __("<a href='https://notificationx.com/#pricing' target='_blank'>Upgrade to PRO</a>", "notificationx"),
164 // phpcs:ignore WordPress.WP.I18n.NoHtmlWrappedStrings -- Reviewed for the NotificationX codebase: acceptable in this context.
165 "html"=> __('
166 <span>Google reviews provide helpful information and make your business stand out.</span>
167 ', 'notificationx')
168 ];
169 }
170
171 public function preview_entry($entry, $settings){
172 if($settings['show_notification_image'] === "greview_icon" ){
173 $entry = array_merge($entry, [
174 "image_data" => [
175 "url" => "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/generic_business-71.png",
176 "alt" => "",
177 "classes" => "greview_icon"
178 ],
179 ]);
180 }
181 return $entry;
182 }
183
184 public function doc(){
185 $url = admin_url('admin.php?page=nx-settings&tab=tab-api-integrations#google_reviews_settings_section');
186 /* translators: %1$s: Google Reviews API link URL, %2$s: documentation link URL, %3$s: Integration with Google Reviews link URL */
187 return sprintf(__('<p>Make sure that you have configured your <a target="_blank" href="%1$s">Google Reviews API</a> key, to showcase your reviews. For further assistance, check out our step by step <a target="_blank" href="%2$s">documentation</a>.</p>
188
189 <p>👉NotificationX <a target="_blank" href="%3$s">Integration with Google Reviews</a>.</p>', 'notificationx'),
190 $url,
191 'https://notificationx.com/docs/collect-api-key-from-google-console',
192 'https://notificationx.com/docs/google-reviews-with-notificationx/'
193 );
194 }
195 }
196