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