Widgets for Google Reviews - Version 4.0

Version Description

  • New feature: new translation (magyar)
  • New feature: dark themes got fancier platform (Facebook, Google, etc...) logos.
  • New feature: Option to hide reviewers' photo from review widgets.
  • New feature: Handling Google Place IDs.
  • Bugfix: Eliminating some typos.
Download this release

Release Info

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

Version 4.0

languages/trustindex-hu_HU.mo ADDED
Binary file
readme.txt ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Widgets for Google Reviews ===
2
+ Contributors: trustindex
3
+ Donate link: https://www.trustindex.io/prices/
4
+ Tags: google, google places reviews, reviews, widget, google business
5
+ Requires at least: 3.0.1
6
+ Tested up to: 5.5
7
+ Requires PHP: 5.2
8
+ Stable tag: trunk
9
+ License: GPLv2 or later
10
+ License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
+ Plugin Name: Widgets for Google Reviews
12
+ Plugin Title: Widgets for Google Reviews Plugin
13
+ 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: trustindex
17
+ Version: 4.0
18
+
19
+ Embed Google reviews fast and easily into your WordPress site. Increase SEO, trust and sales using Google reviews.
20
+
21
+ == Description ==
22
+
23
+ Display your **Google Reviews** for free with our responsive widgets in 2 minutes.
24
+
25
+ [vimeo https://player.vimeo.com/video/429285826]
26
+
27
+ The plugin displays your **Google Reviews** in amazing predesigned widgets. You can simply create and display your own widgets, and filter your reviews to build customers' trust and increase SEO.
28
+
29
+ ### Free plugin features
30
+
31
+ * Free usage
32
+ * Display of 5 Google Reviews
33
+ * 7 Widget layouts
34
+ * 9 Pre-designed widget styles
35
+ * 1 Review widget
36
+ * Review filtering
37
+ * Language support
38
+ * Shortcode integration
39
+ * Keep all reviews in a WordPress database
40
+ * SEO boost
41
+ * Dark website support
42
+ * Site builder support
43
+ * Zero loading time
44
+ * Use in any page builder: Gutenberg, Elementor, Page Origin, Beaver Builder, WPBakery, Divi
45
+
46
+ ### Get more features with our professional review software
47
+
48
+ [Create a free account for more features!](https://www.trustindex.io/register/sys-wp-google-r1)
49
+
50
+ * Display all reviews: Google, Facebook, Yelp, Amazon, Tripadvisor, Booking.com, AirBnb, Hotels.com, ...
51
+ * Display of mixed reviews
52
+ * 13 Widget layouts
53
+ * Total design personalization
54
+ * Unlimited number of widgets
55
+ * Management of multiple businesses
56
+ * Professional review tagging system
57
+ * Widgets are updated when you receive a new review
58
+ * Widget link modification
59
+ * Edit review order
60
+ * Review shortening
61
+ * Automated review invitation system
62
+ * Review widgets for your email signatures
63
+ * Shortcode & HTML/JavaScript support
64
+ * Detailed statistics
65
+ * Priority support
66
+
67
+ [Create a free account for more features!](https://www.trustindex.io/register/sys-wp-google-r2)
68
+
69
+ == Screenshots ==
70
+
71
+ 1. Sample widget - Slider I. (light background)
72
+ 2. Sample widget - Slider I. (dark background)
73
+ 3. Sample widget - Slider I. (light border)
74
+ 4. Sample widget - Slider III. (light background)
75
+ 5. Sample widget - Grid (light background)
76
+ 6. Sample widget - Slider IV. (light background)
77
+ 7. Sample widget - Float (light background)
78
+ 8. Sample widget - Sidebar I. (light background)
79
+ 9. Sample widget - Sidebar III. (light background)
80
+
81
+ == Additional free review plugins ==
82
+
83
+ Why not display your other ratings, too? Check out our other free review plugins:
84
+
85
+ * <a href="https://wordpress.org/plugins/review-widgets-for-amazon/" target="_blank">Amazon</a>
86
+ * <a href="https://wordpress.org/plugins/review-widgets-for-airbnb/" target="_blank">Airbnb</a>
87
+ * <a href="https://wordpress.org/plugins/review-widgets-for-booking-com/" target="_blank">Booking.com</a>
88
+ * <a href="https://wordpress.org/plugins/review-widgets-for-bookatable/" target="_blank">Bookatable</a>
89
+ * <a href="https://wordpress.org/plugins/review-widgets-for-capterra/" target="_blank">Capterra</a>
90
+ * <a href="https://wordpress.org/plugins/free-facebook-reviews-and-recommendations-widgets/" target="_blank">Facebook</a>
91
+ * <a href="https://wordpress.org/plugins/review-widgets-for-foursquare/" target="_blank">Foursquare</a>
92
+ * <a href="https://wordpress.org/plugins/wp-reviews-plugin-for-google/" target="_blank">Google</a>
93
+ * <a href="https://wordpress.org/plugins/review-widgets-for-hotels-com/" target="_blank">Hotels.com</a>
94
+ * <a href="https://wordpress.org/plugins/reviews-widgets-for-opentable/" target="_blank">Opentable</a>
95
+ * <a href="https://wordpress.org/plugins/review-widgets-for-tripadvisor/" target="_blank">Tripadvisor</a>
96
+ * <a href="https://wordpress.org/plugins/review-widgets-for-trustpilot/" target="_blank">Trustpilot</a>
97
+ * <a href="https://wordpress.org/plugins/widgets-for-thumbtack-reviews/" target="_blank">Thumbtack</a>
98
+ * <a href="https://wordpress.org/plugins/reviews-widgets-for-yelp/" target="_blank">Yelp</a>
99
+
100
+ == Support ==
101
+
102
+ Email: support@trustindex.io
103
+
104
+ == Installation ==
105
+
106
+ 1. Upload the plugin files to the `/wp-content/plugins/` directory, or install the plugin through the WordPress plugins screen directly.
107
+ 2. Activate the plugin through the 'Plugins' screen in WordPress
108
+ 3. Use the Trustindex.io menu item on the left to configure the plugin.
109
+ 4. You can get PRO functions by registering in Trustindex on the "Log in" tab!
110
+
111
+ == Frequently Asked Questions ==
112
+
113
+ = Is the Plugin Free? =
114
+
115
+ Yes! You can use Trustindex WordPress plugins for free. It has a basic functionality, which are perfect for small merchants, services...
116
+
117
+ If you need more functions (more platforms, automatic review collecting, managing reviews, displaying reviews in one place, email signature, etc.), create a free account on Trustindex. (But you can use our professional widgets without subscription -for free- only 7 days.)
118
+
119
+ = What can I set in the free plugin? =
120
+
121
+ You can select a template and a style for your review widget’s appearance. There is a review filter and you can skip ratings (reviews without texts...). The free plugin also supports languages and internationalization: changing (or hiding) footer texts and date formats are also available!
122
+
123
+ = Can I use (only) the free plugin if I don't want to subcribe to Trustindex? =
124
+
125
+ Yes, sure!
126
+
127
+ = I don’t have any Google Reviews yet, what can I do? =
128
+
129
+ You can create review-requesting campaigns easily in Trustindex if you create a free account. Also there are some useful stuff in our blog.
130
+
131
+ = Why Google Reviews are better than a simple review collected by myself? =
132
+
133
+ Reviews collected by Google are much more reliable than feedbacks from a private uncontrollable source. You can increase SEO, trust and sales using Google Reviews.
134
+
135
+ == Changelog ==
136
+
137
+ = 4.0 =
138
+ * New feature: new translation (magyar)
139
+ * New feature: dark themes got fancier platform (Facebook, Google, etc...) logos.
140
+ * New feature: Option to hide reviewers' photo from review widgets.
141
+ * New feature: Handling Google Place IDs.
142
+ * Bugfix: Eliminating some typos.
143
+
144
+ = 3.2 =
145
+ * New design: Improved style.
146
+ * New feature: Package helper to exactly know that your review widgets are working or not.
147
+ * Bugfix: PHP bugfix about connecting Facebook platform to get its reviews.
148
+
149
+ = 3.1.3 =
150
+ * Bugfix: Text modifications.
151
+
152
+ = 3.1.2 =
153
+ * Bugfix: Widget size modifications.
154
+
155
+ = 3.1.1 =
156
+ * New feature: URL helper when connect.
157
+ * Content: New setup help texts.
158
+
159
+ = 3.1 =
160
+ * New feature: Troubleshooting (refreshing database, and review widget styles).
161
+ * New feature: Review list (check your reviews).
162
+ * Optimization: Decreased Plugin sizes.
163
+
164
+ = 3.0 =
165
+ * New feature: Introduction of 10-point scale of review in some cases (Booking.com, Hotels.com, Foursquare, ...).
166
+
167
+ = 2.11 =
168
+ * New feature: Reload/refresh reviews.
169
+ * Content: End of review promo in some platforms: Amazon, Facebook, Airbnb ...
170
+ * Content: Changed plugin promo: Thumbtack.
171
+
172
+ = 2.10 =
173
+ * New feature: CSS classnames became unique.
174
+ * Content: Widget renamings.
175
+ * Content: Changed plugin promo: Capterra.
176
+
177
+ = 2.9 =
178
+ * Content: New review collecting discount.
179
+ * New feature: Show verified icons.
180
+ * New feature: Enable animation.
181
+ * New feature: Show navigation arrows.
182
+
183
+ = 2.8.13 =
184
+ * Bugfix: layout_id casting problems are solved.
185
+ * Content: Forever free mode emphased.
186
+ * Content: New F.A.Q.
187
+
188
+ = 2.8.12 =
189
+ * New feature: Mouse hover animation in review widgets.
190
+ * New feature: Recommendation support in Facebook.
191
+
192
+ = 2.8.11 =
193
+ * New feature: Amazon multiple domain support.
194
+ * Content: Minify on source codes.
195
+ * Bugfix: Sanitizing user inputs.
196
+ * Content: Changed plugin promo: Bookatable
197
+
198
+ = 2.8.10 =
199
+ * Bugfix: Hotels.com plugin input placeholder changed.
200
+ * Bugfix: Remove warning notices.
201
+ * Content: Changed plugin promo: Foursquare.
202
+
203
+ = 2.8.9 =
204
+ * Optimization: Amazon, Booking.com, Opentable.
205
+ * New feature: Facebook recommendation icon.
206
+ * Bugfix: Google profile searching.
207
+ * Content: Changed plugin promo: Foursquare.
208
+
209
+ = 2.8.8 =
210
+ * Bugfix: Eliminating some typos.
211
+ * Bugfix: "Show only ratings" feature is now clearer.
212
+
213
+ = 2.8.7 =
214
+ * Bugfix: Request for review is responsible now.
215
+ * New feature: Backward compatibility for older PHP versions.
216
+ * Content: minor mods in default widget styles.
217
+
218
+ = 2.8.6 =
219
+ * Bugfix: Eliminating some typos.
220
+
221
+ = 2.8.5 =
222
+ * Content: Changed plugin promo.
223
+ * New feature: Minor improvements.
224
+
225
+ = 2.8.4 =
226
+ * Bugfix: Some recommendations (ie.:Facebook) has no rating value.
227
+
228
+ = 2.8.3 =
229
+ * Content: New readme texts.
230
+
231
+ = 2.8.2 =
232
+ * Content: Screencast added to readme and to help tab also.
233
+ * New feature: Added cache to business page finder.
234
+ * New feature: More friendly 'ask for review' popups. Please help us to grow with adding a positive review! Thank you in advance!
235
+ * Bugfix: JS error on Facebook connecting.
236
+
237
+ = 2.8.1 =
238
+ * Bugfix: font loading issue.
239
+ * Bugfix: CSS loader issue (style and layout selecting).
240
+
241
+ = 2.8 =
242
+ * New feature: Request for review.
243
+ * New feature: Connect Trustindex account.
244
+ * Bugfix: Toggle Widget shortcode in connected panel.
245
+
246
+ = 2.7.3 =
247
+ * Content: New assets, changed plugin promo.
248
+
249
+ = 2.7.2 =
250
+ * Content: Changed plugin promo.
251
+ * New feature: Custom Wordpress file structure is now supported.
252
+
253
+ = 2.7.1 =
254
+ * Content: Changed tabs.
255
+
256
+ = 2.7 =
257
+ * New feature: Multi-language widget-text variations and dates.
258
+
259
+ = 2.6.3 =
260
+ * Bugfix: PHP7.4 solution of plugin differences.
261
+
262
+ = 2.6.2 =
263
+ * Change feature: Star filter.
264
+ * Bugfix: Class loader optimization.
265
+
266
+ = 2.6.1 =
267
+ * Content: More demonstrative review widgets in example sections.
268
+
269
+ = 2.6 =
270
+ * Content: More purposeful descriptions about Review widget usage.
271
+
272
+ = 2.5.3 =
273
+ * Bugfix: Multiple plugin usage collision.
274
+
275
+ = 2.5.1 =
276
+ * Bugfix: Filter styling
277
+ * Bugfix: Width change when narrow widgets selected.
278
+
279
+ = 2.5 =
280
+ * New feature: Style selector.
281
+
282
+ = 2.4 =
283
+ * New feature: Improved communication with Facebook platfrom.
284
+
285
+ = 2.3 =
286
+ * Bugfix: Minor bugs.
287
+
288
+ = 2.2 =
289
+ * New feature: Setup guide divided into 3 sections for faster Facebook and Trustindex setup.
290
+
291
+ = 2.1 =
292
+ * New feature: Simplified setup to integrate Facebook reviews and recommendations easily.
293
+ * New feature: Added Trustindex prices tab.
294
+ * New feature: Minor changes to meet Wordpress requirements.
295
+
296
+ = 2.0 =
297
+ * New feature: You can use this plugin without any registration. Easier review integratation: no need to API-s, technical skills, Facebook apps, and so on...
298
+ * New feature: New design.
299
+ * New feature: New setup guide.
300
+
301
+ = 1.7 =
302
+ * New feature: Editor (TinyMCE) button has arrived. Integrate your review widget from the editor's toolbar with two click!
303
+
304
+ = 1.6 =
305
+ * New feature: Changed design.
306
+
307
+ = 1.5 =
308
+ * New feature: Added help text.
309
+
310
+ = 1.4 =
311
+ * New feature: Added setup guide.
312
+
313
+ = 1.3 =
314
+ * New feature: Changed layout for easier clarity.
315
+
316
+ = 1.2 =
317
+ * New feature: Widget for reviews added.
318
+ * New feature: New admin menu structure.
319
+
320
+ = 1.1 =
321
+ * New feature: More secured plugin.
322
+
323
+ = 1.0 =
324
+ * Introduce: It makes Trusindex integration easier!
325
+
326
+ == Upgrade Notice ==
327
+
328
+ = 3.2 =
329
+ * Please upgrade!
330
+
331
+ = 3.0 =
332
+ * Please upgrade!
333
+ * Please refresh your reviews
334
+
335
+ = 2.8.12 =
336
+ * Please disconnect and reconnect your profile (Facebook/Google/Yelp/...) if you are using the plugin in forever-free mode (without registration/subscription)
337
+
338
+ = 2.5 =
339
+ * Please upgrade!
340
+
341
+ = 2.0 =
342
+ * Check your shortcodes, please!
343
+
344
+ = 1.0 =
345
+ * Make a backup!
settings.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ if (!current_user_can('manage_options'))
5
+ {
6
+ die('The account you\'re logged in to doesn\'t have permission to access this page.');
7
+ }
8
+ if(isset($_GET['rate_us']))
9
+ {
10
+ switch($_GET['rate_us'])
11
+ {
12
+ case 'open':
13
+ update_option($trustindex_pm_google->get_option_name('rate-us') , 'hide', false);
14
+ $url = 'https://wordpress.org/support/plugin/'. $trustindex_pm_google->get_plugin_slug() . '/reviews/?rate=5#new-post';
15
+ header('Location: '. $url);
16
+ die;
17
+ case 'later':
18
+ $time = time() + (30 * 86400);
19
+ update_option($trustindex_pm_google->get_option_name('rate-us') , $time, false);
20
+ break;
21
+ case 'hide':
22
+ update_option($trustindex_pm_google->get_option_name('rate-us') , 'hide', false);
23
+ break;
24
+ }
25
+ echo "<script type='text/javascript'>self.close();</script>";
26
+ die;
27
+ }
28
+ $tabs = array(
29
+ TrustindexPlugin::___('Free Widget Configurator') => "setup_no_reg",
30
+ TrustindexPlugin::___('My Reviews') => "my_reviews",
31
+ TrustindexPlugin::___("Rate Us") => "rate",
32
+ TrustindexPlugin::___('Get more Features') => "setup_trustindex",
33
+ TrustindexPlugin::___('Log In') => "setup_trustindex_join",
34
+ TrustindexPlugin::___('Troubleshooting') => "troubleshooting",
35
+ );
36
+ $selected_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : null;
37
+ if (!in_array($selected_tab, $tabs)){ $selected_tab = reset($tabs); }
38
+ wp_enqueue_script( "trustindex_settings_script_common_google");
39
+ wp_enqueue_style( "trustindex_settings_style_google" );
40
+ if(wp_script_is( "trustindex_settings_script_google", 'registered' ))
41
+ {
42
+ wp_enqueue_script( "trustindex_settings_script_google");
43
+ }
44
+ ?>
45
+ <div id="trustindex-plugin-settings-page">
46
+ <h1><a href="https://www.trustindex.io" target="_blank" title="Trustindex">
47
+ <img src="<?php echo $trustindex_pm_google->get_plugin_file_url('static/img/trustindex.svg'); ?>" /></a>
48
+ </h1>
49
+ <div class="container_wrapper">
50
+ <div class="container_cell" id="container-main">
51
+ <div class="nav-tab-wrapper">
52
+ <?php foreach ($tabs as $tab_name => $tab): ?>
53
+
54
+ <a id="link-tab-<?php echo $tab; ?>" class="nav-tab<?php if ($selected_tab == $tab): ?> nav-tab-active<?php endif; ?><?php if ($tab == 'troubleshooting'): ?> float-right<?php endif; ?>" href="<?php echo admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab='.$tab); ?>"><?php echo $tab_name; ?></a>
55
+ <?php endforeach; ?>
56
+
57
+ </div>
58
+ <div id="tab-<?php echo $selected_tab; ?>">
59
+ <?php include( plugin_dir_path(__FILE__ ) . "tabs/".$selected_tab.".php" ); ?>
60
+
61
+ </div>
62
+ </div>
63
+ <?php /*
64
+
65
+ <div class="container_cell" id="container-sidebar">
66
+ <div class="box">
67
+ <div class="box-header">
68
+ <h4><?php echo TrustindexPlugin::___('Pro package'); ?></h4>
69
+ </div>
70
+ <div class="box-content">
71
+ <p>
72
+ + <?php echo TrustindexPlugin::___('No ads'); ?><br />
73
+ + <?php echo TrustindexPlugin::___('No banner'); ?><br />
74
+ </p>
75
+ <hr />
76
+ <a href="https://www.trustindex.io" target="_blank" class="btn btn-primary">Check www.trustindex.io!</a>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ */ ?>
81
+ </div>
82
+ </div>
static/css/admin-editor.css ADDED
@@ -0,0 +1,2 @@
 
 
1
+ .dashicons, .dashicons-before:before { font-family: dashicons !important;}
2
+ .text-danger { color: red !important; }
static/css/admin-page-settings.css ADDED
@@ -0,0 +1,742 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800&display=swap&subset=latin-ext');
2
+ @import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');
3
+
4
+
5
+ /*************************************************************************/
6
+ /* LAYOUT */
7
+ #trustindex-plugin-settings-page {
8
+ max-width: 1200px;
9
+ }
10
+
11
+ #trustindex-plugin-settings-page .container_wrapper {
12
+ display: table;
13
+ width: 100%;
14
+ table-layout: fixed;
15
+ }
16
+
17
+ #trustindex-plugin-settings-page .container_cell {
18
+ display: table-cell;
19
+ margin: 0px;
20
+ padding: 10px;
21
+ vertical-align: top;
22
+ }
23
+
24
+ #trustindex-plugin-settings-page #container-main {
25
+ width: 100%;
26
+ }
27
+
28
+ #trustindex-plugin-settings-page #container-sidebar {
29
+ width: 261px;
30
+ padding: 100px 0 0 19px;
31
+ }
32
+
33
+ #trustindex-plugin-settings-page #container-sidebar .sticky {
34
+ position: fixed;
35
+ top: 200px;
36
+ }
37
+
38
+ /* NAV - TABS */
39
+ #trustindex-plugin-settings-page .nav-tab-wrapper {
40
+ margin-bottom: 50px;
41
+ }
42
+
43
+ #trustindex-plugin-settings-page .maxwidth {
44
+ max-width: 1240px;
45
+ }
46
+
47
+ /* H1-H6 */
48
+ #trustindex-plugin-settings-page h1 {
49
+ line-height: 1.35em;
50
+ color: #000;
51
+ font-family: "Montserrat";
52
+ font-weight: 600;
53
+ font-size: 35px;
54
+ }
55
+ @media (max-width:767px){
56
+ #trustindex-plugin-settings-page h1 {
57
+ font-size: 21px;
58
+ }
59
+ }
60
+
61
+ #trustindex-plugin-settings-page h1 strong {
62
+ font-weight: 900;
63
+ }
64
+
65
+ #trustindex-plugin-settings-page h1 img {
66
+ height: 30px;
67
+ }
68
+
69
+ #trustindex-plugin-settings-page h2 {
70
+ margin-top: 40px;
71
+ font-weight: 700;
72
+ font-size: 16px;
73
+ line-height: 1.35em;
74
+ font-family: 'Open Sans', serif;
75
+ }
76
+
77
+ #trustindex-plugin-settings-page h3 {
78
+ font-weight: 700;
79
+ font-size: 20px;
80
+ font-family: 'Montserrat';
81
+
82
+ }
83
+
84
+ /* GENERAL */
85
+ #trustindex-plugin-settings-page p {
86
+ font-size: 16px;
87
+ font-family: 'Open Sans', serif;
88
+ font-weight: 400;
89
+ color: #5c666d;
90
+ }
91
+
92
+ #trustindex-plugin-settings-page label {
93
+ font-size: 18px;
94
+ font-family: 'Open Sans', serif;
95
+ font-weight: 400;
96
+ color: #5c666d;
97
+ }
98
+
99
+ #trustindex-plugin-settings-page .yellow {
100
+ background: #eaeb94;
101
+ }
102
+
103
+ #trustindex-plugin-settings-page .text-danger {
104
+ color: red;
105
+ }
106
+
107
+ #trustindex-plugin-settings-page .text-muted {
108
+ color: gray;
109
+ }
110
+
111
+ #trustindex-plugin-settings-page .float-right {
112
+ float: right;
113
+ }
114
+
115
+ #trustindex-plugin-settings-page .text-center {
116
+ text-align: center;
117
+ }
118
+
119
+ #trustindex-plugin-settings-page p.text-small {
120
+ font-size: 10px;
121
+ margin: 0px;
122
+ }
123
+
124
+ #trustindex-plugin-settings-page .code,
125
+ #trustindex-plugin-settings-page code {
126
+ display: inline-block;
127
+ padding: 10px;
128
+ }
129
+
130
+ #trustindex-plugin-settings-page .ti-ul {
131
+ padding-left: 30px;
132
+ }
133
+
134
+ #trustindex-plugin-settings-page .ti-ul li {
135
+ list-style: disc;
136
+ }
137
+
138
+ /* LIST */
139
+ #trustindex-plugin-settings-page ul.numbered {
140
+ margin-top: 60px;
141
+ border-left: dashed 1px #ccc;
142
+ margin-left: 30px;
143
+ counter-reset: li;
144
+ padding-left: 45px;
145
+ }
146
+
147
+ #trustindex-plugin-settings-page ul.numbered.narrow {
148
+ max-width: 500px;
149
+ }
150
+
151
+ #trustindex-plugin-settings-page ul.numbered>li {
152
+ position: relative;
153
+ list-style: none;
154
+ margin: 0 !important;
155
+ margin-bottom: 35px !important;
156
+ counter-increment: li;
157
+ background: #fff;
158
+ padding: 25px 30px;
159
+ border-radius: 4px;
160
+ -webkit-box-shadow: 10px 10px 39px 0px rgba(0,0,0,0.0.05);
161
+ -moz-box-shadow: 10px 10px 39px 0px rgba(0,0,0,0.05);
162
+ box-shadow: 10px 10px 39px 0px rgba(0,0,0,0.05);
163
+ }
164
+
165
+
166
+ #trustindex-plugin-settings-page ul.numbered>li.disabled {
167
+ opacity: 0.4;
168
+ }
169
+
170
+ #trustindex-plugin-settings-page ul.numbered>li h3 {
171
+ margin-top: 0px;
172
+ padding-bottom: 20px;
173
+ margin-left: -30px;
174
+ margin-right: -30px;
175
+ padding-left: 30px;
176
+ padding-right: 30px;
177
+ margin-bottom: 30px;
178
+ border-bottom: 1px #dbdde5 solid ;
179
+ }
180
+
181
+ #trustindex-plugin-settings-page ul.numbered>li:before {
182
+ content: counter(li);
183
+ position: absolute;
184
+ width: 50px;
185
+ height: 50px;
186
+ line-height: 50px;
187
+ font-weight: 800;
188
+ font-size: 18px;
189
+ text-align: center;
190
+ border-radius: 50px;
191
+ left: -73px;
192
+ top: -26px;
193
+ border: solid 2px #242F62;
194
+ background: #242F62;
195
+ color: #fff;
196
+ }
197
+
198
+ #trustindex-plugin-settings-page ul.numbered>li:after {
199
+ width: 0;
200
+ height: 0;
201
+ border-style: solid;
202
+ border-width: 0 25px 25px 0;
203
+ border-color: transparent #ffffff transparent transparent;
204
+ position: absolute;
205
+ top: 0px;
206
+ left: -14px;
207
+ content: "";
208
+ }
209
+
210
+ #trustindex-plugin-settings-page ol,
211
+ #trustindex-plugin-settings-page ol li,
212
+ #trustindex-plugin-settings-page ul,
213
+ #trustindex-plugin-settings-page ul li {
214
+ font-size: 14px;
215
+ font-family: 'Open Sans', serif;
216
+ }
217
+
218
+ #trustindex-plugin-settings-page li {
219
+ margin-bottom: 7px;
220
+ }
221
+
222
+ #trustindex-plugin-settings-page strong {
223
+ font-weight: 700;
224
+ color: #000;
225
+ }
226
+
227
+ #trustindex-plugin-settings-page .center-text {
228
+ text-align: center;
229
+ }
230
+
231
+ /* IMG */
232
+ #trustindex-plugin-settings-page img.max100 {
233
+ max-width: 100%;
234
+ }
235
+
236
+ #trustindex-plugin-settings-page .zoomable-pic {
237
+ max-width: 200px;
238
+ cursor: pointer;
239
+ }
240
+
241
+ /* FORMS */
242
+ #trustindex-plugin-settings-page .form-group {
243
+ display: block;
244
+ overflow: hidden;
245
+ margin-top: 20px;
246
+ }
247
+
248
+ #trustindex-plugin-settings-page .form-control {
249
+ width: 100%;
250
+ margin: 0;
251
+ padding: 8px 15px;
252
+ border-radius: .25rem;
253
+ border: 2px solid #ddd;
254
+
255
+ background-color: #efefef;
256
+ }
257
+
258
+ #trustindex-plugin-settings-page .input-group>.form-control {
259
+ position: relative;
260
+ -webkit-box-flex: 1;
261
+ -ms-flex: 1 1 auto;
262
+ flex: 1 1 auto;
263
+ width: 1%;
264
+ margin-bottom: 0;
265
+ }
266
+
267
+ #trustindex-plugin-settings-page .input-group {
268
+ position: relative;
269
+ display: -webkit-box;
270
+ display: -ms-flexbox;
271
+ display: flex;
272
+ -ms-flex-wrap: wrap;
273
+ flex-wrap: wrap;
274
+ -webkit-box-align: stretch;
275
+ -ms-flex-align: stretch;
276
+ align-items: stretch;
277
+ width: 100%;
278
+ }
279
+
280
+ #trustindex-plugin-settings-page .input-group-prepend {
281
+ margin-right: -1px;
282
+ }
283
+
284
+ #trustindex-plugin-settings-page .input-group-append,
285
+ #trustindex-plugin-settings-page .input-group-prepend {
286
+ display: -webkit-box;
287
+ display: -ms-flexbox;
288
+ display: flex;
289
+ }
290
+
291
+ #trustindex-plugin-settings-page .input-group-text {
292
+ display: -webkit-box;
293
+ display: -ms-flexbox;
294
+ display: flex;
295
+ -webkit-box-align: center;
296
+ -ms-flex-align: center;
297
+ align-items: center;
298
+ padding: .375rem .75rem;
299
+ margin-bottom: 0;
300
+ font-size: 1rem;
301
+ font-weight: 400;
302
+ line-height: 1.5;
303
+ color: #495057;
304
+ text-align: center;
305
+ white-space: nowrap;
306
+ background-color: #e9ecef;
307
+ border: 1px solid #ced4da;
308
+ border-radius: .25rem;
309
+ border-top-right-radius: 0;
310
+ border-bottom-right-radius: 0;
311
+ }
312
+
313
+ /* BTN */
314
+ #trustindex-plugin-settings-page .btn {
315
+ display: block;
316
+ line-height: 1.5;
317
+ text-align: center;
318
+
319
+ white-space: nowrap;
320
+ vertical-align: middle;
321
+ -webkit-user-select: none;
322
+ -moz-user-select: none;
323
+ -ms-user-select: none;
324
+ user-select: none;
325
+
326
+ border: 1px solid transparent;
327
+
328
+ padding: .8rem 1.5rem;
329
+ margin: 20px auto 0px auto;
330
+ width: fit-content;
331
+
332
+ font-size: 1.2rem;
333
+ border-radius: .25rem;
334
+ -webkit-transition: all .2s ease-in-out;
335
+ -o-transition: all .2s ease-in-out;
336
+ transition: all .2s ease-in-out;
337
+
338
+ font-weight: bold;
339
+ text-decoration: none;
340
+
341
+ cursor: pointer;
342
+ }
343
+
344
+ #trustindex-plugin-settings-page .btn:hover {
345
+ color: #fff;
346
+ opacity: .9;
347
+ }
348
+
349
+ #trustindex-plugin-settings-page .btn-primary,
350
+ #trustindex-plugin-settings-page .btn-warning {
351
+ background-color: #ee7321 !important;
352
+ border-color: #ee7321 !important;
353
+ font-family: "Montserrat";
354
+ font-weight: 700;
355
+ color: white;
356
+ }
357
+
358
+ #trustindex-plugin-settings-page .btn-delete {
359
+ background-color: white;
360
+ border-color: #e33244 !important;
361
+ color: #e33244;
362
+ border-width:2px; font-family: "Montserrat";
363
+ font-weight: 700;
364
+ }
365
+
366
+ #trustindex-plugin-settings-page .btn-delete:hover {
367
+ background-color: #e33244;
368
+ color: #fff;
369
+ opacity: .9;
370
+ }
371
+
372
+ #trustindex-plugin-settings-page .btn-text {
373
+ display: inline-block;
374
+ color: #fff;
375
+ text-decoration: none;
376
+ border-radius: 4px;
377
+ background: #2AA8D7;
378
+ font-family: "Montserrat";
379
+ padding: 10px 15px;
380
+ margin: 3px;
381
+ font-weight: 700;
382
+ }
383
+ #trustindex-plugin-settings-page .btn-text:hover{
384
+ background-color: #2187ad !important;
385
+ border-color: #2187ad !important;
386
+ }
387
+ /*************************************************************************/
388
+ /* AUTOCOMPLETE */
389
+ #trustindex-plugin-settings-page .autocomplete {
390
+ display: block;
391
+ position: relative;
392
+ }
393
+
394
+ #trustindex-plugin-settings-page .autocomplete .loading {
395
+ float: right;
396
+ margin-top: -27px;
397
+ margin-right: 8px;
398
+ width: 18px;
399
+ position: relative;
400
+ z-index: 1;
401
+ display: none
402
+ }
403
+
404
+ #trustindex-plugin-settings-page .autocomplete span {
405
+ display: block;
406
+ padding: 10px;
407
+ }
408
+
409
+ #trustindex-plugin-settings-page .autocomplete span.error {
410
+ color: #e33244;
411
+ }
412
+
413
+ #trustindex-plugin-settings-page .autocomplete .results {
414
+ position: absolute;
415
+ z-index: 1;
416
+ width: calc(100% - 2px);
417
+ padding: 0;
418
+ margin: 0;
419
+ border-radius: .25rem;
420
+ border: 1px solid #ddd;
421
+ background: #fff;
422
+ margin-top: 10px;
423
+ display: none;
424
+ -webkit-touch-callout: none;
425
+ -webkit-user-select: none;
426
+ -khtml-user-select: none;
427
+ -moz-user-select: none;
428
+ -ms-user-select: none;
429
+ user-select: none;
430
+ }
431
+
432
+ #trustindex-plugin-settings-page .autocomplete .results:after,
433
+ #trustindex-plugin-settings-page .autocomplete .results:before {
434
+ bottom: 100%;
435
+ left: 32px;
436
+ border: solid transparent;
437
+ content: " ";
438
+ height: 0;
439
+ width: 0;
440
+ position: absolute;
441
+ pointer-events: none;
442
+ }
443
+
444
+ #trustindex-plugin-settings-page .autocomplete .results:after {
445
+ border-color: rgba(255, 255, 255, 0);
446
+ border-bottom-color: #fff;
447
+ border-width: 8px;
448
+ margin-left: -8px;
449
+ }
450
+
451
+ #trustindex-plugin-settings-page .autocomplete .results:before {
452
+ border-color: rgba(221, 221, 221, 0);
453
+ border-bottom-color: #ddd;
454
+ border-width: 9px;
455
+ margin-left: -9px;
456
+ }
457
+
458
+ #trustindex-plugin-settings-page .autocomplete .results ul {
459
+ display: block;
460
+ max-height: 300px;
461
+ overflow: auto;
462
+ list-style-type: none;
463
+ margin: 0;
464
+ padding: 0;
465
+ }
466
+
467
+ #trustindex-plugin-settings-page .autocomplete .results li {
468
+ display: block;
469
+ padding: 5px 10px;
470
+ margin: 0;
471
+ border-bottom: 1px solid grey;
472
+ cursor: pointer;
473
+ transition: all .25s
474
+ }
475
+
476
+ #trustindex-plugin-settings-page .autocomplete .results li:last-of-type {
477
+ border-bottom: 0
478
+ }
479
+
480
+ #trustindex-plugin-settings-page .autocomplete .results li:hover {
481
+ background: rgba(0, 100, 255, 0.1)
482
+ }
483
+
484
+ #trustindex-plugin-settings-page .autocomplete .results li svg {
485
+ width: 40px;
486
+ height: 40px;
487
+ position: relative;
488
+ top: 3px;
489
+ margin-right: 10px;
490
+ float: left;
491
+ }
492
+
493
+ #trustindex-plugin-settings-page .autocomplete .results li img {
494
+ width: 44px;
495
+ height: 44px;
496
+ margin-right: 10px;
497
+ float: left;
498
+ border-radius: 50%;
499
+ box-shadow: 0 0 2px black;
500
+ }
501
+
502
+ #trustindex-plugin-settings-page .autocomplete .results li .title {
503
+ margin: 0;
504
+ margin-bottom: 5px;
505
+ font-size: 14px;
506
+ color: #000;
507
+ pointer-events: none
508
+ }
509
+
510
+ #trustindex-plugin-settings-page .autocomplete .results li .location {
511
+ margin: 0;
512
+ font-size: 12px;
513
+ color: #888;
514
+ pointer-events: none
515
+ }
516
+
517
+ .ti-left-block,
518
+ .ti-right-block {
519
+ display: inline-block !important;
520
+ float: left;
521
+ vertical-align: top;
522
+ width: calc(50% - 15px) !important;
523
+ margin: 0 !important
524
+ }
525
+ .ti-left-block .form-control, .ti-right-block .form-control{
526
+ max-width: 400px;
527
+
528
+ }
529
+ .ti-right-block {
530
+ float: right
531
+ }
532
+
533
+ .ti-checkbox {
534
+ float: left;
535
+ display: inline-block;
536
+ width: calc(33.333% - 15px);
537
+ margin-bottom: 2px;
538
+ margin-right: 15px;
539
+ white-space: nowrap;
540
+ cursor: pointer;
541
+ user-select: none;
542
+ }
543
+
544
+ .ti-checkbox.row {
545
+ float: initial;
546
+ display: block
547
+ }
548
+
549
+ .ti-checkbox:last-of-type {
550
+ width: 33.333%;
551
+ margin-right: 0
552
+ }
553
+
554
+ .ti-checkbox input,
555
+ .ti-checkbox label {
556
+ pointer-events: none
557
+ }
558
+
559
+ .ti-checkbox input {
560
+ position: relative;
561
+ top: 2px;
562
+ margin-right: 10px;
563
+ }
564
+
565
+ .ti-checkbox span {
566
+ width: 16px;
567
+ height: 16px;
568
+ display: inline-block;
569
+ margin-right: 1px;
570
+ }
571
+
572
+ .ti-checkbox label {
573
+ font-size: 14px !important
574
+ }
575
+
576
+ .ti-style-widget {
577
+ margin-right: -15px;
578
+ margin-left: -15px;
579
+ display: flex !important;
580
+ flex-wrap: wrap;
581
+ }
582
+
583
+ .ti-style-widget .col-sm-4 {
584
+ display: inline-block;
585
+ width: calc(33.333333% - 30px);
586
+ float: left;
587
+ position: relative;
588
+ padding-right: 15px;
589
+ padding-left: 15px;
590
+ margin-bottom: 10px;
591
+ }
592
+
593
+ .ti-style-widget .col-sm-4 input {
594
+ height: 30px;
595
+ line-height: 1.5;
596
+ }
597
+
598
+ .ti-style-widget .col-sm-4 label {
599
+ display: block;
600
+ font-size: 0.82rem !important;
601
+ margin-bottom: 3px;
602
+ cursor: default !important
603
+ }
604
+
605
+ .ti-style-widget .col-sm-4 input[type=color] {
606
+ padding: 2px 4px !important;
607
+ height: 32px;
608
+ cursor: pointer
609
+ }
610
+
611
+ .ti-style-widget .col-sm-4 .btn {
612
+ margin: 0 !important;
613
+ padding-top: 0 !important;
614
+ padding-bottom: 0 !important;
615
+ height: 30px;
616
+ line-height: 30px;
617
+ font-size: 1rem !important;
618
+ border: 0 !important;
619
+ outline: 0 !important;
620
+ box-shadow: none !important
621
+ }
622
+
623
+ .ti-select {
624
+ display: block;
625
+ max-width: calc(25rem - 30px);
626
+ margin: 0;
627
+ padding: 8px 15px;
628
+ border-radius: .25rem;
629
+ border: 2px solid #ddd;
630
+
631
+ background-color: #efefef;
632
+ font-size: 14px;
633
+ line-height: 2;
634
+ color: #32373c;
635
+ position: relative;
636
+ cursor: pointer;
637
+ user-select: none;
638
+ }
639
+
640
+ .ti-select:after {
641
+ content: '\203A';
642
+ position: absolute;
643
+ top: 50%;
644
+ right: 9px;
645
+ font-size: 26px;
646
+ z-index: 1;
647
+ transform: translateY(-50%) rotate(90deg);
648
+ }
649
+
650
+ .ti-select ul {
651
+ display: none;
652
+ position: absolute;
653
+ z-index: 1;
654
+ left: -1px;
655
+ top: 100%;
656
+ width: 100%;
657
+ margin: 0;
658
+ padding: 0;
659
+ list-style-type: none;
660
+ background-color: #efefef;
661
+ border: 1px solid #ddd;
662
+ border-top: 0;
663
+ border-bottom-left-radius: .25rem;
664
+ border-bottom-right-radius: .25rem;
665
+ }
666
+
667
+ .ti-select ul li {
668
+ display: block;
669
+ margin: 0 !important;
670
+ padding: 5px 10px;
671
+ border-top: 1px solid #ccc;
672
+ cursor: pointer;
673
+ line-height: 1.4;
674
+ transition: all .3s
675
+ }
676
+
677
+ .ti-select ul li:hover {
678
+ background: rgba(30, 144, 255, .3)
679
+ }
680
+
681
+ .ti-select ul li.selected {
682
+ background: rgba(30, 144, 255, .6);
683
+ pointer-events: none
684
+ }
685
+
686
+ .ti-select ul li * {
687
+ pointer-events: none
688
+ }
689
+
690
+ .ti-select .ti-star {
691
+ position: relative;
692
+ top: 3px;
693
+ width: 16px;
694
+ height: 16px;
695
+ display: inline-block;
696
+ margin-right: 1px;
697
+ }
698
+
699
+ .ti-select.active {
700
+ border-radius: 0;
701
+ border-bottom: 0;
702
+ border-top-left-radius: .25rem;
703
+ border-top-right-radius: .25rem;
704
+ }
705
+
706
+ .ti-select.active ul {
707
+ display: block;
708
+ }
709
+
710
+ .ti-select.active:after {
711
+ content: '\2039'
712
+ }
713
+
714
+ .ti-my-reviews .ti-user-avatar {
715
+ width: 30px;
716
+ margin-bottom: -2px;
717
+ border-radius: 50%;
718
+ }
719
+
720
+ .ti-my-reviews .ti-star {
721
+ display: inline-block;
722
+ width: 17px
723
+ }
724
+
725
+ .ti-my-reviews .morecontent a {
726
+ outline: 0 !important;
727
+ box-shadow: none !important
728
+ }
729
+
730
+ .ti-troubleshooting-info {
731
+ width: 100%;
732
+ height: 200px;
733
+ resize: none;
734
+ outline: 0 !important;
735
+ box-shadow: none !important;
736
+ border: 1px solid #7e8993 !important
737
+ }
738
+ .ti-preview-box{
739
+ padding-top: 30px;
740
+ padding-bottom: 15px;
741
+ margin-top: -10px;
742
+ }
static/css/admin-widget.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .text-danger { color: red; }
2
+ .text-success { color: green; }
3
+
4
+ .trustindex-widget-admin .block-help-template { display: none; }
5
+ .trustindex-widget-admin .help-block { position: absolute; background: white;padding: 10px; border: 1px solid blue; z-index: 10; }
6
+ .trustindex-widget-admin .help-block p { margin-top: 0px; }
7
+ .trustindex-widget-admin .help-block .dashicons-dismiss { float: right; cursor: pointer; }
8
+ .trustindex-widget-admin .btn-insert-tooltip { cursor: pointer; }
9
+ .trustindex-widget-admin label .dashicons { float: right; }
10
+
11
+ .trustindex-widget-admin .btn-copy-widget-id { text-decoration: none; }
static/img/help-where-is-id.jpg ADDED
Binary file
static/img/no.png ADDED
Binary file
static/img/trustindex-sign-logo-tiny.png ADDED
Binary file
static/img/trustindex-sign-logo.png ADDED
Binary file
static/img/trustindex.svg ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg width="100%" height="100%" viewBox="0 0 164 28" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
+ <g transform="matrix(1,0,0,1,-729.338,-2270.76)">
5
+ <g transform="matrix(1,0,0,3.12614,599,2245)">
6
+ <g transform="matrix(0.980402,0,0,0.861654,-4.28566,114.712)">
7
+ <g transform="matrix(0.244286,0,0,0.374686,181.291,-27.4186)">
8
+ <g>
9
+ <g>
10
+ <g transform="matrix(102.339,0,0,24.2848,-45,-233.981)">
11
+ <path d="M0.228,-0.568L0.004,-0.568L0.004,-0.7L0.614,-0.7L0.614,-0.568L0.39,-0.568L0.39,0L0.228,0L0.228,-0.568Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
12
+ </g>
13
+ <g transform="matrix(102.339,0,0,24.2848,15.1754,-233.981)">
14
+ <path d="M0.221,-0.467C0.24,-0.493 0.265,-0.513 0.297,-0.526C0.328,-0.539 0.365,-0.546 0.406,-0.546L0.406,-0.402C0.389,-0.403 0.377,-0.404 0.371,-0.404C0.326,-0.404 0.291,-0.392 0.266,-0.367C0.241,-0.342 0.228,-0.304 0.228,-0.254L0.228,0L0.072,0L0.072,-0.538L0.221,-0.538L0.221,-0.467Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
15
+ </g>
16
+ <g transform="matrix(102.339,0,0,24.2848,56.2135,-233.981)">
17
+ <path d="M0.614,-0.538L0.614,0L0.466,0L0.466,-0.064C0.445,-0.041 0.421,-0.023 0.392,-0.011C0.363,0.002 0.332,0.008 0.299,0.008C0.228,0.008 0.172,-0.012 0.131,-0.053C0.09,-0.094 0.069,-0.154 0.069,-0.234L0.069,-0.538L0.225,-0.538L0.225,-0.257C0.225,-0.17 0.261,-0.127 0.334,-0.127C0.371,-0.127 0.401,-0.139 0.424,-0.164C0.447,-0.188 0.458,-0.224 0.458,-0.272L0.458,-0.538L0.614,-0.538Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
18
+ </g>
19
+ <g transform="matrix(102.339,0,0,24.2848,123.45,-233.981)">
20
+ <path d="M0.253,0.008C0.208,0.008 0.165,0.002 0.122,-0.009C0.079,-0.02 0.045,-0.033 0.02,-0.05L0.072,-0.162C0.096,-0.147 0.125,-0.134 0.159,-0.125C0.193,-0.115 0.226,-0.11 0.259,-0.11C0.325,-0.11 0.358,-0.126 0.358,-0.159C0.358,-0.174 0.349,-0.185 0.331,-0.192C0.313,-0.199 0.285,-0.204 0.248,-0.209C0.204,-0.216 0.168,-0.223 0.139,-0.232C0.11,-0.241 0.086,-0.256 0.065,-0.278C0.043,-0.3 0.033,-0.331 0.033,-0.372C0.033,-0.406 0.043,-0.436 0.063,-0.463C0.082,-0.489 0.111,-0.509 0.149,-0.524C0.186,-0.539 0.231,-0.546 0.282,-0.546C0.32,-0.546 0.358,-0.542 0.396,-0.534C0.433,-0.525 0.464,-0.514 0.489,-0.499L0.437,-0.388C0.39,-0.415 0.338,-0.428 0.282,-0.428C0.249,-0.428 0.224,-0.423 0.207,-0.414C0.19,-0.405 0.182,-0.393 0.182,-0.378C0.182,-0.361 0.191,-0.35 0.209,-0.343C0.227,-0.336 0.256,-0.33 0.295,-0.324C0.339,-0.317 0.375,-0.309 0.403,-0.301C0.431,-0.292 0.455,-0.277 0.476,-0.255C0.497,-0.233 0.507,-0.202 0.507,-0.163C0.507,-0.13 0.497,-0.1 0.477,-0.074C0.457,-0.048 0.428,-0.028 0.39,-0.014C0.351,0.001 0.306,0.008 0.253,0.008Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
21
+ </g>
22
+ <g transform="matrix(102.339,0,0,24.2848,174.722,-233.981)">
23
+ <path d="M0.419,-0.026C0.404,-0.015 0.385,-0.006 0.363,-0.001C0.34,0.005 0.317,0.008 0.292,0.008C0.228,0.008 0.179,-0.008 0.143,-0.041C0.109,-0.074 0.091,-0.122 0.091,-0.185L0.091,-0.406L0.008,-0.406L0.008,-0.526L0.091,-0.526L0.091,-0.657L0.247,-0.657L0.247,-0.526L0.381,-0.526L0.381,-0.406L0.247,-0.406L0.247,-0.187C0.247,-0.164 0.253,-0.147 0.265,-0.135C0.276,-0.122 0.293,-0.116 0.314,-0.116C0.339,-0.116 0.36,-0.123 0.377,-0.136L0.419,-0.026Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
24
+ </g>
25
+ <g transform="matrix(102.339,0,0,24.2848,216.17,-233.981)">
26
+ <path d="M0.072,-0.538L0.228,-0.538L0.228,0L0.072,0L0.072,-0.538ZM0.15,-0.613C0.121,-0.613 0.098,-0.621 0.08,-0.638C0.062,-0.655 0.053,-0.675 0.053,-0.7C0.053,-0.725 0.062,-0.745 0.08,-0.762C0.098,-0.779 0.121,-0.787 0.15,-0.787C0.179,-0.787 0.202,-0.779 0.22,-0.763C0.238,-0.747 0.247,-0.727 0.247,-0.703C0.247,-0.677 0.238,-0.656 0.22,-0.639C0.202,-0.622 0.179,-0.613 0.15,-0.613Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
27
+ </g>
28
+ <g transform="matrix(102.339,0,0,24.2848,243.904,-233.981)">
29
+ <path d="M0.399,-0.546C0.466,-0.546 0.52,-0.526 0.561,-0.486C0.602,-0.446 0.622,-0.387 0.622,-0.308L0.622,0L0.466,0L0.466,-0.284C0.466,-0.327 0.457,-0.359 0.438,-0.38C0.419,-0.401 0.392,-0.411 0.357,-0.411C0.318,-0.411 0.286,-0.399 0.263,-0.375C0.24,-0.35 0.228,-0.314 0.228,-0.266L0.228,0L0.072,0L0.072,-0.538L0.221,-0.538L0.221,-0.475C0.242,-0.498 0.267,-0.515 0.298,-0.528C0.329,-0.54 0.362,-0.546 0.399,-0.546Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
30
+ </g>
31
+ <g transform="matrix(102.339,0,0,24.2848,311.55,-233.981)">
32
+ <path d="M0.62,-0.742L0.62,0L0.471,0L0.471,-0.062C0.432,-0.015 0.376,0.008 0.303,0.008C0.252,0.008 0.206,-0.003 0.166,-0.026C0.125,-0.049 0.092,-0.081 0.069,-0.123C0.046,-0.165 0.034,-0.214 0.034,-0.269C0.034,-0.324 0.046,-0.373 0.069,-0.415C0.092,-0.457 0.125,-0.489 0.166,-0.512C0.206,-0.535 0.252,-0.546 0.303,-0.546C0.372,-0.546 0.425,-0.524 0.464,-0.481L0.464,-0.742L0.62,-0.742ZM0.33,-0.12C0.369,-0.12 0.402,-0.134 0.428,-0.161C0.454,-0.188 0.467,-0.224 0.467,-0.269C0.467,-0.314 0.454,-0.35 0.428,-0.378C0.402,-0.405 0.369,-0.418 0.33,-0.418C0.29,-0.418 0.257,-0.405 0.231,-0.378C0.205,-0.35 0.192,-0.314 0.192,-0.269C0.192,-0.224 0.205,-0.188 0.231,-0.161C0.257,-0.134 0.29,-0.12 0.33,-0.12Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
33
+ </g>
34
+ <g transform="matrix(102.339,0,0,24.2848,379.298,-233.981)">
35
+ <path d="M0.599,-0.267C0.599,-0.265 0.598,-0.251 0.596,-0.225L0.189,-0.225C0.196,-0.192 0.214,-0.165 0.241,-0.146C0.268,-0.127 0.302,-0.117 0.343,-0.117C0.371,-0.117 0.396,-0.121 0.418,-0.13C0.439,-0.138 0.459,-0.151 0.478,-0.169L0.561,-0.079C0.51,-0.021 0.436,0.008 0.339,0.008C0.278,0.008 0.225,-0.004 0.178,-0.028C0.131,-0.051 0.095,-0.084 0.07,-0.126C0.045,-0.168 0.032,-0.216 0.032,-0.269C0.032,-0.322 0.045,-0.369 0.07,-0.411C0.095,-0.454 0.129,-0.487 0.172,-0.51C0.216,-0.534 0.265,-0.546 0.319,-0.546C0.372,-0.546 0.419,-0.535 0.462,-0.512C0.505,-0.489 0.538,-0.457 0.563,-0.414C0.587,-0.372 0.599,-0.323 0.599,-0.267ZM0.32,-0.428C0.285,-0.428 0.255,-0.418 0.231,-0.398C0.207,-0.378 0.192,-0.351 0.187,-0.316L0.452,-0.316C0.447,-0.35 0.432,-0.377 0.408,-0.398C0.384,-0.418 0.355,-0.428 0.32,-0.428Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
36
+ </g>
37
+ <g transform="matrix(102.339,0,0,24.2848,440.804,-233.981)">
38
+ <path d="M0.414,0L0.296,-0.165L0.174,0L0.004,0L0.211,-0.271L0.011,-0.538L0.186,-0.538L0.3,-0.381L0.417,-0.538L0.583,-0.538L0.383,-0.275L0.591,0L0.414,0Z" style="fill:rgb(59,64,75);fill-rule:nonzero;"/>
39
+ </g>
40
+ </g>
41
+ </g>
42
+ </g>
43
+ <g transform="matrix(0.591272,0,0,0.21496,-126.416,66.9821)">
44
+ <g transform="matrix(-1.68585,-8.1708e-16,1.50946e-16,-1.68585,675.316,-776.864)">
45
+ <path d="M136,48.2C136,42.019 130.987,37 124.813,37L119.187,37C113.013,37 108,42.019 108,48.2L108,53.8C108,59.981 113.013,65 119.187,65L124.813,65C130.987,65 136,59.981 136,53.8L136,48.2Z" style="fill:rgb(42,168,215);"/>
46
+ </g>
47
+ <g transform="matrix(1.72508,0,0,1.72703,-812.125,-4808.11)">
48
+ <path d="M742.366,2284.2L747.872,2278.68C748.282,2278.27 748.947,2278.27 749.357,2278.68L750.842,2280.17C751.252,2280.58 751.252,2281.25 750.842,2281.66L743.499,2289.01C743.478,2289.04 743.455,2289.07 743.431,2289.09L741.945,2290.58C741.74,2290.78 741.469,2290.89 741.199,2290.89C740.929,2290.89 740.659,2290.78 740.453,2290.58L738.968,2289.09C738.944,2289.07 738.921,2289.04 738.9,2289.01L735.057,2285.16C734.647,2284.75 734.647,2284.09 735.057,2283.68L736.542,2282.19C736.952,2281.78 737.618,2281.78 738.028,2282.19L740.938,2285.1L740.937,2285.1L740.943,2285.11L741.199,2285.37L741.201,2285.36L744.176,2288.31L742.366,2284.2Z" style="fill:white;"/>
49
+ </g>
50
+ </g>
51
+ </g>
52
+ </g>
53
+ </g>
54
+ </svg>
static/img/yes.png ADDED
Binary file
static/js/admin-editor.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(){tinymce.create("tinymce.plugins.trustindex",{init:function(a,b){a.addButton("trustindex",{title:"Add Trustindex widget shortcode",cmd:"add-trustindex-widget",image:b+"/../img/trustindex-sign-logo-tiny.png",text:"Add Trustindex widget"});a.addCommand("add-trustindex-widget",function(){jQuery.get(ajax_object.ajax_url+"?action=list_trustindex_widgets",function(c){a.windowManager.open({title:"Please add an Trustindex widget ID!",body:[{type:"container",name:"container",label:"",html:c},{type:"textbox",name:"widget-id",placeholder:"Trustindex widget ID",multiline:false,minWidth:200}],onsubmit:function(f){var d=f.data["widget-id"];if(d.length<10){alert("Trustindex ID is missing or too short. Please check, mayba a copy-paste error!");return false}else{a.execCommand("mceInsertContent",0,'[trustindex data-widget-id="'+d+'"]')}}})});jQuery("body").on("click",".btn-copy-widget-id",function(c){let selected_class="text-danger";c.preventDefault();let link=jQuery(this);let id=link.data("ti-id");link.closest(".mce-form").find("input").val(id).trigger("change");link.closest(".mce-form").find(".btn-copy-widget-id."+selected_class).each(function(d,e){jQuery(e).removeClass(selected_class).find(".dashicons").attr("class","dashicons dashicons-admin-post")});link.addClass(selected_class).find(".dashicons").attr("class","dashicons dashicons-yes")})})},createControl:function(b,a){return null},getInfo:function(){return{longname:"Trustindex Buttons",author:"Trustindex.io - Velvel ltd[www.velvel.hu]",authorurl:"https://www.trustindex.io/",infourl:"https://www.trustindex.io/",version:"1.1"}}});tinymce.PluginManager.add("trustindex",tinymce.plugins.trustindex)})();
static/js/admin-page-settings-common.js ADDED
@@ -0,0 +1,658 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery.fn.delayKeyup = function(callback, ms) {
2
+ var timer = 0;
3
+ var el = jQuery(this);
4
+ var old = el.val();
5
+ el.on('input', function(e) {
6
+ if(old != el.val())
7
+ {
8
+ old = el.val();
9
+ clearTimeout(timer);
10
+ timer = setTimeout(callback, ms);
11
+ }
12
+ });
13
+ return jQuery(this);
14
+ };
15
+
16
+ String.prototype.ucfirst = function() {
17
+ return this.charAt(0).toUpperCase() + this.slice(1)
18
+ }
19
+
20
+ // Autocomplete config
21
+ var Trustindex_Autocomplete = null;
22
+ jQuery(document).ready(function(){
23
+ /*************************************************************************/
24
+ /* NO REG MODE */
25
+
26
+ Trustindex_Autocomplete = {
27
+ box: jQuery("#trustindex-plugin-settings-page .autocomplete .results"),
28
+ load: jQuery("#trustindex-plugin-settings-page .autocomplete .loading"),
29
+ input: jQuery("#trustindex-plugin-settings-page .autocomplete input.name"),
30
+ button: jQuery("#trustindex-plugin-settings-page .btn-search"),
31
+ svg: {
32
+ 'Hotels': '<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M810.666667 298.666667h-341.333334v298.666666H128V213.333333H42.666667v640h85.333333v-128h768v128h85.333333v-384a170.666667 170.666667 0 0 0-170.666666-170.666666M298.666667 554.666667a128 128 0 0 0 128-128 128 128 0 0 0-128-128 128 128 0 0 0-128 128 128 128 0 0 0 128 128z" fill="" /></svg>',
33
+ 'Restaurants': '<svg id="Layer_1" version="1.1" viewBox="0 0 30 30" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M23,19l-3.328-3.232C19.239,15.273,19,14.637,19,13.98V12c0-4.945,3.157-9.535,3.157-9.535L23,2.999V19z"/><circle cx="23" cy="3" r="1"/><path d="M24,3h-2l-1,10v13.5c0,0.828,0.672,1.5,1.5,1.5h0c0.828,0,1.5-0.672,1.5-1.5V3z"/><path d="M13.087,2.445C13.037,2.186,12.811,2,12.548,2C12.245,2,12,2.245,12,2.548v5.807C12,8.711,11.711,9,11.355,9 c-0.329,0-0.605-0.247-0.641-0.574l-0.66-5.939C10.023,2.21,9.789,2,9.509,2H9.5H9.491C9.211,2,8.977,2.21,8.946,2.488l-0.66,5.939 C8.25,8.753,7.974,9,7.645,9C7.289,9,7,8.711,7,8.355V2.548C7,2.245,6.755,2,6.452,2C6.189,2,5.963,2.186,5.913,2.445 C5.671,3.713,5,7.362,5,9c0,4,3,5,3,5v12.5C8,27.328,8.672,28,9.5,28s1.5-0.672,1.5-1.5V14c0,0,3-1,3-5 C14,7.362,13.329,3.713,13.087,2.445z"/></svg>',
34
+ 'Attractions': '<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M533.333333 128.810667l43.008 0.149333c23.573333 0.085333 42.666667 19.413333 42.666667 42.816V213.333333H405.653333c0.298667-14.357333 0.106667-42.346667 0.106667-42.346666a42.197333 42.197333 0 0 1 42.56-42.496L490.666667 128.64V64a21.333333 21.333333 0 0 1 42.666666 0v64.810667zM726.677333 661.333333c85.482667 174.272 190.698667 277.333333 190.698667 277.333334H662.186667c-65.450667-148.181333-236.032-149.056-299.029334 0H105.088s105.173333-99.925333 191.146667-277.333334H234.666667a21.333333 21.333333 0 0 1 0-42.666666h554.666666a21.333333 21.333333 0 0 1 0 42.666666h-62.634666z m-103.872-362.666666c9.237333 102.464 34.346667 195.690667 66.304 277.333333H333.333333a1074.709333 1074.709333 0 0 0 66.986667-277.333333H362.666667a21.333333 21.333333 0 0 1 0-42.666667h298.666666a21.333333 21.333333 0 0 1 0 42.666667h-38.506666z" fill="#3D3D3D" /></svg>'
35
+ },
36
+ searching: false,
37
+ cache: [],
38
+ search: function(platform) {
39
+ let query_term = Trustindex_Autocomplete.input.val();
40
+
41
+ if(query_term.length < 4)
42
+ {
43
+ Trustindex_Autocomplete.box.html('<span>'+ Trustindex_Autocomplete.box.data('tooshorttext') +'</span>');
44
+ Trustindex_Autocomplete.box.show();
45
+ return false;
46
+ }
47
+
48
+ if(Trustindex_Autocomplete.input.data('url') === undefined && (query_term.substr(0, 4) == 'www.' || query_term.substr(0, 7) == 'http://' || query_term.substr(0, 8) == 'https://'))
49
+ {
50
+ Trustindex_Autocomplete.box.html('<span>This is an URL. '+ Trustindex_Autocomplete.input.attr('placeholder') +'</span>');
51
+ Trustindex_Autocomplete.box.show();
52
+ return false;
53
+ }
54
+
55
+ //Return if request processing
56
+ if(Trustindex_Autocomplete.searching)
57
+ {
58
+ return false;
59
+ }
60
+
61
+ //Hide box and show load
62
+ Trustindex_Autocomplete.box.hide();
63
+ Trustindex_Autocomplete.load.show();
64
+ Trustindex_Autocomplete.searching = true;
65
+
66
+ //Check cache
67
+ let cache_term = query_term.trim();
68
+ if(Trustindex_Autocomplete.cache[cache_term] !== undefined)
69
+ {
70
+ //Show results
71
+ setTimeout(function() {
72
+ Trustindex_Autocomplete.showResults(Trustindex_Autocomplete.cache[cache_term]);
73
+ }, 400);
74
+
75
+ return;
76
+ }
77
+
78
+ //Get request
79
+ jQuery.ajax({
80
+ method: "POST",
81
+ url: "https://admin.trustindex.io/api/searchPage",
82
+ data: {
83
+ q: query_term,
84
+ platform: platform
85
+ },
86
+ dataType: "jsonp",
87
+ success: function(response) {
88
+ //Save cache
89
+ Trustindex_Autocomplete.cache[cache_term] = response;
90
+
91
+ //Show results
92
+ Trustindex_Autocomplete.showResults(response);
93
+ }
94
+ });
95
+ },
96
+ showResults: function(response) {
97
+ //Hide load
98
+ Trustindex_Autocomplete.load.hide();
99
+ Trustindex_Autocomplete.searching = false;
100
+
101
+ //Check if we successfully receive results
102
+ if(response.success && response.result && response.result.length)
103
+ {
104
+ let html = "";
105
+ response.result.forEach(function(r) {
106
+ html += '<li class="result" data-page-id="'+ r.page_id +'" data-name="'+ r.name +'" data-type="'+ r.type +'" data-url="' + r.url + '" data-address="' + r.address + '">'
107
+ + (Trustindex_Autocomplete.svg[r.type] || '')
108
+ + '<p class="title">'+ r.name +'</p>'
109
+ + '<p class="location">'+ (r.address || r.url) +'</p>'
110
+ +'</li>';
111
+ });
112
+
113
+ Trustindex_Autocomplete.box.html('<ul>' + html + '</ul>');
114
+ Trustindex_Autocomplete.box.show();
115
+ }
116
+ //Request successful but do not receive results
117
+ else if(response.success)
118
+ {
119
+ Trustindex_Autocomplete.box.html('<span>'+ Trustindex_Autocomplete.box.data('noresultstext') +'</span>');
120
+ Trustindex_Autocomplete.box.show();
121
+ }
122
+ //Something went wrong
123
+ else
124
+ {
125
+ Trustindex_Autocomplete.box.html('<span class="error">'+ Trustindex_Autocomplete.box.data('errortext') +'</span>');
126
+ Trustindex_Autocomplete.box.show();
127
+ }
128
+ },
129
+ checkRegex: null,
130
+ checkRegexValid: function(m) {
131
+ if(!m)
132
+ {
133
+ return false;
134
+ }
135
+
136
+ for(let i = 0; i < m.length; i++) {
137
+ if(m[i] === "")
138
+ {
139
+ return false;
140
+ }
141
+ }
142
+
143
+ return true;
144
+ }
145
+ };
146
+
147
+ //Automatically search on input
148
+ if(Trustindex_Autocomplete.input.length)
149
+ {
150
+ Trustindex_Autocomplete.input.delayKeyup(function() {
151
+ Trustindex_Autocomplete.button.click();
152
+ }, 650);
153
+ }
154
+
155
+ //Search init after click
156
+ if(Trustindex_Autocomplete.button.length)
157
+ {
158
+ Trustindex_Autocomplete.button.click(function(e) {
159
+ e.preventDefault();
160
+
161
+ Trustindex_Autocomplete.search(Trustindex_Autocomplete.button.closest('form').data('platform'));
162
+ });
163
+ }
164
+
165
+ //Click on autocomplete's result
166
+ jQuery(document).on('click', '#trustindex-plugin-settings-page .autocomplete .results li[data-page-id]', function() {
167
+ let selected_element = jQuery(this);
168
+ let form = selected_element.closest("form");
169
+ let div = form.find(".div-selected-page-info");
170
+
171
+ let page_details = {
172
+ id: selected_element.data('page-id'),
173
+ name: selected_element.data('name'),
174
+ address: selected_element.data('address')
175
+ };
176
+
177
+ form.find("#ti-noreg-page_details").val( JSON.stringify(page_details) );
178
+ div.find("#label-noreg-page_name").html( selected_element.data('name') );
179
+ div.find("#label-noreg-url").html( "<a target='_blank' href='" + selected_element.data('url') + "'>" + selected_element.data('url') + "</a>" );
180
+
181
+ if(selected_element.data('address'))
182
+ {
183
+ div.find("#label-noreg-address").html( '- ' + selected_element.data('address') + '<br />' );
184
+ }
185
+
186
+ Trustindex_Autocomplete.box.hide();
187
+
188
+ div.fadeIn();
189
+
190
+ Trustindex_Autocomplete.button.addClass("btn-default").removeClass("btn-primary");
191
+ });
192
+
193
+ // Show loading text on connect
194
+ jQuery("#trustindex-plugin-settings-page form:not([data-platform='facebook']) .btn-connect").click(function(e){
195
+ let btn = jQuery(this);
196
+
197
+ btn.css('pointer-events', 'none');
198
+ btn.addClass("btn-default").removeClass("btn-primary");
199
+ btn.blur();
200
+ TI_manage_dots(btn);
201
+
202
+ Trustindex_Autocomplete.button.css('pointer-events', 'none');
203
+ jQuery("#trustindex-plugin-settings-page .btn-check").css('pointer-events', 'none');
204
+ });
205
+
206
+ // Show loading text on refresh
207
+ jQuery("#trustindex-plugin-settings-page .btn-refresh").click(function(e){
208
+ let btn = jQuery(this);
209
+
210
+ btn.css('pointer-events', 'none');
211
+ btn.addClass("btn-default").removeClass("btn-primary");
212
+ btn.blur();
213
+ TI_manage_dots(btn);
214
+
215
+ jQuery("#trustindex-plugin-settings-page .btn").css('pointer-events', 'none');
216
+ });
217
+
218
+ // Check init after click
219
+ jQuery("#trustindex-plugin-settings-page .btn-check").click(function(e){
220
+ e.preventDefault();
221
+
222
+ let input = jQuery("#trustindex-plugin-settings-page #page-link");
223
+
224
+ if(!Trustindex_Autocomplete.checkRegex)
225
+ {
226
+ return false;
227
+ }
228
+
229
+ let m = Trustindex_Autocomplete.checkRegex.exec(input.val());
230
+ if(!Trustindex_Autocomplete.checkRegexValid(m))
231
+ {
232
+ Trustindex_Autocomplete.box.html('<span>'+ Trustindex_Autocomplete.box.data('errortext') +'</span>');
233
+ Trustindex_Autocomplete.box.show();
234
+ return false;
235
+ }
236
+
237
+ let page_id = m[1];
238
+ if(m[2] !== undefined && m[2])
239
+ {
240
+ page_id += '|' + m[2];
241
+ }
242
+
243
+ //Hide box and show load
244
+ Trustindex_Autocomplete.box.hide();
245
+ Trustindex_Autocomplete.load.show();
246
+
247
+ //Get request
248
+ jQuery.ajax({
249
+ method: "POST",
250
+ url: "https://admin.trustindex.io/api/getPageDetails",
251
+ data: {
252
+ platform: jQuery('#submit-form').data('platform'),
253
+ page_id: page_id
254
+ },
255
+ dataType: "jsonp",
256
+ success: function(response) {
257
+
258
+ //Hide load
259
+ Trustindex_Autocomplete.load.hide();
260
+
261
+ //Check if we successfully receive results
262
+ if(response.success && response.result)
263
+ {
264
+ let page_details = {
265
+ id: response.result.page_id,
266
+ name: response.result.name,
267
+ address: response.result.address
268
+ };
269
+
270
+ let form = jQuery('#submit-form');
271
+ let div = form.find(".div-selected-page-info");
272
+ form.find("#ti-noreg-page_details").val( JSON.stringify(page_details) );
273
+
274
+ div.find("#label-noreg-page_name").html( page_details.name );
275
+ div.find("#label-noreg-address").html( page_details.address );
276
+ div.find("#label-noreg-url").html( "<a target='_blank' href='" + response.result.url + "'>" + response.result.url + "</a>" );
277
+
278
+ jQuery("#trustindex-plugin-settings-page .btn-check").addClass("btn-default").removeClass("btn-primary");
279
+ div.fadeIn();
280
+ }
281
+ //Something went wrong
282
+ else
283
+ {
284
+ Trustindex_Autocomplete.box.html('<span class="error">'+ Trustindex_Autocomplete.box.data('errortext') +'</span>');
285
+ Trustindex_Autocomplete.box.show();
286
+ }
287
+ }
288
+ });
289
+ });
290
+
291
+ /*************************************************************************/
292
+ /* TOGGLE */
293
+ jQuery("#trustindex-plugin-settings-page .btn-toggle").on('click', function(e) {
294
+ e.preventDefault();
295
+
296
+ jQuery(jQuery(this).attr("href")).toggle();
297
+
298
+ return false;
299
+ });
300
+
301
+ /*************************************************************************/
302
+ /* CONNECT TO TRUSTINDEX */
303
+ var used_emails = [];
304
+ jQuery("#ti-reg-email, #ti-reg-password").blur(function(){
305
+
306
+ let email = jQuery("#ti-reg-email").val();
307
+
308
+ //if previously checked
309
+ if (jQuery.inArray(email, used_emails) != -1)
310
+ {
311
+ jQuery("#txt-email-used").fadeIn();
312
+ return false;
313
+ }
314
+
315
+ jQuery.ajax({
316
+ method: "POST",
317
+ url: "https://admin.trustindex.io/api/userCheckEmail",
318
+ data: { 'email': email, 's': 'wp' },
319
+ dataType: "jsonp",
320
+ success: function(data) {
321
+ //invalid e-mail
322
+ if (data == -1)
323
+ {
324
+
325
+ }
326
+ //new e-mail
327
+ else if (data == 0)
328
+ {
329
+ jQuery("#txt-email-used").fadeOut();
330
+ }
331
+ //used e-mail
332
+ else
333
+ {
334
+ let link = jQuery("#txt-email-used").find("a");
335
+ link.html(link.html().replace("$email", email));
336
+ jQuery("#txt-email-used").fadeIn();
337
+ jQuery("#ti-reg-email").val("");
338
+
339
+ //register as used email
340
+ used_emails.push(email);
341
+ }
342
+ }
343
+ });
344
+ });
345
+
346
+ jQuery("#form-reg").submit(function(e){
347
+ return !jQuery("#txt-email-used").is(":visible");
348
+ });
349
+
350
+ /*************************************************************************/
351
+ /* COPY 2 CLIPBOARD */
352
+ jQuery(".btn-copy2clipboard").click(function(e){
353
+ e.preventDefault();
354
+
355
+ let obj = jQuery(jQuery(this).attr("href"));
356
+ let text = obj.html() ? obj.html() : obj.val();
357
+
358
+ TI_copyTextToClipboard(text);
359
+ });
360
+
361
+ /*************************************************************************/
362
+ /* STYLE */
363
+ var apply_style = function() {
364
+
365
+ let style_id = jQuery('#ti-style-id').val();
366
+ let box = jQuery('#ti-review-list').closest('.ti-preview-box');
367
+
368
+ if(['8', '9', '10', '11', '12'].indexOf(style_id) != -1 && !is_no_reviews_with_filter)
369
+ {
370
+ box.css('width', '30%');
371
+ }
372
+ else if(['6', '7'].indexOf(style_id) != -1 && !is_no_reviews_with_filter)
373
+ {
374
+ box.css('width', '50%');
375
+ }
376
+ else
377
+ {
378
+ box.css('width', 'auto');
379
+ }
380
+
381
+ //This is necessary to round up x.5 px width
382
+ box.css('width', box.width());
383
+ };
384
+
385
+ /*************************************************************************/
386
+ /* FILTER */
387
+ //Checkbox
388
+ jQuery('.ti-checkbox').on('click', function() {
389
+ let checkbox = jQuery(this).find('input[type=checkbox]');
390
+ checkbox.prop('checked', !checkbox.prop('checked')).trigger("change");
391
+
392
+ return false;
393
+ });
394
+
395
+ //Custom select - init
396
+ jQuery('.ti-select').each(function() {
397
+ let el = jQuery(this);
398
+ let selected = el.find('ul li.selected');
399
+
400
+ if(selected.length == 0)
401
+ {
402
+ selected = el.find('ul li:first');
403
+ }
404
+
405
+ el.data('value', selected.data('value')).find('font').html(selected.html());
406
+ });
407
+
408
+ //Custom select - toggle click
409
+ jQuery(document).on('click', '.ti-select', function() {
410
+ let el = jQuery(this);
411
+ el.toggleClass('active');
412
+
413
+ if(el.hasClass('active'))
414
+ {
415
+ jQuery(window).unbind().on('click', function(e) {
416
+ if(!jQuery(e.target).is(el) && jQuery(e.target).closest('.ti-select').length == 0)
417
+ {
418
+ el.removeClass('active');
419
+ jQuery(window).unbind();
420
+ }
421
+ });
422
+ }
423
+ });
424
+
425
+ //Custom select - select item
426
+ jQuery(document).on('click', '.ti-select li', function() {
427
+ let el = jQuery(this);
428
+ el.parent().parent().data('value', el.data('value')).trigger('change').find('font').html(el.html());
429
+
430
+ el.parent().find('li').removeClass('selected');
431
+ el.addClass('selected');
432
+ });
433
+
434
+ var is_no_reviews_with_filter = false;
435
+
436
+ //Get reviews to memory
437
+ var reviews_el = jQuery('#ti-review-list .ti-widget').clone();
438
+
439
+ //Set reviews' rating and empty to attributes
440
+ reviews_el.find('.ti-review-item').each(function() {
441
+ let el = jQuery(this);
442
+ let rating = el.find('.ti-stars .ti-star.f, .stars .ti-star.f').length;
443
+
444
+ //Facebook recommendations
445
+ if(el.find('.ti-recommendation-icon.positive').length)
446
+ {
447
+ rating = 5;
448
+ }
449
+ else if(el.find('.ti-recommendation-icon.negative').length)
450
+ {
451
+ rating = 1;
452
+ }
453
+
454
+ //Ten scale
455
+ if(el.find('.ti-rating-box').length)
456
+ {
457
+ rating = Math.round(parseFloat(el.find('.ti-rating-box').text()) / 2);
458
+ }
459
+
460
+ let selector = '.ti-review-content';
461
+ if(el.find('.ti-review-text').length)
462
+ {
463
+ selector = '.ti-review-text';
464
+ }
465
+
466
+ el.attr('data-rating', rating);
467
+ el.attr('data-empty', el.find(selector).text().trim() == "" ? 1 : 0);
468
+ });
469
+
470
+ //Set the stars background in the filter for the corresponding platform
471
+ var set_star_background = function() {
472
+ let platform = (jQuery('#ti-filter #show-star').data('platform') || 'google').ucfirst();
473
+
474
+ let el = jQuery('<div class="ti-widget" style="display: none"><div class="source-'+ platform +'"><span class="ti-star f"></span><span class="ti-star e"></span></div></div>');
475
+ el.append('body');
476
+
477
+ jQuery('body').append(el);
478
+ jQuery('#ti-filter .ti-star.e').css('background', el.find('.ti-star.e').css('background'));
479
+ jQuery('#ti-filter .ti-star.f').css('background', el.find('.ti-star.f').css('background'));
480
+
481
+ el.remove();
482
+ };
483
+ set_star_background();
484
+
485
+ //Check badge type
486
+ var is_badge_widget = function() {
487
+ let layout_id = jQuery('#ti-review-list .ti-widget').data('layout-id');
488
+ return (layout_id == 11 || layout_id == 12);
489
+ };
490
+
491
+ //Apply filter when change or init
492
+ var apply_filter = function(init) {
493
+ let style_id = jQuery('#ti-style-id').val();
494
+
495
+ //get stars
496
+ let stars = (jQuery('#ti-filter #show-star').data('value') + "").split(',').map(i => parseInt(i));
497
+
498
+ //only ratings
499
+ let show_only_ratings = jQuery('#ti-filter-only-ratings').prop('checked');
500
+
501
+ //filter removed
502
+ if(!jQuery('#ti-filter').length)
503
+ {
504
+ stars = [ 1, 2, 3, 4, 5 ];
505
+ show_only_ratings = false;
506
+ }
507
+
508
+ //remove current review elements
509
+ jQuery('.ti-widget .ti-reviews-container-wrapper .ti-review-item').remove();
510
+
511
+ //iterate through stored reviews
512
+ let results = 0;
513
+ reviews_el.find('.ti-review-item').each(function() {
514
+ let el = jQuery(this);
515
+
516
+ //check rating
517
+ if(stars.indexOf(el.data('rating')) !== -1)
518
+ {
519
+ //check only ratings
520
+ if(show_only_ratings && el.data('empty'))
521
+ {
522
+ return;
523
+ }
524
+
525
+ //return after 5 results (vertical widgets)
526
+ if(['8', '9', '10', '18'].indexOf(style_id) != -1 && results > 4)
527
+ {
528
+ return;
529
+ }
530
+
531
+ //clone and append element
532
+ let clone = el.clone();
533
+ jQuery('#ti-review-list .ti-widget .ti-reviews-container-wrapper').append(clone);
534
+ clone.hide();
535
+ clone.fadeIn();
536
+
537
+ //increase count
538
+ results++;
539
+ }
540
+ });
541
+
542
+ //clear pager interval
543
+ if(Trustindex !== undefined && Trustindex.intervalPointer)
544
+ {
545
+ clearInterval(Trustindex.intervalPointer);
546
+ }
547
+
548
+ //show empty text
549
+ if(results == 0 && !is_badge_widget())
550
+ {
551
+ jQuery('#ti-review-list').hide().next().fadeIn();
552
+ is_no_reviews_with_filter = true;
553
+ }
554
+ else
555
+ {
556
+ jQuery('#ti-review-list').fadeIn().next().hide();
557
+ is_no_reviews_with_filter = false;
558
+
559
+ //start pager
560
+ if(init === undefined && Trustindex !== undefined)
561
+ {
562
+ let dot_container = jQuery('#ti-review-list .ti-widget .ti-controls-dots');
563
+ if(dot_container.length)
564
+ {
565
+ let dot = dot_container.children(":first").clone();
566
+ dot_container.html(" " + dot.removeAttr('data-pager-state')[0].outerHTML + " ");
567
+ }
568
+ Trustindex.init_pager(jQuery('.ti-widget'));
569
+ }
570
+ }
571
+
572
+ //ajax save
573
+ if(init === undefined)
574
+ {
575
+ jQuery.post('', {
576
+ command: 'save-filter',
577
+ filter: JSON.stringify({
578
+ 'stars': stars,
579
+ 'only-ratings': show_only_ratings
580
+ })
581
+ });
582
+ }
583
+
584
+ apply_style();
585
+ }
586
+
587
+ //hooks
588
+ jQuery('#ti-filter #show-star').on('change', () => apply_filter());
589
+ jQuery('#ti-filter-only-ratings').on('change', (e) => {
590
+ e.preventDefault();
591
+ apply_filter();
592
+ return false;
593
+ });
594
+
595
+ //init
596
+ if(reviews_el.length)
597
+ {
598
+ apply_filter(true);
599
+ apply_style();
600
+ }
601
+
602
+ //Background post save - style and set change
603
+ jQuery("#ti-style-id, #ti-set-id, #ti-lang-id, #ti-dateformat-id, #ti-widget-options input[type=checkbox]:not(.no-form-update)").on('change', function() {
604
+ let form = jQuery(this).closest('form');
605
+
606
+ jQuery('li.ti-preview-box').addClass('disabled');
607
+ jQuery.ajax({
608
+ url: form.attr('action'),
609
+ type: 'post',
610
+ dataType: 'application/json',
611
+ data: form.serialize()
612
+ }).always(function() {
613
+ location.reload(true);
614
+ });
615
+
616
+ return false;
617
+ });
618
+ });
619
+
620
+ function TI_manage_dots($btn)
621
+ {
622
+ let loading_text = $btn.data("loading-text");
623
+
624
+ let num_of_dots = ($btn.html().match(new RegExp(/\./, "g")) || []).length;
625
+ let next_dots = [".", "..", "...", ""];
626
+
627
+ $btn.html(loading_text + next_dots[num_of_dots]);
628
+
629
+ setTimeout(function(){ TI_manage_dots($btn); }, 1000);
630
+ }
631
+
632
+ function TI_copyTextToClipboard(text)
633
+ {
634
+ if (!navigator.clipboard)
635
+ {
636
+ //fallback
637
+ var textArea = document.createElement("textarea");
638
+ textArea.value = text;
639
+ textArea.style.position="fixed"; //avoid scrolling to bottom
640
+ document.body.appendChild(textArea);
641
+ textArea.focus();
642
+ textArea.select();
643
+
644
+ try {
645
+ var successful = document.execCommand('copy');
646
+ //console.log('Fallback: Copying text command was ' + msg);
647
+ } catch (err) {
648
+ //console.error('Fallback: Oops, unable to copy', err);
649
+ }
650
+
651
+ document.body.removeChild(textArea);
652
+ return;
653
+ }
654
+ navigator.clipboard.writeText(text).then(
655
+ function() {/*console.log('Async: Copying to clipboard was successful!');*/},
656
+ function(err) {/*console.error('Async: Could not copy text: ', err);*/}
657
+ );
658
+ }
static/js/admin-popup.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){let popupPosition=function(){let pad=jQuery("#wpcontent").css("padding-left");jQuery(".trustindex-popup").css({right:pad,"margin-left":pad})};popupPosition();jQuery(window).resize(popupPosition);jQuery(document).on("click","a.trustindex-rateus",function(a){let link=jQuery(this),closeButton=link.closest(".notice").find(".notice-dismiss"),url=link.attr("href");closeButton.click();if(link.attr("target")===undefined){a.preventDefault();jQuery.get(url);return false}})});
static/js/admin-widget.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(){let wp_content=jQuery("#wpbody-content").length?jQuery("#wpbody-content"):jQuery("body");wp_content.on("click",".btn-insert-tooltip",function(a){a.preventDefault();jQuery(this).closest("label").after(jQuery(".block-help-template:last").clone().removeAttr("id").removeClass("block-help-template"))});wp_content.on("click",".dashicons-dismiss",function(a){a.preventDefault();jQuery(this).closest(".help-block").remove()});wp_content.on("click",".btn-copy-widget-id",function(a){a.preventDefault();let link=jQuery(this);link.closest("form").find(".form-control").val(link.data("ti-id")).trigger("change");TImanageCopyLinks(link.closest("form"),link)});wp_content.on("blur",".trustindex-widget-admin .form-control",function(){let input=jQuery(this);if(input.attr("required")!="required"||input.val()){input.prev().removeClass("text-danger")}else{input.prev().addClass("text-danger")}TImanageCopyLinks(input.closest("form"),input.closest("form").find("[data-ti-id='"+input.val()+"']"))})});function TImanageCopyLinks(b,a){let selected_class="text-danger";b.find(".btn-copy-widget-id."+selected_class).each(function(c,d){jQuery(d).removeClass(selected_class).find(".dashicons").attr("class","dashicons dashicons-admin-post")});if(a){a.addClass(selected_class).find(".dashicons").attr("class","dashicons dashicons-yes")}};
tabs/faq.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ ?>
5
+ <div class="maxwidth">
6
+ <h1><?php echo TrustindexPlugin::___("Top questions about the %s free Plugin", ["Widgets for Google Reviews"]); ?></h1>
7
+ <p>
8
+ <strong><?php echo TrustindexPlugin::___('How many %s reviews will be downloaded by the free plugin?', ["Google"]); ?></strong><br />
9
+ <?php echo TrustindexPlugin::___('The plugin will download 10 %s reviews.', ["Google"]); ?>
10
+
11
+ </p>
12
+ <p>
13
+ <strong><?php echo TrustindexPlugin::___('How many widgets can be generated with the free plugin?'); ?></strong><br />
14
+ <?php echo TrustindexPlugin::___('You can generate and use 1 widget with the free plugin.'); ?>
15
+
16
+ </p>
17
+ <p>
18
+ <strong><?php echo TrustindexPlugin::___('How many widget layout templates can I choose from in the free version?'); ?></strong><br />
19
+ <?php echo TrustindexPlugin::___('You can choose from 13 layout templates.'); ?>
20
+
21
+ </p>
22
+ <p>
23
+ <strong><?php echo TrustindexPlugin::___('How many predesigned widget styles are included in the free version?'); ?></strong><br />
24
+ <?php echo TrustindexPlugin::___('You can use 9 predesigned widget styles.'); ?>
25
+
26
+ </p>
27
+ <p>
28
+ <strong><?php echo TrustindexPlugin::___('Can I filter the reviews by stars in the free plugin?'); ?></strong><br />
29
+ <?php echo TrustindexPlugin::___('Yes, you have the possibility to display your 5-star reviews only.'); ?>
30
+
31
+ </p>
32
+ </div>
tabs/help.php ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ $video_urls = [
5
+ "google" => "https://player.vimeo.com/video/429285826",
6
+ "airbnb" => "https://player.vimeo.com/video/429285404",
7
+ "amazon" => "https://player.vimeo.com/video/429285589",
8
+ "tripadvisor" => "https://player.vimeo.com/video/429286092",
9
+ "booking" => "https://player.vimeo.com/video/429285668",
10
+ "yelp" => "https://player.vimeo.com/video/429286037",
11
+ "hotels" => "https://player.vimeo.com/video/429285880",
12
+ ];
13
+ ?>
14
+ <div class="maxwidth">
15
+ <h1><?php echo TrustindexPlugin::___('How to use our plugin?');?></h1>
16
+ <?php if(isset($video_urls["google"])): ?>
17
+
18
+ <h3><?php echo TrustindexPlugin::___('Screencast'); ?></h3>
19
+ <iframe src="<?php echo $video_urls["google"]; ?>" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>
20
+ <h3><?php echo TrustindexPlugin::___('Step by step'); ?></h3>
21
+ <?php endif; ?>
22
+
23
+ <p><?php echo TrustindexPlugin::___('After downloading the Widgets for Google Reviews, you can find Trustindex.io in the left menu. Click on that and choose "Google reviews".'); ?></p>
24
+ <p><?php echo TrustindexPlugin::___('Click on <strong>"Setup - Forever free"</strong> tab and follow these steps'); ?>:</p>
25
+ <ol>
26
+ <li>
27
+ <?php echo TrustindexPlugin::___('Connect your Google Reviews to our plugin'); ?>
28
+
29
+ <br /><span class="text-muted"> &nbsp; - <?php echo TrustindexPlugin::___('The plugin will automatically download some reviews for Review Widgets for Google'); ?></span>
30
+ </li>
31
+ <li>
32
+ <?php echo TrustindexPlugin::___('Configure your widget'); ?>
33
+
34
+ <br /><span class="text-muted"> &nbsp; - <?php echo TrustindexPlugin::___('Select your widget template and style, add your language and date format, and filter your reviews if you want to.'); ?></span>
35
+ </li>
36
+ <li>
37
+ <?php echo TrustindexPlugin::___('Check your widget'); ?>
38
+
39
+ <br /><span class="text-muted"> &nbsp; - <?php echo TrustindexPlugin::___('Here you will see the widget you generated as it would be displayed on your website.'); ?></span>
40
+ </li>
41
+ <li>
42
+ <?php echo TrustindexPlugin::___('Insert this shortcode into your website to display your widget'); ?>
43
+
44
+ </li>
45
+ <li>
46
+ <?php echo TrustindexPlugin::___('Upgrade to Professional Review Plugin'); ?>
47
+
48
+ <br /><span class="text-muted"> &nbsp; - <?php echo TrustindexPlugin::___('If you are a professional user, we suggest you to upgrade to the Professional Review Plugin, as it offers significantly better features for companies and businesses than the free version.'); ?></span>
49
+ </li>
50
+ <li>
51
+ <?php echo TrustindexPlugin::___('Set auto update ON'); ?>
52
+
53
+ <br /><span class="text-muted"> &nbsp; - <?php echo TrustindexPlugin::___('Enable auto-updates:'); ?> <a href="http://wp-dev.trustindex.io/wp-admin/plugins.php"><?php echo TrustindexPlugin::___('here'); ?></a></span>
54
+ </li>
55
+ </ol>
56
+ <p><strong><?php echo TrustindexPlugin::___('If you would like to display more reviews and modify the links in your widgets, <a href="%s"> create a Free Trustindex account.</a>', [ admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex') ]); ?></strong></p>
57
+ <h2><?php echo TrustindexPlugin::___("Top questions about the Widgets for Google Reviews Plugin"); ?></h1>
58
+ <p>
59
+ <strong><?php echo TrustindexPlugin::___('How many Google Reviews will be downloaded by the free plugin?'); ?></strong><br />
60
+ <?php echo TrustindexPlugin::___('The plugin will download 10 reviews from Google.'); ?>
61
+
62
+ </p>
63
+ <p>
64
+ <strong><?php echo TrustindexPlugin::___('How many widgets can be generated with the free plugin?'); ?></strong><br />
65
+ <?php echo TrustindexPlugin::___('You can generate and use 1 widget with the plugin in Forever free mode.'); ?>
66
+
67
+ </p>
68
+ <p>
69
+ <strong><?php echo TrustindexPlugin::___('How many widget layout templates can I choose from in the free version?'); ?></strong><br />
70
+ <?php echo TrustindexPlugin::___('You can choose from 9 layout templates.'); ?>
71
+
72
+ </p>
73
+ <p>
74
+ <strong><?php echo TrustindexPlugin::___('How many predesigned widget styles are included in the free version?'); ?></strong><br />
75
+ <?php echo TrustindexPlugin::___('You can use 13 predesigned widget styles.'); ?>
76
+
77
+ </p>
78
+ <p>
79
+ <strong><?php echo TrustindexPlugin::___('Can I filter the reviews by stars in the free plugin?'); ?></strong><br />
80
+ <?php echo TrustindexPlugin::___('Yes, you have the possibility to display your 5-star reviews only.'); ?>
81
+
82
+ </p>
83
+ </div>
tabs/my_reviews.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ $reviews = [];
5
+ if($trustindex_pm_google->is_noreg_linked() && $trustindex_pm_google->is_noreg_table_exists())
6
+ {
7
+ $reviews = $wpdb->get_results('SELECT * FROM '. $trustindex_pm_google->get_noreg_tablename() .' ORDER BY date DESC');
8
+ }
9
+ function write_rating_stars($score)
10
+ {
11
+ global $trustindex_pm_google;
12
+ if($trustindex_pm_google->is_ten_scale_rating_platform())
13
+ {
14
+ return '<div class="ti-rating-box">'. $trustindex_pm_google->formatTenRating($score) .'</div>';
15
+ }
16
+ $text = "";
17
+ $link = "https://cdn.trustindex.io/assets/platform/Google/star/";
18
+ if(!is_numeric($score))
19
+ {
20
+ return $text;
21
+ }
22
+ for ($si = 1; $si <= $score; $si++)
23
+ {
24
+ $text .= '<img src="'. $link .'f.svg" class="ti-star" />';
25
+ }
26
+ $fractional = $score - floor($score);
27
+ if( 0.25 <= $fractional )
28
+ {
29
+ if ( $fractional < 0.75 )
30
+ {
31
+ $text .= '<img src="'. $link .'h.svg" class="ti-star" />';
32
+ }
33
+ else
34
+ {
35
+ $text .= '<img src="'. $link .'f.svg" class="ti-star" />';
36
+ }
37
+ $si++;
38
+ }
39
+ for (; $si <= 5; $si++)
40
+ {
41
+ $text .= '<img src="'. $link .'e.svg" class="ti-star" />';
42
+ }
43
+ return $text;
44
+ }
45
+ wp_enqueue_script('trustindex-js', 'https://cdn.trustindex.io/www-assets/trustindex-review.js', [], false, true);
46
+ wp_enqueue_style('trustindex-widget-css', 'https://cdn.trustindex.io/assets/widget-presetted-css/4-light-background.css');
47
+ wp_add_inline_script('trustindex-js', '
48
+ jQuery(".ti-review-content").TI_shorten({
49
+ "showChars": 250,
50
+ "lessText": "'. TrustindexPlugin::___("Show less") .'",
51
+ "moreText": "'. TrustindexPlugin::___("Show more") .'",
52
+ });
53
+ jQuery(".ti-review-content").TI_format();
54
+ ');
55
+ ?>
56
+ <h1><?php echo TrustindexPlugin::___("My Reviews"); ?></h1>
57
+ <?php if(!$trustindex_pm_google->is_noreg_linked()): ?>
58
+
59
+ <div class="notice notice-warning" style="margin-left: 0">
60
+ <p><?php echo TrustindexPlugin::___("Connect your %s platform to download reviews.", ["Google"]); ?></p>
61
+ </div>
62
+ <?php else: ?>
63
+
64
+ <div class="tablenav top" style="margin-bottom: 15px">
65
+ <div class="alignleft actions">
66
+ <a href="?page=<?php echo $_GET['page']; ?>&refresh&my_reviews" class="btn-text btn-refresh" style="margin-left: 0" data-loading-text="<?php echo TrustindexPlugin::___("Loading") ;?>"><?php echo TrustindexPlugin::___("Download new reviews") ;?></a>
67
+ </div>
68
+ </div>
69
+ <?php if(!count($reviews)): ?>
70
+
71
+ <div class="notice notice-warning" style="margin-left: 0">
72
+ <p><?php echo TrustindexPlugin::___("You had no reviews at the time of last review downloading."); ?></p>
73
+ </div>
74
+ <?php else: ?>
75
+
76
+ <table class="wp-list-table widefat fixed striped table-view-list ti-my-reviews ti-widget">
77
+ <thead>
78
+ <tr>
79
+ <th class="text-center"><?php echo TrustindexPlugin::___("Reviewer"); ?></th>
80
+ <th class="text-center" style="width: 90px;"><?php echo TrustindexPlugin::___("Rating"); ?></th>
81
+ <th class="text-center"><?php echo TrustindexPlugin::___("Date"); ?></th>
82
+ <th style="width: 70%"><?php echo TrustindexPlugin::___("Text"); ?></th>
83
+ </tr>
84
+ </thead>
85
+ <tbody>
86
+ <?php foreach ($reviews as $review): ?>
87
+
88
+ <tr>
89
+ <td class="text-center">
90
+ <img src="<?php echo $review->user_photo; ?>" class="ti-user-avatar" /><br />
91
+ <?php echo $review->user; ?>
92
+
93
+ </td>
94
+ <td class="text-center source-Google"><?php echo write_rating_stars($review->rating); ?></td>
95
+ <td class="text-center"><?php echo $review->date; ?></td>
96
+ <td class="ti-review-content"><?php echo $review->text; ?></td>
97
+ </tr>
98
+ <?php endforeach; ?>
99
+
100
+ </tbody>
101
+ </table>
102
+ <?php endif; ?>
103
+
104
+ <?php endif; ?>
tabs/rate.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ ?>
5
+ <div class="maxwidth">
6
+ <h1><?php echo TrustindexPlugin::___('Please help us by reviewing our Plugin.'); ?> <?php echo TrustindexPlugin::___('Thank you in advance!'); ?></h1>
7
+ <p>
8
+ <a class="btn-text" href="https://wordpress.org/support/plugin/<?php echo $trustindex_pm_google->get_plugin_slug(); ?>/reviews/?rate=5#new-post" target="_blank"><?php echo TrustindexPlugin::___('Click here to rate us!'); ?></a>
9
+ </p>
10
+ </div>
tabs/setup_no_reg.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php include( plugin_dir_path(__FILE__ ) . "setup_no_reg_header.php" ); ?>
2
+
3
+ <h1><?php echo TrustindexPlugin::___('Display your <strong>%s reviews</strong> with our <strong>FREE Widgets</strong>!', [ 'Google' ]); ?></h1>
4
+ <?php if(!$trustindex_pm_google->is_noreg_linked()): ?>
5
+
6
+ <p><?php echo TrustindexPlugin::___('See an example below:'); ?></p>
7
+ <?php echo $trustindex_pm_google->get_trustindex_widget('2d9bf9019f8d93ad1430e9135'); ?>
8
+
9
+ <?php endif; ?>
10
+
11
+ <h2><?php echo TrustindexPlugin::___('Follow these 3 steps to embed %s in 2 minutes:', [ 'Google Reviews' ]); ?></h2>
12
+ <ul class="numbered">
13
+ <li>
14
+ <h3><?php echo TrustindexPlugin::___("Type your business/company's name or Place ID and select from the list:"); ?></h3>
15
+ <?php if($trustindex_pm_google->is_noreg_linked()): ?>
16
+
17
+ <p>
18
+ <?php echo TrustindexPlugin::___("Your %s is connected.", [ TrustindexPlugin::___('Google Reviews') ]); ?><br />
19
+
20
+ <?php $page_details = get_option($trustindex_pm_google->get_option_name('page-details')); ?>
21
+
22
+ - <?php echo TrustindexPlugin::___("Name") ; ?>: <strong style="font-size: 115%"><?php echo $page_details['name']; ?></strong><br />
23
+ <?php if ($page_details['address']): ?>
24
+
25
+ - <?php echo TrustindexPlugin::___("Address"); ?>: <?php echo $page_details['address']; ?><br />
26
+ <?php endif; ?>
27
+
28
+ </p>
29
+ <form method="post" action="">
30
+ <input type="hidden" name="command" value="delete-page" />
31
+ <?php wp_nonce_field( 'delete-noreg_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_delete' ); ?>
32
+
33
+ <button class="btn btn-delete" type="submit"><?php echo TrustindexPlugin::___("Disconnect"); ?></button>
34
+ </form>
35
+ <?php else: ?>
36
+
37
+ <form method="post" action="" data-platform="google" id="submit-form">
38
+ <input type="hidden" name="command" value="save-page" />
39
+ <?php wp_nonce_field( 'save-noreg_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_save' ); ?>
40
+
41
+ <input type="hidden"
42
+ name="page_details"
43
+ class="form-control"
44
+ required="required"
45
+ id="ti-noreg-page_details"
46
+ value=""
47
+ />
48
+ <div class="autocomplete" style="width: 600px; float: left;">
49
+ <input class="form-control name"
50
+ placeholder="<?php echo TrustindexPlugin::___("e.g.:") . ' ' . $example; ?>"
51
+ type="text" required="required"
52
+ />
53
+ <img class="loading" src="<?php echo admin_url('images/loading.gif'); ?>" />
54
+ <div class="results"
55
+ data-errortext="<?php echo TrustindexPlugin::___("Something went wrong."); ?>"
56
+ data-noresultstext="<?php echo TrustindexPlugin::___("No results. %s cannot find your business by the terms you gave. Do not panic! There is an unique business search function in Trustindex, you only need to register for free and it will help you to find your business/store. Check out the next tab, called 'More Features'!", [" Google"]); ?>"
57
+ data-tooshorttext="<?php echo TrustindexPlugin::___("Too short! Please enter your business' name and city, if applicable"); ?>"
58
+ ></div>
59
+ </div>
60
+ <button class="btn btn-primary btn-search"><?php echo TrustindexPlugin::___("Search") ;?></button>
61
+ <div style="display: none;" class="div-selected-page-info">
62
+ <p><?php echo TrustindexPlugin::___('Selected page:'); ?></p>
63
+ <strong id="label-noreg-page_name"></strong><br />
64
+ <span id="label-noreg-address"></span>
65
+ - <span id="label-noreg-url"></span>
66
+ <button class="btn btn-primary btn-connect" data-loading-text="<?php echo TrustindexPlugin::___("Loading") ;?>"><?php echo TrustindexPlugin::___("Connect") ;?></button>
67
+ </div>
68
+ </form>
69
+ <?php endif; ?>
70
+
71
+ </li>
72
+ <?php include( plugin_dir_path(__FILE__ ) . "setup_no_reg_widget.php" ); ?>
73
+
74
+ <?php include( plugin_dir_path(__FILE__ ) . "setup_no_reg_footer.php" ); ?>
75
+
76
+ </ul>
tabs/setup_no_reg_footer.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <li class="<?php if(!$trustindex_pm_google->is_noreg_linked() || !$style_id): ?>disabled<?php endif; ?>">
2
+ <h3><?php echo TrustindexPlugin::___('Insert this shortcode into your website'); ?></h3>
3
+ <?php if($trustindex_pm_google->is_noreg_linked() && $style_id): ?>
4
+
5
+ <code class="code-shortcode">[<?php echo $trustindex_pm_google->get_shortcode_name(); ?> no-registration=google]</code>
6
+ <a href=".code-shortcode" class="btn-text btn-copy2clipboard"><?php echo TrustindexPlugin::___("Copy to clipboard") ;?></a>
7
+ <?php else: ?>
8
+
9
+ <p><?php echo TrustindexPlugin::___("Do not skip the previous steps!"); ?></p>
10
+ <?php endif; ?>
11
+
12
+ </li>
13
+ <li class="<?php if(!$trustindex_pm_google->is_noreg_linked() || !$style_id): ?>disabled<?php endif; ?>">
14
+ <h3><?php echo TrustindexPlugin::___("Want to get more customers?"); ?></h3>
15
+ <a class="btn-text" href="https://www.trustindex.io/ti-redirect.php?a=sys&c=wp-google-1" target="_blank"><?php echo TrustindexPlugin::___('Create a Free Account for More Features'); ?></a>
16
+ <p>
17
+ <strong><?php echo TrustindexPlugin::___("1. Reviews from ALL these platforms"); ?></strong><br />
18
+ <?php echo TrustindexPlugin::___("Add more reviews to your widget from %s, etc. to enjoy more trust, and to keep customers on your site.", [ 'Google, Facebook, Yelp, Amazon, Tripadvisor, Booking.com, Airbnb, Hotels.com, Bookatable, Capterra, Foursquare, Opentable' ]); ?><br />
19
+
20
+ <?php $promo_platforms = ["Facebook", "Google", "Yelp", "Amazon", "Tripadvisor", "Booking", "Airbnb", "Hotels", "Bookatable", "Capterra", "Foursquare", "Opentable"];
21
+
22
+ foreach ($promo_platforms as $pp): ?>
23
+ <img src="https://cdn.trustindex.io/assets/platform/<?php echo $pp; ?>/icon.png" alt="<?php echo $pp; ?>" title="<?php echo $pp; ?>" />
24
+ <?php endforeach; ?>
25
+
26
+ </p>
27
+ <p>
28
+ <strong><?php echo TrustindexPlugin::___("2. Unlock new, exclusive styles"); ?></strong><br />
29
+ <?php echo TrustindexPlugin::___("Pick from 13 widget layouts and 9 predesigned styles to match the branding of your website."); ?>
30
+
31
+ </p>
32
+ <p>
33
+ <strong><?php echo TrustindexPlugin::___("3. Hide Negative Reviews - THIS IS GREAT!"); ?></strong><br />
34
+ <?php echo TrustindexPlugin::___("Turn on email alert to ALL new reviews, so that you can manage them quickly."); ?>
35
+
36
+ </p>
37
+ <p>
38
+ <strong><?php echo TrustindexPlugin::___("4. New Review Notification"); ?></strong><br />
39
+ <?php echo TrustindexPlugin::___("You can mix your reviews from different platforms and display them in 1 review widget."); ?>
40
+
41
+ </p>
42
+ <p>
43
+ <strong><?php echo TrustindexPlugin::___("5. Get More Reviews!"); ?></strong><br />
44
+ <?php echo TrustindexPlugin::___("Use our Review Invitation System to collect hundreds of new reviews. Become impossible to resist!"); ?>
45
+
46
+ </p>
47
+ <p>
48
+ <strong><?php echo TrustindexPlugin::___("6. Automatically update with NEW reviews"); ?></strong><br />
49
+ <?php echo TrustindexPlugin::___("Wordpress cannot update reviews, but Trustindex can! As soon as you get a new review, Trustindex Business can automatically add it to your website. Customers love fresh reviews!"); ?>
50
+
51
+ </p>
52
+ <p>
53
+ <strong><?php echo TrustindexPlugin::___("7. Display UNLIMITED number of reviews"); ?></strong><br />
54
+ <?php echo TrustindexPlugin::___("You can test Trustindex with 10 reviews in the free version. Upgrade to Business to display ALL the reviews received. Be the undisputed customer choice in your industry!"); ?>
55
+
56
+ </p>
57
+ <br />
58
+ <a class="btn-text" href="https://www.trustindex.io/ti-redirect.php?a=sys&c=wp-google-2" target="_blank"><?php echo TrustindexPlugin::___('Create a Free Account for More Features'); ?></a>
59
+ <br />
60
+ <br />
61
+ <p>
62
+ <strong><?php echo TrustindexPlugin::___("DAILY DEAL"); ?></strong><br />
63
+ <?php echo TrustindexPlugin::___("Fast onboarding discount: save 30% on your annual fee. See details after <a href='%s' target='_blank'>registration</a>", [ 'https://www.trustindex.io/ti-redirect.php?a=sys&c=wp-google' ]); ?>
64
+
65
+ </p>
66
+ </li>
tabs/setup_no_reg_header.php ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ $ti_command = isset($_POST['command']) ? sanitize_text_field($_POST['command']) : null;
5
+ if (!in_array($ti_command, array("save-page", "delete-page", "save-style", "save-filter", "save-set", "save-language", "save-dateformat", "save-options"))) { $ti_command = null; }
6
+ function ti_connect_page($page_details = null)
7
+ {
8
+ global $trustindex_pm_google;
9
+ global $wpdb;
10
+ if(!$page_details)
11
+ {
12
+ return false;
13
+ }
14
+ if (!isset($page_details['rating_number']) || !isset($page_details['avatar_url']))
15
+ {
16
+ $response = $trustindex_pm_google->download_noreg_details($page_details);
17
+ if ($response['success'])
18
+ {
19
+ if(!isset($page_details['rating_number'])) $page_details['rating_number'] = $response['result']['reviews']['count'];
20
+ if(!isset($page_details['rating_score'])) $page_details['rating_score'] = $response['result']['reviews']['score'];
21
+ if(!isset($page_details['avatar_url'])) $page_details['avatar_url'] = $response['result']['avatar_url'];
22
+ }
23
+ }
24
+ $reviews = null;
25
+ if(isset($page_details['reviews']))
26
+ {
27
+ $reviews = $page_details['reviews'];
28
+ unset($page_details['reviews']);
29
+ }
30
+ update_option( $trustindex_pm_google->get_option_name('page-details') , $page_details, false );
31
+ $GLOBALS['wp_object_cache']->delete( $trustindex_pm_google->get_option_name('page-details'), 'options' );
32
+ $dbtable = $trustindex_pm_google->get_noreg_tablename();
33
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
34
+ $sql = "CREATE TABLE IF NOT EXISTS $dbtable (
35
+ `id` TINYINT(1) NOT NULL AUTO_INCREMENT,
36
+ `user` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci,
37
+ `user_photo` TEXT,
38
+ `text` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
39
+ `rating` DECIMAL(3,1),
40
+ `date` DATE, PRIMARY KEY (`id`));";
41
+ dbDelta($sql);
42
+ $wpdb->query("TRUNCATE $dbtable;");
43
+ if(!$reviews)
44
+ {
45
+ $reviews = $trustindex_pm_google->download_noreg_reviews($page_details, null);
46
+ $reviews = $reviews['success'] ? $reviews['result'] : [];
47
+ }
48
+ foreach($reviews as $row)
49
+ {
50
+ $date = isset($row['created_at']) ? $row['created_at'] : (isset($row['date']) ? $row['date'] : '');
51
+ $wpdb->insert($dbtable, [
52
+ 'user' => $row['reviewer']['name'],
53
+ 'user_photo' => $row['reviewer']['avatar_url'],
54
+ 'text' => $row['text'],
55
+ 'rating' => $row['rating'] ? $row['rating'] : 5,
56
+ 'date' => substr($date, 0, 10)
57
+ ]);
58
+ }
59
+ $lang = strtolower(substr(get_locale(), 0, 2));
60
+ if(!isset(TrustindexPlugin::$widget_languages[$lang]))
61
+ {
62
+ $lang = 'en';
63
+ }
64
+ update_option( $trustindex_pm_google->get_option_name('lang') , $lang, false );
65
+ update_option( $trustindex_pm_google->get_option_name('style-id') , 4, false );
66
+ $trustindex_pm_google->noreg_save_css();
67
+ }
68
+ function ti_disconnect_page()
69
+ {
70
+ global $trustindex_pm_google;
71
+ global $wpdb;
72
+ delete_option( $trustindex_pm_google->get_option_name('page-details') );
73
+ delete_option( $trustindex_pm_google->get_option_name('style-id') );
74
+ delete_option( $trustindex_pm_google->get_option_name('review-content') );
75
+ delete_option( $trustindex_pm_google->get_option_name('css-content') );
76
+ delete_option( $trustindex_pm_google->get_option_name('scss-set') );
77
+ delete_option( $trustindex_pm_google->get_option_name('filter') );
78
+ delete_option( $trustindex_pm_google->get_option_name('lang') );
79
+ delete_option( $trustindex_pm_google->get_option_name('dateformat') );
80
+ delete_option( $trustindex_pm_google->get_option_name('no-rating-text') );
81
+ $dbtable = $trustindex_pm_google->get_noreg_tablename();
82
+ $wpdb->query("TRUNCATE $dbtable;");
83
+ }
84
+ if($ti_command == 'save-page')
85
+ {
86
+ check_admin_referer( 'save-noreg_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_save' );
87
+ $page_details = isset($_POST['page_details']) ? sanitize_text_field($_POST['page_details']) : null;
88
+ $page_details = json_decode(stripcslashes($page_details), true);
89
+ ti_connect_page($page_details);
90
+ }
91
+ elseif($ti_command == 'delete-page')
92
+ {
93
+ check_admin_referer( 'delete-noreg_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_delete' );
94
+ ti_disconnect_page();
95
+ }
96
+ elseif($ti_command == 'save-style')
97
+ {
98
+ check_admin_referer( 'save-style_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_style' );
99
+ update_option( $trustindex_pm_google->get_option_name('style-id') , sanitize_text_field($_POST['style_id']), false );
100
+ delete_option( $trustindex_pm_google->get_option_name('review-content') );
101
+ if(in_array(intval($_POST['style_id']), [ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 ]))
102
+ {
103
+ update_option( $trustindex_pm_google->get_option_name('no-rating-text') , 0, false );
104
+ }
105
+ else
106
+ {
107
+ update_option( $trustindex_pm_google->get_option_name('no-rating-text') , 1, false );
108
+ }
109
+ $trustindex_pm_google->noreg_save_css();
110
+ exit;
111
+ }
112
+ elseif($ti_command == 'save-set')
113
+ {
114
+ check_admin_referer( 'save-set_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_set' );
115
+ update_option( $trustindex_pm_google->get_option_name('scss-set') , sanitize_text_field($_POST['set_id']), false );
116
+ $trustindex_pm_google->noreg_save_css(true);
117
+ exit;
118
+ }
119
+ elseif($ti_command == 'save-filter')
120
+ {
121
+ $filter = isset($_POST['filter']) ? sanitize_text_field($_POST['filter']) : null;
122
+ $filter = json_decode(stripcslashes($filter), true);
123
+ update_option( $trustindex_pm_google->get_option_name('filter') , $filter, false );
124
+ exit;
125
+ }
126
+ elseif($ti_command == 'save-language')
127
+ {
128
+ check_admin_referer( 'save-language_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_language' );
129
+ update_option( $trustindex_pm_google->get_option_name('lang') , sanitize_text_field($_POST['lang']), false );
130
+ delete_option( $trustindex_pm_google->get_option_name('review-content') );
131
+ exit;
132
+ }
133
+ elseif($ti_command == 'save-dateformat')
134
+ {
135
+ check_admin_referer( 'save-dateformat_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_dateformat' );
136
+ update_option( $trustindex_pm_google->get_option_name('dateformat') , sanitize_text_field($_POST['dateformat']), false );
137
+ exit;
138
+ }
139
+ elseif($ti_command == 'save-options')
140
+ {
141
+ check_admin_referer( 'save-options_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_options' );
142
+ $r = 0;
143
+ if(isset($_POST['verified-icon']))
144
+ {
145
+ $r = sanitize_text_field($_POST['verified-icon']);
146
+ }
147
+ update_option( $trustindex_pm_google->get_option_name('verified-icon') , $r, false );
148
+ $r = 0;
149
+ if(isset($_POST['enable-animation']))
150
+ {
151
+ $r = sanitize_text_field($_POST['enable-animation']);
152
+ }
153
+ update_option( $trustindex_pm_google->get_option_name('enable-animation') , $r, false );
154
+ $r = 0;
155
+ if(isset($_POST['show-arrows']))
156
+ {
157
+ $r = sanitize_text_field($_POST['show-arrows']);
158
+ }
159
+ update_option( $trustindex_pm_google->get_option_name('show-arrows') , $r, false );
160
+ $r = 0;
161
+ if(isset($_POST['show-reviewers-photo']))
162
+ {
163
+ $r = sanitize_text_field($_POST['show-reviewers-photo']);
164
+ }
165
+ update_option( $trustindex_pm_google->get_option_name('show-reviewers-photo') , $r, false );
166
+ $r = 0;
167
+ if(isset($_POST['no-rating-text']))
168
+ {
169
+ $r = sanitize_text_field($_POST['no-rating-text']);
170
+ }
171
+ update_option( $trustindex_pm_google->get_option_name('no-rating-text') , $r, false );
172
+ delete_option( $trustindex_pm_google->get_option_name('review-content') );
173
+ $trustindex_pm_google->noreg_save_css(true);
174
+ exit;
175
+ }
176
+ $style_id = get_option( $trustindex_pm_google->get_option_name('style-id') );
177
+ $scss_set = get_option( $trustindex_pm_google->get_option_name('scss-set') );
178
+ $lang = get_option( $trustindex_pm_google->get_option_name('lang'), 'en');
179
+ $dateformat = get_option( $trustindex_pm_google->get_option_name('dateformat'), 'Y-m-d' );
180
+ $no_rating_text = get_option( $trustindex_pm_google->get_option_name('no-rating-text'), 1 );
181
+ $filter = get_option( $trustindex_pm_google->get_option_name('filter'), [ 'stars' => [1, 2, 3, 4, 5], 'only-ratings' => true ] );
182
+ $verified_icon = get_option( $trustindex_pm_google->get_option_name('verified-icon'), 0 );
183
+ $enable_animation = get_option( $trustindex_pm_google->get_option_name('enable-animation'), 1 );
184
+ $show_arrows = get_option( $trustindex_pm_google->get_option_name('show-arrows'), 1 );
185
+ $show_reviewers_photo = get_option( $trustindex_pm_google->get_option_name('show-reviewers-photo'), 1 );
186
+ $need_to_refresh = false;
187
+ if($trustindex_pm_google->is_noreg_linked() && $trustindex_pm_google->is_ten_scale_rating_platform())
188
+ {
189
+ $fields = $wpdb->get_results('SHOW FIELDS FROM `'. $trustindex_pm_google->get_noreg_tablename() .'` WHERE Field = "rating"');
190
+ if($fields && isset($fields[0]) && isset($fields[0]->Type))
191
+ {
192
+ if($fields[0]->Type == 'tinyint(1)')
193
+ {
194
+ $wpdb->query('ALTER TABLE `'. $trustindex_pm_google->get_noreg_tablename() .'` CHANGE `rating` `rating` DECIMAL(3,1) NULL DEFAULT NULL');
195
+ $need_to_refresh = true;
196
+ }
197
+ }
198
+ }
199
+ if(isset($_GET['refresh']) || $need_to_refresh)
200
+ {
201
+ $page_details = get_option( $trustindex_pm_google->get_option_name('page-details') );
202
+ $tmp = $trustindex_pm_google->download_noreg_details($page_details);
203
+ $page_details['rating_number'] = $tmp['reviews']['count'];
204
+ $page_details['rating_score'] = $tmp['reviews']['score'];
205
+ $page_details['avatar_url'] = $tmp['avatar_url'];
206
+ ti_disconnect_page();
207
+ ti_connect_page($page_details);
208
+ header('Location: admin.php?page=' . $_GET['page'] . (isset($_GET['my_reviews']) ? '&tab=my_reviews' : ''));
209
+ exit;
210
+ }
211
+ if(isset($_GET['recreate']))
212
+ {
213
+ $trustindex_pm_google->deactivate();
214
+ header('Location: admin.php?page=' . $_GET['page']);
215
+ exit;
216
+ }
217
+ if($trustindex_pm_google->is_noreg_linked())
218
+ {
219
+ if(!$scss_set)
220
+ {
221
+ $trustindex_pm_google->noreg_save_css();
222
+ $scss_set = get_option( $trustindex_pm_google->get_option_name('scss-set') );
223
+ }
224
+ else
225
+ {
226
+ $dir = __DIR__ . '/../wp-reviews-plugin-for-google.php';
227
+ $plugin_data = get_plugin_data( $dir );
228
+ $content_version = get_option( $trustindex_pm_google->get_option_name('content-saved-to'), '' );
229
+ if(!$content_version || $content_version != $plugin_data['Version'])
230
+ {
231
+ update_option( $trustindex_pm_google->get_option_name('content-saved-to') , $plugin_data['Version'], false );
232
+ delete_option( $trustindex_pm_google->get_option_name('review-content') );
233
+ $trustindex_pm_google->noreg_save_css(true);
234
+ }
235
+ }
236
+ }
237
+ $example = 'HairPalace';
238
+ $example_url = null;
239
+ switch("google")
240
+ {
241
+ case 'airbnb':
242
+ $example_url = 'https://www.airbnb.com/rooms/2861469';
243
+ break;
244
+ case 'amazon':
245
+ $example_url = 'https://www.amazon.com/sp?seller=A2VE8XCDXE9M4H';
246
+ break;
247
+ case 'bookatable':
248
+ $example_url = 'https://www.bookatable.co.uk/roka-canary-wharf-london';
249
+ break;
250
+ case 'booking':
251
+ $example_url = 'https://www.booking.com/hotel/us/four-seasons-san-francisco.html';
252
+ break;
253
+ case 'capterra':
254
+ $example_url = 'https://www.capterra.com/p/192416/MicroStation';
255
+ break;
256
+ case 'foursquare':
257
+ $example_url = 'https://foursquare.com/v/lands-end-lookout/4f839a12e4b049ff96c6b29a';
258
+ break;
259
+ case 'hotels':
260
+ $example_url = 'https://www.hotels.com/ho108742';
261
+ break;
262
+ case 'opentable':
263
+ $example_url = 'https://www.opentable.com/r/historic-johns-grill-san-francisco';
264
+ break;
265
+ case 'szallashu':
266
+ $example_url = 'https://revngo.com/ramada-by-wyndham-city-center-hotel-budapest';
267
+ break;
268
+ case 'thumbtack':
269
+ $example_url = 'https://www.thumbtack.com/ca/san-francisco/handyman/steve-switchenko-installations-handyman-services/service/246750705829561442';
270
+ break;
271
+ }
272
+ ?>
tabs/setup_no_reg_widget.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <li class="<?php if(!$trustindex_pm_google->is_noreg_linked()): ?>disabled<?php endif; ?>">
2
+ <h3><?php echo TrustindexPlugin::___('Configure your Widget'); ?></h3>
3
+ <div class="ti-left-block">
4
+ <?php if($trustindex_pm_google->is_noreg_linked()): ?>
5
+
6
+ <h4 style="font-size: 120%;margin-bottom: 0.5em"><?php echo TrustindexPlugin::___('Select your template'); ?></h4>
7
+ <form method="post" action="">
8
+ <input type="hidden" name="command" value="save-style" />
9
+ <?php wp_nonce_field( 'save-style_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_style' ); ?>
10
+
11
+ <select class="form-control" id="ti-style-id" name="style_id">
12
+ <?php foreach(['horizontal', 'vertical', 'badge', 'popup'] as $type): ?>
13
+
14
+ <optgroup label="<?php echo TrustindexPlugin::___(ucfirst($type)); ?>">
15
+ <?php foreach(TrustindexPlugin::$widget_templates as $id => $template): ?>
16
+
17
+ <?php if($template['type'] == $type): ?>
18
+
19
+ <option value="<?php echo $id; ?>" <?php echo $style_id == $id ? 'selected' : ''; ?>><?php echo TrustindexPlugin::___($template['name']); ?></option>
20
+ <?php endif; ?>
21
+
22
+ <?php endforeach; ?>
23
+
24
+ </optgroup>
25
+ <?php endforeach; ?>
26
+
27
+ <option disabled value=""><?php echo TrustindexPlugin::___("More layouts in PRO version"); ?></option>
28
+ </select>
29
+ </form>
30
+ <?php else: ?>
31
+
32
+ <p><?php echo TrustindexPlugin::___("Do not skip the previous steps!"); ?></p>
33
+ <?php endif; ?>
34
+
35
+ </div>
36
+ <?php if($trustindex_pm_google->is_noreg_linked() && $style_id): ?>
37
+
38
+ <div class="ti-right-block">
39
+ <h4 style="font-size: 120%;margin-bottom: 0.5em"><?php echo TrustindexPlugin::___('Select your style'); ?></h4>
40
+ <form method="post" action="">
41
+ <input type="hidden" name="command" value="save-set" />
42
+ <?php wp_nonce_field( 'save-set_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_set' ); ?>
43
+
44
+ <select class="form-control" id="ti-set-id" name="set_id">
45
+ <?php foreach(TrustindexPlugin::$widget_styles as $id => $name): ?>
46
+
47
+ <option value="<?php echo $id; ?>" <?php echo $scss_set == $id ? 'selected' : ''; ?>><?php echo TrustindexPlugin::___($name); ?></option>
48
+ <?php endforeach; ?>
49
+
50
+ </select>
51
+ </form>
52
+ </div>
53
+ <div class="clear"></div>
54
+ <div id="ti-filter" class="ti-left-block">
55
+ <h4 style="font-size: 120%;margin-bottom: 0.5em"><?php echo TrustindexPlugin::___('Filter your ratings'); ?></h4>
56
+ <div class="ti-select" id="show-star" data-platform="google">
57
+ <font></font>
58
+ <ul>
59
+ <li data-value="1,2,3,4,5" <?php echo count($filter['stars']) > 2 ? 'class="selected"' : ''; ?>><?php echo TrustindexPlugin::___('Show all'); ?></li>
60
+ <li data-value="4,5" <?php echo count($filter['stars']) == 2 ? 'class="selected"' : ''; ?>>
61
+ <?php echo TrustindexPlugin::get_rating_stars(4); ?> - <?php echo TrustindexPlugin::get_rating_stars(5); ?>
62
+
63
+ </li>
64
+ <li data-value="5" <?php echo count($filter['stars']) == 1 ? 'class="selected"' : ''; ?>>
65
+ <?php echo TrustindexPlugin::___('only'); ?> <?php echo TrustindexPlugin::get_rating_stars(5); ?>
66
+
67
+ </li>
68
+ </ul>
69
+ </div>
70
+ </div>
71
+ <div class="ti-right-block">
72
+ <h4 style="font-size: 120%;margin-bottom: 0.5em"><?php echo TrustindexPlugin::___('Select language'); ?></h4>
73
+ <form method="post" action="">
74
+ <input type="hidden" name="command" value="save-language" />
75
+ <?php wp_nonce_field( 'save-language_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_language' ); ?>
76
+
77
+ <select class="form-control" name="lang" id="ti-lang-id">
78
+ <?php foreach(TrustindexPlugin::$widget_languages as $id => $name): ?>
79
+
80
+ <option value="<?php echo $id; ?>" <?php echo $lang == $id ? 'selected' : ''; ?>><?php echo $name; ?></option>
81
+ <?php endforeach; ?>
82
+
83
+ </select>
84
+ </form>
85
+ </div>
86
+ <div class="clear"></div>
87
+ <div class="ti-left-block">
88
+ <h4 style="font-size: 120%;margin-bottom: 0.5em"><?php echo TrustindexPlugin::___('Select date format'); ?></h4>
89
+ <form method="post" action="">
90
+ <input type="hidden" name="command" value="save-dateformat" />
91
+ <?php wp_nonce_field( 'save-dateformat_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_dateformat' ); ?>
92
+
93
+ <select class="form-control" name="dateformat" id="ti-dateformat-id">
94
+ <?php foreach(TrustindexPlugin::$widget_dateformats as $format): ?>
95
+
96
+ <option value="<?php echo $format; ?>" <?php echo $dateformat == $format ? 'selected' : ''; ?>><?php echo date($format); ?></option>
97
+ <?php endforeach; ?>
98
+
99
+ </select>
100
+ </form>
101
+ </div>
102
+ <div class="ti-right-block">
103
+ <h4 style="font-size: 120%;margin-bottom: 0.5em"><?php echo TrustindexPlugin::___('Other settings'); ?></h4>
104
+ <form method="post" action="" id="ti-widget-options">
105
+ <input type="hidden" name="command" value="save-options" />
106
+ <?php wp_nonce_field( 'save-options_'.$trustindex_pm_google->get_plugin_slug(), '_wpnonce_options' ); ?>
107
+
108
+ <span class="ti-checkbox row">
109
+ <input type="checkbox" id="ti-filter-only-ratings" class="no-form-update" name="only-ratings" value="1" <?php if($filter['only-ratings']): ?>checked<?php endif;?>>
110
+ <label><?php echo TrustindexPlugin::___("Hide reviews without comments"); ?></label>
111
+ </span>
112
+ <span class="ti-checkbox row">
113
+ <input type="checkbox" name="no-rating-text" value="1" <?php if($no_rating_text): ?>checked<?php endif;?>>
114
+ <label><?php echo TrustindexPlugin::___("Hide rating text"); ?></label>
115
+ </span>
116
+ <span class="ti-checkbox row">
117
+ <input type="checkbox" name="verified-icon" value="1" <?php if($verified_icon): ?>checked<?php endif;?>>
118
+ <label><?php echo TrustindexPlugin::___("Show verified review icon"); ?></label>
119
+ </span>
120
+ <span class="ti-checkbox row">
121
+ <input type="checkbox" name="show-arrows" value="1" <?php if($show_arrows): ?>checked<?php endif;?>>
122
+ <label><?php echo TrustindexPlugin::___("Show navigation arrows"); ?></label>
123
+ </span>
124
+ <span class="ti-checkbox row">
125
+ <input type="checkbox" name="show-reviewers-photo" value="1" <?php if($show_reviewers_photo): ?>checked<?php endif;?>>
126
+ <label><?php echo TrustindexPlugin::___("Show reviewers' photo"); ?></label>
127
+ </span>
128
+ <span class="ti-checkbox row">
129
+ <input type="checkbox" name="enable-animation" value="1" <?php if($enable_animation): ?>checked<?php endif;?>>
130
+ <label><?php echo TrustindexPlugin::___("Enable animation"); ?></label>
131
+ </span>
132
+ </form>
133
+ </div>
134
+ <div class="clear"></div>
135
+ <br />
136
+ <br />
137
+ <h3 class="box-title"><?php echo TrustindexPlugin::___("Preview"); ?></h3>
138
+ <div class="ti-preview-box" style="margin: 0">
139
+ <div id="ti-review-list"><?php echo $trustindex_pm_google->get_noreg_list_reviews(null, true); ?></div>
140
+ <div style="display: none; text-align: center">
141
+ <?php echo TrustindexPlugin::___("You do not have reviews with the current filters. <br />Change your filters if you would like to display reviews on your page!"); ?>
142
+
143
+ </div>
144
+ </div>
145
+ <?php endif; ?>
146
+
147
+ <div class="clear"></div>
148
+ </li>
tabs/setup_trustindex.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ $ti_success = null;
5
+ $ti_error = null;
6
+ $ti_command = isset($_POST['command']) ? sanitize_text_field($_POST['command']) : null;
7
+ if (!in_array($ti_command, array("register"))) { $ti_command = null; }
8
+ if ($ti_command == "register")
9
+ {
10
+ check_admin_referer( 'register-reg_'.$trustindex_pm_google->get_plugin_slug());
11
+ $sanitized_email = sanitize_email($_POST['email']);
12
+ $sanitized_password = sanitize_text_field($_POST['password']);
13
+ $sanitized_url = esc_url_raw($_POST['url']);
14
+ if (
15
+ $sanitized_email
16
+ && $sanitized_password
17
+ && $sanitized_url
18
+ )
19
+ {
20
+ $server_output = $trustindex_pm_google->connect_trustindex_api(
21
+ array(
22
+ "pre_profile" => array(
23
+ "agent_id" => "sys",
24
+ "campaign_id" => "wp-google",
25
+ "language" => substr(get_locale(), 0, 2),
26
+ "email" => $sanitized_email,
27
+ "password" => $sanitized_password,
28
+ "website" => $sanitized_url
29
+ )
30
+ ),
31
+ "new"
32
+ );
33
+ if ($server_output['success'])
34
+ {
35
+ wp_redirect( admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex_join') );
36
+ exit;
37
+ }
38
+ else
39
+ {
40
+ $ti_error = json_encode($server_output);
41
+ }
42
+ }
43
+ else
44
+ {
45
+ $ti_error = TrustindexPlugin::___('You must provide a password and a valid e-mail, url!');
46
+ }
47
+ }
48
+ $trustindex_subscription_id = $trustindex_pm_google->is_trustindex_connected();
49
+ $widget_number = $trustindex_pm_google->get_trustindex_widget_number();
50
+ ?>
51
+ <?php if ($ti_error): ?>
52
+
53
+ <?php echo $trustindex_pm_google->get_noticebox("error", $ti_error); ?>
54
+
55
+ <?php endif; ?>
56
+
57
+ <?php if ($trustindex_subscription_id): ?>
58
+
59
+ <h1><?php echo TrustindexPlugin::___('Trustindex account'); ?></h1>
60
+ <p>
61
+ <?php echo TrustindexPlugin::___("Your %s is connected.", [ TrustindexPlugin::___('Trustindex account') ]); ?><br />
62
+
63
+ - <?php echo TrustindexPlugin::___('Your subscription ID:'); ?> <strong><?php echo $trustindex_subscription_id; ?></strong><br />
64
+ </p>
65
+ <form method="post" action="<?php echo admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex_join'); ?>">
66
+ <input type="hidden" name="command" value="disconnect" />
67
+ <?php wp_nonce_field( 'disconnect-reg_'.$trustindex_pm_google->get_plugin_slug() ); ?>
68
+
69
+ <button class="btn btn-delete" type="submit"><?php echo TrustindexPlugin::___("Disconnect"); ?></button>
70
+ </form>
71
+ <?php else: ?>
72
+
73
+ <h1><?php echo TrustindexPlugin::___('Skyrocket Your Sales with Customer Reviews'); ?></h1>
74
+ <p><?php echo TrustindexPlugin::___('20,000+ WordPress websites use Trustindex to embed reviews fast and easily.'); ?></p>
75
+ <p><?php echo TrustindexPlugin::___('Increase SEO, trust and sales using customer reviews.'); ?></p>
76
+ <h3><?php echo TrustindexPlugin::___('Top Features'); ?></h3>
77
+ <ul>
78
+ <li>- <?php echo TrustindexPlugin::___('Reviews from 17+ platforms'); ?></li>
79
+ <li>- <?php echo TrustindexPlugin::___('Exclusive styles and designs'); ?></li>
80
+ <li>- <?php echo TrustindexPlugin::___('Hide negative reviews'); ?></li>
81
+ <li>- <?php echo TrustindexPlugin::___('Review notification emails'); ?></li>
82
+ <li>- <?php echo TrustindexPlugin::___('Review invitation system'); ?></li>
83
+ <li>- <?php echo TrustindexPlugin::___('Automatic review update'); ?></li>
84
+ <li>- <?php echo TrustindexPlugin::___('Display unlimited number of reviews'); ?></li>
85
+ </ul>
86
+ <a class="btn-text" href="https://www.trustindex.io/ti-redirect.php?a=sys&c=wp-google-3" target="_blank"><?php echo TrustindexPlugin::___('Create a Free Trustindex Account for More Features'); ?></a>
87
+ <?php endif; ?>
88
+
89
+ <?php /*
90
+
91
+ <ul class="numbered narrow">
92
+ <li>
93
+ <form id="form-reg" class="box-content" method="post" action="">
94
+ <input type="hidden" name="command" value="register" />
95
+ <?php wp_nonce_field( 'register-reg_'.$trustindex_pm_google->get_plugin_slug() ); ?>
96
+
97
+ <div class="form-group">
98
+ <label for="ti-reg-email"><?php echo TrustindexPlugin::___('E-mail'); ?></label>
99
+ <input type="email"
100
+ placeholder="<?php echo TrustindexPlugin::___('E-mail'); ?>"
101
+ name="email"
102
+ class="form-control"
103
+ required="required"
104
+ id="ti-reg-email"
105
+ value="<?php echo $current_user->user_email; ?>"
106
+ /> <br />
107
+ <small class="form-text text-danger" id="txt-email-used" style="display: none;">
108
+ <a href="<?php echo admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex_join'); ?>"><?php echo TrustindexPlugin::___('Email ($email) is already used!'); ?> <?php echo TrustindexPlugin::___('Connect!'); ?></a>
109
+ </small>
110
+ </div>
111
+ <div class="form-group">
112
+ <label for="ti-reg-password"><?php echo TrustindexPlugin::___('Password'); ?></label>
113
+ <input type="password"
114
+ placeholder="<?php echo TrustindexPlugin::___('Password'); ?>"
115
+ name="password"
116
+ class="form-control"
117
+ required="required"
118
+ id="ti-reg-password"
119
+ />
120
+ </div>
121
+ <div class="form-group">
122
+ <label for="ti-reg-url"><?php echo TrustindexPlugin::___('Website URL'); ?></label>
123
+ <?php $my_website = get_site_url(); ?>
124
+
125
+ <input type="text"
126
+ placeholder="<?php echo TrustindexPlugin::___('Website URL'); ?>"
127
+ name="url"
128
+ class="form-control"
129
+ required="required"
130
+ id="ti-reg-url"
131
+ value="<?php echo $my_website; ?>"
132
+ />
133
+ </div>
134
+ <button type="submit" class="btn btn-primary" data-loading-text="<?php echo TrustindexPlugin::___("Loading") ;?>"><?php echo TrustindexPlugin::___('CREATE A FREE ACCOUNT');?></button>
135
+ <br />
136
+ <p class="text-center text-small"><?php echo TrustindexPlugin::___('By clicking the button I agree to <a href="https://www.trustindex.io/terms-and-conditions-and-privacy-policy/" target="_blank">Terms & Conditions and Privacy Policy</a>.'); ?></p>
137
+ </form>
138
+ <a href="<?php echo admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex_join'); ?>"><?php echo TrustindexPlugin::___('Already have an account?'); ?></a>
139
+ </li>
140
+ </ul>
141
+ */ ?>
tabs/setup_trustindex_join.php ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ $ti_success = null;
5
+ $ti_error = null;
6
+ $ti_command = isset($_POST['command']) ? sanitize_text_field($_POST['command']) : null;
7
+ if (!in_array($ti_command, array("connect", "disconnect"))) { $ti_command = null; }
8
+ if ($ti_command == "connect")
9
+ {
10
+ check_admin_referer( 'connect-reg_'.$trustindex_pm_google->get_plugin_slug());
11
+ $sanitized_email = sanitize_email($_POST['email']);
12
+ $sanitized_password = sanitize_text_field($_POST['password']);
13
+ if (
14
+ $sanitized_email
15
+ && $sanitized_password
16
+ )
17
+ {
18
+ $server_output = $trustindex_pm_google->connect_trustindex_api(
19
+ array(
20
+ "signin" => array(
21
+ "username" => $sanitized_email,
22
+ "password" => $sanitized_password,
23
+ ),
24
+ "callback" => bin2hex(openssl_random_pseudo_bytes(10))
25
+ ),
26
+ "connect"
27
+ );
28
+ if ($server_output['success'])
29
+ {
30
+ $ti_success = "connected";
31
+ }
32
+ else
33
+ {
34
+ $ti_error = TrustindexPlugin::___('Wrong e-mail or password! <a href="%s">You can try again!</a>', array(admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex')));
35
+ }
36
+ }
37
+ else
38
+ {
39
+ $ti_error = TrustindexPlugin::___('You must provide a password and a valid e-mail!');
40
+ }
41
+ }
42
+ elseif ($ti_command == "disconnect")
43
+ {
44
+ check_admin_referer( 'disconnect-reg_'.$trustindex_pm_google->get_plugin_slug());
45
+ delete_option($trustindex_pm_google->get_option_name("subscription-id"));
46
+ $ti_success = "disconnected";
47
+ }
48
+ $trustindex_subscription_id = $trustindex_pm_google->is_trustindex_connected();
49
+ $widget_number = $trustindex_pm_google->get_trustindex_widget_number();
50
+ ?>
51
+ <?php if ($ti_success == "connected"): ?>
52
+
53
+ <?php echo $trustindex_pm_google->get_noticebox("success", TrustindexPlugin::___('Trustindex account successfully connected!')); ?>
54
+
55
+ <?php elseif ($ti_success == "disconnected"): ?>
56
+
57
+ <?php echo $trustindex_pm_google->get_noticebox("success", TrustindexPlugin::___('Trustindex account successfully disconnected!')); ?>
58
+
59
+ <?php endif; ?>
60
+
61
+ <?php if ($ti_error): ?>
62
+
63
+ <?php echo $trustindex_pm_google->get_noticebox("error", $ti_error); ?>
64
+
65
+ <?php endif; ?>
66
+
67
+ <div class="maxwidth">
68
+ <h1><?php echo TrustindexPlugin::___('You can connect your %s with your Trustindex account, and can display your widgets easier.', [ 'Widgets for Google Reviews' ]); ?></h1>
69
+ <ul class="numbered">
70
+ <li>
71
+ <h3><?php echo TrustindexPlugin::___('Connect your Trustindex page to our plugin'); ?></h3>
72
+ <?php if ($trustindex_subscription_id): ?>
73
+
74
+ <?php
75
+
76
+ $ti_widgets = $trustindex_pm_google->get_trustindex_widgets();
77
+ $ti_package = $ti_widgets[0]['package'] ?? "free";
78
+ ?>
79
+ <p>
80
+ <?php echo TrustindexPlugin::___("Your %s is connected.", [ TrustindexPlugin::___('Trustindex account') ]); ?><br />
81
+
82
+ - <?php echo TrustindexPlugin::___('Your subscription ID:'); ?> <strong><?php echo $trustindex_subscription_id; ?></strong><br />
83
+ - <?php echo TrustindexPlugin::___('Your package:'); ?> <strong><?php echo TrustindexPlugin::___($ti_package); ?></strong>
84
+ </p>
85
+ <?php if ($ti_package == "free"): ?>
86
+
87
+ <?php echo $trustindex_pm_google->get_noticebox("error", TrustindexPlugin::___('Your widgets will not display fully after the trial period is over!')); ?>
88
+
89
+ <?php elseif ($ti_package == "trial"): ?>
90
+
91
+ <?php echo $trustindex_pm_google->get_noticebox("warning", TrustindexPlugin::___('Your widgets will not display, because the trial period is over! You can subscribe or switch back the the "%s" tab', [ TrustindexPlugin::___('Free Widget Configurator') ])); ?>
92
+
93
+ <?php endif; ?>
94
+
95
+ <form method="post" action="">
96
+ <input type="hidden" name="command" value="disconnect" />
97
+ <?php wp_nonce_field( 'disconnect-reg_'.$trustindex_pm_google->get_plugin_slug() ); ?>
98
+
99
+ <button class="btn btn-delete" type="submit"><?php echo TrustindexPlugin::___("Disconnect"); ?></button>
100
+ </form>
101
+ <?php else: ?>
102
+
103
+ <form id="form-connect" class="box-content" method="post" action="">
104
+ <input type="hidden" name="command" value="connect" />
105
+ <?php wp_nonce_field( 'connect-reg_'.$trustindex_pm_google->get_plugin_slug() ); ?>
106
+
107
+ <div class="form-group">
108
+ <div class="col-sm-12">
109
+ <label for="ti-reg-email2"><?php echo TrustindexPlugin::___('E-mail'); ?></label>
110
+ <input type="email"
111
+ placeholder="<?php echo TrustindexPlugin::___('E-mail'); ?>"
112
+ name="email"
113
+ class="form-control"
114
+ required="required"
115
+ id="ti-reg-email2"
116
+ value="<?php echo $current_user->user_email; ?>"
117
+ />
118
+ </div>
119
+ </div>
120
+ <div class="form-group">
121
+ <div class="col-sm-12">
122
+ <label for="ti-reg-password2"><?php echo TrustindexPlugin::___('Password'); ?></label>
123
+ <input type="password"
124
+ placeholder="<?php echo TrustindexPlugin::___('Password'); ?>"
125
+ name="password"
126
+ class="form-control"
127
+ required="required"
128
+ id="ti-reg-password2"
129
+ />
130
+ </div>
131
+ </div>
132
+ <button type="submit" class="btn btn-primary" data-loading-text="<?php echo TrustindexPlugin::___("Loading") ;?>"><?php echo TrustindexPlugin::___('CONNECT ACCOUNT');?></button>
133
+ <br />
134
+ <p class="text-center">
135
+ <a class="btn-text" href="https://www.trustindex.io/forgot-password" target="_blank"><?php echo TrustindexPlugin::___('Have you forgotten your password?'); ?></a>
136
+ <a class="btn-text" href="https://www.trustindex.io/ti-redirect.php?a=sys&c=wp-google-4" target="_blank"><?php echo TrustindexPlugin::___('Create a new Trustindex account');?></a>
137
+ </p>
138
+ </form>
139
+ <?php endif; ?>
140
+
141
+ </li>
142
+ <li class="<?php if(!$trustindex_subscription_id): ?>disabled<?php endif; ?>">
143
+ <h3><?php echo TrustindexPlugin::___("Manage your Trustindex account"); ?></h3>
144
+ <a class="btn-text" href="https://admin.trustindex.io/widget" target="_blank" <?php if ($ti_success == "connected"): ?>data-autoclick="true"<?php endif; ?>><?php echo TrustindexPlugin::___("Go to Trustindex's admin!"); ?></a>
145
+ <?php if ($ti_success == "connected"): ?>
146
+
147
+ <?php echo $trustindex_pm_google->get_noticebox("success", TrustindexPlugin::___('We will redirect you to the admin panel automatically in some seconds...')); ?>
148
+
149
+ <?php endif; ?>
150
+
151
+ </li>
152
+ <li class="<?php if(!$trustindex_subscription_id): ?>disabled<?php endif; ?>">
153
+ <h3><?php echo TrustindexPlugin::___("Insert your widget into your wordpress site using shortcode"); ?></h3>
154
+ <?php if ($trustindex_subscription_id): ?>
155
+
156
+ <?php if ($widget_number): ?>
157
+
158
+ <p>
159
+ <?php echo TrustindexPlugin::___('You have got %d widgets saved in Trustindex admin.', array($widget_number)); ?>
160
+
161
+ </p>
162
+ <?php foreach ($ti_widgets as $wc_i => $wc): ?>
163
+
164
+ <p><strong><?php echo $wc['name']; ?>:</strong></p>
165
+ <?php if ($wc['widgets']): ?>
166
+
167
+ <ul>
168
+ <?php foreach ($wc['widgets'] as $wi_num => $w): ?>
169
+
170
+ <li>
171
+ <?php echo $wi_num+1; ?>.
172
+
173
+ <a href=".ti-w-<?php echo $wc_i; ?>-<?php echo $wi_num; ?>" class="btn-toggle" data-ti-id="<?php echo $w['id']; ?>">
174
+ <?php echo $w['name']; ?>
175
+
176
+ </a>
177
+ <div style="display: none;" class="ti-w-<?php echo $wc_i; ?>-<?php echo $wi_num; ?>">
178
+ <code class="code-ti-w-<?php echo $wc_i; ?>-<?php echo $wi_num; ?>">[<?php echo $trustindex_pm_google->get_shortcode_name(); ?> data-widget-id="<?php echo $w['id']; ?>"]</code>
179
+ <a href=".code-ti-w-<?php echo $wc_i; ?>-<?php echo $wi_num; ?>" class="btn-text btn-copy2clipboard"><?php echo TrustindexPlugin::___("Copy to clipboard") ;?></a>
180
+ <br />
181
+ <br />
182
+ </div>
183
+ </li>
184
+ <?php endforeach; ?>
185
+
186
+ </ul>
187
+ <?php else: ?>
188
+
189
+ -
190
+ <?php endif; ?>
191
+
192
+ <?php endforeach; ?>
193
+
194
+ <?php else: ?>
195
+
196
+ <p>
197
+ <?php echo $trustindex_pm_google->get_noticebox("warning", "You have no widgets saved!"); ?>
198
+
199
+ </p>
200
+ <?php endif; ?>
201
+
202
+ <p>
203
+ <a class="btn-text" href="https://admin.trustindex.io/widget" target="_blank"><?php echo TrustindexPlugin::___("Create more!"); ?></a>
204
+ </p>
205
+ <?php else: ?>
206
+
207
+ <?php endif; ?>
208
+
209
+ </li>
210
+ </ul>
211
+ </div>
tabs/support.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ ?>
5
+ <div class="maxwidth">
6
+ <h1><?php echo TrustindexPlugin::___("Support"); ?></h1>
7
+ <p><?php echo TrustindexPlugin::___('If you have any questions or problem, please send an email to support@trustindex.io and our colleagues will answer you in 48 hours!'); ?></p>
8
+ </div>
tabs/troubleshooting.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ $reviews = [];
5
+ if($trustindex_pm_google->is_noreg_linked() && $trustindex_pm_google->is_noreg_table_exists())
6
+ {
7
+ $reviews = $wpdb->get_results('SELECT * FROM '. $trustindex_pm_google->get_noreg_tablename() .' ORDER BY date DESC');
8
+ }
9
+ ?>
10
+ <div class="maxwidth">
11
+ <h1><?php echo TrustindexPlugin::___("Troubleshooting"); ?></h1>
12
+ <p><?php echo TrustindexPlugin::___('If you have any questions or problem, please send an email to support@trustindex.io included the information below and our colleagues will answer you in 48 hours!'); ?></p>
13
+ <?php
14
+
15
+ $dir = __DIR__ . '/../wp-reviews-plugin-for-google.php';
16
+ $plugin_data = get_plugin_data( $dir );
17
+ ?>
18
+ <?php
19
+
20
+ $memory_limit = "N/A";
21
+ if(ini_get('memory_limit'))
22
+ {
23
+ $memory_limit = filter_var(ini_get('memory_limit'), FILTER_SANITIZE_STRING);
24
+ }
25
+ $upload_max = "N/A";
26
+ if (ini_get('upload_max_filesize'))
27
+ {
28
+ $upload_max = filter_var(ini_get('upload_max_filesize'), FILTER_SANITIZE_STRING);
29
+ }
30
+ $post_max = "N/A";
31
+ if (ini_get('post_max_size'))
32
+ {
33
+ $post_max = filter_var(ini_get('post_max_size'), FILTER_SANITIZE_STRING);
34
+ }
35
+ $max_execute = "N/A";
36
+ if (ini_get('max_execution_time'))
37
+ {
38
+ $max_execute = filter_var(ini_get('max_execution_time'));
39
+ }
40
+ ?>
41
+ <textarea class="ti-troubleshooting-info" readonly>
42
+ URL: <?php echo esc_url(get_option('siteurl')) ."\n"; ?>
43
+ MySQL Version: <?php echo esc_html($wpdb->db_version()) ."\n"; ?>
44
+ WP Table Prefix: <?php echo esc_html($wpdb->prefix) ."\n"; ?>
45
+ WP Version: <?php echo esc_html($wp_version) ."\n"; ?>
46
+ Server Name: <?php echo esc_html($_SERVER['SERVER_NAME']) ."\n"; ?>
47
+ Cookie Domain: <?php $cookieDomain = parse_url(strtolower(get_bloginfo('wpurl'))); echo esc_html($cookieDomain['host']) ."\n"; ?>
48
+ CURL Library Present: <?php echo (function_exists('curl_init') ? "Yes" : "No") ."\n\n"; ?>
49
+ PHP Info: <?php echo "\n\t"; ?>
50
+ Version: <?php echo esc_html(phpversion()) ."\n\t"; ?>
51
+ Memory Usage: <?php echo round(memory_get_usage() / 1024 / 1024, 2) . "MB\n\t"; ?>
52
+ Memory Limit : <?php echo $memory_limit . "\n\t"; ?>
53
+ Max Upload Size : <?php echo $upload_max . "\n\t"; ?>
54
+ Max Post Size : <?php echo $post_max . "\n\t"; ?>
55
+ Allow URL fopen : <?php echo (ini_get('allow_url_fopen') ? "On" : "Off") . "\n\t"; ?>
56
+ Allow URL Include : <?php echo (ini_get('allow_url_include') ? "On" : "Off") . "\n\t"; ?>
57
+ Display Errors : <?php echo (ini_get('display_errors') ? "On" : "Off") . "\n\t"; ?>
58
+ Max Script Execution Time : <?php echo $max_execute . " seconds\n\n"; ?>
59
+ Plugin: <?php echo $plugin_data['Name'] ."\n"; ?>
60
+ Plugin Version: <?php echo $plugin_data['Version'] ."\n"; ?>
61
+ Options: <?php foreach ($trustindex_pm_google->get_option_names() as $opt_name) {
62
+ $option = get_option($trustindex_pm_google->get_option_name( $opt_name ));
63
+ echo "\n\t$opt_name: ";
64
+ if($opt_name == "page-details")
65
+ {
66
+ if(isset($option['reviews']))
67
+ {
68
+ unset($option['reviews']);
69
+ }
70
+ echo str_replace("\n", "\n\t\t", print_r($option, true));
71
+ }
72
+ else
73
+ {
74
+ echo $option;
75
+ }
76
+ }
77
+ echo "\n\n"; ?>
78
+ Reviews: <?php echo str_replace("\n", "\n\t", print_r($reviews, true)) ."\n\n"; ?>
79
+ Active Theme: <?php
80
+ if (!function_exists('wp_get_theme'))
81
+ {
82
+ $theme = get_theme(get_current_theme());
83
+ echo esc_html($theme['Name'] . ' ' . $theme['Version']);
84
+ }
85
+ else
86
+ {
87
+ $theme = wp_get_theme();
88
+ echo esc_html($theme->Name . ' ' . $theme->Version);
89
+ }
90
+ echo "\n"; ?>
91
+ Plugins: <?php foreach (get_plugins() as $key => $plugin) {
92
+ echo "\n\t". esc_html($plugin['Name'].' ('.$plugin['Version'] . (is_plugin_active($key) ? ' - active' : '') . ')');
93
+ } ?>
94
+ </textarea>
95
+ <a href=".ti-troubleshooting-info" class="btn-text btn-copy2clipboard" style="margin-left: 0"><?php echo TrustindexPlugin::___("Copy to clipboard"); ?></a>
96
+ <h1><?php echo TrustindexPlugin::___("Re-create plugin"); ?></h1>
97
+ <p><?php echo TrustindexPlugin::___('Re-create the database tables of the plugin.<br />Please note: this removes all settings and reviews.'); ?></p>
98
+ <a href="?page=<?php echo $_GET['page']; ?>&recreate" class="btn-text btn-refresh" data-loading-text="<?php echo TrustindexPlugin::___("Loading") ;?>" style="margin-left: 0"><?php echo TrustindexPlugin::___("Re-create plugin"); ?></a>
99
+ </div>
tabs/upgrade.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ ?>
5
+ <div class="maxwidth">
6
+ <h1><?php echo TrustindexPlugin::___('Upgrade to Professional Review Plugin');?></h1>
7
+ <p><strong><?php echo TrustindexPlugin::___('GET MORE FEATURES WITH OUR PROFESSIONAL REVIEW PLUGIN'); ?></strong></p>
8
+ <p><strong><a class="btn-text" href="https://www.trustindex.io/prices/"><?php echo TrustindexPlugin::___('Upgrade to Professional Review Plugin.'); ?></a></strong></p>
9
+ <h2><?php echo TrustindexPlugin::___('All Professional Functions'); ?></h2>
10
+ <ol>
11
+ <li>Display ALL reviews: Google, Facebook, Yelp, Amazon, Tripadvisor, Booking.com, AirBnb</li>
12
+ <li>Display of mixed reviews</li>
13
+ <li>13 Widget Layout Templates</li>
14
+ <li>Total design personalization</li>
15
+ <li>Unlimited number of widgets</li>
16
+ <li>Management of 3 domains</li>
17
+ <li>Management of multiple businesses</li>
18
+ <li>Professional review tagging system</li>
19
+ <li>Widgets are updated when you receive a new review</li>
20
+ <li>Widget link modification</li>
21
+ <li>Edit review order</li>
22
+ <li>Review shortening</li>
23
+ <li>Automated review invitation system</li>
24
+ <li>Review widgets for your email signatures</li>
25
+ <li>Shortcode & HTML/JavaScript support</li>
26
+ <li>Detailed statistics</li>
27
+ <li>Priority support</li>
28
+ </ol>
29
+ <p><strong><a class="btn-text" href="https://www.trustindex.io/prices/"><?php echo TrustindexPlugin::___('Upgrade to Professional Review Plugin.'); ?></a></strong></p>
30
+ </div>
trustindex-google-widget.class.php ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
4
+ class TrustindexWidget_google extends WP_Widget {
5
+ private $widget_fields = array(
6
+ 'ti-widget-ID' => array('default' => '', 'required' => true,
7
+ 'placeholder' => 'eg.: 478dcc2136263f2b3a3726ff', 'name' => 'Trustindex Widget ID',
8
+ 'help' => null,
9
+ 'help-icon' => '<span class="dashicons dashicons-editor-help btn-insert-tooltip"></span>'
10
+ ),
11
+ );
12
+ private $errors = array();
13
+ public function __construct()
14
+ {
15
+ parent::__construct(
16
+ 'trustindex_google_widget',
17
+ 'Review Widgets for Google',
18
+ array(
19
+ 'classname' => 'trustindex-widget',
20
+ 'description' => TrustindexPlugin::___('Embed Google reviews fast and easily into your WordPress site. Increase SEO, trust and sales using Google reviews.')
21
+ )
22
+ );
23
+ }
24
+ function widget($args, $instance)
25
+ {
26
+ global $wpdb;
27
+ global $trustindex_pm_google;
28
+ if ($trustindex_pm_google->is_enabled())
29
+ {
30
+ extract($args);
31
+ echo $before_widget;
32
+ $was_error = false;
33
+ foreach ($this->widget_fields as $fname => $fparams)
34
+ {
35
+ if ($fparams['required'] && $instance[$fname] == "")
36
+ {
37
+ $was_error = true;
38
+ break;
39
+ }
40
+ }
41
+ if($instance['ti-widget-ID'] && !$was_error)
42
+ {
43
+ echo $trustindex_pm_google->get_trustindex_widget($instance['ti-widget-ID']);
44
+ }
45
+ elseif($trustindex_pm_google->is_noreg_linked() && $trustindex_pm_google->is_noreg_table_exists())
46
+ {
47
+ echo $trustindex_pm_google->get_noreg_list_reviews();
48
+ }
49
+ else
50
+ {
51
+ echo TrustindexPlugin::get_alertbox(
52
+ "error",
53
+ " in <strong>".TrustindexPlugin::___('Widgets for Google Reviews')."</strong> plugin<br /><br />"
54
+ .TrustindexPlugin::___('Please fill out <strong>all the required fields</strong> in the <a href="%s">widget settings</a> page', [admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php')]),
55
+ false
56
+ );
57
+ }
58
+ echo $after_widget;
59
+ }
60
+ else
61
+ {
62
+ }
63
+ }
64
+ function form($instance)
65
+ {
66
+ global $wp_version;
67
+ global $trustindex_pm_google;
68
+ $ti_widgets = $trustindex_pm_google->get_trustindex_widgets();
69
+ $selected_widget_id = isset($instance['ti-widget-ID']) ? esc_attr($instance['ti-widget-ID']) : $this->widget_fields['ti-widget-ID']['default'];
70
+ ?>
71
+ <div class="trustindex-widget-admin">
72
+ <?php if ($trustindex_pm_google->is_trustindex_connected()): ?>
73
+
74
+ <?php if ($ti_widgets): ?>
75
+
76
+ <h2><?php echo TrustindexPlugin::___('Your saved widgets'); ?></h2>
77
+ <?php foreach ($ti_widgets as $wc): ?>
78
+
79
+ <p><strong><?php echo $wc['name']; ?>:</strong></p>
80
+ <p>
81
+ <?php foreach ($wc['widgets'] as $w): ?>
82
+
83
+ <a href="#" class="btn-copy-widget-id <?php if($selected_widget_id == $w['id']): ?>text-danger<?php endif; ?>" data-ti-id="<?php echo $w['id']; ?>">
84
+ <span class="dashicons <?php if($selected_widget_id == $w['id']): ?>dashicons-yes<?php else: ?>dashicons-admin-post<?php endif; ?>"></span>
85
+ <?php echo $w['name']; ?>
86
+
87
+ </a><br />
88
+ <?php endforeach; ?>
89
+
90
+ </p>
91
+ <?php endforeach; ?>
92
+
93
+ <?php else: ?>
94
+
95
+ <?php echo $trustindex_pm_google->get_alertbox("warning",
96
+
97
+ TrustindexPlugin::___("You have no widget saved!") . " "
98
+ . "<a target='_blank' href='https://admin.trustindex.io/widget'>". TrustindexPlugin::___("Let's go, create amazing widgets for free!")."</a>"
99
+ ); ?>
100
+ <?php endif; ?>
101
+
102
+ <?php foreach ($this->widget_fields as $fname => $fparams): ?>
103
+
104
+ <div class="form-group">
105
+ <div class="col-sm-12">
106
+ <label class="<?php if (isset($this->errors[$fname])):?>text-danger<?php endif; ?>">
107
+ <?php echo TrustindexPlugin::___($fparams['name']); ?> <?php if ($fparams['required']): ?><strong class="text-danger">*</strong><?php endif; ?>
108
+
109
+ <?php if ($fparams['help-icon']): ?>
110
+
111
+ <?php echo TrustindexPlugin::___($fparams['help-icon']); ?>
112
+
113
+ <?php endif; ?>
114
+
115
+ </label>
116
+ <input type="text"
117
+ placeholder="<?php echo TrustindexPlugin::___($fparams['placeholder']); ?>"
118
+ id="<?php echo $this->get_field_id($fname); ?>"
119
+ name="<?php echo $this->get_field_name($fname); ?>"
120
+ value="<?php echo isset($instance[$fname]) ? esc_attr($instance[$fname]) : $fparams['default']; ?>"
121
+ class="form-control"
122
+ <?php if ($fparams['required']): ?>required="required"<?php endif; ?>
123
+
124
+ />
125
+ <?php if ($fparams['help']): ?>
126
+
127
+ <small class="text-muted"><?php echo TrustindexPlugin::___($fparams['help']); ?></small>
128
+ <?php endif; ?>
129
+
130
+ </div>
131
+ </div>
132
+ <?php endforeach; ?>
133
+
134
+ <div class="help-block block-help-template">
135
+ <span class="dashicons dashicons-dismiss"></span>
136
+ <p>
137
+ Check our portal, <a href="https://admin.trustindex.io/widget" target="_blank">list your widgets</a> and find IDs in the first colums.
138
+ </p>
139
+ <img src="<?php echo $trustindex_pm_google->get_plugin_file_url('static/img/help-where-is-id.jpg'); ?>" alt="ID column here: https://admin.trustindex.io/widget" />
140
+ </div>
141
+ <?php else: ?>
142
+
143
+ <?php echo $trustindex_pm_google->get_alertbox("warning",
144
+
145
+ TrustindexPlugin::___("You have not set up your Trustindex account yet!") . " " .
146
+ TrustindexPlugin::___("You can only list 10 reviews without it.") . "<br>"
147
+ . TrustindexPlugin::___("Go to <a href='%s'>plugin setup page</a> to complete the one-step setup guide and enjoy the full functionalization!", array(admin_url('admin.php?page='.$trustindex_pm_google->get_plugin_slug().'/settings.php&tab=setup_trustindex')))
148
+ ); ?>
149
+ <?php endif; ?>
150
+
151
+ </div>
152
+ <?php
153
+
154
+ }
155
+ }
156
+ ?>
trustindex-plugin.class.php ADDED
@@ -0,0 +1,1650 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* GENERATED: 1602572265 */
3
+ class TrustindexPlugin
4
+ {
5
+ private $plugin_file_path;
6
+ private $plugin_name;
7
+ private $shortname;
8
+ private $version;
9
+ public function __construct($shortname, $plugin_file_path, $version, $plugin_name)
10
+ {
11
+ $this->shortname = $shortname;
12
+ $this->plugin_file_path = $plugin_file_path;
13
+ $this->version = $version;
14
+ $this->plugin_name = $plugin_name;
15
+ }
16
+ public function get_plugin_dir()
17
+ {
18
+ return plugin_dir_path($this->plugin_file_path);
19
+ }
20
+ public function get_plugin_file_url($file, $add_versioning = true)
21
+ {
22
+ $url = plugins_url($file, $this->plugin_file_path);
23
+ if ($add_versioning)
24
+ {
25
+ $append_mark = strpos($url, "?") === FALSE ? "?" : "&";
26
+ $url .= $append_mark . 'ver=' . $this->version;
27
+ }
28
+ return $url;
29
+ }
30
+ public function get_plugin_slug()
31
+ {
32
+ return basename($this->get_plugin_dir());
33
+ }
34
+ public function loadI18N()
35
+ {
36
+ load_plugin_textdomain('trustindex', false, $this->get_plugin_slug() . '/languages');
37
+ }
38
+ public static function ___($text, $params = null)
39
+ {
40
+ if (!is_array($params))
41
+ {
42
+ $params = func_get_args();
43
+ $params = array_slice($params, 1);
44
+ }
45
+ return vsprintf(__($text, 'trustindex'), $params);
46
+ }
47
+ public function output_buffer()
48
+ {
49
+ ob_start();
50
+ }
51
+ public function activate()
52
+ {
53
+ if ($this->is_need_update())
54
+ {
55
+ add_option($this->get_option_name('active'), '1');
56
+ update_option($this->get_option_name('version'), ${'trustindex_p_'.$this->shortname.'_version'});
57
+ }
58
+ }
59
+ public function deactivate()
60
+ {
61
+ foreach ($this->get_option_names() as $opt_name)
62
+ {
63
+ delete_option($this->get_option_name($opt_name));
64
+ }
65
+ global $wpdb;
66
+ $dbtable = $this->get_noreg_tablename();
67
+ $wpdb->query( "DROP TABLE IF EXISTS $dbtable" );
68
+ }
69
+ public function is_enabled()
70
+ {
71
+ $active = get_option($this->get_option_name('active'));
72
+ if (empty($active) || $active === '0')
73
+ {
74
+ return false;
75
+ }
76
+ return true;
77
+ }
78
+ public function is_need_update()
79
+ {
80
+ $version = (string)get_option($this->get_option_name('version'));
81
+ if (!$version)
82
+ {
83
+ $version = '0';
84
+ }
85
+ if (version_compare($version, $this->version, '<'))
86
+ {
87
+ return true;
88
+ }
89
+ return false;
90
+ }
91
+ public function add_setting_menu()
92
+ {
93
+ global $menu, $submenu;
94
+ $permissions = ["edit_posts"];
95
+ $settings_page_url = $this->get_plugin_slug() . "/settings.php";
96
+ $settings_page_title = str_replace([ 'Arukereso', 'Szallashu' ], [ 'Árukereső', 'Szallas.hu' ], ucfirst($this->shortname)).' '.mb_strtolower(TrustindexPlugin::___('Reviews'));
97
+ foreach ($permissions as $perm)
98
+ {
99
+ $top_menu = false;
100
+ foreach($menu as $key => $item)
101
+ {
102
+ if($item[0] == 'Trustindex.io')
103
+ {
104
+ $top_menu = $item;
105
+ break;
106
+ }
107
+ }
108
+ if($top_menu === false)
109
+ {
110
+ add_menu_page(
111
+ $settings_page_title,
112
+ 'Trustindex.io',
113
+ $perm,
114
+ $settings_page_url,
115
+ '',
116
+ $this->get_plugin_file_url('static/img/trustindex-sign-logo.png')
117
+ );
118
+ }
119
+ else
120
+ {
121
+ if(!isset($submenu[$top_menu[2]]))
122
+ {
123
+ add_submenu_page(
124
+ $top_menu[2],
125
+ 'Trustindex.io',
126
+ $top_menu[3],
127
+ $perm,
128
+ $top_menu[2]
129
+ );
130
+ }
131
+ add_submenu_page(
132
+ $top_menu[2],
133
+ 'Trustindex.io',
134
+ $settings_page_title,
135
+ $perm,
136
+ $settings_page_url
137
+ );
138
+ }
139
+ }
140
+ }
141
+ public function add_plugin_action_links($links, $file)
142
+ {
143
+ $plugin_file = basename($this->plugin_file_path);
144
+ if (basename($file) == $plugin_file)
145
+ {
146
+ $new_item2 = '<a target="_blank" href="https://www.trustindex.io" target="_blank">by <span style="background-color: #4067af; color: white; font-weight: bold; padding: 1px 8px;">Trustindex.io</span></a>';
147
+ $new_item1 = '<a href="' . admin_url('admin.php?page=' . $this->get_plugin_slug() . '/settings.php') . '">' . TrustindexPlugin::___('Settings') . '</a>';
148
+ array_unshift($links, $new_item2, $new_item1);
149
+ }
150
+ return $links;
151
+ }
152
+ public function add_plugin_meta_links( $meta, $file )
153
+ {
154
+ $plugin_file = basename($this->plugin_file_path);
155
+ if (basename($file) == $plugin_file)
156
+ {
157
+ $meta[] = "<a href='http://wordpress.org/support/view/plugin-reviews/".$this->get_plugin_slug()."' target='_blank' rel='noopener noreferrer' title='" . TrustindexPlugin::___( 'Rate our plugin') . ': '.$this->plugin_name . "'>" . TrustindexPlugin::___('Rate our plugin') . '</a>';
158
+ }
159
+ return $meta;
160
+ }
161
+ public function init_widget()
162
+ {
163
+ if (!class_exists('TrustindexWidget_'.$this->shortname))
164
+ {
165
+ require $this->get_plugin_dir() . 'trustindex-'.$this->shortname.'-widget.class.php';
166
+ }
167
+ }
168
+ public function register_widget()
169
+ {
170
+ return register_widget('TrustindexWidget_'.$this->shortname);
171
+ }
172
+ public function get_option_name($opt_name)
173
+ {
174
+ if (!in_array($opt_name, $this->get_option_names()))
175
+ {
176
+ echo "Option not registered in plugin (Trustindex class)";
177
+ }
178
+ if ($opt_name == "subscription-id")
179
+ {
180
+ return "trustindex-".$opt_name;
181
+ }
182
+ else
183
+ {
184
+ return "trustindex-".$this->shortname."-".$opt_name;
185
+ }
186
+ }
187
+ public function get_option_names()
188
+ {
189
+ return ['active', 'version', 'page-details', 'subscription-id', 'style-id', 'review-content', 'filter', 'scss-set', 'css-content', 'lang', 'no-rating-text', 'dateformat', 'rate-us', 'verified-icon', 'enable-animation', 'show-arrows', 'content-saved-to', 'show-reviewers-photo'];
190
+ }
191
+ public function get_platforms()
192
+ {
193
+ return ["facebook", "google", "tripadvisor", "yelp", "booking", "trustpilot", "amazon", "arukereso", "airbnb", "hotels", "opentable", "foursquare", "bookatable", "capterra", "szallashu", "thumbtack"];
194
+ }
195
+ public function get_plugin_slugs()
196
+ {
197
+ return [
198
+ "free-facebook-reviews-and-recommendations-widgets",
199
+ "wp-reviews-plugin-for-google",
200
+ "review-widgets-for-tripadvisor",
201
+ "reviews-widgets-for-yelp",
202
+ "review-widgets-for-booking-com",
203
+ "review-widgets-for-trustpilot",
204
+ "review-widgets-for-amazon",
205
+ "review-widgets-for-arukereso",
206
+ "review-widgets-for-airbnb",
207
+ "review-widgets-for-hotels-com",
208
+ "review-widgets-for-opentable",
209
+ "review-widgets-for-foursquare",
210
+ "review-widgets-for-bookatable",
211
+ "review-widgets-for-capterra",
212
+ "review-widgets-for-szallas-hu",
213
+ "widgets-for-thumbtack-reviews",
214
+ ];
215
+ }
216
+ public static function get_noticebox($type, $message)
217
+ {
218
+ return '<div class="notice notice-'.$type.' is-dismissible"><p>'.TrustindexPlugin::___($message).'</p></div>';
219
+ }
220
+ public static function get_alertbox($type, $content, $newline_content = true)
221
+ {
222
+ $types = array(
223
+ "warning" => array(
224
+ "css" => "color: #856404; background-color: #fff3cd; border-color: #ffeeba;",
225
+ "icon" => "dashicons-warning"
226
+ ),
227
+ "info" => array(
228
+ "css" => "color: #0c5460; background-color: #d1ecf1; border-color: #bee5eb;",
229
+ "icon" => "dashicons-info"
230
+ ),
231
+ "error" => array(
232
+ "css" => "color: #721c24; background-color: #f8d7da; border-color: #f5c6cb;",
233
+ "icon" => "dashicons-info"
234
+ )
235
+ );
236
+ return "<div style='margin:20px 0px; padding:10px; " . $types[$type]['css'] . " border-radius: 5px;'>"
237
+ . "<span class='dashicons " . $types[$type]['icon'] . "'></span> <strong>" . strtoupper(TrustindexPlugin::___($type)) . "</strong>"
238
+ . ($newline_content ? "<br />" : "")
239
+ . $content
240
+ . "</div>";
241
+ }
242
+ public function get_trustindex_widget($ti_id)
243
+ {
244
+ wp_enqueue_script( 'trustindex-js', 'https://cdn.trustindex.io/loader.js', [], false, true);
245
+ return "<div src='https://cdn.trustindex.io/loader.js?" . $ti_id . "'></div>";
246
+ }
247
+ public function get_shortcode_name()
248
+ {
249
+ return 'trustindex';
250
+ }
251
+ public function init_shortcode()
252
+ {
253
+ if (!shortcode_exists($this->get_shortcode_name()))
254
+ {
255
+ add_shortcode( $this->get_shortcode_name(), [$this, 'shortcode_func'] );
256
+ }
257
+ }
258
+ public function shortcode_func($atts)
259
+ {
260
+ $atts = shortcode_atts(
261
+ array(
262
+ 'data-widget-id' => null,
263
+ 'no-registration' => null
264
+ ),
265
+ $atts
266
+ );
267
+ if (isset($atts["data-widget-id"]) && $atts["data-widget-id"])
268
+ {
269
+ return $this->get_trustindex_widget($atts["data-widget-id"]);
270
+ }
271
+ else if (isset($atts["no-registration"]) && $atts["no-registration"])
272
+ {
273
+ $force_platform = $atts["no-registration"];
274
+ if (!in_array($force_platform, $this->get_platforms()))
275
+ {
276
+ $av_platforms = $this->get_platforms();
277
+ $force_platform = $av_platforms[0];
278
+ }
279
+ $chosed_platform = new TrustindexPlugin($force_platform, __FILE__, "do-not-care-4.0", "do-not-care-Widgets for Google Reviews");
280
+ if(!$chosed_platform->is_noreg_linked() || !$chosed_platform->is_noreg_table_exists($force_platform))
281
+ {
282
+ return $this->get_alertbox(
283
+ "error",
284
+ " in <strong>".TrustindexPlugin::___($this->plugin_name . " plugin")."</strong><br /><br />"
285
+ .TrustindexPlugin::___('You have to connect your business (%s)!', [$force_platform]),
286
+ false
287
+ );
288
+ }
289
+ else
290
+ {
291
+ return $chosed_platform->get_noreg_list_reviews($force_platform);
292
+ }
293
+ }
294
+ else
295
+ {
296
+ return $this->get_alertbox(
297
+ "error",
298
+ " in <strong>".TrustindexPlugin::___($this->plugin_name . "plugin")."</strong><br /><br />"
299
+ .TrustindexPlugin::___('Your shortcode is deficient: Trustindex Widget ID is empty! Example: ') . '<br /><code>['.$this->get_shortcode_name().' data-widget-id="478dcc2136263f2b3a3726ff"]</code>',
300
+ false
301
+ );
302
+ }
303
+ }
304
+ public function is_noreg_linked()
305
+ {
306
+ $page_details = get_option($this->get_option_name('page-details'));
307
+ return $page_details && !empty($page_details);
308
+ }
309
+ public function get_noreg_tablename($force_platform = null)
310
+ {
311
+ global $wpdb;
312
+ $force_platform = $force_platform ? $force_platform : $this->shortname;
313
+ return $wpdb->prefix ."trustindex_".$force_platform."_reviews";
314
+ }
315
+ public function is_noreg_table_exists($force_platform = null)
316
+ {
317
+ global $wpdb;
318
+ $dbtable = $this->get_noreg_tablename($force_platform);
319
+ return ($wpdb->get_var("SHOW TABLES LIKE '$dbtable'") == $dbtable);
320
+ }
321
+ public function noreg_save_css($set_change = false)
322
+ {
323
+ $style_id = (int)get_option($this->get_option_name('style-id'));
324
+ $set_id = get_option($this->get_option_name('scss-set'));
325
+ if(!$style_id)
326
+ {
327
+ $style_id = 4;
328
+ }
329
+ $args = array(
330
+ 'timeout' => '20',
331
+ 'redirection' => '5',
332
+ 'blocking' => true
333
+ );
334
+ add_filter( 'https_ssl_verify', '__return_false' );
335
+ add_filter( 'block_local_requests', '__return_false' );
336
+ $params = [
337
+ 'layout_id' => $style_id,
338
+ 'overrides' => [
339
+ 'nav' => get_option($this->get_option_name('show-arrows'), 1) ? true : false,
340
+ 'hover-anim' => get_option($this->get_option_name('enable-animation'), 1) ? true : false,
341
+ ]
342
+ ];
343
+ if($set_change)
344
+ {
345
+ $params['set_id'] = $set_id;
346
+ }
347
+ $url = 'https://admin.trustindex.io/api/getLayoutScss?' . http_build_query($params);
348
+ $server_output = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
349
+ if($server_output[0] !== '[' && $server_output[0] !== '{')
350
+ {
351
+ $server_output = substr($server_output, strpos($server_output, '('));
352
+ $server_output = trim($server_output,'();');
353
+ }
354
+ $server_output = json_decode($server_output, true);
355
+ if(!$set_change)
356
+ {
357
+ update_option($this->get_option_name('scss-set'), $server_output['default'], false);
358
+ }
359
+ if($server_output['css'])
360
+ {
361
+ update_option($this->get_option_name('css-content'), $server_output['css'], false);
362
+ }
363
+ return $content;
364
+ }
365
+ public static $widget_templates = array (
366
+ 8 =>
367
+ array (
368
+ 'name' => 'Full sidebar I.',
369
+ 'type' => 'vertical',
370
+ ),
371
+ 18 =>
372
+ array (
373
+ 'name' => 'Full sidebar I. - without header',
374
+ 'type' => 'vertical',
375
+ ),
376
+ 9 =>
377
+ array (
378
+ 'name' => 'Full sidebar II.',
379
+ 'type' => 'vertical',
380
+ ),
381
+ 10 =>
382
+ array (
383
+ 'name' => 'Full sidebar III.',
384
+ 'type' => 'vertical',
385
+ ),
386
+ 11 =>
387
+ array (
388
+ 'name' => 'HTML badge I.',
389
+ 'type' => 'badge',
390
+ ),
391
+ 12 =>
392
+ array (
393
+ 'name' => 'HTML badge II.',
394
+ 'type' => 'badge',
395
+ ),
396
+ 6 =>
397
+ array (
398
+ 'name' => 'Sidebar slider I.',
399
+ 'type' => 'vertical',
400
+ ),
401
+ 7 =>
402
+ array (
403
+ 'name' => 'Sidebar slider II.',
404
+ 'type' => 'vertical',
405
+ ),
406
+ 4 =>
407
+ array (
408
+ 'name' => 'Slider I.',
409
+ 'type' => 'horizontal',
410
+ ),
411
+ 15 =>
412
+ array (
413
+ 'name' => 'Slider II.',
414
+ 'type' => 'horizontal',
415
+ ),
416
+ 5 =>
417
+ array (
418
+ 'name' => 'Slider III. - with badge',
419
+ 'type' => 'horizontal',
420
+ ),
421
+ 13 =>
422
+ array (
423
+ 'name' => 'Slider III. - with company header',
424
+ 'type' => 'horizontal',
425
+ ),
426
+ 19 =>
427
+ array (
428
+ 'name' => 'Slider IV.',
429
+ 'type' => 'horizontal',
430
+ ),
431
+ );
432
+ public static $widget_styles = array (
433
+ 'blue' => 'Blue',
434
+ 'light-background' => 'Light background',
435
+ 'light-background-border' => 'Light background border',
436
+ 'ligth-border' => 'Light border',
437
+ 'light-contrast' => 'Light contrast',
438
+ 'dark-background' => 'Dark background',
439
+ 'dark-border' => 'Dark border',
440
+ 'dark-contrast' => 'Dark contrast',
441
+ 'soft' => 'Soft',
442
+ );
443
+ public static $widget_languages = [
444
+ 'ar' => "العربية",
445
+ 'zh' => "汉语",
446
+ 'cs' => "Čeština",
447
+ 'da' => "Dansk",
448
+ 'nl' => "Nederlands",
449
+ 'en' => "English",
450
+ 'fi' => "Suomi",
451
+ 'fr' => "Français",
452
+ 'de' => "Deutsch",
453
+ 'el' => "Ελληνικά",
454
+ 'hi' => "हिन्दी",
455
+ 'hu' => "Magyar",
456
+ 'it' => "Italiano",
457
+ 'no' => "Norsk",
458
+ 'pl' => "Polski",
459
+ 'pt' => "Português",
460
+ 'ro' => "Română",
461
+ 'ru' => "Русский",
462
+ 'sk' => "Slovenčina",
463
+ 'es' => "Español",
464
+ 'sv' => "Svenska",
465
+ 'tr' => "Türkçe"
466
+ ];
467
+ public static $widget_dateformats = [ 'j. F, Y.', 'F j, Y.', 'Y.m.d.', 'Y-m-d', 'd/m/Y' ];
468
+ private static $widget_rating_texts = array (
469
+ 'en' =>
470
+ array (
471
+ 0 => 'poor',
472
+ 1 => 'below average',
473
+ 2 => 'average',
474
+ 3 => 'good',
475
+ 4 => 'excellent',
476
+ ),
477
+ 'ar' =>
478
+ array (
479
+ 0 => 'فيعض',
480
+ 1 => 'طسوتملا تحت',
481
+ 2 => 'طسوتم',
482
+ 3 => 'ديج',
483
+ 4 => 'زاتمم',
484
+ ),
485
+ 'cs' =>
486
+ array (
487
+ 0 => 'Slabý',
488
+ 1 => 'Podprůměrný',
489
+ 2 => 'Průměrný',
490
+ 3 => 'Dobrý',
491
+ 4 => 'Vynikající',
492
+ ),
493
+ 'da' =>
494
+ array (
495
+ 0 => 'Svag',
496
+ 1 => 'Under gennemsnitlig',
497
+ 2 => 'Gennemsnitlig',
498
+ 3 => 'God',
499
+ 4 => 'Fremragende',
500
+ ),
501
+ 'de' =>
502
+ array (
503
+ 0 => 'Schwach',
504
+ 1 => 'Unterdurchschnittlich',
505
+ 2 => 'Durchschnittlich',
506
+ 3 => 'Gut',
507
+ 4 => 'Ausgezeichnet',
508
+ ),
509
+ 'el' =>
510
+ array (
511
+ 0 => 'Χαμηλή',
512
+ 1 => 'Κάτω από τον μέσο όρο',
513
+ 2 => 'Μέτρια',
514
+ 3 => 'Καλή',
515
+ 4 => 'Άριστη',
516
+ ),
517
+ 'es' =>
518
+ array (
519
+ 0 => 'Flojo',
520
+ 1 => 'Por debajo de lo regular',
521
+ 2 => 'Regular',
522
+ 3 => 'Bueno',
523
+ 4 => 'Excelente',
524
+ ),
525
+ 'fi' =>
526
+ array (
527
+ 0 => 'Heikko',
528
+ 1 => 'Keskitasoa alhaisempi',
529
+ 2 => 'Keskitasoinen',
530
+ 3 => 'Hyvä',
531
+ 4 => 'Erinomainen',
532
+ ),
533
+ 'fr' =>
534
+ array (
535
+ 0 => 'faible',
536
+ 1 => 'moyenne basse',
537
+ 2 => 'moyenne',
538
+ 3 => 'bien',
539
+ 4 => 'excellent',
540
+ ),
541
+ 'hi' =>
542
+ array (
543
+ 0 => 'कमज़ोर',
544
+ 1 => 'औसत से कम ',
545
+ 2 => 'औसत ',
546
+ 3 => 'अच्छा ',
547
+ 4 => 'अति उत्कृष्ट ',
548
+ ),
549
+ 'hu' =>
550
+ array (
551
+ 0 => 'Gyenge',
552
+ 1 => 'Átlag alatti',
553
+ 2 => 'Átlagos',
554
+ 3 => 'Jó',
555
+ 4 => 'Kiváló',
556
+ ),
557
+ 'it' =>
558
+ array (
559
+ 0 => 'Scarso',
560
+ 1 => 'Sotto la media',
561
+ 2 => 'Medio',
562
+ 3 => 'Buono',
563
+ 4 => 'Eccellente',
564
+ ),
565
+ 'nl' =>
566
+ array (
567
+ 0 => 'Zwak',
568
+ 1 => 'Onder gemiddeld',
569
+ 2 => 'Gemiddeld',
570
+ 3 => 'Goed',
571
+ 4 => 'Uitstekend',
572
+ ),
573
+ 'no' =>
574
+ array (
575
+ 0 => 'Dårlig',
576
+ 1 => 'Utilstrekkelig',
577
+ 2 => 'Gjennomsnittlig',
578
+ 3 => 'Bra',
579
+ 4 => 'Utmerket',
580
+ ),
581
+ 'pl' =>
582
+ array (
583
+ 0 => 'Śłaby',
584
+ 1 => 'Poniżej średniego',
585
+ 2 => 'Średni',
586
+ 3 => 'Dobry',
587
+ 4 => 'Doskonały',
588
+ ),
589
+ 'pt' =>
590
+ array (
591
+ 0 => 'Fraco',
592
+ 1 => 'Inferior ao médio',
593
+ 2 => 'Medíocre',
594
+ 3 => 'Bom',
595
+ 4 => 'Excelente',
596
+ ),
597
+ 'ro' =>
598
+ array (
599
+ 0 => 'Slab',
600
+ 1 => 'Sub nivel mediu',
601
+ 2 => 'Mediu',
602
+ 3 => 'Bun',
603
+ 4 => 'Excelent',
604
+ ),
605
+ 'ru' =>
606
+ array (
607
+ 0 => 'Слабо',
608
+ 1 => 'Ниже среднего',
609
+ 2 => 'Средний',
610
+ 3 => 'Хорошо',
611
+ 4 => 'Отлично',
612
+ ),
613
+ 'sk' =>
614
+ array (
615
+ 0 => 'Slabé',
616
+ 1 => 'Podpriemerné',
617
+ 2 => 'Priemerné',
618
+ 3 => 'Dobré',
619
+ 4 => 'Vynikajúce',
620
+ ),
621
+ 'sv' =>
622
+ array (
623
+ 0 => 'Svag',
624
+ 1 => 'Under genomsnittet',
625
+ 2 => 'Genomsnitt',
626
+ 3 => 'God',
627
+ 4 => 'Utmärkt',
628
+ ),
629
+ 'tr' =>
630
+ array (
631
+ 0 => 'Zayıf',
632
+ 1 => 'Ortanın altıi',
633
+ 2 => 'Orta',
634
+ 3 => 'İyi',
635
+ 4 => 'Mükemmel',
636
+ ),
637
+ 'zh' =>
638
+ array (
639
+ 0 => '差',
640
+ 1 => '不如一般',
641
+ 2 => '一般',
642
+ 3 => '好',
643
+ 4 => '非常好',
644
+ ),
645
+ );
646
+ private static $widget_recommendation_texts = array (
647
+ 'en' =>
648
+ array (
649
+ 'negative' => 'NOT_RECOMMEND_ICON not recommends',
650
+ 'positive' => 'RECOMMEND_ICON recommends',
651
+ ),
652
+ 'ar' =>
653
+ array (
654
+ 'negative' => 'لا توصي NOT_RECOMMEND_ICON',
655
+ 'positive' => 'توصي RECOMMEND_ICON',
656
+ ),
657
+ 'cs' =>
658
+ array (
659
+ 'negative' => 'NOT_RECOMMEND_ICON not nedoporučuje',
660
+ 'positive' => 'RECOMMEND_ICON doporučuje',
661
+ ),
662
+ 'da' =>
663
+ array (
664
+ 'negative' => 'NOT_RECOMMEND_ICON anbefaler ikke',
665
+ 'positive' => 'RECOMMEND_ICON anbefaler',
666
+ ),
667
+ 'de' =>
668
+ array (
669
+ 'negative' => 'NOT_RECOMMEND_ICON wird nicht empfohlen',
670
+ 'positive' => 'RECOMMEND_ICON empfiehlt',
671
+ ),
672
+ 'el' =>
673
+ array (
674
+ 'negative' => 'NOT_RECOMMEND_ICON δεν συνιστά',
675
+ 'positive' => 'RECOMMEND_ICON συνιστά',
676
+ ),
677
+ 'es' =>
678
+ array (
679
+ 'negative' => 'NOT_RECOMMEND_ICON no recomienda',
680
+ 'positive' => 'RECOMMEND_ICON recomienda',
681
+ ),
682
+ 'fi' =>
683
+ array (
684
+ 'negative' => 'NOT_RECOMMEND_ICON ei suosittele',
685
+ 'positive' => 'RECOMMEND_ICON suosittelee',
686
+ ),
687
+ 'fr' =>
688
+ array (
689
+ 'negative' => 'NOT_RECOMMEND_ICON ne recommande pas',
690
+ 'positive' => 'RECOMMEND_ICON recommande',
691
+ ),
692
+ 'hi' =>
693
+ array (
694
+ 'negative' => 'NOT_RECOMMEND_ICON अनुशंसा नहीं करता है',
695
+ 'positive' => 'RECOMMEND_ICON अनुशंसा करता है',
696
+ ),
697
+ 'hu' =>
698
+ array (
699
+ 'negative' => 'NOT_RECOMMEND_ICON nem ajánlja',
700
+ 'positive' => 'RECOMMEND_ICON ajánlja',
701
+ ),
702
+ 'it' =>
703
+ array (
704
+ 'negative' => 'NOT_RECOMMEND_ICON non lo consiglia',
705
+ 'positive' => 'RECOMMEND_ICON consiglia',
706
+ ),
707
+ 'nl' =>
708
+ array (
709
+ 'negative' => 'NOT_RECOMMEND_ICON raadt niet aan',
710
+ 'positive' => 'RECOMMEND_ICON raadt aan',
711
+ ),
712
+ 'no' =>
713
+ array (
714
+ 'negative' => 'NOT_RECOMMEND_ICON anbefaler ikke',
715
+ 'positive' => 'RECOMMEND_ICON anbefaler',
716
+ ),
717
+ 'pl' =>
718
+ array (
719
+ 'negative' => 'NOT_RECOMMEND_ICON nie zaleca',
720
+ 'positive' => 'RECOMMEND_ICON poleca',
721
+ ),
722
+ 'pt' =>
723
+ array (
724
+ 'negative' => 'NOT_RECOMMEND_ICON não recomenda',
725
+ 'positive' => 'RECOMMEND_ICON recomenda',
726
+ ),
727
+ 'ro' =>
728
+ array (
729
+ 'negative' => 'NOT_RECOMMEND_ICON nu recomandă',
730
+ 'positive' => 'RECOMMEND_ICON recomandă',
731
+ ),
732
+ 'ru' =>
733
+ array (
734
+ 'negative' => 'NOT_RECOMMEND_ICON не рекомендует',
735
+ 'positive' => 'RECOMMEND_ICON рекомендует',
736
+ ),
737
+ 'sk' =>
738
+ array (
739
+ 'negative' => 'NOT_RECOMMEND_ICON neodporúča',
740
+ 'positive' => 'RECOMMEND_ICON odporúča',
741
+ ),
742
+ 'sv' =>
743
+ array (
744
+ 'negative' => 'NOT_RECOMMEND_ICON rekommenderar inte',
745
+ 'positive' => 'RECOMMEND_ICON rekommenderar',
746
+ ),
747
+ 'tr' =>
748
+ array (
749
+ 'negative' => 'NOT_RECOMMEND_ICON önerilmez',
750
+ 'positive' => 'RECOMMEND_ICON önerir',
751
+ ),
752
+ 'zh' =>
753
+ array (
754
+ 'negative' => 'NOT_RECOMMEND_ICON 不推荐',
755
+ 'positive' => 'RECOMMEND_ICON 推荐',
756
+ ),
757
+ );
758
+ private static $widget_verified_texts = array (
759
+ 'en' => 'Verified review',
760
+ 'ar' => 'مراجعة التحقق',
761
+ 'cs' => 'Ověřená recenze',
762
+ 'da' => 'Bekræftet anmeldelse',
763
+ 'de' => 'Verifizierte bewertung',
764
+ 'el' => 'Επαληθευμένη κριτική',
765
+ 'es' => 'Revisión verificada',
766
+ 'fi' => 'Vahvistettu arvostelu',
767
+ 'fr' => 'Avis vérifié',
768
+ 'hi' => 'सत्यापित समीक्षा',
769
+ 'hu' => 'Hitelesített vélemény',
770
+ 'it' => 'Recensione verificata',
771
+ 'nl' => 'Geverifieerde beoordeling',
772
+ 'no' => 'Bekreftet anmeldelse',
773
+ 'pl' => 'Zweryfikowana recenzja',
774
+ 'pt' => 'Avaliação verificada',
775
+ 'ro' => 'Recenzie verificată',
776
+ 'ru' => 'Проверенный обзор',
777
+ 'sk' => 'Overená recenzia',
778
+ 'sv' => 'Verifierad recension',
779
+ 'tr' => 'Doğrulanmış inceleme',
780
+ 'zh' => '验证评论',
781
+ );
782
+ private static $widget_month_names = array (
783
+ 'en' =>
784
+ array (
785
+ 0 => 'January',
786
+ 1 => 'February',
787
+ 2 => 'March',
788
+ 3 => 'April',
789
+ 4 => 'May',
790
+ 5 => 'June',
791
+ 6 => 'July',
792
+ 7 => 'August',
793
+ 8 => 'September',
794
+ 9 => 'October',
795
+ 10 => 'November',
796
+ 11 => 'December',
797
+ ),
798
+ 'ar' =>
799
+ array (
800
+ 0 => 'يناير',
801
+ 1 => 'فبراير',
802
+ 2 => 'مارس',
803
+ 3 => 'أبريل',
804
+ 4 => 'مايو',
805
+ 5 => 'يونيو',
806
+ 6 => 'يوليه',
807
+ 7 => 'أغسطس',
808
+ 8 => 'سبتمبر',
809
+ 9 => 'أكتوبر',
810
+ 10 => 'نوفمبر',
811
+ 11 => 'ديسمبر',
812
+ ),
813
+ 'zh' =>
814
+ array (
815
+ 0 => '一月',
816
+ 1 => '二月',
817
+ 2 => '三月',
818
+ 3 => '四月',
819
+ 4 => '五月',
820
+ 5 => '六月',
821
+ 6 => '七月',
822
+ 7 => '八月',
823
+ 8 => '九月',
824
+ 9 => '十月',
825
+ 10 => '十一月',
826
+ 11 => '十二月',
827
+ ),
828
+ 'cs' =>
829
+ array (
830
+ 0 => 'Leden',
831
+ 1 => 'Únor',
832
+ 2 => 'Březen',
833
+ 3 => 'Duben',
834
+ 4 => 'Květen',
835
+ 5 => 'Červen',
836
+ 6 => 'Červenec',
837
+ 7 => 'Srpen',
838
+ 8 => 'Září',
839
+ 9 => 'Říjen',
840
+ 10 => 'Listopad',
841
+ 11 => 'Prosinec',
842
+ ),
843
+ 'da' =>
844
+ array (
845
+ 0 => 'Januar',
846
+ 1 => 'Februar',
847
+ 2 => 'Marts',
848
+ 3 => 'April',
849
+ 4 => 'Maj',
850
+ 5 => 'Juni',
851
+ 6 => 'Juli',
852
+ 7 => 'August',
853
+ 8 => 'September',
854
+ 9 => 'Oktober',
855
+ 10 => 'November',
856
+ 11 => 'December',
857
+ ),
858
+ 'nl' =>
859
+ array (
860
+ 0 => 'Januari',
861
+ 1 => 'Februari',
862
+ 2 => 'Maart',
863
+ 3 => 'April',
864
+ 4 => 'Mei',
865
+ 5 => 'Juni',
866
+ 6 => 'Juli',
867
+ 7 => 'Augustus',
868
+ 8 => 'September',
869
+ 9 => 'Oktober',
870
+ 10 => 'November',
871
+ 11 => 'December',
872
+ ),
873
+ 'fi' =>
874
+ array (
875
+ 0 => 'Tammikuu',
876
+ 1 => 'Helmikuu',
877
+ 2 => 'Maaliskuu',
878
+ 3 => 'Huhtikuu',
879
+ 4 => 'Toukokuu',
880
+ 5 => 'Kesäkuu',
881
+ 6 => 'Heinäkuu',
882
+ 7 => 'Elokuu',
883
+ 8 => 'Syyskuu',
884
+ 9 => 'Lokakuu',
885
+ 10 => 'Marraskuu',
886
+ 11 => 'Joulukuu',
887
+ ),
888
+ 'fr' =>
889
+ array (
890
+ 0 => 'Janvier',
891
+ 1 => 'Février',
892
+ 2 => 'Mars',
893
+ 3 => 'Avril',
894
+ 4 => 'Mai',
895
+ 5 => 'Juin',
896
+ 6 => 'Juillet',
897
+ 7 => 'Août',
898
+ 8 => 'Septembre',
899
+ 9 => 'Octobre',
900
+ 10 => 'Novembre',
901
+ 11 => 'Décembre',
902
+ ),
903
+ 'de' =>
904
+ array (
905
+ 0 => 'Januar',
906
+ 1 => 'Februar',
907
+ 2 => 'März',
908
+ 3 => 'April',
909
+ 4 => 'Mai',
910
+ 5 => 'Juni',
911
+ 6 => 'Juli',
912
+ 7 => 'August',
913
+ 8 => 'September',
914
+ 9 => 'Oktober',
915
+ 10 => 'November',
916
+ 11 => 'Dezember',
917
+ ),
918
+ 'el' =>
919
+ array (
920
+ 0 => 'Iανουάριος',
921
+ 1 => 'Φεβρουάριος',
922
+ 2 => 'Μάρτιος',
923
+ 3 => 'Aρίλιος',
924
+ 4 => 'Μάιος',
925
+ 5 => 'Iούνιος',
926
+ 6 => 'Iούλιος',
927
+ 7 => 'Αύγουστος',
928
+ 8 => 'Σεπτέμβριος',
929
+ 9 => 'Oκτώβριος',
930
+ 10 => 'Νοέμβριος',
931
+ 11 => 'Δεκέμβριος',
932
+ ),
933
+ 'hi' =>
934
+ array (
935
+ 0 => 'जनवरी',
936
+ 1 => 'फ़रवरी',
937
+ 2 => 'मार्च',
938
+ 3 => 'अप्रैल',
939
+ 4 => 'मई',
940
+ 5 => 'जून',
941
+ 6 => 'जुलाई',
942
+ 7 => 'अगस्त',
943
+ 8 => 'सितंबर',
944
+ 9 => 'अक्टूबर',
945
+ 10 => 'नवंबर',
946
+ 11 => 'दिसंबर',
947
+ ),
948
+ 'hu' =>
949
+ array (
950
+ 0 => 'Január',
951
+ 1 => 'Február',
952
+ 2 => 'Március',
953
+ 3 => 'Április',
954
+ 4 => 'Május',
955
+ 5 => 'Június',
956
+ 6 => 'Július',
957
+ 7 => 'Augusztus',
958
+ 8 => 'Szeptember',
959
+ 9 => 'Október',
960
+ 10 => 'November',
961
+ 11 => 'December',
962
+ ),
963
+ 'it' =>
964
+ array (
965
+ 0 => 'Gennaio',
966
+ 1 => 'Febbraio',
967
+ 2 => 'Marzo',
968
+ 3 => 'Aprile',
969
+ 4 => 'Maggio',
970
+ 5 => 'Giugno',
971
+ 6 => 'Luglio',
972
+ 7 => 'Agosto',
973
+ 8 => 'Settembre',
974
+ 9 => 'Ottobre',
975
+ 10 => 'Novembre',
976
+ 11 => 'Dicembre',
977
+ ),
978
+ 'no' =>
979
+ array (
980
+ 0 => 'Januar',
981
+ 1 => 'Februar',
982
+ 2 => 'Mars',
983
+ 3 => 'April',
984
+ 4 => 'Mai',
985
+ 5 => 'Juni',
986
+ 6 => 'Juli',
987
+ 7 => 'August',
988
+ 8 => 'September',
989
+ 9 => 'Oktober',
990
+ 10 => 'November',
991
+ 11 => 'Desember',
992
+ ),
993
+ 'pl' =>
994
+ array (
995
+ 0 => 'Styczeń',
996
+ 1 => 'Luty',
997
+ 2 => 'Marzec',
998
+ 3 => 'Kwiecień',
999
+ 4 => 'Maj',
1000
+ 5 => 'Czerwiec',
1001
+ 6 => 'Lipiec',
1002
+ 7 => 'Sierpień',
1003
+ 8 => 'Wrzesień',
1004
+ 9 => 'Październik',
1005
+ 10 => 'Listopad',
1006
+ 11 => 'Grudzień',
1007
+ ),
1008
+ 'pt' =>
1009
+ array (
1010
+ 0 => 'Janeiro',
1011
+ 1 => 'Fevereiro',
1012
+ 2 => 'Março',
1013
+ 3 => 'Abril',
1014
+ 4 => 'Maio',
1015
+ 5 => 'Junho',
1016
+ 6 => 'Julho',
1017
+ 7 => 'Agosto',
1018
+ 8 => 'Setembro',
1019
+ 9 => 'Outubro',
1020
+ 10 => 'Novembro',
1021
+ 11 => 'Dezembro',
1022
+ ),
1023
+ 'ro' =>
1024
+ array (
1025
+ 0 => 'Ianuarie',
1026
+ 1 => 'Februarie',
1027
+ 2 => 'Martie',
1028
+ 3 => 'Aprilie',
1029
+ 4 => 'Mai',
1030
+ 5 => 'Iunie',
1031
+ 6 => 'Iulie',
1032
+ 7 => 'August',
1033
+ 8 => 'Septembrie',
1034
+ 9 => 'Octombrie',
1035
+ 10 => 'Noiembrie',
1036
+ 11 => 'Decembrie',
1037
+ ),
1038
+ 'ru' =>
1039
+ array (
1040
+ 0 => 'январь',
1041
+ 1 => 'февраль',
1042
+ 2 => 'март',
1043
+ 3 => 'апрель',
1044
+ 4 => 'май',
1045
+ 5 => 'июнь',
1046
+ 6 => 'июль',
1047
+ 7 => 'август',
1048
+ 8 => 'сентябрь',
1049
+ 9 => 'октябрь',
1050
+ 10 => 'ноябрь',
1051
+ 11 => 'декабрь',
1052
+ ),
1053
+ 'sk' =>
1054
+ array (
1055
+ 0 => 'Január',
1056
+ 1 => 'Február',
1057
+ 2 => 'Marec',
1058
+ 3 => 'Apríl',
1059
+ 4 => 'Máj',
1060
+ 5 => 'Jún',
1061
+ 6 => 'Júl',
1062
+ 7 => 'August',
1063
+ 8 => 'September',
1064
+ 9 => 'Október',
1065
+ 10 => 'November',
1066
+ 11 => 'December',
1067
+ ),
1068
+ 'es' =>
1069
+ array (
1070
+ 0 => 'Enero',
1071
+ 1 => 'Febrero',
1072
+ 2 => 'Marzo',
1073
+ 3 => 'Abril',
1074
+ 4 => 'Mayo',
1075
+ 5 => 'Junio',
1076
+ 6 => 'Julio',
1077
+ 7 => 'Agosto',
1078
+ 8 => 'Septiembre',
1079
+ 9 => 'Octubre',
1080
+ 10 => 'Noviembre',
1081
+ 11 => 'Diciembre',
1082
+ ),
1083
+ 'sv' =>
1084
+ array (
1085
+ 0 => 'Januari',
1086
+ 1 => 'Februari',
1087
+ 2 => 'Mars',
1088
+ 3 => 'April',
1089
+ 4 => 'Maj',
1090
+ 5 => 'Juni',
1091
+ 6 => 'Juli',
1092
+ 7 => 'Augusti',
1093
+ 8 => 'September',
1094
+ 9 => 'Oktober',
1095
+ 10 => 'November',
1096
+ 11 => 'December',
1097
+ ),
1098
+ 'tr' =>
1099
+ array (
1100
+ 0 => 'Ocak',
1101
+ 1 => 'Şubat',
1102
+ 2 => 'Mart',
1103
+ 3 => 'Nisan',
1104
+ 4 => 'Mayis',
1105
+ 5 => 'Haziran',
1106
+ 6 => 'Temmuz',
1107
+ 7 => 'Ağustos',
1108
+ 8 => 'Eylül',
1109
+ 9 => 'Ekim',
1110
+ 10 => 'Kasım',
1111
+ 11 => 'Aralık',
1112
+ ),
1113
+ );
1114
+ public function get_noreg_list_reviews($force_platform = null, $list_all = false)
1115
+ {
1116
+ global $wpdb;
1117
+ $dbtable = $this->get_noreg_tablename($force_platform);
1118
+ $page_details = get_option($this->get_option_name('page-details'));
1119
+ $style_id = (int)get_option($this->get_option_name('style-id'), 4);
1120
+ $content = get_option($this->get_option_name('review-content'));
1121
+ $lang = get_option($this->get_option_name('lang'), 'en');
1122
+ $dateformat = get_option($this->get_option_name('dateformat'), 'Y-m-d');
1123
+ $no_rating_text = get_option($this->get_option_name('no-rating-text'), 1);
1124
+ $verified_icon = get_option($this->get_option_name('verified-icon'), 1);
1125
+ $show_reviewers_photo = get_option($this->get_option_name('show-reviewers-photo'), 1);
1126
+ $set_id = get_option($this->get_option_name('scss-set'));
1127
+ $sql_rating_field = 'rating';
1128
+ if($this->is_ten_scale_rating_platform())
1129
+ {
1130
+ $sql_rating_field = 'ROUND(rating / 2, 0)';
1131
+ }
1132
+ $sql = "SELECT id, user, user_photo, text, date, rating as original_rating, $sql_rating_field as rating FROM $dbtable ";
1133
+ $filter = get_option($this->get_option_name('filter'));
1134
+ if(!$list_all && $filter)
1135
+ {
1136
+ if(count($filter['stars']) == 0)
1137
+ {
1138
+ $sql .= "WHERE 0 ";
1139
+ }
1140
+ else
1141
+ {
1142
+ $sql .= "WHERE ($sql_rating_field IN (". implode(',', $filter['stars']) .")";
1143
+ if(in_array(5, $filter['stars']))
1144
+ {
1145
+ $sql .= ' or rating IS NULL';
1146
+ }
1147
+ $sql .= ') ';
1148
+ if($filter['only-ratings'])
1149
+ {
1150
+ $sql .= "and text != '' ";
1151
+ }
1152
+ }
1153
+ }
1154
+ $sql .= "ORDER BY date DESC";
1155
+ if(!$list_all && in_array($style_id, [ 8, 9, 10, 18 ]))
1156
+ {
1157
+ $sql .= " LIMIT 5";
1158
+ }
1159
+ $reviews = $wpdb->get_results($sql);
1160
+ wp_enqueue_script( 'trustindex-js', 'https://cdn.trustindex.io/loader.js', [], false, true);
1161
+ wp_add_inline_script( 'trustindex-js', 'setTimeout(function(){ Trustindex.init_pager(jQuery(".ti-widget")) }, 1985)' );
1162
+ if($content === false || empty($content) || strpos($content, '<!-- R-LIST -->') === false)
1163
+ {
1164
+ add_action('http_api_curl', function( $handle ){
1165
+ curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);
1166
+ curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
1167
+ }, 10);
1168
+ $response = wp_remote_get( "https://cdn.trustindex.io/widget-assets/template/$lang/$style_id.html");
1169
+ $content = $response['body'];
1170
+ update_option($this->get_option_name('review-content'), $content, false);
1171
+ }
1172
+ $content = $this->parse_noreg_list_reviews([
1173
+ 'content' => $content,
1174
+ 'reviews' => $reviews,
1175
+ 'page_details' => $page_details,
1176
+ 'style_id' => $style_id,
1177
+ 'set_id' => $set_id,
1178
+ 'no_rating_text' => $no_rating_text,
1179
+ 'dateformat' => $dateformat,
1180
+ 'language' => $lang,
1181
+ 'verified_icon' => $verified_icon,
1182
+ 'show_reviewers_photo' => $show_reviewers_photo
1183
+ ]);
1184
+ $content = preg_replace('/data-set[_-]id=[\'"][^\'"]*[\'"]/m', 'data-set-id="'. get_option($this->get_option_name('scss-set')) .'"', $content);
1185
+ $widget_css = get_option($this->get_option_name('css-content'));
1186
+ if(!$widget_css)
1187
+ {
1188
+ wp_enqueue_style( "trustindex-widget-css-" . $this->shortname, "https://cdn.trustindex.io/widget-assets/css/". $style_id ."-blue.css");
1189
+ }
1190
+ else
1191
+ {
1192
+ $content .= '<style type="text/css">'. $widget_css .'</style>';
1193
+ }
1194
+ return $content;
1195
+ }
1196
+ public function parse_noreg_list_reviews($array = [])
1197
+ {
1198
+ preg_match('/<!-- R-LIST -->(.*)<!-- R-LIST -->/', $array['content'], $matches);
1199
+ if(isset($matches[1]))
1200
+ {
1201
+ $reviewContent = "";
1202
+ if($array['reviews'] && count($array['reviews'])) foreach($array['reviews'] as $r)
1203
+ {
1204
+ $date = "&nbsp;";
1205
+ if($r->date && $r->date != '0000-00-00')
1206
+ {
1207
+ $date = str_replace(self::$widget_month_names['en'], self::$widget_month_names[$array['language']], date($array['dateformat'], strtotime($r->date)));
1208
+ }
1209
+ $rating_content = $this->get_rating_stars($r->rating);
1210
+ if($this->shortname == 'facebook' && in_array($r->rating, [ 1, 5 ]))
1211
+ {
1212
+ if($r->rating == 1)
1213
+ {
1214
+ $rating_content = self::$widget_recommendation_texts[ $array['language'] ]['negative'];
1215
+ }
1216
+ else
1217
+ {
1218
+ $rating_content = self::$widget_recommendation_texts[ $array['language'] ]['positive'];
1219
+ }
1220
+ $r_text = trim(str_replace([ 'NOT_RECOMMEND_ICON', 'RECOMMEND_ICON' ], '', $rating_content));
1221
+ $rating_content = '<span class="ti-recommendation">'. str_replace([
1222
+ 'NOT_RECOMMEND_ICON',
1223
+ 'RECOMMEND_ICON',
1224
+ ' ' . $r_text,
1225
+ $r_text . ' '
1226
+ ], [
1227
+ '<span class="ti-recommendation-icon negative"></span>',
1228
+ '<span class="ti-recommendation-icon positive"></span>',
1229
+ '<span class="ti-recommendation-title">'. $r_text .'</span>',
1230
+ '<span class="ti-recommendation-title">'. $r_text .'</span>'
1231
+ ], $rating_content) .'</span>';
1232
+ }
1233
+ else if($this->is_ten_scale_rating_platform())
1234
+ {
1235
+ $rating_content = '<div class="ti-rating-box">'. $this->formatTenRating($r->original_rating) .'</div>';
1236
+ }
1237
+ if($array['verified_icon'])
1238
+ {
1239
+ $rating_content .= '<span class="ti-verified-review"><span class="ti-verified-tooltip">'. self::$widget_verified_texts[ $array['language'] ] .'</span></span>';
1240
+ }
1241
+ $platform_name = ucfirst($this->shortname);
1242
+ if($platform_name == 'Szallashu')
1243
+ {
1244
+ $tmp = explode('/', $array['page_details']['id']);
1245
+ $platform_name .= '" data-domain="' . $tmp[0];
1246
+ }
1247
+ if(!$array['show_reviewers_photo'])
1248
+ {
1249
+ $matches[1] = str_replace('<div class="ti-profile-img"> <img src="%reviewer_photo%" alt="%reviewer_name%" /> </div>', '', $matches[1]);
1250
+ }
1251
+ $reviewContent .= str_replace([
1252
+ '%platform%',
1253
+ '%reviewer_photo%',
1254
+ '%reviewer_name%',
1255
+ '%created_at%',
1256
+ '%text%',
1257
+ '<span class="ti-star f"></span><span class="ti-star f"></span><span class="ti-star f"></span><span class="ti-star f"></span><span class="ti-star f"></span>'
1258
+ ], [
1259
+ $platform_name,
1260
+ $r->user_photo,
1261
+ $r->user,
1262
+ $date,
1263
+ $r->text,
1264
+ $rating_content
1265
+ ], $matches[1]);
1266
+ }
1267
+ $array['content'] = str_replace($matches[0], $reviewContent, $array['content']);
1268
+ }
1269
+ $rating_count = $array['page_details']['rating_number'];
1270
+ $rating_score = $array['page_details']['rating_score'];
1271
+ if(substr($array['set_id'], 0, 5) == 'dark-')
1272
+ {
1273
+ $array['content'] = str_replace('%platform%/logo', '%platform%/logo-dark', $array['content']);
1274
+ }
1275
+ $array['content'] = str_replace([
1276
+ '%platform%',
1277
+ '%site_name%',
1278
+ "RATING_STARS",
1279
+ "RATING_NUMBER",
1280
+ "RATING_SCORE",
1281
+ "RATING_SCALE",
1282
+ "RATING_TEXT",
1283
+ "PLATFORM_URL_LOGO",
1284
+ "PLATFORM_NAME",
1285
+ '<span class="ti-star e"></span><span class="ti-star e"></span><span class="ti-star e"></span><span class="ti-star e"></span><span class="ti-star e"></span>'
1286
+ ], [
1287
+ ucfirst($this->shortname),
1288
+ $array['page_details']['name'],
1289
+ $r->rating,
1290
+ $rating_count,
1291
+ $rating_score,
1292
+ $this->is_ten_scale_rating_platform() ? 10 : 5,
1293
+ $this->get_rating_text($rating_score, $array['language']),
1294
+ $array['page_details']['avatar_url'],
1295
+ $this->get_platform_name($this->shortname, $array['page_details']['id']),
1296
+ $this->is_ten_scale_rating_platform() ? "<div class='ti-rating-box'>". $this->formatTenRating($rating_score) ."</div>" : $this->get_rating_stars($rating_score)
1297
+ ], $array['content']);
1298
+ if($this->is_ten_scale_rating_platform() && $array['style_id'] == 11)
1299
+ {
1300
+ $array['content'] = str_replace('<span class="ti-rating">'. $rating_score .'</span> ', '', $array['content']);
1301
+ }
1302
+ if($this->shortname == 'szallashu')
1303
+ {
1304
+ $tmp = explode('/', $array['page_details']['id']);
1305
+ $array['content'] = str_replace([ 'Szallashu/logo.svg', 'Szallashu/logo-dark.svg' ], [ 'Szallashu/logo-'. $tmp[0] .'.svg', 'Szallashu/logo-'. $tmp[0] .'-dark.svg' ], $array['content']);
1306
+ }
1307
+ else if($this->shortname == 'arukereso')
1308
+ {
1309
+ $tmp = explode('|', $array['page_details']['id']);
1310
+ $array['content'] = str_replace([ 'Arukereso/logo.svg', 'Arukereso/logo-dark.svg' ], [ 'Arukereso/logo-'. $tmp[0] .'.svg', 'Arukereso/logo-'. $tmp[0] .'-dark.svg' ], $array['content']);
1311
+ }
1312
+ $array['content'] = preg_replace('/<a href=[\'"]%footer_link%[\'"][^>]*>(.+)<\/a>/mU', '$1', $array['content']);
1313
+ if($array['no_rating_text'])
1314
+ {
1315
+ if(in_array($array['style_id'], [6, 7]))
1316
+ {
1317
+ $array['content'] = preg_replace('/<div class="ti-footer">.*<\/div>/mU', '<div class="ti-footer"></div>', $array['content']);
1318
+ }
1319
+ else if($array['style_id'] == 11)
1320
+ {
1321
+ $array['content'] = preg_replace('/<div class="ti-text">.*<\/div>/mU', '', $array['content']);
1322
+ }
1323
+ else
1324
+ {
1325
+ $array['content'] = preg_replace('/<div class="ti-rating-text">.*<\/div>/mU', '', $array['content']);
1326
+ }
1327
+ }
1328
+ return $array['content'];
1329
+ }
1330
+ public function get_platform_name($type, $id = "")
1331
+ {
1332
+ $text = ucfirst($type);
1333
+ if($text == "Szallashu")
1334
+ {
1335
+ $domains = [
1336
+ 'cz' => 'Hotely.cz',
1337
+ 'hu' => 'Szallas.hu',
1338
+ 'ro' => 'Hotelguru.ro',
1339
+ 'com' => 'Revngo.com',
1340
+ 'pl' => 'Noclegi.pl'
1341
+ ];
1342
+ $tmp = explode('/', $id);
1343
+ if(isset($domains[ $tmp[0] ]))
1344
+ {
1345
+ $text = $domains[ $tmp[0] ];
1346
+ }
1347
+ }
1348
+ else if($text == "Arukereso")
1349
+ {
1350
+ $domains = [
1351
+ 'hu' => 'Árukereső.hu',
1352
+ 'bg' => 'Pazaruvaj.com',
1353
+ 'ro' => 'Compari.ro'
1354
+ ];
1355
+ $tmp = explode('|', $id);
1356
+ if(isset($domains[ $tmp[0] ]))
1357
+ {
1358
+ $text = $domains[ $tmp[0] ];
1359
+ }
1360
+ }
1361
+ return $text;
1362
+ }
1363
+ public function get_rating_text($rating, $lang = "en")
1364
+ {
1365
+ $texts = self::$widget_rating_texts[$lang];
1366
+ $rating = round($rating);
1367
+ if($rating < 1) $rating = 1;
1368
+ elseif($rating > 5) $rating = 5;
1369
+ return mb_strtoupper($texts[$rating - 1]);
1370
+ }
1371
+ public function get_rating_stars($rating_score)
1372
+ {
1373
+ $text = "";
1374
+ if(!is_numeric($rating_score))
1375
+ {
1376
+ return $text;
1377
+ }
1378
+ for ($si = 1; $si <= $rating_score; $si++)
1379
+ {
1380
+ $text .= '<span class="ti-star f"></span>';
1381
+ }
1382
+ $fractional = $rating_score - floor($rating_score);
1383
+ if( 0.25 <= $fractional )
1384
+ {
1385
+ if ( $fractional < 0.75 )
1386
+ {
1387
+ $text .= '<span class="ti-star h"></span>';
1388
+ }
1389
+ else
1390
+ {
1391
+ $text .= '<span class="ti-star f"></span>';
1392
+ }
1393
+ $si++;
1394
+ }
1395
+ for (; $si <= 5; $si++)
1396
+ {
1397
+ $text .= '<span class="ti-star e"></span>';
1398
+ }
1399
+ return $text;
1400
+ }
1401
+ public function download_noreg_reviews($page_details, $force_platform = null)
1402
+ {
1403
+ $force_platform = $force_platform ? $force_platform : $this->shortname;
1404
+ $url = "https://admin.trustindex.io/api/getPromoReviews?platform=".$force_platform."&page_id=" . $page_details['id'];
1405
+ $args = array(
1406
+ 'timeout' => '20',
1407
+ 'redirection' => '5',
1408
+ 'blocking' => true,
1409
+ );
1410
+ $server_output = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
1411
+ if($server_output[0] !== '[' && $server_output[0] !== '{')
1412
+ {
1413
+ $server_output = substr($server_output, strpos($server_output, '('));
1414
+ $server_output = trim($server_output,'();');
1415
+ }
1416
+ $server_output = json_decode($server_output, true);
1417
+ return $server_output;
1418
+ }
1419
+ public function download_noreg_details($page_details, $force_platform = null)
1420
+ {
1421
+ $force_platform = $force_platform ? $force_platform : $this->shortname;
1422
+ $url = "https://admin.trustindex.io/api/getPageDetails?platform=".$force_platform."&page_id=" . $page_details['id'];
1423
+ if($force_platform == "facebook")
1424
+ {
1425
+ $url .= "&access_token=". $page_details['access_token'];
1426
+ }
1427
+ $args = array(
1428
+ 'timeout' => '20',
1429
+ 'redirection' => '5',
1430
+ 'blocking' => true,
1431
+ );
1432
+ $server_output = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
1433
+ if($server_output[0] !== '[' && $server_output[0] !== '{')
1434
+ {
1435
+ $server_output = substr($server_output, strpos($server_output, '('));
1436
+ $server_output = trim($server_output,'();');
1437
+ }
1438
+ $server_output = json_decode($server_output, true);
1439
+ return $server_output;
1440
+ }
1441
+ public function is_trustindex_connected()
1442
+ {
1443
+ return get_option($this->get_option_name("subscription-id"));
1444
+ }
1445
+ public function get_trustindex_widget_number()
1446
+ {
1447
+ $widgets = $this->get_trustindex_widgets();
1448
+ $number = 0;
1449
+ foreach ($widgets as $wc)
1450
+ {
1451
+ $number += count($wc['widgets']);
1452
+ }
1453
+ return $number;
1454
+ }
1455
+ public function get_trustindex_widgets()
1456
+ {
1457
+ $widgets = array();
1458
+ $trustindex_subscription_id = $this->is_trustindex_connected();
1459
+ if ($trustindex_subscription_id)
1460
+ {
1461
+ $widgets = wp_remote_get("https://admin.trustindex.io/api/getWidgets?subscription_id=".$trustindex_subscription_id);
1462
+ if ($widgets)
1463
+ {
1464
+ $widgets = json_decode($widgets['body'], true);
1465
+ }
1466
+ }
1467
+ return $widgets;
1468
+ }
1469
+ public function connect_trustindex_api($post_data, $mode = "new")
1470
+ {
1471
+ $url = $mode == "new" ? "https://admin.trustindex.io/api/userRegister" : "https://admin.trustindex.io/api/connectApi";
1472
+ $args = array(
1473
+ 'body' => $post_data,
1474
+ 'timeout' => '5',
1475
+ 'redirection' => '5',
1476
+ 'blocking' => true,
1477
+ );
1478
+ $server_output = wp_remote_retrieve_body( wp_remote_post( $url, $args ) );
1479
+ if($server_output[0] !== '[' && $server_output[0] !== '{')
1480
+ {
1481
+ $server_output = substr($server_output, strpos($server_output, '('));
1482
+ $server_output = trim($server_output,'();');
1483
+ }
1484
+ $server_output = json_decode($server_output, true);
1485
+ if ($server_output['success'])
1486
+ {
1487
+ update_option( $this->get_option_name("subscription-id"), $server_output["subscription_id"]);
1488
+ $GLOBALS['wp_object_cache']->delete( $this->get_option_name('subscription-id'), 'options' );
1489
+ }
1490
+ return $server_output;
1491
+ }
1492
+ public function register_tinymce_features()
1493
+ {
1494
+ if ( ! has_filter( "mce_external_plugins", "add_tinymce_buttons" ) )
1495
+ {
1496
+ add_filter( "mce_external_plugins", [$this, "add_tinymce_buttons"] );
1497
+ add_filter( "mce_buttons", [$this, "register_tinymce_buttons"] );
1498
+ }
1499
+ }
1500
+ public function add_tinymce_buttons( $plugin_array )
1501
+ {
1502
+ $plugin_name = 'trustindex';
1503
+ if (!isset($plugin_array[$plugin_name]))
1504
+ {
1505
+ $plugin_array[$plugin_name] = $this->get_plugin_file_url('static/js/admin-editor.js');
1506
+ }
1507
+ wp_localize_script( 'jquery', 'ajax_object', array(
1508
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
1509
+ ));
1510
+ return $plugin_array;
1511
+ }
1512
+ public function register_tinymce_buttons( $buttons )
1513
+ {
1514
+ $button_name = 'trustindex';
1515
+ if (!in_array($button_name, $buttons))
1516
+ {
1517
+ array_push( $buttons, $button_name );
1518
+ }
1519
+ return $buttons;
1520
+ }
1521
+ public function list_trustindex_widgets_ajax()
1522
+ {
1523
+ $ti_widgets = $this->get_trustindex_widgets();
1524
+ if ($this->is_trustindex_connected()): ?>
1525
+ <?php if ($ti_widgets): ?>
1526
+
1527
+ <h2><?php echo TrustindexPlugin::___('Your saved widgets'); ?></h2>
1528
+ <?php foreach ($ti_widgets as $wc): ?>
1529
+
1530
+ <p><strong><?php echo $wc['name']; ?>:</strong></p>
1531
+ <p>
1532
+ <?php foreach ($wc['widgets'] as $w): ?>
1533
+
1534
+ <a href="#" class="btn-copy-widget-id" data-ti-id="<?php echo $w['id']; ?>">
1535
+ <span class="dashicons dashicons-admin-post"></span>
1536
+ <?php echo $w['name']; ?>
1537
+
1538
+ </a><br />
1539
+ <?php endforeach; ?>
1540
+
1541
+ </p>
1542
+ <?php endforeach; ?>
1543
+
1544
+ <?php else: ?>
1545
+
1546
+ <?php echo $this->get_alertbox("warning",
1547
+
1548
+ TrustindexPlugin::___("You have no widget saved!") . " "
1549
+ . "<a target='_blank' href='https://admin.trustindex.io/widget'>". TrustindexPlugin::___("Let's go, create amazing widgets for free!")."</a>"
1550
+ ); ?>
1551
+ <?php endif; ?>
1552
+
1553
+ <?php else: ?>
1554
+
1555
+ <?php echo $this->get_alertbox("warning",
1556
+
1557
+ TrustindexPlugin::___("You have not set up your Trustindex account yet!") . " "
1558
+ . TrustindexPlugin::___("Go to <a href='%s'>plugin setup page</a> to complete the one-step setup guide and enjoy the full functionalization!", array(admin_url('admin.php?page='.$this->get_plugin_slug().'/settings.php&tab=setup_trustindex')))
1559
+ ); ?>
1560
+ <?php endif;
1561
+
1562
+ wp_die();
1563
+ }
1564
+ public function trustindex_add_scripts($hook)
1565
+ {
1566
+ if ($hook === 'widgets.php')
1567
+ {
1568
+ wp_enqueue_script('trustindex_script', $this->get_plugin_file_url('static/js/admin-widget.js'));
1569
+ wp_enqueue_style('trustindex_style', $this->get_plugin_file_url('static/css/admin-widget.css'));
1570
+ }
1571
+ elseif ($hook === 'post.php')
1572
+ {
1573
+ wp_enqueue_style('trustindex_editor_style', $this->get_plugin_file_url('static/css/admin-editor.css'));
1574
+ }
1575
+ elseif (in_array(strstr($hook, '/', true), $this->get_plugin_slugs()))
1576
+ {
1577
+ wp_register_style('trustindex_settings_style_'. $this->shortname, $this->get_plugin_file_url('static/css/admin-page-settings.css') );
1578
+ wp_register_script('trustindex_settings_script_common_'. $this->shortname, $this->get_plugin_file_url('static/js/admin-page-settings-common.js') );
1579
+ if(file_exists($this->get_plugin_dir() . 'static/js/admin-page-settings.js'))
1580
+ {
1581
+ wp_register_script('trustindex_settings_script_'. $this->shortname, $this->get_plugin_file_url('static/js/admin-page-settings.js') );
1582
+ }
1583
+ }
1584
+ wp_register_script('trustindex_admin_popup', $this->get_plugin_file_url('static/js/admin-popup.js') );
1585
+ wp_enqueue_script('trustindex_admin_popup');
1586
+ }
1587
+ public function get_plugin_details( $plugin_slug = null )
1588
+ {
1589
+ if (!$plugin_slug)
1590
+ {
1591
+ $plugin_slug = $this->get_plugin_slug();
1592
+ }
1593
+ $plugin_return = false;
1594
+ $wp_repo_plugins = '';
1595
+ $wp_response = '';
1596
+ $wp_version = get_bloginfo('version');
1597
+ if ( $plugin_slug && $wp_version > 3.8 )
1598
+ {
1599
+ $args = array(
1600
+ 'author' => 'Trustindex.io',
1601
+ 'fields' => array(
1602
+ 'downloaded' => true,
1603
+ 'active_installs' => true,
1604
+ 'ratings' => true
1605
+ )
1606
+ );
1607
+ $wp_response = wp_remote_post(
1608
+ 'http://api.wordpress.org/plugins/info/1.0/',
1609
+ array(
1610
+ 'body' => array(
1611
+ 'action' => 'query_plugins',
1612
+ 'request' => serialize( (object) $args )
1613
+ )
1614
+ )
1615
+ );
1616
+ if ( ! is_wp_error( $wp_response ) )
1617
+ {
1618
+ $wp_repo_response = unserialize( wp_remote_retrieve_body( $wp_response ) );
1619
+ $wp_repo_plugins = $wp_repo_response->plugins;
1620
+ }
1621
+ if ( $wp_repo_plugins )
1622
+ {
1623
+ foreach ( $wp_repo_plugins as $plugin_details )
1624
+ {
1625
+ if ( $plugin_slug == $plugin_details->slug )
1626
+ {
1627
+ $plugin_return = $plugin_details;
1628
+ }
1629
+ }
1630
+ }
1631
+ }
1632
+ return $plugin_return;
1633
+ }
1634
+ public function is_ten_scale_rating_platform()
1635
+ {
1636
+ return in_array($this->shortname, [ 'booking', 'hotels', 'foursquare', 'szallashu' ]);
1637
+ }
1638
+ public function formatTenRating($rating)
1639
+ {
1640
+ if($rating == 10)
1641
+ {
1642
+ $rating = '10';
1643
+ }
1644
+ if($this->shortname == "booking")
1645
+ {
1646
+ $rating = str_replace('.', ',', $rating);
1647
+ }
1648
+ return $rating;
1649
+ }
1650
+ }
wp-reviews-plugin-for-google.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Widgets for Google Reviews
4
+ Plugin Title: Widgets for Google Reviews Plugin
5
+ Plugin URI: https://wordpress.org/plugins/wp-reviews-plugin-for-google/
6
+ Description: Embed Google reviews fast and easily into your WordPress site. Increase SEO, trust and sales using Google reviews.
7
+ Tags: google, google places reviews, reviews, widget, google business
8
+ Author: Trustindex.io <support@trustindex.io>
9
+ Author URI: https://www.trustindex.io/
10
+ Contributors: trustindex
11
+ License: GPLv2 or later
12
+ Version: 4.0
13
+ Text Domain: trustindex
14
+ Domain Path: /languages/
15
+ Donate link: https://www.trustindex.io/prices/
16
+ */
17
+ /*
18
+ Copyright 2019 Trustindex Kft (email: support@trustindex.io)
19
+ */
20
+
21
+ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
22
+ require(ABSPATH . 'wp-includes/version.php');
23
+
24
+ /*****************************************************************************/
25
+ /* LOAD COMMON CODE */
26
+
27
+ if (!class_exists('TrustindexPlugin' ) )
28
+ {
29
+ $plugin_dirs = scandir(WP_PLUGIN_DIR);
30
+ $ti_plugins = [];
31
+
32
+ foreach($plugin_dirs as $dir)
33
+ {
34
+ $class_file = WP_PLUGIN_DIR . '/' . $dir . '/trustindex-plugin.class.php';
35
+ if($dir == '.' || $dir == '..' || !is_dir(WP_PLUGIN_DIR . '/' . $dir) || !file_exists($class_file))
36
+ {
37
+ continue;
38
+ }
39
+
40
+ $second_line = array_slice(file($class_file), 1, 1)[0];
41
+ $ti_plugins[$class_file] = (substr($second_line , 0, 14) == '/* GENERATED: ' ? (int)preg_replace('/[^\d]/m', '', $second_line) : 0);
42
+ }
43
+
44
+ $plugin_file = array_search(max($ti_plugins), $ti_plugins);
45
+ if(empty($plugin_file))
46
+ {
47
+ $plugin_file = $plugin_dir . "trustindex-plugin.class.php";
48
+ }
49
+ require_once($plugin_file);
50
+ }
51
+
52
+ $trustindex_pm_google = new TrustindexPlugin("google", __FILE__, "4.0", "Widgets for Google Reviews");
53
+
54
+ /*****************************************************************************/
55
+ /* INIT HOOKS */
56
+ //activation hook
57
+ register_activation_hook(__FILE__, array($trustindex_pm_google, 'activate'));
58
+
59
+ //deactivation hook
60
+ register_deactivation_hook(__FILE__, array($trustindex_pm_google, 'deactivate'));
61
+
62
+ //load i18n
63
+ add_action('plugins_loaded', array($trustindex_pm_google, 'loadI18N'));
64
+
65
+ /******************************************************************************
66
+ /* ADMIN MENU */
67
+ // menu
68
+ add_action('admin_menu', array($trustindex_pm_google, 'add_setting_menu'), 10);
69
+
70
+ //plugin list menu
71
+ add_filter('plugin_action_links', array($trustindex_pm_google, 'add_plugin_action_links'), 10, 2);
72
+
73
+ //plugin page meta links.
74
+ add_filter( 'plugin_row_meta', array($trustindex_pm_google, 'add_plugin_meta_links'), 10, 2 );
75
+
76
+ /*****************************************************************************/
77
+ /* WIDGET */
78
+ // widget init
79
+ add_action('widgets_init', array($trustindex_pm_google, 'init_widget'));
80
+
81
+ //widget register
82
+ add_action('widgets_init', array($trustindex_pm_google, 'register_widget'));
83
+
84
+ /*****************************************************************************/
85
+ /* SHORTCODE */
86
+ //init
87
+ add_action( 'init', array($trustindex_pm_google, 'init_shortcode'));
88
+
89
+ /*****************************************************************************/
90
+ /* TINYMCE BUTTON */
91
+ //register plugin to tinyMCE
92
+ add_action( 'init', array($trustindex_pm_google, 'register_tinymce_features') );
93
+
94
+ /*****************************************************************************/
95
+ /* APP OUTPUT BUFFER */
96
+ add_action( 'init', array($trustindex_pm_google, 'output_buffer') );
97
+
98
+ /*****************************************************************************/
99
+ /* AJAX FUNCTIONS */
100
+ add_action( 'wp_ajax_list_trustindex_widgets', array($trustindex_pm_google, 'list_trustindex_widgets_ajax') );
101
+ add_action( 'admin_enqueue_scripts', array($trustindex_pm_google, 'trustindex_add_scripts') );
102
+
103
+ //Notice to rate us
104
+ function trustindex_rate_us_google() {
105
+ //Check DB
106
+ $rate_us = get_option('trustindex-google-rate-us', time() - 1);
107
+ if($rate_us == 'hide' || (int)$rate_us > time())
108
+ {
109
+ return;
110
+ }
111
+
112
+ //Check usage
113
+ $dir = WP_PLUGIN_DIR . '/wp-reviews-plugin-for-google';
114
+ $usage_time = time() + 10;
115
+ if(is_dir($dir))
116
+ {
117
+ $usage_time = filemtime($dir) + (1 * 86400);
118
+ }
119
+
120
+ if($usage_time > time())
121
+ {
122
+ return;
123
+ }
124
+ ?>
125
+ <div class="notice notice-warning is-dismissible trustindex-popup" style="position: fixed; top: 50px; right: 20px; padding-right: 30px; z-index: 1">
126
+ <p>
127
+ <?php echo TrustindexPlugin::___("Hello, I am happy to see that you've been using our <strong>%s</strong> plugin for a while now!", ["Widgets for Google Reviews"]); ?><br>
128
+ <?php echo TrustindexPlugin::___("Could you please help us and give it a 5-star rating on WordPress?"); ?><br><br>
129
+ <?php echo TrustindexPlugin::___("-- Thanks, Gabor M."); ?>
130
+ </p>
131
+ <p>
132
+ <a href="<?php echo admin_url("admin.php?page=wp-reviews-plugin-for-google/settings.php&rate_us=open"); ?>" class="trustindex-rateus" style="text-decoration: none" target="_blank">
133
+ <button class="button button-primary"><?php echo TrustindexPlugin::___("Sure, you deserve it"); ?></button>
134
+ </a>
135
+ <a href="<?php echo admin_url("admin.php?page=wp-reviews-plugin-for-google/settings.php&rate_us=later"); ?>" class="trustindex-rateus" style="text-decoration: none">
136
+ <button class="button button-secondary"><?php echo TrustindexPlugin::___("Maybe later"); ?></button>
137
+ </a>
138
+ <a href="<?php echo admin_url("admin.php?page=wp-reviews-plugin-for-google/settings.php&rate_us=hide"); ?>" class="trustindex-rateus" style="text-decoration: none">
139
+ <button class="button button-secondary" style="float: right"><?php echo TrustindexPlugin::___("Do not remind me again"); ?></button>
140
+ </a>
141
+ </p>
142
+ </div>
143
+ <?php
144
+ }
145
+
146
+ $type = 'google';
147
+ if(!in_array($type, [ 'facebook', 'airbnb', 'amazon' ]))
148
+ {
149
+ add_action( 'admin_notices', 'trustindex_rate_us_google' );
150
+ }
151
+ ?>