PluginProbe ʕ •ᴥ•ʔ
Rich Showcase for Google Reviews / 3.1
Rich Showcase for Google Reviews v3.1
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-builder-page.php
widget-google-reviews / includes Last commit date
admin 2 years ago core 2 years ago class-activator.php 3 years ago class-assets.php 2 years ago class-builder-page.php 3 years ago class-deactivator.php 3 years ago class-debug-info.php 2 years ago class-feed-ajax.php 2 years ago class-feed-block.php 2 years ago class-feed-deserializer.php 2 years ago class-feed-old.php 4 years ago class-feed-page.php 3 years ago class-feed-serializer.php 3 years ago class-feed-shortcode.php 3 years ago class-feed-widget.php 4 years ago class-plugin-overview-ajax.php 3 years ago class-plugin-overview.php 3 years ago class-plugin-settings.php 2 years ago class-plugin-support.php 3 years ago class-plugin.php 2 years ago class-post-types.php 3 years ago class-reviews-cron.php 2 years ago class-settings-save.php 3 years ago class-view.php 2 years ago index.php 4 years ago page-setting-fig.php 3 years ago page-setting-support.php 4 years ago
class-builder-page.php
179 lines
1 <?php
2
3 namespace WP_Rplg_Google_Reviews\Includes;
4
5 use WP_Rplg_Google_Reviews\Includes\Core\Core;
6 use WP_Rplg_Google_Reviews\Includes\Core\Database;
7
8 class Builder_Page {
9
10 private $view;
11 private $core;
12 private $feed_deserializer;
13
14 public function __construct(Feed_Deserializer $feed_deserializer, Core $core, View $view) {
15 $this->feed_deserializer = $feed_deserializer;
16 $this->core = $core;
17 $this->view = $view;
18 }
19
20 public function register() {
21 add_action('grw_admin_page_grw-builder', array($this, 'init'));
22 }
23
24 public function init() {
25 if (isset($_GET['grw_notice'])) {
26 $this->add_admin_notice();
27 }
28
29 $feed = null;
30 if (isset($_GET[Post_Types::FEED_POST_TYPE . '_id'])) {
31 $feed = $this->feed_deserializer->get_feed(sanitize_text_field(wp_unslash($_GET[Post_Types::FEED_POST_TYPE . '_id'])));
32 }
33
34 $this->render($feed);
35 }
36
37 public function add_admin_notice($notice_code = 0) {
38
39 }
40
41 public function render($feed) {
42 global $wp_version;
43 if (version_compare($wp_version, '3.5', '>=')) {
44 wp_enqueue_media();
45 }
46
47 $feed_id = '';
48 $feed_post_title = '';
49 $feed_content = '';
50 $feed_inited = false;
51 $businesses = null;
52 $reviews = null;
53
54 $rate_us = get_option('grw_rate_us');
55
56 if ($feed != null) {
57 $feed_id = $feed->ID;
58 $feed_post_title = $feed->post_title;
59 $feed_content = trim($feed->post_content);
60
61 $data = $this->core->get_reviews($feed, true);
62 $businesses = $data['businesses'];
63 $reviews = $data['reviews'];
64 $options = $data['options'];
65 if (isset($businesses) && count($businesses) || isset($reviews) && count($reviews)) {
66 $feed_inited = true;
67 }
68 }
69
70 ?>
71 <div class="grw-builder">
72 <form method="post" action="<?php echo esc_url(admin_url('admin-post.php?action=' . Post_Types::FEED_POST_TYPE . '_save')); ?>">
73 <?php wp_nonce_field('grw_wpnonce', 'grw_nonce'); ?>
74 <input type="hidden" id="grw_post_id" name="<?php echo Post_Types::FEED_POST_TYPE; ?>[post_id]" value="<?php echo esc_attr($feed_id); ?>">
75 <input type="hidden" id="grw_current_url" name="<?php echo Post_Types::FEED_POST_TYPE; ?>[current_url]" value="<?php echo home_url($_SERVER['REQUEST_URI']); ?>">
76 <div class="grw-builder-workspace">
77 <div class="grw-toolbar">
78 <div class="grw-toolbar-title">
79 <input id="grw_title" class="grw-toolbar-title-input" type="text" name="<?php echo Post_Types::FEED_POST_TYPE; ?>[title]" value="<?php if (isset($feed_post_title)) { echo $feed_post_title; } ?>" placeholder="Enter a widget name" maxlength="255" autofocus>
80 </div>
81 <div class="grw-toolbar-control">
82 <?php if ($feed_inited) { ?>
83 <label>
84 <span id="grw_sc_msg">Shortcode </span>
85 <input id="grw_sc" type="text" value="[grw id=&quot;<?php echo esc_attr($feed_id); ?>&quot;]" data-grw-shortcode="[grw id=&quot;<?php echo esc_attr($feed_id); ?>&quot;]" onclick="this.select(); document.execCommand('copy'); window.grw_sc_msg.innerHTML = 'Shortcode Copied! ';" readonly/>
86 </label>
87 <div class="grw-toolbar-options">
88 <label title="Sometimes, you need to use this shortcode in PHP, for instance in header.php or footer.php files, in this case use this option"><input type="checkbox" onclick="var el = window.grw_sc; if (this.checked) { el.value = '&lt;?php echo do_shortcode( \'' + el.getAttribute('data-grw-shortcode') + '\' ); ?&gt;'; } else { el.value = el.getAttribute('data-grw-shortcode'); } el.select();document.execCommand('copy'); window.grw_sc_msg.innerHTML = 'Shortcode Copied! ';"/>Use in PHP</label>
89 </div>
90 <?php } ?>
91 <button id="grw_save" type="submit" class="button button-primary">Save & Update</button>
92 </div>
93 </div>
94 <div class="grw-builder-preview">
95 <textarea id="grw-builder-connection" name="<?php echo Post_Types::FEED_POST_TYPE; ?>[content]" style="display:none"><?php echo $feed_content; ?></textarea>
96 <div id="grw_collection_preview">
97 <?php
98 if ($feed_inited) {
99 echo $this->view->render($feed_id, $businesses, $reviews, $options, true);
100 } else {
101 ?>To show reviews in this preview, firstly connect it on the right menu (CONNECT GOOGLE) and click
102 '<b>Save & Update</b>' button. Then you can use this created widget on a sidebar or through a shortcode.<?php
103 }
104 ?>
105 </div>
106 </div>
107 </div>
108 <div id="grw-builder-option" class="grw-builder-options"></div>
109 </form>
110 </div>
111
112 <?php if (!$rate_us) { ?>
113 <div id="grw-rate_us-wrap">
114 <div id="grw-rate_us">
115 <div class="grw-rate_us-content">
116 <div class="grw-rate_us-head">
117 How's experience with RichPlugins?
118 </div>
119 <div class="grw-rate_us-body">
120 Rate us clicking on the stars:
121 <?php $this->view->grw_stars(5); ?>
122 </div>
123 </div>
124 </div>
125 </div>
126 <?php } ?>
127
128 <div id="grw-rate_us-feedback" title="Thanks for your feedback!" style="display:none;">
129 <b>Please tell us how we can improve the plugin.</b>
130 <p style="font-size:16px;">
131 <span id="grw-rate_us-feedback-stars"></span>
132 </p>
133 <p style="font-size:16px;">
134 <input type="text" value="<?php global $current_user; echo $current_user->user_email; ?>" placeholder="Contact email"/>
135 </p>
136 <p style="font-size:16px;">
137 <textarea autofocus placeholder="Describe your experience and how we can improve that"></textarea>
138 </p>
139 <button class="grw-rate_us-cancel">Cancel</button><button class="grw-rate_us-send">Send</button>
140 </div>
141
142 <div id="dialog" title="Google API key required" style="display:none;">
143 <p style="font-size:16px;">
144 This plugin uses our default <b>Google Places API key which is mandatory for retrieving Google reviews</b> through official way approved by Google (without crawling). Our API key can make 5 requests to Google API for each WordPress server and it's exceeded at the moment.
145 </p>
146 <p style="font-size:16px;">
147 To continue working with Google API and daily reviews refreshing, please create your own API key by <a href="<?php echo admin_url('admin.php?page=grw-support&grw_tab=fig#fig_api_key'); ?>" target="_blank">this instruction</a> and save it on the settings page of the plugin.
148 </p>
149 <p style="font-size:16px;">
150 Don’t worry, it will be free because Google is currently giving free credit a month and it should be enough to use the plugin for connecting several Google places and daily refresh of reviews.
151 </p>
152 </div>
153
154 <script>
155 jQuery(document).ready(function($) {
156 function grw_builder_init_listener(attempts) {
157 if (!window.grw_builder_init) {
158 if (attempts > 0) {
159 setTimeout(function() { grw_builder_init_listener(attempts - 1); }, 200);
160 }
161 return;
162 }
163 grw_builder_init($, {
164 el : '#grw-builder-option',
165 use_gpa : true,
166 authcode : '<?php echo get_option('grw_auth_code'); ?>',
167 <?php if (strlen($feed_content) > 0) { echo 'conns: ' . $feed_content; } ?>
168 });
169 }
170 grw_builder_init_listener(20);
171 });
172 </script>
173 <style>
174 .update-nag { display: none; }
175 </style>
176 <?php
177 }
178 }
179