PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 4.2.9
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v4.2.9
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 / Core.php
embedpress / EmbedPress Last commit date
AMP 2 years ago Elementor 1 year ago Ends 11 months ago Includes 1 year ago Plugins 1 year ago Providers 11 months ago ThirdParty 1 year ago AutoLoader.php 2 years ago Compatibility.php 2 years ago Core.php 1 year ago CoreLegacy.php 1 year ago DisablerLegacy.php 2 years ago Loader.php 2 years ago RestAPI.php 1 year ago Shortcode.php 1 year ago index.html 7 years ago simple_html_dom.php 4 years ago
Core.php
679 lines
1 <?php
2
3 namespace EmbedPress;
4
5 use EmbedPress\Ends\Back\Handler as EndHandlerAdmin;
6 use EmbedPress\Ends\Back\Settings\EmbedpressSettings;
7 use EmbedPress\Ends\Front\Handler as EndHandlerPublic;
8 use EmbedPress\Includes\Traits\Shared;
9
10
11 (defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed.");
12
13 /**
14 * Entity that glues together all pieces that the plugin is made of, for WordPress 5+.
15 *
16 * @package EmbedPress
17 * @author EmbedPress <help@embedpress.com>
18 * @copyright Copyright (C) 2021 WPDeveloper. All rights reserved.
19 * @license GPLv3 or later
20 * @since 1.0.0
21 */
22 class Core
23 {
24 use Shared;
25
26 /**
27 * The name of the plugin.
28 *
29 * @since 1.0.0
30 * @access protected
31 *
32 * @var string $pluginName The name of the plugin.
33 */
34 protected $pluginName;
35
36 /**
37 * The version of the plugin.
38 *
39 * @since 1.0.0
40 * @access protected
41 *
42 * @var string $pluginVersion The version of the plugin.
43 */
44 protected $pluginVersion;
45
46 /**
47 * An instance of the plugin loader.
48 *
49 * @since 1.0.0
50 * @access protected
51 *
52 * @var Loader $pluginVersion The version of the plugin.
53 */
54 protected $loaderInstance;
55
56 /**
57 * An associative array storing all registered/active EmbedPress plugins and their namespaces.
58 *
59 * @since 1.4.0
60 * @access private
61 * @static
62 *
63 * @var array
64 */
65 private static $plugins = [];
66
67 /**
68 * Initialize the plugin and set its properties.
69 *
70 * @return void
71 * @since 1.0.0
72 *
73 */
74 public function __construct()
75 {
76 $this->pluginName = EMBEDPRESS_PLG_NAME;
77 $this->pluginVersion = EMBEDPRESS_VERSION;
78
79 $this->loaderInstance = new Loader();
80
81 add_action( 'in_admin_header', [ $this, 'remove_admin_notice' ], 99 );
82 add_action('ep_admin_notices', [$this, 'embedpress_admin_notice']);
83 add_action('ep_admin_notices', [$this, 'admin_notice']);
84
85 add_filter('upload_mimes', [$this, 'extended_mime_types']);
86
87 }
88
89 /**
90 * Method that retrieves the plugin name.
91 *
92 * @return string
93 * @since 1.0.0
94 *
95 */
96 public function getPluginName()
97 {
98 return $this->pluginName;
99 }
100
101 /**
102 * Method that retrieves the plugin version.
103 *
104 * @return string
105 * @since 1.0.0
106 *
107 */
108 public function getPluginVersion()
109 {
110 return $this->pluginVersion;
111 }
112
113 /**
114 * Method that retrieves the loader instance.
115 *
116 * @return Loader
117 * @since 1.0.0
118 *
119 */
120 public function getLoader()
121 {
122 return $this->loaderInstance;
123 }
124
125 /**
126 * Method responsible to connect all required hooks in order to make the plugin work.
127 *
128 * @return void
129 * @since 1.0.0
130 *
131 */
132 public function initialize()
133 {
134 global $wp_actions;
135 add_filter('oembed_providers', [$this, 'addOEmbedProviders']);
136 add_action('rest_api_init', [$this, 'registerOEmbedRestRoutes']);
137 add_action('rest_api_init', [$this, 'register_feedback_email_endpoint']);
138
139
140 $this->start_plugin_tracking();
141
142 if (is_admin()) {
143 new EmbedpressSettings();
144 $plgSettings = self::getSettings();
145
146
147 add_action('init', [$this, 'admin_notice']);
148
149 add_filter(
150 'plugin_action_links_embedpress/embedpress.php',
151 ['\\EmbedPress\\Core', 'handleActionLinks'],
152 10,
153 2
154 );
155
156 add_action('admin_enqueue_scripts', ['\\EmbedPress\\Ends\\Back\\Handler', 'enqueueStyles']);
157 add_action('wp_ajax_embedpress_notice_dismiss', ['\\EmbedPress\\Ends\\Back\\Handler', 'embedpress_notice_dismiss']);
158
159 $plgHandlerAdminInstance = new EndHandlerAdmin($this->getPluginName(), $this->getPluginVersion());
160
161 if ($plgSettings->enablePluginInAdmin) {
162 $this->loaderInstance->add_action('admin_enqueue_scripts', $plgHandlerAdminInstance, 'enqueueScripts');
163 }
164 } else {
165 $plgHandlerPublicInstance = new EndHandlerPublic($this->getPluginName(), $this->getPluginVersion());
166
167 $this->loaderInstance->add_action('wp_enqueue_scripts', $plgHandlerPublicInstance, 'enqueueScripts');
168 $this->loaderInstance->add_action('wp_enqueue_scripts', $plgHandlerPublicInstance, 'enqueueStyles');
169
170 unset($plgHandlerPublicInstance);
171 }
172
173 // Add support for embeds on AMP pages
174 add_filter('pp_embed_parsed_content', ['\\EmbedPress\\AMP\\EmbedHandler', 'processParsedContent'], 10, 3);
175
176 // Add support for our embeds on Beaver Builder. Without this it only run the native embeds.
177 add_filter(
178 'fl_builder_before_render_shortcodes',
179 ['\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes']
180 );
181 $this->loaderInstance->run();
182 }
183
184 /**
185 * @param $providers
186 *
187 * @return mixed
188 */
189 public function addOEmbedProviders($providers)
190 {
191 $newProviders = [
192 // Viddler
193 '#https?://(.+\.)?viddler\.com/v/.+#i' => 'viddler',
194
195 // Deviantart.com (http://www.deviantart.com)
196 // '#https?://(.+\.)?deviantart\.com/art/.+#i' => 'devianart',
197 // '#https?://(.+\.)?deviantart\.com/.+#i' => 'devianart',
198 // '#https?://(.+\.)?deviantart\.com/.*/d.+#i' => 'devianart',
199 // '#https?://(.+\.)?fav\.me/.+#i' => 'devianart',
200 // '#https?://(.+\.)?sta\.sh/.+#i' => 'devianart',
201
202 // chirbit.com (http://www.chirbit.com/)
203 //'#https?://(.+\.)?chirb\.it/.+#i' => 'chirbit',
204
205
206 // nfb.ca (http://www.nfb.ca/)
207 //'#https?://(.+\.)?nfb\.ca/film/.+#i' => 'nfb',
208
209 // Dotsub (http://dotsub.com/)
210 //'#https?://(.+\.)?dotsub\.com/view/.+#i' => 'dotsub',
211
212 // Rdio (http://rdio.com/)
213 '#https?://(.+\.)?rdio\.com/(artist|people)/.+#i' => 'rdio',
214
215 // Sapo Videos (http://videos.sapo.pt)
216 //'#https?://(.+\.)?videos\.sapo\.pt/.+#i' => 'sapo',
217
218 // Official FM (http://official.fm)
219 '#https?://(.+\.)?official\.fm/(tracks|playlists)/.+#i' => 'officialfm',
220
221 // HuffDuffer (http://huffduffer.com)
222 //'#https?://(.+\.)?huffduffer\.com/.+#i' => 'huffduffer',
223
224 // Shoudio (http://shoudio.com)
225 //'#https?://(.+\.)?shoudio\.(com|io)/.+#i' => 'shoudio',
226
227 // Moby Picture (http://www.mobypicture.com)
228 '#https?://(.+\.)?mobypicture\.com/user/.+/view/.+#i' => 'mobypicture',
229 '#https?://(.+\.)?moby\.to/.+#i' => 'mobypicture',
230
231 // 23HQ (http://www.23hq.com)
232 //'#https?://(.+\.)?23hq\.com/.+/photo/.+#i' => '23hq',
233
234 // Cacoo (https://cacoo.com)
235 '#https?://(.+\.)?cacoo\.com/diagrams/.+#i' => 'cacoo',
236
237 // Dipity (http://www.dipity.com)
238 '#https?://(.+\.)?dipity\.com/.+#i' => 'dipity',
239
240 // Roomshare (http://roomshare.jp)
241 //'#https?://(.+\.)?roomshare\.jp/(en/)?post/.+#i' => 'roomshare',
242
243 // Crowd Ranking (http://crowdranking.com)
244 '#https?://(.+\.)?c9ng\.com/.+#i' => 'crowd',
245
246 // CircuitLab (https://www.circuitlab.com/)
247 //'#https?://(.+\.)?circuitlab\.com/circuit/.+#i' => 'circuitlab',
248
249 // Coub (http://coub.com/)
250 //'#https?://(.+\.)?coub\.com/(view|embed)/.+#i' => 'coub',
251
252 // Ustream (http://www.ustream.tv)
253 //'#https?://(.+\.)?ustream\.(tv|com)/.+#i' => 'ustream',
254
255 // Daily Mile (http://www.dailymile.com)
256 '#https?://(.+\.)?dailymile\.com/people/.+/entries/.+#i' => 'daily',
257
258 // Sketchfab (http://sketchfab.com)
259 '#https?://(.+\.)?sketchfab\.com/models/.+#i' => 'sketchfab',
260 '#https?://(.+\.)?sketchfab\.com/.+/folders/.+#i' => 'sketchfab',
261
262 // AudioSnaps (http://audiosnaps.com)
263 '#https?://(.+\.)?audiosnaps\.com/k/.+#i' => 'audiosnaps',
264
265 // RapidEngage (https://rapidengage.com)
266 '#https?://(.+\.)?rapidengage\.com/s/.+#i' => 'rapidengage',
267
268 // Getty Images (http://www.gettyimages.com/)
269 //'#https?://(.+\.)?gty\.im/.+#i' => 'gettyimages',
270 //'#https?://(.+\.)?gettyimages\.com/detail/photo/.+#i' => 'gettyimages',
271
272 // amCharts Live Editor (http://live.amcharts.com/)
273 //'#https?://(.+\.)?live\.amcharts\.com/.+#i' => 'amcharts',
274
275 // Infogram (https://infogr.am/)
276 //'#https?://(.+\.)?infogr\.am/.+#i' => 'infogram',
277 //(https://infogram.com/)
278 //'#https?://(.+\.)?infogram\.com/.+#i' => 'infogram',
279
280 // ChartBlocks (http://www.chartblocks.com/)
281 //'#https?://(.+\.)?public\.chartblocks\.com/c/.+#i' => 'chartblocks',
282
283 // ReleaseWire (http://www.releasewire.com/)
284 //'#https?://(.+\.)?rwire\.com/.+#i' => 'releasewire',
285
286 // ShortNote (https://www.shortnote.jp/)
287 //'#https?://(.+\.)?shortnote\.jp/view/notes/.+#i' => 'shortnote',
288
289 // EgliseInfo (http://egliseinfo.catholique.fr/)
290 '#https?://(.+\.)?egliseinfo\.catholique\.fr/.+#i' => 'egliseinfo',
291
292 // Silk (http://www.silk.co/)
293 '#https?://(.+\.)?silk\.co/explore/.+#i' => 'silk',
294 '#https?://(.+\.)?silk\.co/s/embed/.+#i' => 'silk',
295
296 // http://bambuser.com
297 '#https?://(.+\.)?bambuser\.com/v/.+#i' => 'bambuser',
298
299 // https://clyp.it
300 //'#https?://(.+\.)?clyp\.it/.+#i' => 'clyp',
301
302 // https://gist.github.com
303 // '#https?://(.+\.)?gist\.github\.com/.+#i' => 'github',
304
305 // https://portfolium.com
306 //'#https?://(.+\.)?portfolium\.com/.+#i' => 'portfolium',
307
308 // http://rutube.ru
309 '#https?://(.+\.)?rutube\.ru/video/.+#i' => 'rutube',
310
311 // http://www.videojug.com
312 '#https?://(.+\.)?videojug\.com/.+#i' => 'videojug',
313
314 // https://vine.com
315 //'#https?://(.+\.)?vine\.co/v/.+#i' => 'vine',
316
317 // Google Shortened Url
318 '#https?://(.+\.)?goo\.gl/.+#i' => 'google',
319
320 // Google Maps
321 //'#https?://(.+\.)?google\.com/maps/.+#i' => 'googlemaps',
322 //'#https?://(.+\.)?maps\.google\.com/.+#i' => 'googlemaps',
323
324 // Google Docs
325 //'#https?://(.+\.)?docs\.google\.com/(.+/)?(document|presentation|spreadsheets|forms|drawings)/.+#i' => 'googledocs',
326
327 // Twitch.tv
328 //'#https?://(.+\.)?twitch\.tv/.+#i' => 'twitch',
329
330 // Giphy
331 //'#https?://(.+\.)?giphy\.com/gifs/.+#i' => 'giphy',
332 //'#https?://(.+\.)?i\.giphy\.com/.+#i' => 'giphy',
333 //'#https?://(.+\.)?gph\.is/.+#i' => 'giphy',
334
335 // Wistia
336 //'#https?://(.+\.)?wistia\.com/medias/.+#i' => 'wistia',
337 //'#https?://(.+\.)?fast\.wistia\.com/embed/medias/.+#i\.jsonp' => 'wistia',
338 ];
339
340 /**
341 * ========================================
342 * Make sure the $wp_write global is set.
343 * This fix compatibility with JetPack, Classical Editor and Disable Gutenberg. JetPack makes
344 * the oembed_providers filter be called and this activates our class too, but one dependency
345 * of the rest_url method is not loaded yet.
346 */
347 global $wp_rewrite;
348
349 if (!class_exists('\\WP_Rewrite')) {
350 $path = ABSPATH . WPINC . '/class-wp-rewrite.php';
351 if (file_exists($path)) {
352 require_once $path;
353 }
354 }
355
356 if (!is_object($wp_rewrite)) {
357 $wp_rewrite = new \WP_Rewrite();
358 $_GLOBALS['wp_write'] = $wp_rewrite;
359 }
360 /*========================================*/
361
362 foreach ($newProviders as $url => &$data) {
363 $data = [
364 rest_url('embedpress/v1/oembed/' . $data),
365 true,
366 ];
367 }
368
369 $providers = array_merge($providers, $newProviders);
370
371 return $providers;
372 }
373
374 /**
375 * Register OEmbed Rest Routes
376 */
377 public function registerOEmbedRestRoutes()
378 {
379 register_rest_route(
380 'embedpress/v1',
381 '/oembed/(?P<provider>[a-zA-Z0-9\-]+)',
382 [
383 'methods' => \WP_REST_Server::READABLE,
384 'callback' => ['\\EmbedPress\\RestAPI', 'oembed'],
385 'permission_callback' => '__return_true',
386 ]
387 );
388 register_rest_route(
389 'embedpress/v1',
390 '/oembed/(?P<provider>[a-zA-Z0-9\-]+)',
391 [
392 'methods' => \WP_REST_Server::CREATABLE,
393 'callback' => ['\\EmbedPress\\RestAPI', 'oembed'],
394 'permission_callback' => '__return_true',
395 ]
396 );
397 }
398
399 public function send_user_feedback_email($params)
400 {
401 $params = $params->get_params();
402
403 $site_name = get_bloginfo('name');
404 $site_url = get_site_url();
405 $admin_email = get_option('admin_email');
406 $wp_version = get_bloginfo('version');
407
408 $admin_user = get_user_by('ID', 1);
409 if ($admin_user) {
410 $first_name = get_user_meta($admin_user->ID, 'first_name', true);
411 $last_name = get_user_meta($admin_user->ID, 'last_name', true);
412
413 $admin_full_name = trim("$first_name $last_name");
414
415 // Fallback to display name if full name is not set
416 if (empty($admin_full_name)) {
417 $admin_full_name = $admin_user->display_name;
418 }
419 } else {
420 $admin_full_name = 'Unknown';
421 }
422
423 $to = 'akash@wpdeveloper.com, rasel@wpdeveloper.com, nahid@wpdeveloper.com, md-nahid-hasan@wpdeveloper.com'; // Replace with the recipient's email
424 $subject = '[IMPORTANT] New feedback received from an EmbedPress user.';
425
426 // HTML Email Template
427 $message = '<html><body style="font-family: Arial, sans-serif; padding: 20px;">';
428 $message .= '<div style="max-width: 600px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin: auto;">';
429 $message .= '<div style="text-align: center; padding-bottom: 20px; border-bottom: 1px solid #ddd">';
430 $message .= '<img src="https://embedpress.com/wp-content/uploads/2025/03/logo.png" alt="EmbedPress" style="max-width: 150px;">';
431 $message .= '</div>';
432 $message .= '<h2 style="font-family: system-ui; color: #333; text-align: center;">Feedback Overview</h2>';
433 $message .= '<table style="font-family: system-ui; width: 100%; border-collapse: collapse; border: 1px solid #ddd">';
434
435 // Email
436 $message .= '<tr><td style="padding: 10px; font-weight: bold; width: 100px; border-bottom: 1px solid #ddd;">Email :</td>';
437 $message .= '<td style="padding: 10px; border-bottom: 1px solid #ddd;"><a href="mailto:' . esc_attr($params['email']) . '">' . esc_html($params['email']) . '</a></td></tr>';
438
439 // Rating
440 $message .= '<tr><td style="padding: 10px; font-weight: bold; width: 100px; border-bottom: 1px solid #ddd;">Rating :</td>';
441 $message .= '<td style="padding: 10px; border-bottom: 1px solid #ddd;">' . esc_html($params['rating']) . ' ⭐️</td></tr>';
442
443 // User
444 $message .= '<tr><td style="padding: 10px; font-weight: bold; width: 100px; border-bottom: 1px solid #ddd;">Name :</td>';
445 $message .= '<td style="padding: 10px; border-bottom: 1px solid #ddd; font-weight: 500;">' . esc_html($admin_full_name) . '</td></tr>';
446
447 // Pack
448 $message .= '<tr><td style="padding: 10px; font-weight: bold; width: 100px; border-bottom: 1px solid #ddd;">Site Url :</td>';
449 $message .= '<td style="padding: 10px; border-bottom: 1px solid #ddd;"><a target="_blank" href="' . esc_url($site_url) . '" style="color: blue;">' . esc_html($site_url) . '</a></td></tr>';
450
451 // Feedback
452 $message .= '<tr><td style="padding: 10px; font-weight: bold; width: 100px; display: flex;">Feedback :</td>';
453 $message .= '<td style="padding: 10px;">' . nl2br(esc_html($params['message'])) . '</td></tr>';
454
455 $message .= '</table>';
456 $message .= '</div></body></html>';
457
458 $headers = [
459 'Content-Type: text/html; charset=UTF-8',
460 'From: ' . esc_html($params['name']) . ' <' . esc_html($params['email']) . '>'
461 ];
462
463 // Send the email
464 $sent = wp_mail($to, $subject, $message, $headers);
465
466 if ($sent) {
467 update_option('embedpress_feedback_submited', true);
468 return new \WP_REST_Response(['message' => 'Email sent successfully!'], 200);
469 } else {
470 return new \WP_REST_Response(['message' => 'Failed to send email.'], 500);
471 }
472 }
473
474
475 public function register_feedback_email_endpoint()
476 {
477 register_rest_route('embedpress/v1', '/send-feedback', [
478 'methods' => 'POST',
479 'callback' => [$this, 'send_user_feedback_email'],
480 'permission_callback' => '__return_true'
481 ]);
482 }
483
484
485
486 /**
487 * Callback called right after the plugin has been activated.
488 *
489 * @return void
490 * @since 1.0.0
491 * @static
492 *
493 */
494 public static function onPluginActivationCallback()
495 {
496 $dirname = wp_get_upload_dir()['basedir'] . '/embedpress';
497 if (!file_exists($dirname)) {
498 mkdir($dirname, 0777);
499 }
500 flush_rewrite_rules();
501 embedpress_schedule_cache_cleanup();
502 }
503
504 /**
505 * Callback called right after the plugin has been deactivated.
506 *
507 * @return void
508 * @since 1.0.0
509 * @static
510 *
511 */
512 public static function onPluginDeactivationCallback()
513 {
514 flush_rewrite_rules();
515 embedpress_cache_cleanup();
516 $timestamp = wp_next_scheduled('embedpress_backup_cleanup_action');
517 if ($timestamp) {
518 wp_unschedule_event($timestamp, 'embedpress_backup_cleanup_action');
519 }
520 }
521
522 /**
523 * Method that retrieves all additional service providers defined in the ~<plugin_root_path>/providers.php file.
524 *
525 * @return array
526 * @since 1.0.0
527 * @static
528 *
529 */
530 public static function getAdditionalServiceProviders()
531 {
532 $additionalProvidersFilePath = EMBEDPRESS_PATH_BASE . 'providers.php';
533 if (file_exists($additionalProvidersFilePath)) {
534 include $additionalProvidersFilePath;
535
536 if (isset($additionalServiceProviders)) {
537 return apply_filters('embedpress_additional_service_providers', $additionalServiceProviders);
538 }
539 }
540
541 return apply_filters('embedpress_additional_service_providers', []);
542 }
543
544 /**
545 * Method that checks if an embed of a given service provider can be responsive.
546 *
547 * @param string $serviceProviderAlias The service's slug.
548 *
549 * @return boolean
550 * @since 1.0.0
551 * @static
552 *
553 */
554 public static function canServiceProviderBeResponsive($serviceProviderAlias)
555 {
556 return in_array($serviceProviderAlias, [
557 "dailymotion",
558 "kickstarter",
559 "rutube",
560 "ted",
561 "vimeo",
562 "youtube",
563 "ustream",
564 "google-docs",
565 "animatron",
566 "amcharts",
567 "on-aol-com",
568 "animoto",
569 "videojug",
570 'issuu',
571 ]);
572 }
573
574 /**
575 * Method that retrieves the plugin settings defined by the user.
576 *
577 * @return object
578 * @since 1.0.0
579 * @static
580 *
581 */
582 public static function getSettings()
583 {
584 // Fetch settings from the database
585 $settings = get_option(EMBEDPRESS_PLG_NAME);
586
587 // If the settings are not an array (it might return false), initialize as an empty array
588 if (!is_array($settings)) {
589 $settings = [];
590 }
591
592 // Default values if settings are missing
593 if (!isset($settings['enablePluginInAdmin'])) {
594 $settings['enablePluginInAdmin'] = true;
595 }
596
597 if (!isset($settings['enablePluginInFront'])) {
598 $settings['enablePluginInFront'] = true;
599 }
600
601 if (!isset($settings['enableGlobalEmbedResize'])) {
602 $settings['enableGlobalEmbedResize'] = false;
603 }
604
605 if (!isset($settings['enableEmbedResizeHeight'])) {
606 $settings['enableEmbedResizeHeight'] = 550; // old 552
607 }
608
609 if (!isset($settings['enableEmbedResizeWidth'])) {
610 $settings['enableEmbedResizeWidth'] = 600; // old 652
611 }
612
613 return (object) $settings;
614 }
615
616 /**
617 * Retrieve all registered plugins.
618 *
619 * @return array
620 * @since 1.4.0
621 * @static
622 *
623 */
624 public static function getPlugins()
625 {
626 return self::$plugins;
627 }
628
629 /**
630 * Handle links displayed below the plugin name in the WordPress Installed Plugins page.
631 *
632 * @return array
633 * @since 1.4.0
634 * @static
635 *
636 */
637 public static function handleActionLinks($links, $file)
638 {
639 $settingsLink = '<a href="' . admin_url('admin.php?page=embedpress') . '" aria-label="' . __(
640 'Open settings page',
641 'embedpress'
642 ) . '">' . __('Settings', 'embedpress') . '</a>';
643
644 array_unshift($links, $settingsLink);
645 if (!apply_filters('embedpress/is_allow_rander', false)) {
646 $links[] = '<a href="https://wpdeveloper.com/in/upgrade-embedpress" target="_blank" class="embedpress-go-pro-action" style="color: green">' . __('Go Pro', 'embedpress') . '</a>';
647 }
648 return $links;
649 }
650
651
652 /**
653 * Method that ensures the API's url are whitelisted to WordPress external requests.
654 *
655 * @param boolean $isAllowed
656 * @param string $host
657 * @param string $url
658 *
659 * @return boolean
660 * @since 1.4.0
661 * @static
662 *
663 */
664 public static function allowApiHost($isAllowed, $host, $url)
665 {
666 if ($host === EMBEDPRESS_LICENSES_API_HOST) {
667 $isAllowed = true;
668 }
669
670 return $isAllowed;
671 }
672
673 public function extended_mime_types($mimes)
674 {
675 $mimes['ppsx'] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
676 return $mimes;
677 }
678 }
679