PluginProbe
Juicer.io: Effortlessly embed, curate, and aggregate social media feeds into your website / trunk
Juicer.io: Effortlessly embed, curate, and aggregate social media feeds into your website vtrunk
1.12.18 1.12.5 1.12.6 1.12.7 1.12.8 1.12.9 1.2 1.3 1.3.1 1.4 1.4.1 1.5 1.6 1.6.1 1.7 1.7.1 1.7.2 1.8 1.9 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 All 45 releases
juicer / includes / admin / settings.php

settings.php in Juicer.io: Effortlessly embed, curate, and aggregate social media feeds into your website trunk, at includes/admin/settings.php

240 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 // Make a request to the API endpoint
8 $host_url = home_url();
9 $response = wp_remote_get('https://www.juicer.io/api/hosts?hostname='. $host_url);
10 $response_cta = wp_remote_get('https://www.juicer.io/api/hosts/cta?hostname='. $host_url);
11
12 $feedExists = false;
13
14 // Check if the request was successful
15 if (!is_wp_error($response)) {
16
17 // Get the response code
18 $response_code = wp_remote_retrieve_response_code($response);
19
20 // Check if the response code is no 404 (Not Found)
21 if ($response_code !== 404) {
22
23 $body = wp_remote_retrieve_body($response);
24 $data = json_decode($body, true);
25
26 $uniqueFeeds = [];
27
28 // Check if "feed_id" exists in the response
29 foreach ($data as $item) {
30 if (isset($item['feed_id'])) {
31 $feedExists = true;
32 break;
33 }
34 }
35 foreach ($data as $item) {
36 $feedId = $item['feed_id'];
37 $feedSlug = $item['feed_slug'];
38
39 if (!array_key_exists($feedId, $uniqueFeeds)) {
40 $uniqueFeeds[$feedId] = $feedSlug;
41 }
42 }
43 }
44 }
45
46 // Check if the CTA request was successful
47 if (!is_wp_error($response_cta)) {
48
49 // Get the response code for CTA
50 $response_cta_code = wp_remote_retrieve_response_code($response_cta);
51
52 // Check if the response code is not 404 (Not Found)
53 if ($response_cta_code !== 404) {
54
55 $body_cta = wp_remote_retrieve_body($response_cta);
56 $cta_data = json_decode($body_cta, true);
57 }
58 }
59
60 ?>
61
62 <div class="juicer-header">
63 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>/img/juicer-logo.svg" width="116" >
64 <div>
65 <a href="https://www.juicer.io/?utm_source=wordpress_plugin_instructions&utm_medium=referral&utm_content=cta_website" target="_blank" class="juicer-header__link">Juicer Website <img class="juicer-widget__icon-link" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-outbound-link-icon.svg" height="16" width="16" ></a>
66 <a href="https://www.juicer.io/dashboard?utm_source=wordpress_plugin_instructions&utm_medium=referral&utm_content=cta_dashboard" target="_blank" class="juicer-header__link">Your Juicer Dashboard <img class="juicer-widget__icon-link" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-outbound-link-icon.svg" height="16" width="16" ></a>
67 </div>
68 </div>
69 <div class="juicer-container">
70 <div class="juicer-column-2-3">
71
72 <?php if (is_wp_error($response)) : ?>
73 <div class="juicer-widget blue">
74 <div class="juicer-info-block">
75 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-info-blue.svg" height="24" width="24" >
76 <span>We can't confirm if your feed is setup correctly due to an API error</span>
77 </div>
78 </div>
79 <?php elseif ($feedExists) : ?>
80 <div class="juicer-widget green">
81 <div class="juicer-info-block">
82 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-checkbox-green.svg" height="24" width="24" >
83 <span>Good Job! The feed on this website is set up correctly.</span>
84 <div class="juicer-info-block__feed-list">
85 <?php
86 $count = count($uniqueFeeds);
87
88 if ($count > 1) {
89 echo "Your active feeds: ";
90 } else {
91 echo "Your active feed: ";
92 }
93
94 $index = 0;
95
96 foreach ($uniqueFeeds as $feedSlug) {
97 echo "<strong>{$feedSlug}</strong>";
98 $index++;
99
100 if ($index !== $count) {
101 echo ", ";
102 }
103 }
104 ?>
105 </div>
106 </div>
107 </div>
108 <?php elseif (isset($_COOKIE['juicer_welcome'])) : ?>
109 <div class="juicer-widget blue">
110 <div class="juicer-info-block">
111 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wave-emoji.svg" height="32" width="32" >
112 <span>Welcome to Juicer! Follow the instructions below to set up your first feed.</span>
113 <script>document.cookie = 'juicer_welcome=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';</script>
114 </div>
115 </div>
116 <?php else: ?>
117 <div class="juicer-widget red">
118 <div class="juicer-info-block">
119 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-info-red.svg" height="24" width="24" >
120 <span>The feed may not be set up on your website, or we can't verify its correct display.</span>
121 </div>
122 </div>
123 <?php endif; ?>
124
125 <div class="juicer-widget">
126 <h2>How to set up a Juicer feed on your website?</h2>
127
128 <div class="juicer-img-holder">
129 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/feed-img.png">
130 </div>
131
132 <div class="juicer-social-networks-holder">
133 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-social-networks.svg">
134 <span>15+ Social networks supported</span>
135 </div>
136
137 <ol class="juicer-steps-list">
138 <li>Sign up at <a href="https://www.juicer.io/?utm_source=wordpress_plugin_instructions&utm_medium=referral&utm_content=cta_bullet" target="_blank">Juicer.io</a> and create a free feed. It only takes 1 minute.</li>
139 <li>Navigate to your Juicer dashboard, where you can see your latest feeds.</li>
140 <li>Copy your feed name from the URL in the address bar of your browser.</li>
141 <li>Embed your social media feed by pasting shortcode with your feed name.</li>
142 </ol>
143 <div class="juicer-code-wrapper" style="margin-left: 25px;">
144 <pre>[juicer name='FEED_NAME']</pre>
145 <button class="juicer-code-copy"><img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-copy-icon.svg"></button>
146 <span class="code-copy-tooltip">Copied</span>
147 </div>
148 </div>
149
150 <?php if ( did_action( 'elementor/loaded' ) ) : ?>
151 <div class="juicer-widget juicer-widget__elementor-setup">
152 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-elementor-icon.svg" height="40" width="40" >
153 <p>Using Elementor, you can easily add your Juicer feed using the Juicer feed widget. This allows for easy drag-and-drop integration directly from the Elementor editor.</p>
154 </div>
155 <?php endif; ?>
156
157 <div class="juicer-widget">
158 <p>If you prefer, you can also use the following PHP snippet to add the feed to your template.</p>
159 <div class="juicer-code-wrapper">
160 <pre>&lt;?php juicer_feed('name=juicer'); ?&gt;</pre>
161 <button class="juicer-code-copy"><img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-copy-icon.svg"></button>
162 <span class="code-copy-tooltip">Copied</span>
163 </div>
164 </div>
165 </div>
166
167 <div class="juicer-column-1-3">
168 <!-- CTA block start -->
169 <?php if (isset($cta_data['show']) && $cta_data['show']) : ?>
170 <div class="juicer-cta-widget">
171 <p class="juicer-promotion"><img class="juicer-cta-widget__juicer-promotion__icon" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-lightning-icon.svg" height="16" width="16" > <?php echo $cta_data['promotion']; ?></p>
172 <h2 class="juicer-cta-widget__headline"><?php echo $cta_data['headline_text']; ?></h2>
173 <p class="juicer-cta-widget__subheadline"><?php echo $cta_data['sub_headline_text']; ?></p>
174 <ul class="juicer-cta-widget__features">
175 <?php foreach ($cta_data['features'] as $feature) : ?>
176 <li class="<?php echo $feature['icon'] == 'checkmark' ? 'feature-checkmark' : 'feature-cross'; ?>">
177 <?php echo $feature['text']; ?>
178 </li>
179 <?php endforeach; ?>
180 </ul>
181 <div class="juicer-cta-widget__buttons">
182 <?php foreach ($cta_data['buttons'] as $button) : ?>
183 <a href="<?php echo $button['link']; ?>" class="juicer-btn <?php echo $button['style']; ?>">
184 <?php echo $button['text']; ?>
185 </a>
186 <?php endforeach; ?>
187 </div>
188 </div>
189 <?php endif; ?>
190 <!-- CTA block end -->
191
192 <a href="#" class="juicer-widget link juicer-review-link">
193 <div class="juicer-widget__title">
194 <img class="juicer-widget__icon" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-rating-icon.svg" height="24" width="24" >
195 <h2>Show Your Love</h2>
196 <img class="juicer-widget__icon-link" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-outbound-link-icon.svg" height="16" width="16" >
197 </div>
198 <p>Take 2 minutes to review the plugin. Spread the love to encourage us to keep getting better.</p>
199 </a>
200
201 <a href="https://help.juicer.io/hc/en-us/sections/360008042291-Getting-Started-with-Juicer?utm_source=wordpress_plugin_instructions&utm_medium=referral&utm_content=cta_documentation" target="_blank" class="juicer-widget link">
202 <div class="juicer-widget__title">
203 <img class="juicer-widget__icon" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-docs-icon.svg" height="24" width="24" >
204 <h2>View Documentation</h2>
205 <img class="juicer-widget__icon-link" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-outbound-link-icon.svg" height="16" width="16" >
206 </div>
207 <p>For advanced usage and customization options, refer to the documentation for the Juicer WordPress Plugin.</p>
208 </a>
209
210 <a href="https://www.juicer.io/contact?utm_source=wordpress_plugin_instructions&utm_medium=referral&utm_content=cta_help" target="_blank" class="juicer-widget link">
211 <div class="juicer-widget__title">
212 <img class="juicer-widget__icon" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-support-icon.svg" height="24" width="24" >
213 <h2>Need Help?</h2>
214 <img class="juicer-widget__icon-link" src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-outbound-link-icon.svg" height="16" width="16" >
215 </div>
216 <p>Stuck with something?<br />Get help by submitting a support ticket.</p>
217 </a>
218 </div>
219 </div>
220
221 <!-- Modal -->
222 <div id="juicer-modal" class="juicer-modal">
223 <div class="juicer-modal-content">
224 <span class="juicer-close">&times;</span>
225 <p>We would love to hear your feedback. It won't take more than a minute.</p>
226 <h2>Enjoying the Juicer plugin?</h2>
227 <div class="juicer-modal-link-wrapper">
228 <a href="https://wordpress.org/plugins/juicer/#reviews" target="_blank" class="juicer-modal-link">
229 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-heart-icon.svg" width="40" >
230 <strong>Yes</strong>
231 <p>(leave a review)</p>
232 </a>
233 <a href="https://help.juicer.io/hc/en-us/requests/new" target="_blank" class="juicer-modal-link">
234 <img src="<?php echo plugin_dir_url( __FILE__ ) ?>img/wp-feedback-icon.svg" width="40" >
235 <strong>No</strong>
236 <p>(share your feedback)</p>
237 </a>
238 </div>
239 </div>
240 </div>