PluginProbe ʕ •ᴥ•ʔ
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress / 4.9.0
Smash Balloon Social Post Feed – Simple Social Feeds for WordPress v4.9.0
4.12.0 4.10.0 4.9.0 4.8.1 trunk 1.0 1.1 1.12.1 1.2.3 1.2.4 1.2.5 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.5 1.5.1 1.5.2 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.5.1 1.6.6 1.6.6.1 1.6.6.2 1.6.6.3 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.2.1 1.8.2.2 1.8.2.3 1.9.0 1.9.1 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.8.1 1.9.9 1.9.9.1 1.9.9.2 1.9.9.3 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.10 2.11 2.11.1 2.12 2.12.1 2.12.2 2.12.3 2.12.4 2.13 2.14 2.14.1 2.15 2.15.1 2.16 2.16.1 2.17 2.17.1 2.18 2.18.1 2.18.2 2.18.3 2.19 2.19.1 2.19.2 2.19.3 2.2 2.2.1 2.3 2.3.1 2.3.10 2.3.2 2.3.3 2.3.4 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.1.1 2.4.1.2 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.7 2.7.1 2.7.2 2.8 2.9 2.9.1 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3.0 4.3.1 4.3.2 4.3.3 4.3.4 4.7.5 4.7.6 4.7.7
custom-facebook-feed / inc / Admin / CFF_oEmbeds.php
custom-facebook-feed / inc / Admin Last commit date
Blocks 1 month ago Traits 1 month ago CFF_About_Us.php 1 month ago CFF_Admin.php 1 month ago CFF_Admin_Notices.php 1 month ago CFF_Callout.php 1 month ago CFF_Global_Settings.php 1 month ago CFF_Install_Skin.php 1 month ago CFF_New_User.php 1 month ago CFF_Notifications.php 1 month ago CFF_Onboarding_Wizard.php 1 month ago CFF_Support.php 1 month ago CFF_Support_Tool.php 1 month ago CFF_Upgrader.php 1 month ago CFF_oEmbeds.php 1 month ago index.php 1 month ago
CFF_oEmbeds.php
474 lines
1 <?php
2
3 /**
4 * The Settings Page
5 *
6 * @since 4.0
7 */
8
9 namespace CustomFacebookFeed\Admin;
10
11 if (! defined('ABSPATH')) {
12 exit; // Exit if accessed directly
13 }
14
15 use CustomFacebookFeed\CFF_View;
16 use CustomFacebookFeed\CFF_Response;
17 use CustomFacebookFeed\Helpers\Util;
18
19 class CFF_oEmbeds
20 {
21 /**
22 * Admin menu page slug.
23 *
24 * @since 4.0
25 *
26 * @var string
27 */
28 const SLUG = 'cff-oembeds-manager';
29
30 /**
31 * Initializing the class
32 *
33 * @since 4.0
34 */
35 public function __construct()
36 {
37 $this->init();
38 }
39
40 /**
41 * Determining if the user is viewing the our page, if so, party on.
42 *
43 * @since 4.0
44 */
45 public function init()
46 {
47 if (! is_admin()) {
48 return;
49 }
50
51 add_action('admin_menu', [$this, 'register_menu']);
52
53 add_action('wp_ajax_disable_facebook_oembed', [$this, 'disable_facebook_oembed']);
54 add_action('wp_ajax_disable_instagram_oembed', [$this, 'disable_instagram_oembed']);
55 }
56
57 /**
58 * Register Menu.
59 *
60 * @since 4.0
61 */
62 public function register_menu()
63 {
64 $cap = current_user_can('manage_custom_facebook_feed_options') ? 'manage_custom_facebook_feed_options' : 'manage_options';
65 $cap = apply_filters('cff_settings_pages_capability', $cap);
66
67 $oembeds_manager = add_submenu_page(
68 'cff-top',
69 __('oEmbeds', 'custom-facebook-feed'),
70 __('oEmbeds', 'custom-facebook-feed'),
71 $cap,
72 self::SLUG,
73 [$this, 'oembeds_manager'],
74 2
75 );
76 add_action('load-' . $oembeds_manager, [$this,'oembeds_enqueue_admin_scripts']);
77 }
78
79 /**
80 * Disable Facebook oEmbed
81 *
82 * @since 4.0
83 *
84 * @return CFF_Response
85 */
86 public function disable_facebook_oembed()
87 {
88 \CustomFacebookFeed\Builder\CFF_Feed_Builder::check_privilege('nonce');
89
90 $oembed_settings = get_option('cff_oembed_token', array());
91 $oembed_settings['access_token'] = '';
92 $oembed_settings['disabled'] = true;
93 update_option('cff_oembed_token', $oembed_settings);
94
95 $response = new CFF_Response(true, array(
96 'connectionUrl' => $this->get_connection_url()
97 ));
98 $response->send();
99 }
100
101 /**
102 * Disable Instagram oEmbed
103 *
104 * @since 4.0
105 *
106 * @return CFF_Response
107 */
108 public function disable_instagram_oembed()
109 {
110 \CustomFacebookFeed\Builder\CFF_Feed_Builder::check_privilege('nonce');
111
112 $oembed_settings = get_option('sbi_oembed_token', array());
113 $oembed_settings['access_token'] = '';
114 $oembed_settings['disabled'] = true;
115 update_option('sbi_oembed_token', $oembed_settings);
116
117 $response = new CFF_Response(true, array(
118 'connectionUrl' => $this->get_connection_url()
119 ));
120 $response->send();
121 }
122
123 /**
124 * Enqueue oEmbeds CSS & Script.
125 *
126 * Loads only for oEmbeds page
127 *
128 * @since 4.0
129 */
130 public function oembeds_enqueue_admin_scripts()
131 {
132 if (! Util::current_page_is('cff-oembeds')) {
133 return;
134 }
135
136 wp_enqueue_style(
137 'oembeds-style',
138 CFF_PLUGIN_URL . 'admin/assets/css/oembeds.css',
139 false,
140 CFFVER
141 );
142
143 wp_enqueue_script(
144 'sb-vue',
145 CFF_PLUGIN_URL . 'admin/assets/js/vue.min.js',
146 null,
147 '2.6.12',
148 true
149 );
150
151 wp_enqueue_script(
152 'oembeds-app',
153 CFF_PLUGIN_URL . 'admin/assets/js/oembeds.js',
154 array( 'sb-vue' ),
155 CFFVER,
156 true
157 );
158
159 $cff_oembends = $this->statuses_and_info();
160 $cff_oembends['nonce'] = wp_create_nonce('cff-admin');
161
162 wp_localize_script(
163 'oembeds-app',
164 'cff_oembeds',
165 $cff_oembends
166 );
167 }
168
169 /**
170 * Statuses and info about the current state of oEmbed connection
171 *
172 * @return array
173 *
174 * @since 4.0
175 */
176 public function statuses_and_info()
177 {
178 $return = array(
179 'admin_url' => admin_url(),
180 'ajax_handler' => admin_url('admin-ajax.php'),
181 'supportPageUrl' => admin_url('admin.php?page=cff-support'),
182 'links' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_links_with_utm(),
183 'socialWallLinks' => \CustomFacebookFeed\Builder\CFF_Feed_Builder::get_social_wall_links(),
184 'socialWallActivated' => is_plugin_active('social-wall/social-wall.php'),
185 'genericText' => array(
186 'help' => __('Help', 'custom-facebook-feed'),
187 'title' => __('oEmbeds', 'custom-facebook-feed'),
188 'description' => __('Use Smash Balloon to power any Facebook or Instagram oEmbeds across your site. Just click the button below and we\'ll do the rest. ', 'custom-facebook-feed'),
189 'facebookOEmbeds' => __('Facebook oEmbeds are currently not being handled by Smash Balloon', 'custom-facebook-feed'),
190 'facebookOEmbedsEnabled' => __('Facebook oEmbeds are turned on', 'custom-facebook-feed'),
191 'instagramOEmbeds' => __('Instagram oEmbeds are currently not being handled by Smash Balloon', 'custom-facebook-feed'),
192 'instagramOEmbedsEnabled' => __('Instagram oEmbeds are turned on', 'custom-facebook-feed'),
193 'enable' => __('Enable', 'custom-facebook-feed'),
194 'disable' => __('Disable', 'custom-facebook-feed'),
195 'whatAreOembeds' => __('What are oEmbeds?', 'custom-facebook-feed'),
196 'whatElseOembeds' => __('What else can the Custom Facebook Feed plugin do?', 'custom-facebook-feed'),
197 'whenYouPaste' => __('When you paste a link to a Facebook or Instagram post in WordPress, it automatically displays the post instead of the URL. That is called an oEmbed.', 'custom-facebook-feed'),
198 'dueToRecent' => __('Due to recent API changes from Facebook, WordPress cannot automatically embed your posts.', 'custom-facebook-feed'),
199 'however' => __('However, we have added this feature to Smash Balloon to make sure your oEmbeds keep working.', 'custom-facebook-feed'),
200 'justEnable' => __('Just enable it above, and all your existing and new embeds should work automatically, no other input required.', 'custom-facebook-feed'),
201 'displayACompletely' => __('Display a completely customizable Facebook Feed with tons of features', 'custom-facebook-feed'),
202 'createACustom' => __('Create a custom styled feed of your Facebook Page or Group posts which integrates seamlessly with your WordPress theme.', 'custom-facebook-feed'),
203 ),
204 'images' => array(
205 'fbIcon' => '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 2.04004C6.5 2.04004 2 6.53004 2 12.06C2 17.06 5.66 21.21 10.44 21.96V14.96H7.9V12.06H10.44V9.85004C10.44 7.34004 11.93 5.96004 14.22 5.96004C15.31 5.96004 16.45 6.15004 16.45 6.15004V8.62004H15.19C13.95 8.62004 13.56 9.39004 13.56 10.18V12.06H16.34L15.89 14.96H13.56V21.96C15.9164 21.5879 18.0622 20.3856 19.6099 18.5701C21.1576 16.7546 22.0054 14.4457 22 12.06C22 6.53004 17.5 2.04004 12 2.04004Z" fill="#006BFA"/></svg>',
206 'instaIcon' => '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 6.60938C9 6.60938 6.60938 9.04688 6.60938 12C6.60938 15 9 17.3906 12 17.3906C14.9531 17.3906 17.3906 15 17.3906 12C17.3906 9.04688 14.9531 6.60938 12 6.60938ZM12 15.5156C10.0781 15.5156 8.48438 13.9688 8.48438 12C8.48438 10.0781 10.0312 8.53125 12 8.53125C13.9219 8.53125 15.4688 10.0781 15.4688 12C15.4688 13.9688 13.9219 15.5156 12 15.5156ZM18.8438 6.42188C18.8438 5.71875 18.2812 5.15625 17.5781 5.15625C16.875 5.15625 16.3125 5.71875 16.3125 6.42188C16.3125 7.125 16.875 7.6875 17.5781 7.6875C18.2812 7.6875 18.8438 7.125 18.8438 6.42188ZM22.4062 7.6875C22.3125 6 21.9375 4.5 20.7188 3.28125C19.5 2.0625 18 1.6875 16.3125 1.59375C14.5781 1.5 9.375 1.5 7.64062 1.59375C5.95312 1.6875 4.5 2.0625 3.23438 3.28125C2.01562 4.5 1.64062 6 1.54688 7.6875C1.45312 9.42188 1.45312 14.625 1.54688 16.3594C1.64062 18.0469 2.01562 19.5 3.23438 20.7656C4.5 21.9844 5.95312 22.3594 7.64062 22.4531C9.375 22.5469 14.5781 22.5469 16.3125 22.4531C18 22.3594 19.5 21.9844 20.7188 20.7656C21.9375 19.5 22.3125 18.0469 22.4062 16.3594C22.5 14.625 22.5 9.42188 22.4062 7.6875ZM20.1562 18.1875C19.8281 19.125 19.0781 19.8281 18.1875 20.2031C16.7812 20.7656 13.5 20.625 12 20.625C10.4531 20.625 7.17188 20.7656 5.8125 20.2031C4.875 19.8281 4.17188 19.125 3.79688 18.1875C3.23438 16.8281 3.375 13.5469 3.375 12C3.375 10.5 3.23438 7.21875 3.79688 5.8125C4.17188 4.92188 4.875 4.21875 5.8125 3.84375C7.17188 3.28125 10.4531 3.42188 12 3.42188C13.5 3.42188 16.7812 3.28125 18.1875 3.84375C19.0781 4.17188 19.7812 4.92188 20.1562 5.8125C20.7188 7.21875 20.5781 10.5 20.5781 12C20.5781 13.5469 20.7188 16.8281 20.1562 18.1875Z" fill="url(#paint0_linear)"/><defs><linearGradient id="paint0_linear" x1="8.95781" y1="41.6859" x2="53.1891" y2="-3.46406" gradientUnits="userSpaceOnUse"><stop stop-color="white"/><stop offset="0.147864" stop-color="#F6640E"/><stop offset="0.443974" stop-color="#BA03A7"/><stop offset="0.733337" stop-color="#6A01B9"/><stop offset="1" stop-color="#6B01B9"/></linearGradient></defs></svg>',
207 'image1_2x' => CFF_PLUGIN_URL . 'admin/assets/img/oembeds-image-1@2x.png',
208 'image2_2x' => CFF_PLUGIN_URL . 'admin/assets/img/oembeds-image-2@2x.png',
209 'image3_2x' => CFF_PLUGIN_URL . 'admin/assets/img/oembeds-image-3@2x.png',
210 'image4_2x' => CFF_PLUGIN_URL . 'admin/assets/img/oembeds-image-4@2x.png',
211 ),
212 'modal' => array(
213 'title' => __('Enable Instagram oEmbeds', 'custom-facebook-feed'),
214 'description' => __('To enable Instagram oEmbeds our Instagram Feed plugin is required. Click the button below to Install it and enable Instagram oEmbeds.', 'custom-facebook-feed'),
215 'install' => __('Install Plugin', 'custom-facebook-feed'),
216 'activate' => __('Activate Plugin', 'custom-facebook-feed'),
217 'cancel' => __('Cancel', 'custom-facebook-feed'),
218 'instaIcon' => CFF_PLUGIN_URL . 'admin/assets/img/instagram-color-icon.svg',
219 'timesIcon' => '<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.2084 2.14275L12.8572 0.791504L7.50008 6.14859L2.143 0.791504L0.791748 2.14275L6.14883 7.49984L0.791748 12.8569L2.143 14.2082L7.50008 8.85109L12.8572 14.2082L14.2084 12.8569L8.85133 7.49984L14.2084 2.14275Z" fill="#141B38"/></svg>',
220 'plusIcon' => '<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0832 6.83317H7.08317V11.8332H5.4165V6.83317H0.416504V5.1665H5.4165V0.166504H7.08317V5.1665H12.0832V6.83317Z" fill="white"/></svg>'
221 ),
222 'loaderSVG' => '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="20px" height="20px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#fff" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg>',
223 'checkmarkSVG' => '<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40"><path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/></svg>',
224 );
225
226 $oembed_token_settings = get_option('cff_oembed_token', array());
227 $saved_access_token_data = isset($oembed_token_settings['access_token']) ? $oembed_token_settings['access_token'] : false;
228 $newly_retrieved_oembed_connection_data = $this->maybeConnectionData($saved_access_token_data);
229 if (! empty($newly_retrieved_oembed_connection_data['access_token'])) {
230 $oembed_token_settings = $newly_retrieved_oembed_connection_data;
231 $return['newOembedData'] = $newly_retrieved_oembed_connection_data;
232
233 $encryption = new \CustomFacebookFeed\SB_Facebook_Data_Encryption();
234 if (isset($newly_retrieved_oembed_connection_data['access_token']) && ! $encryption->decrypt($newly_retrieved_oembed_connection_data['access_token'])) {
235 $newly_retrieved_oembed_connection_data['access_token'] = $encryption->encrypt($newly_retrieved_oembed_connection_data['access_token']);
236 }
237
238 update_option('cff_oembed_token', $newly_retrieved_oembed_connection_data);
239 update_option('sbi_oembed_token', $newly_retrieved_oembed_connection_data);
240 } elseif (! empty($newly_retrieved_oembed_connection_data)) {
241 $return['newOembedData'] = $newly_retrieved_oembed_connection_data;
242 }
243
244 $return['connectionURL'] = $this->get_connection_url();
245 $return['tokenData'] = $oembed_token_settings;
246
247 $return['facebook'] = array(
248 'doingOembeds' => $this->facebook_oembed_enabled()
249 );
250 $return['instagram'] = [
251 'active' => class_exists('\SB_Instagram_Oembed'),
252 'doingOembeds' => false
253 ];
254
255 $return['instagram']['installer'] = $this->instagram_installer_info();
256
257 if (class_exists('\SB_Instagram_Oembed')) {
258 $return['instagram']['doingOembeds'] = \SB_Instagram_Oembed::can_do_oembed();
259 }
260
261 return $return;
262 }
263
264 /**
265 * Connection URLs are based on the website connecting accounts so that is
266 * configured here and returned
267 *
268 * @return array
269 *
270 * @since 4.0
271 */
272 public static function get_connection_url()
273 {
274
275 $admin_url_state = admin_url('admin.php?page=cff-oembeds-manager');
276 $nonce = wp_create_nonce('cff_con');
277 // If the admin_url isn't returned correctly then use a fallback.
278 if ($admin_url_state === '/wp-admin/admin.php?page=cff-oembeds-manager') {
279 $admin_url_state = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
280 }
281 return array(
282 'connect' => CFF_OEMBED_CONNECT_URL,
283 'cff_con' => $nonce,
284 'stateURL' => $admin_url_state
285 );
286 }
287
288 /**
289 * Listener for retrieving and storing an access token for oEmbeds
290 *
291 * @param string $saved_access_token_data
292 *
293 * @return array|bool
294 *
295 * @since 4.0
296 */
297 public static function maybeConnectionData($saved_access_token_data)
298 {
299 global $cff_notices;
300 $screen = get_current_screen();
301 $return = false;
302
303 if (!$screen || $screen->id !== 'facebook-feed_page_cff-oembeds-manager') {
304 return false;
305 }
306
307 $oembed_success_notice = $cff_notices->get_notice('oembed_api_change_reconnect');
308 if ($oembed_success_notice) {
309 $cff_notices->remove_notice('oembed_api_change_reconnect');
310 }
311
312 if (!empty($_GET['transfer']) && class_exists('\SB_Instagram_Oembed')) {
313 $sbi_oembed_token = \SB_Instagram_Oembed::last_access_token();
314 $return = get_option('sbi_oembed_token', array());
315 $return['access_token'] = $sbi_oembed_token;
316 $return['disabled'] = false;
317 }
318
319 if (isset($_GET['cff_access_token'])) {
320 $return = self::processCffOembedAccessToken($saved_access_token_data);
321 }
322 return $return;
323 }
324
325 /**
326 * Process oEmbed Access Token
327 *
328 * @return array
329 *
330 * @since 4.0
331 */
332 public static function processCffOembedAccessToken($saved_access_token_data)
333 {
334 global $cff_notices;
335 $return = [];
336 $access_token = $_GET['cff_access_token'];
337
338 $valid_new_access_token = !empty($access_token) && strlen($access_token) > 20 && $saved_access_token_data !== $access_token ?
339 sanitize_text_field($_GET['cff_access_token']) : false;
340
341 if ($valid_new_access_token) {
342 $return['access_token'] = $valid_new_access_token;
343 $return['disabled'] = false;
344 $return['expiration_date'] = 'never';
345
346 $oembed_notice = $cff_notices->get_notice('oembed_api_change');
347 if ($oembed_notice) {
348 $cff_notices->remove_notice('oembed_api_change');
349 }
350
351 $message = '<p><strong>' .
352 __('oEmbed account successfully connected. You are all set to continue creating oEmbeds.', 'custom-facebook-feed')
353 . '</strong></p>';
354 $success_args = array(
355 'class' => 'cff-admin-notices',
356 'message' => $message,
357 'dismissible' => true,
358 'dismiss' => array(
359 'class' => 'cff-notice-dismiss',
360 'icon' => CFF_PLUGIN_URL . 'admin/assets/img/cff-dismiss-icon.svg',
361 'tag' => 'a',
362 'href' => '#',
363 ),
364 'priority' => 1,
365 'page' => array(
366 'cff-oembeds-manager',
367 ),
368 'icon' => array(
369 'src' => CFF_PLUGIN_URL . 'admin/assets/img/cff-exclamation.svg',
370 'wrap' => '<span class="sb-notice-icon"><img {src}></span>',
371 ),
372 'styles' => array(
373 'display' => 'flex',
374 'justify-content' => 'space-between',
375 'gap' => '2rem',
376 ),
377 'wrap_schema' => '<div {id} {class}>{icon}<div class="cff-notice-wrap" {styles}><div class="cff-notice-body">{message}</div>{dismiss}</div></div>',
378 );
379
380 $cff_notices->add_notice('oembed_api_change_reconnect', 'information', $success_args);
381 $cff_statuses = get_option('cff_statuses', array());
382 $cff_statuses['oembed_api_change_notice'] = true;
383
384 update_option('cff_statuses', $cff_statuses);
385 } else {
386 if ($saved_access_token_data === $access_token) {
387 $return['error'] = 'Not New';
388 } else {
389 $return['error'] = 'Not Valid';
390 }
391 }
392
393 return $return;
394 }
395 /**
396 * Check if Facebook oEmbed is enabled or not
397 *
398 * @return bool
399 *
400 * @since 4.0
401 */
402 public function facebook_oembed_enabled()
403 {
404 $cff_oembed_token = get_option('cff_oembed_token');
405 if (isset($cff_oembed_token['access_token']) && isset($cff_oembed_token['disabled']) && ! $cff_oembed_token['disabled']) {
406 return true;
407 }
408 return false;
409 }
410
411 /**
412 * Determines what action for Instagram should be done in the following order
413 * and returns data used in the common "addon" installer
414 *
415 * Free or Pro active, do nothing
416 * Pro installed but not active, activate Pro
417 * Free installed but not active, activate Free
418 * Nothing installed, install and activate Free
419 *
420 * @return array
421 *
422 * @since 4.0
423 */
424 public static function instagram_installer_info()
425 {
426 $all_plugins = get_plugins();
427 $active_plugins = get_option('active_plugins');
428
429 if (
430 in_array('instagram-feed/instagram-feed.php', $active_plugins, true)
431 || in_array('instagram-feed-pro/instagram-feed.php', $active_plugins, true)
432 ) {
433 return [
434 'nextStep' => 'none',
435 'plugin' => 'none',
436 'action' => 'none'
437 ];
438 }
439
440 foreach ($all_plugins as $plugin) {
441 if (strpos($plugin['Name'], 'Instagram Feed Pro') !== false) {
442 return [
443 'nextStep' => 'pro_activate',
444 'plugin' => 'instagram-feed-pro/instagram-feed.php',
445 'action' => 'cff_activate_addon'
446 ];
447 }
448 if (strpos($plugin['Name'], 'Instagram Feed') !== false) {
449 return [
450 'nextStep' => 'free_activate',
451 'plugin' => 'instagram-feed/instagram-feed.php',
452 'action' => 'cff_activate_addon'
453 ];
454 }
455 }
456
457 return [
458 'nextStep' => 'free_install',
459 'plugin' => 'https://downloads.wordpress.org/plugin/instagram-feed.zip',
460 'action' => 'cff_install_addon'
461 ];
462 }
463
464 /**
465 * oEmbeds Manager Page View Template
466 *
467 * @since 4.0
468 */
469 public function oembeds_manager()
470 {
471 CFF_View::render('oembeds.index');
472 }
473 }
474