PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / trunk
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents vtrunk
4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 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.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / EmbedPress / Ends / Back / Handler.php
embedpress / EmbedPress / Ends / Back Last commit date
Settings 1 week ago Handler.php 1 day ago index.html 7 years ago
Handler.php
852 lines
1 <?php
2
3 namespace EmbedPress\Ends\Back;
4
5 use EmbedPress\Core;
6 use EmbedPress\Ends\Handler as EndHandlerAbstract;
7 use EmbedPress\Shortcode;
8 use Embera\Embera;
9 use EmbedPress\Includes\Classes\Helper;
10
11 (defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed.");
12
13 /**
14 * The admin-facing functionality of the plugin.
15 * Defines the plugin name, version, and enqueue the admin-specific stylesheets and scripts.
16 *
17 * @package EmbedPress
18 * @subpackage EmbedPress/Ends/Back
19 * @author EmbedPress <help@embedpress.com>
20 * @copyright Copyright (C) 2023 WPDeveloper. All rights reserved.
21 * @license GPLv3 or later
22 * @since 1.0.0
23 */
24 class Handler extends EndHandlerAbstract
25 {
26 /**
27 * Method that register all scripts for the admin area.
28 *
29 * @return void
30 * @since 1.0.0
31 *
32 */
33
34 public function __construct($pluginName, $pluginVersion)
35 {
36 parent::__construct($pluginName, $pluginVersion);
37
38 add_action('wp_ajax_delete_instagram_account', [$this, 'delete_instagram_account']);
39 // add_action('init', [$this, 'handle_instagram_data']);
40
41 add_action('wp_ajax_get_instagram_userdata_ajax', [$this, 'get_instagram_userdata_ajax']);
42
43 if (!empty($_GET['page_type']) && $_GET['page_type'] == 'calendly') {
44 add_action('init', [$this, 'handle_calendly_data']);
45 }
46
47 if (defined('EMBEDPRESS_SL_ITEM_SLUG') && is_admin()) {
48 add_action('admin_enqueue_scripts', [$this, 'enqueueLisenceScripts']);
49 }
50
51 add_action('wp_ajax_sync_instagram_data_ajax', [$this, 'sync_instagram_data_ajax']);
52 add_action('wp_ajax_nopriv_sync_instagram_data_ajax', [$this, 'sync_instagram_data_ajax']);
53
54
55 }
56
57
58 public function get_instagram_userdata_ajax()
59 {
60 if (function_exists('set_time_limit')) {
61 set_time_limit(0);
62 }
63
64 if (!current_user_can('manage_options')) {
65 wp_send_json_error(array('message' => 'You do not have sufficient permissions to access this functionality.'));
66 return;
67 }
68
69 if (isset($_POST['_nonce']) && wp_verify_nonce($_POST['_nonce'], 'embedpress_elements_action')) {
70 if (isset($_POST['access_token'])) {
71 $access_token = sanitize_text_field($_POST['access_token']);
72 $account_type = sanitize_text_field($_POST['account_type']);
73
74 $user_data = $this->get_instagram_userdata($access_token, $account_type);
75
76 $this->handle_instagram_data($user_data);
77
78 $access_token = sanitize_text_field($_POST['access_token']);
79 $account_type = sanitize_text_field($_POST['account_type']);
80 $user_id = $this->get_instagram_userid($access_token, $account_type);
81
82 $option_key = 'ep_instagram_feed_data';
83 $feed_data = get_option($option_key, array());
84
85 $feed_userinfo = Helper::getInstagramUserInfo($access_token, $account_type, $user_id, true);
86 $feed_posts = Helper::getInstagramPosts($access_token, $account_type, $user_id, 100, true);
87
88 if (!empty($user_id)) {
89 $feed_data[$user_id] = [
90 'feed_userinfo' => $feed_userinfo,
91 'feed_posts' => $feed_posts,
92 ];
93
94 delete_transient('instagram_user_info_' . $user_id);
95 delete_transient('instagram_posts_' . $user_id);
96 update_option('ep_instagram_feed_data', $feed_data);
97 } else {
98 $feed_data['error'] = "Access token Invalid or expired.";
99 }
100
101
102 wp_send_json($feed_data);
103 } else {
104 wp_send_json_error('Access token not provided');
105 }
106 } else {
107 wp_send_json_error('Nonce verification failed');
108 }
109 }
110
111 public function sync_instagram_data_ajax()
112 {
113 if (function_exists('set_time_limit')) {
114 set_time_limit(0);
115 }
116 if (!current_user_can('manage_options')) {
117 wp_send_json_error(array('message' => 'You do not have sufficient permissions to access this functionality.'));
118 return;
119 }
120
121 if (isset($_POST['_nonce']) && wp_verify_nonce($_POST['_nonce'], 'embedpress_elements_action')) {
122 if (isset($_POST['access_token'])) {
123
124 $access_token = sanitize_text_field($_POST['access_token']);
125 $account_type = sanitize_text_field($_POST['account_type']);
126 $user_id = sanitize_text_field($_POST['user_id']);
127
128 $option_key = 'ep_instagram_feed_data';
129 $feed_data = get_option($option_key, array());
130
131 $feed_userinfo = Helper::getInstagramUserInfo($access_token, $account_type, $user_id, true);
132 $feed_posts = Helper::getInstagramPosts($access_token, $account_type, $user_id, 100, true);
133
134 $feed_data[$user_id] = [
135 'feed_userinfo' => $feed_userinfo,
136 'feed_posts' => $feed_posts,
137 ];
138
139 delete_transient('instagram_user_info_' . $user_id);
140 delete_transient('instagram_posts_' . $user_id);
141 update_option('ep_instagram_feed_data', $feed_data);
142
143
144 wp_send_json($feed_data);
145 } else {
146 wp_send_json_error('Access token not provided');
147 }
148 } else {
149 wp_send_json_error('Nonce verification failed');
150 }
151 }
152
153
154 public function get_instagram_userid($access_token)
155 {
156 $response = "https://graph.facebook.com/v19.0/me/accounts?fields=connected_instagram_account{id}&access_token=$access_token";
157 if (!is_wp_error($response)) {
158
159 $body = wp_remote_retrieve_body($response);
160 $data = json_decode($body, true);
161
162 // Extract the connected Instagram account ID
163 if (isset($data['data'][0]['connected_instagram_account']['id'])) {
164 return $data['data'][0]['connected_instagram_account']['id'];
165 } else {
166 return '';
167 }
168 } else {
169 $user_data['error'] = "Error: Unable to connect to Instagram API.";
170 }
171 }
172
173 public function get_instagram_profile_picture($access_token, $userid) {}
174
175 public function get_instagram_user_id($access_token, $account_type)
176 {
177 // Check if user data is already cached
178 $user_id = get_transient('instagram_user_id_' . $access_token);
179
180 if (!$user_id) {
181 $user_id = array();
182
183 if ($account_type == 'personal') {
184 $response = wp_remote_get('https://graph.instagram.com/v24.0/me?fields=id,username&access_token=' . $access_token);
185 } else {
186 $response = wp_remote_get('https://graph.facebook.com/v19.0/me/accounts?fields=connected_instagram_account{id,name,username,followers_count}&access_token=' . $access_token);
187 }
188
189
190 if (!is_wp_error($response)) {
191
192 $body = wp_remote_retrieve_body($response);
193 $data = json_decode($body, true);
194
195 if ($account_type == 'personal') {
196 if (isset($data['id']) && isset($data['username'])) {
197 set_transient('instagram_user_id_' . $access_token, $data['id'], HOUR_IN_SECONDS);
198 return $data['id'];
199 } else {
200 $data['error'] = "Access token Invalid or expired.";
201 }
202 } else {
203 if (isset($data['data'][0]['connected_instagram_account']['id']) && isset($data['data'][0]['connected_instagram_account']['username'])) {
204 set_transient('instagram_user_id_' . $access_token, $data['data'][0]['connected_instagram_account']['id'], HOUR_IN_SECONDS);
205 return $data['data'][0]['connected_instagram_account']['id'];
206 } else {
207 $data['error'] = "Access token Invalid or expired.";
208 }
209 }
210 } else {
211 $data['error'] = "Error: Unable to connect to Instagram API.";
212 }
213 }
214
215 return $data;
216 }
217
218 public function get_instagram_userdata($access_token, $account_type)
219 {
220 // Check if user data is already cached
221 $user_data = get_transient('instagram_user_data_' . $access_token);
222
223 if (!$user_data) {
224 $user_data = array();
225
226 if ($account_type == 'personal') {
227 $response = wp_remote_get('https://graph.instagram.com/v24.0/me?fields=biography,id,username,website,followers_count,media_count,profile_picture_url,name&access_token=' . $access_token);
228 } else {
229 $response = wp_remote_get('https://graph.facebook.com/v19.0/me/accounts?fields=connected_instagram_account{id,name,username,followers_count}&access_token=' . $access_token);
230 }
231
232
233 if (!is_wp_error($response)) {
234
235 $body = wp_remote_retrieve_body($response);
236 $data = json_decode($body, true);
237
238 if ($account_type == 'personal') {
239 if (isset($data['id']) && isset($data['username'])) {
240 $user_data['access_token'] = $access_token;
241 $user_data['user_id'] = $data['id'];
242 $user_data['username'] = $data['username'];
243 $user_data['account_type'] = $account_type;
244
245 set_transient('instagram_user_data_' . $access_token, $user_data, HOUR_IN_SECONDS);
246 } else {
247 $user_data['error'] = "Access token Invalid or expired.";
248 }
249 } else {
250 if (isset($data['data'][0]['connected_instagram_account']['id']) && isset($data['data'][0]['connected_instagram_account']['username'])) {
251 $user_data['access_token'] = $access_token;
252 $user_data['user_id'] = $data['data'][0]['connected_instagram_account']['id']; // Assuming 'id' refers to Facebook account ID
253 $user_data['instagram_id'] = $data['data'][0]['connected_instagram_account']['id'];
254 $user_data['username'] = $data['data'][0]['connected_instagram_account']['username'];
255 $user_data['account_type'] = $account_type;
256
257 set_transient('instagram_user_data_' . $access_token, $user_data, HOUR_IN_SECONDS);
258 } else {
259 $user_data['error'] = "Access token Invalid or expired.";
260 }
261 }
262 } else {
263 $user_data['error'] = "Error: Unable to connect to Instagram API.";
264 }
265 }
266
267 return $user_data;
268 }
269
270
271
272
273 public function handle_instagram_data($user_data)
274 {
275 if (empty($user_data['error'])) {
276 $user_id = isset($user_data['user_id']) ? $user_data['user_id'] : '';
277 $username = isset($user_data['username']) ? $user_data['username'] : '';
278 $account_type = isset($user_data['account_type']) ? $user_data['account_type'] : '';
279 $access_token = isset($user_data['access_token']) ? $user_data['access_token'] : '';
280
281 $get_instagram_data = get_option('ep_instagram_account_data');
282
283 $token_data = [
284 [
285 'user_id' => $user_id,
286 'username' => $username,
287 'account_type' => $account_type,
288 'access_token' => $access_token,
289 ]
290 ];
291
292 if (!empty($get_instagram_data)) {
293 $updated = false;
294
295 foreach ($get_instagram_data as &$data) {
296
297 if ($data['user_id'] === $user_id) {
298
299 // If user_id matches, update the data
300 $data['username'] = $username;
301 $data['account_type'] = $account_type;
302 $data['access_token'] = $access_token;
303
304 $updated = true;
305 break;
306 }
307 }
308
309 if (!$updated) {
310 // If user_id does not exist, add new data
311 $get_instagram_data[] = $token_data[0];
312 }
313 } else {
314 // If $get_instagram_data is empty, add the new data directly
315 $get_instagram_data = $token_data;
316 }
317
318 update_option('ep_instagram_account_data', $get_instagram_data);
319
320 wp_redirect(admin_url('admin.php?page=embedpress&page_type=instagram'), 301);
321
322 exit();
323 }
324 }
325
326 public function handle_calendly_data()
327 {
328
329 if (empty($_GET['_nonce'])) {
330 return false;
331 }
332
333 $verify = wp_verify_nonce($_GET['_nonce'], 'calendly_nonce');
334
335 // Check if access_token or calendly_status is present and nonce is invalid
336 if (!$verify) {
337 echo esc_html__('Invalid nonce', 'embedpress');
338 die;
339 }
340
341 if ((!empty($_GET['_nonce']) && $verify) && (!empty($_GET['access_token']) && isset($_GET['page_type']) && $_GET['page_type'] == 'calendly') || (isset($_GET['calendly_status']) && ($_GET['calendly_status'] == 'sync' || $_GET['calendly_status'] == 'connect'))) {
342
343 if ($_GET['calendly_status'] === 'connect') {
344 update_option('is_calendly_connected', true);
345 }
346
347 if (isset($_GET['access_token']) && !empty($_GET['access_token'])) {
348 $access_token = $_GET['access_token'];
349 $refresh_token = $_GET['refresh_token'];
350 $expires_in = $_GET['expires_in'];
351 $created_at = $_GET['created_at'];
352 } elseif (isset($_GET['calendly_status']) && ($_GET['calendly_status'] == 'sync' || $_GET['calendly_status'] == 'connect')) {
353 $token_data = get_option('calendly_tokens');
354 $access_token = $token_data['access_token'];
355 $refresh_token = $token_data['refresh_token'];
356 $expires_in = $token_data['expires_in'];
357 $created_at = $token_data['created_at'];
358 }
359
360
361 // Create an array to store the tokens and expiration time
362 $token_data = array(
363 'access_token' => $access_token,
364 'refresh_token' => $refresh_token,
365 'expires_in' => $expires_in,
366 'created_at' => $created_at
367 );
368
369 // Save the serialized data in a single option key
370 update_option('calendly_tokens', $token_data);
371
372 $user_info = json_decode(Helper::getCalendlyUserInfo($access_token), true);
373
374 if (!empty($user_info['resource']['uri'])) {
375 $event_types = Helper::getCalaendlyEventTypes($user_info['resource']['uri'], $access_token);
376 $scheduled_events = Helper::getCalaendlyScheduledEvents($user_info['resource']['uri'], $access_token);
377
378 $invite_list = [];
379
380 if (is_array($scheduled_events['collection'])) {
381 foreach ($scheduled_events['collection'] as $event) :
382 $uuid = Helper::getCalendlyUuid($event['uri']);
383 $invite_list[$uuid] = Helper::getListEventInvitee($uuid, $access_token);
384 endforeach;
385 }
386
387 update_option('calendly_user_info', $user_info);
388
389 if (!apply_filters('embedpress/is_allow_rander', false)) {
390 update_option('calendly_event_types', []);
391 update_option('calendly_scheduled_events', []);
392 update_option('calendly_invitees_list', []);
393 } else {
394 do_action('embedepress/calendly_event_data', $event_types, $scheduled_events, $invite_list);
395 }
396 }
397
398 wp_redirect(admin_url('admin.php?page=embedpress&page_type=calendly'), 302);
399 exit();
400 }
401 }
402
403 public function enqueueScripts()
404 {
405 // Assets and localization are now handled by AssetManager and LocalizationManager
406 // This method is kept for backward compatibility but functionality has been moved
407 }
408
409 public function enqueueLisenceScripts()
410 {
411 // Assets and localization are now handled by AssetManager and LocalizationManager
412 // This method is kept for backward compatibility but functionality has been moved
413 }
414
415
416 /**
417 * Method that register all stylesheets for the admin area.
418 *
419 * @return void
420 * @since 1.0.0
421 * @static
422 *
423 */
424 public static function enqueueStyles()
425 {
426 // Assets are now handled by AssetManager
427 // This method is kept for backward compatibility
428 }
429
430 /**
431 * Method that receive a string via AJAX and return the decoded-shortcoded-version of that string.
432 *
433 * @return void
434 * @since 1.0.0
435 *
436 */
437 public function doShortcodeReceivedViaAjax()
438 {
439 // This handler resolves an arbitrary user-supplied URL server-side
440 // (oEmbed discovery), so it must never be reachable unauthenticated.
441 // Only logged-in editors may call it; the nopriv registration was removed.
442 if (!current_user_can('edit_posts')) {
443 wp_send_json_error(['message' => 'Forbidden'], 403);
444 }
445
446 // CSRF protection: verify the nonce localized into the preview script.
447 check_ajax_referer('embedpress_do_ajax_request');
448
449 $subject = isset($_POST['subject']) ? trim(wp_unslash($_POST['subject'])) : "";
450
451 // Internal-host SSRF (link-local/CGNAT/benchmark) is rejected globally by
452 // the http_request_host_is_external filter, so parseContent can run as-is.
453 $response = [
454 'data' => Shortcode::parseContent($subject, true),
455 ];
456
457 header('Content-Type:application/json;charset=UTF-8');
458 echo json_encode($response);
459
460 exit();
461 }
462
463 /**
464 * Method that receive an url via AJAX and return the info about that url/embed.
465 *
466 * @return void
467 * @since 1.0.0
468 *
469 */
470 public function getUrlInfoViaAjax()
471 {
472 $url = isset($_GET['url']) ? trim($_GET['url']) : "";
473
474 $response = [
475 'url' => $url,
476 'canBeResponsive' => false,
477 ];
478
479 if (!!strlen($response['url'])) {
480
481 $additionalServiceProviders = Core::getAdditionalServiceProviders();
482 if (!empty($additionalServiceProviders)) {
483 foreach ($additionalServiceProviders as $serviceProviderClassName => $serviceProviderUrls) {
484 Shortcode::addServiceProvider($serviceProviderClassName, $serviceProviderUrls);
485 }
486 }
487 $embera = new Embera([], Shortcode::get_collection());
488
489 $urlInfo = $embera->getUrlData($response['url']);
490 if (isset($urlInfo[$response['url']]) && $urlInfo[$response['url']]['provider_name']) {
491 $response['canBeResponsive'] = Core::canServiceProviderBeResponsive(strtolower($urlInfo[$response['url']]['provider_name']));
492 }
493 }
494
495 header('Content-Type:application/json;charset=UTF-8');
496 echo json_encode($response);
497
498 exit();
499 }
500
501 /**
502 * Returns a list of supported URL schemes for the preview script
503 *
504 * @return array
505 */
506 public function getUrlSchemes()
507 {
508 return [
509 // Apple podcasts
510 'podcasts.apple.com/*',
511 // PollDaddy
512 '*.polldaddy.com/s/*',
513 '*.polldaddy.com/poll/*',
514 '*.polldaddy.com/ratings/*',
515 'polldaddy.com/s/*',
516 'polldaddy.com/poll/*',
517 'polldaddy.com/ratings/*',
518
519 // VideoPress
520 'videopress.com/v/*',
521
522 // Tumblr
523 '*.tumblr.com/post/*',
524
525 // SmugMug
526 'smugmug.com/*',
527 '*.smugmug.com/*',
528
529 // SlideShare
530 'slideshare.net/*/*',
531 '*.slideshare.net/*/*',
532
533 // Reddit
534 'reddit.com/r/[^/]+/comments/*',
535
536 // Photobucket
537 'i*.photobucket.com/albums/*',
538 'gi*.photobucket.com/groups/*',
539
540 // Cloudup
541 'cloudup.com/*',
542
543 // Imgur
544 'imgur.com/*',
545 'i.imgur.com/*',
546
547 // YouTube (http://www.youtube.com/)
548 'youtube.com/watch\\?*',
549 'youtube.com/playlist\\?*',
550 'youtube.com/channel/*',
551 'youtube.com/c/*',
552 'youtube.com/user/*',
553 'youtube.com/(\w+)[^?\/]*$',
554
555 // opensea
556 'opensea.io/collection/*',
557
558 // Flickr (http://www.flickr.com/)
559 'flickr.com/photos/*/*',
560 'flic.kr/p/*',
561
562 // Viddler (http://www.viddler.com/)
563 'viddler.com/v/*',
564
565 // Hulu (http://www.hulu.com/)
566 'hulu.com/watch/*',
567
568 // Vimeo (http://vimeo.com/)
569 'vimeo.com/*',
570 'vimeo.com/groups/*/videos/*',
571
572 // CollegeHumor (http://www.collegehumor.com/)
573 'collegehumor.com/video/*',
574
575 // Deviantart.com (http://www.deviantart.com)
576 '*.deviantart.com/art/*',
577 '*.deviantart.com/*#/d*',
578 'fav.me/*',
579 'sta.sh/*',
580
581 // SlideShare (http://www.slideshare.net/)
582
583 // chirbit.com (http://www.chirbit.com/)
584 'chirb.it/*',
585
586 // nfb.ca (http://www.nfb.ca/)
587 '*.nfb.ca/film/*',
588
589 // Scribd (http://www.scribd.com/)
590 '*.scribd.com/doc/*',
591 '*.scribd.com/document/*',
592
593 // Dotsub (http://dotsub.com/)
594 'dotsub.com/view/*',
595
596 // Animoto (http://animoto.com/)
597 'animoto.com/play/*',
598
599 // Rdio (http://rdio.com/)
600 '*.rdio.com/artist/*',
601 '*.rdio.com/people/*',
602
603 // MixCloud (http://mixcloud.com/)
604 'mixcloud.com/*/*/',
605
606 // FunnyOrDie (http://www.funnyordie.com/)
607 'funnyordie.com/videos/*',
608
609 // Ted (http://ted.com)
610 'ted.com/talks/*',
611
612 // Sapo Videos (http://videos.sapo.pt)
613 'videos.sapo.pt/*',
614
615 // Official FM (http://official.fm)
616 'official.fm/tracks/*',
617 'official.fm/playlists/*',
618
619 // HuffDuffer (http://huffduffer.com)
620 'huffduffer.com/*/*',
621
622 // Shoudio (http://shoudio.com)
623 'shoudio.com/*',
624 'shoud.io/*',
625
626 // Moby Picture (http://www.mobypicture.com)
627 'mobypicture.com/user/*/view/*',
628 'moby.to/*',
629
630 // 23HQ (http://www.23hq.com)
631 '23hq.com/*/photo/*',
632
633 // Cacoo (https://cacoo.com)
634 'cacoo.com/diagrams/*',
635
636 // Dipity (http://www.dipity.com)
637 'dipity.com/*/*/',
638
639 // Roomshare (http://roomshare.jp)
640 'roomshare.jp/post/*',
641 'roomshare.jp/en/post/*',
642
643 // Dailymotion (http://www.dailymotion.com)
644 'dailymotion.com/video/*',
645
646 // Crowd Ranking (http://crowdranking.com)
647 'c9ng.com/*/*',
648
649 // CircuitLab (https://www.circuitlab.com/)
650 'circuitlab.com/circuit/*',
651
652 // Coub (http://coub.com/)
653 'coub.com/view/*',
654 'coub.com/embed/*',
655
656 // SpeakerDeck (https://speakerdeck.com)
657 'speakerdeck.com/*/*',
658
659 // Instagram (https://instagram.com)
660 'instagram.com/p/*',
661 'instagr.am/p/*',
662
663 // SoundCloud (http://soundcloud.com/)
664 'soundcloud.com/*',
665
666 // Kickstarter (http://www.kickstarter.com)
667 'kickstarter.com/projects/*',
668
669 // Ustream (http://www.ustream.tv)
670 '*.ustream.tv/*',
671 '*.ustream.com/*',
672
673 // Daily Mile (http://www.dailymile.com)
674 'dailymile.com/people/*/entries/*',
675
676 // Sketchfab (http://sketchfab.com)
677 'sketchfab.com/models/*',
678 'sketchfab.com/*/folders/*',
679
680 // Meetup (http://www.meetup.com)
681 'meetup.com/*',
682 'meetu.ps/*',
683
684 // AudioSnaps (http://audiosnaps.com)
685 'audiosnaps.com/k/*',
686
687 // RapidEngage (https://rapidengage.com)
688 'rapidengage.com/s/*',
689
690 // Getty Images (http://www.gettyimages.com/)
691 'gty.im/*',
692 'gettyimages.com/detail/photo/*',
693
694 // amCharts Live Editor (http://live.amcharts.com/)
695 'live.amcharts.com/*',
696
697 // Infogram (https://infogr.am/)
698 'infogr.am/*',
699 'infogram.com/*',
700
701 // ChartBlocks (http://www.chartblocks.com/)
702 'public.chartblocks.com/c/*',
703
704 // ReleaseWire (http://www.releasewire.com/)
705 'rwire.com/*',
706
707 // ShortNote (https://www.shortnote.jp/)
708 'shortnote.jp/view/notes/*',
709
710 // EgliseInfo (http://egliseinfo.catholique.fr/)
711 'egliseinfo.catholique.fr/*',
712
713 // Silk (http://www.silk.co/)
714 '*.silk.co/explore/*',
715 '*.silk.co/s/embed/*',
716
717 // Twitter
718 'twitter.com/*/status/*',
719 'twitter.com/i/moments/*',
720 'twitter.com/*/timelines/*',
721
722 // http://bambuser.com
723 'bambuser.com/v/*',
724
725 // https://clyp.it
726 'clyp.it/*',
727
728 // https://gist.github.com
729 'gist.github.com/*/*',
730
731 // http://issuu.com
732 'issuu.com/*',
733
734 // https://portfolium.com
735 'portfolium.com/*',
736
737 // https://www.reverbnation.com
738 'reverbnation.com/*',
739
740 // http://rutube.ru
741 'rutube.ru/video/*',
742
743 // https://spotify.com/
744 'open.spotify.com/*',
745
746 // http://www.videojug.com
747 'videojug.com/*',
748
749 // https://vine.com
750 'vine.co/v/*',
751
752 // Facebook
753 'facebook.com/*',
754 'fb.watch/*',
755
756 // Google Shortened Url
757 'goo.gl/*',
758
759 // Google Maps
760 'google.com/*',
761 'google.com.*/*',
762 'google.co.*/*',
763 'maps.google.com/*',
764
765 // Google Docs
766 'docs.google.com/presentation/*',
767 'docs.google.com/document/*',
768 'docs.google.com/spreadsheets/*',
769 'docs.google.com/forms/*',
770 'docs.google.com/drawings/*',
771
772 // Twitch.tv
773 '*.twitch.tv/*',
774 'twitch.tv/*',
775
776 // Giphy
777 '*.giphy.com/gifs/*',
778 'giphy.com/gifs/*',
779 'i.giphy.com/*',
780 'gph.is/*',
781
782 // Wistia
783 '*.wistia.com/medias/*',
784 'fast.wistia.com/embed/medias/*.jsonp',
785 // Boomplay (http://boomplay.com/)
786 'boomplay.com/*',
787 'codepen.io/*',
788 'archivos.digital/*',
789 'audioclip.naver.com/*',
790 'app.blogcast.host/*',
791 'codepoints.net/*',
792 'codesandbox.io/*',
793 'commaful.com/*',
794 '*.survey.fm/*',
795 'survey.fm/*',
796 'datawrapper.dwcdn.net/*',
797 '*.didacte.com/*',
798 'didacte.com/*',
799 'digiteka.com/*',
800 'docdro.id/*',
801 'edumedia-sciences.com/*',
802 'ethfiddle.com/*',
803 'eyrie.io/*',
804 '*.getfader.com/*',
805 'getfader.com/*',
806 'fitapp.pro/*',
807 'fite.tv/*',
808 'public.flourish.studio/*',
809 'geograph.org.gg/*',
810 'geo-en.hlipp.de/*',
811 'geograph.org.uk/*',
812 'fortest.getshow.io/*',
813 'opensea.io/assets/*',
814 ];
815 }
816
817 public function delete_instagram_account()
818 {
819 if (!current_user_can('manage_options')) {
820 wp_send_json_error(array('message' => 'You do not have sufficient permissions to access this functionality.'));
821 return;
822 }
823
824 if (isset($_POST['_nonce']) && wp_verify_nonce($_POST['_nonce'], 'embedpress_elements_action')) {
825 $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : '';
826 $account_type = isset($_POST['account_type']) ? $_POST['account_type'] : '';
827 $account_data = get_option('ep_instagram_account_data');
828
829 $data = array_filter($account_data, function ($item) use ($user_id) {
830 return $item['user_id'] !== $user_id;
831 });
832 $data = array_values($data);
833 update_option('ep_instagram_account_data', $data);
834 } else {
835 wp_die('Nonce verification failed.');
836 }
837 }
838
839
840
841 /**
842 * Update admin notice view status
843 *
844 * @since 2.5.1
845 */
846 public static function embedpress_notice_dismiss()
847 {
848 check_ajax_referer('embedpress', 'security');
849 update_option('embedpress_social_dismiss_notice', true);
850 }
851 }
852