PluginProbe ʕ •ᴥ•ʔ
Rich Showcase for Google Reviews / 6.4
Rich Showcase for Google Reviews v6.4
6.9.8 6.9.7 6.9.6 trunk 1.4 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.5 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.7 1.6.8 1.6.9 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.4 2.4.1 2.4.2 2.5 2.5.1 2.6 2.6.1 2.6.2 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.6.1 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.8.1 4.8.2 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.7.1 5.8 5.9 5.9.1 5.9.2 5.9.3 5.9.7 6.0 6.1 6.2 6.3 6.4 6.4.1 6.5 6.6 6.6.1 6.6.2 6.7 6.8 6.8.1 6.8.2 6.9 6.9.1 6.9.2 6.9.3 6.9.4 6.9.4.1 6.9.4.2 6.9.4.3 6.9.4.4 6.9.5
widget-google-reviews / includes / class-plugin-settings.php
widget-google-reviews / includes Last commit date
admin 10 months ago core 10 months ago class-activator.php 10 months ago class-assets.php 11 months ago class-builder-page.php 1 year ago class-deactivator.php 3 years ago class-debug-info.php 2 years ago class-feed-ajax.php 1 year ago class-feed-block.php 1 year ago class-feed-deserializer.php 11 months ago class-feed-old.php 4 years ago class-feed-page.php 11 months ago class-feed-serializer.php 2 years ago class-feed-shortcode.php 2 years ago class-feed-widget.php 4 years ago class-plugin-overview-ajax.php 1 year ago class-plugin-overview.php 11 months ago class-plugin-settings.php 10 months ago class-plugin-support.php 1 year ago class-plugin.php 11 months ago class-post-types.php 3 years ago class-reviews-cron.php 1 year ago class-settings-save.php 1 year ago class-view.php 10 months ago index.php 4 years ago page-setting-advance.php 1 year ago page-setting-fig.php 1 year ago page-setting-support.php 4 years ago
class-plugin-settings.php
179 lines
1 <?php
2
3 namespace WP_Rplg_Google_Reviews\Includes;
4
5 class Plugin_Settings {
6
7 private $builder_page;
8 private $debug_info;
9
10 public function __construct($builder_page, $debug_info) {
11 $this->builder_page = $builder_page;
12 $this->debug_info = $debug_info;
13 }
14
15 public function register() {
16 $render_func;
17 $feed_ids = get_option('grw_feed_ids');
18 if (empty($feed_ids)) {
19 $render_func = array($this, 'connect');
20 } else {
21 $render_func = array($this, 'render');
22 }
23
24 add_action('grw_admin_page_grw-settings', array($this, 'init'));
25 add_action('grw_admin_page_grw-settings', $render_func);
26 }
27
28 public function init() {
29
30 }
31
32 public function connect() {
33 $this->builder_page->render(null);
34 }
35
36 public function render() {
37
38 $tab = isset($_GET['grw_tab']) && strlen($_GET['grw_tab']) > 0 ? sanitize_text_field(wp_unslash($_GET['grw_tab'])) : 'active';
39
40 $grw_enabled = get_option('grw_active') == '1';
41 $async_css = get_option('grw_async_css');
42 $grw_demand_assets = get_option('grw_demand_assets');
43 $grw_freq_revs_upd = get_option('grw_freq_revs_upd');
44 $gpa_old = get_option('grw_gpa_old');
45 $grw_google_api_key = get_option('grw_google_api_key');
46 $grw_activation_time = get_option('grw_activation_time');
47 ?>
48
49 <div class="grw-page-title">
50 Settings
51 </div>
52
53 <?php do_action('grw_admin_notices'); ?>
54
55 <div class="grw-settings-workspace">
56
57 <div data-nav-tabs="">
58
59 <div class="nav-tab-wrapper">
60 <a href="#grw-general" class="nav-tab<?php if ($tab == 'active') { ?> nav-tab-active<?php } ?>">General</a>
61 <a href="#grw-google" class="nav-tab<?php if ($tab == 'google') { ?> nav-tab-active<?php } ?>">Google</a>
62 <a href="#grw-advance" class="nav-tab<?php if ($tab == 'advance') { ?> nav-tab-active<?php } ?>">Advance</a>
63 </div>
64
65 <div id="grw-general" class="tab-content" style="display:<?php echo $tab == 'active' ? 'block' : 'none'?>;">
66 <h3>General Settings</h3>
67 <form method="post" action="<?php echo esc_url(admin_url('admin-post.php?action=grw_settings_save&grw_tab=active&active=' . (string)((int)($grw_enabled != true)))); ?>">
68 <div class="grw-field">
69 <div class="grw-field-label">
70 <label>Google Reviews plugin is currently <b><?php echo $grw_enabled ? 'enabled' : 'disabled' ?></b></label>
71 </div>
72 <div class="wp-review-field-option">
73 <?php wp_nonce_field('grw-wpnonce_active', 'grw-form_nonce_active'); ?>
74 <input type="submit" name="active" class="button" value="<?php echo $grw_enabled ? 'Disable' : 'Enable'; ?>" />
75 </div>
76 </div>
77 <div class="grw-field">
78 <div class="grw-field-label">
79 <label>Async CSS assets</label>
80 </div>
81 <div class="wp-review-field-option">
82 <label>
83 <input type="hidden" name="grw_async_css" value="false">
84 <input type="checkbox" id="grw_async_css" name="grw_async_css" value="true" <?php checked('true', $async_css); ?>>
85 Asynchronous CSS loads in the background
86 </label>
87 </div>
88 </div>
89 <div class="grw-field">
90 <div class="grw-field-label">
91 <label>Load assets on demand</label>
92 </div>
93 <div class="wp-review-field-option">
94 <label>
95 <input type="hidden" name="grw_demand_assets" value="false">
96 <input type="checkbox" id="grw_demand_assets" name="grw_demand_assets" value="true" <?php checked('true', $grw_demand_assets); ?>>
97 Load static assets (JS/CSS) only on pages where reviews are showing
98 </label>
99 <div style="padding-top:15px">
100 <input type="submit" value="Save" name="save" class="button" />
101 </div>
102 </div>
103 </div>
104 </form>
105 </div>
106
107 <div id="grw-google" class="tab-content" style="display:<?php echo $tab == 'google' ? 'block' : 'none'?>;">
108 <h3>Google</h3>
109 <form method="post" action="<?php echo esc_url(admin_url('admin-post.php?action=grw_settings_save&grw_tab=google')); ?>">
110 <?php wp_nonce_field('grw-wpnonce_save', 'grw-form_nonce_save'); ?>
111 <div class="grw-field">
112 <div class="grw-field-label">
113 <label>Frequency of review updates</label>
114 </div>
115 <div class="wp-review-field-option">
116 <select name="grw_freq_revs_upd">
117 <option value="daily" <?php selected('daily', $grw_freq_revs_upd); ?>>Daily</option>
118 <option value="weekly" <?php selected('weekly', $grw_freq_revs_upd); ?>>Once weekly</option>
119 <option value="fortnightly " <?php selected('fortnightly', $grw_freq_revs_upd); ?>>Every two weeks </option>
120 <option value="monthly" <?php selected('monthly', $grw_freq_revs_upd); ?>>Once monthly</option>
121 </select>
122 </div>
123 </div>
124 <div class="grw-field">
125 <div class="grw-field-label">
126 <label>Use old Places API</label>
127 </div>
128 <div class="wp-review-field-option">
129 <label>
130 <input type="hidden" name="grw_gpa_old" value="false">
131 <input type="checkbox" id="grw_gpa_old" name="grw_gpa_old" value="true" <?php checked('true', $gpa_old); ?>>
132 Applies to API keys created before March 1, 2025,<br>provided that the Places API (New) has not been enabled in Google Console.
133 </label>
134 </div>
135 </div>
136 <div class="grw-field">
137 <div class="grw-field-label">
138 <label>Google Places API key</label>
139 </div>
140 <div class="wp-review-field-option">
141 <input type="text" id="grw_google_api_key" name="grw_google_api_key" class="regular-text" value="<?php echo esc_attr($grw_google_api_key); ?>">
142 <?php if (!$grw_google_api_key && time() - $grw_activation_time > 60 * 60 * 48) { ?>
143 <div class="grw-warn">Your Google API key is not set for this reason, reviews are not automatically updated daily.<br>Please create your own Google API key and save here.</div><?php
144 } elseif ($grw_google_api_key) {
145 $response = wp_remote_get('http://ip6.me/api/');
146 if (is_array($response) && !is_wp_error($response)) {
147 $body = wp_remote_retrieve_body($response);
148 if (!empty($body)) {
149 $parts = explode(',', $body);
150 if (count($parts) > 1) {
151 ?><p>If you wish to restrict your API key, please use <b>Application restrictions</b> - <b>IP addresses</b> and add the IP address: <b><u><?php echo $parts[1]; ?></u></b></p><?php
152 }
153 }
154 }
155 } ?>
156 <p>Google API key is required to automatically update and fetch new reviews.<br>With your own API key, there's no limit to collecting reviews, you can connect more than 10 and collect them daily.</p>
157 <p>After you created your own API key, it's required to add your bank card to confirm usage of this Key.<br>Please do not worry <b>Google gives 1000 free API requests monthly</b> and<br>it's enough for automatically updated up to 2-3 connected your Google places.</p>
158 <p>Here is extrimy complete guide on <a href="<?php echo admin_url('admin.php?page=grw-support&grw_tab=fig#fig_api_key'); ?>" target="_blank">how to create your own API key</a>.</p>
159 <div style="padding-top:15px">
160 <input type="submit" value="Save" name="save" class="button" />
161 </div>
162 </div>
163 </div>
164 </form>
165 </div>
166
167 <div id="grw-advance" class="tab-content" style="display:<?php echo $tab == 'advance' ? 'block' : 'none'?>;">
168 <h3>Advance</h3>
169 <?php include_once(dirname(GRW_PLUGIN_FILE) . '/includes/page-setting-advance.php'); ?>
170 </div>
171
172 </div>
173
174 </div>
175 <?php
176 }
177
178 }
179