AMP
2 years ago
Elementor
1 year ago
Ends
1 year ago
Includes
1 year ago
Plugins
2 years ago
Providers
1 year ago
ThirdParty
2 years ago
AutoLoader.php
2 years ago
Compatibility.php
2 years ago
Core.php
2 years ago
CoreLegacy.php
4 years ago
DisablerLegacy.php
2 years ago
Loader.php
2 years ago
RestAPI.php
2 years ago
Shortcode.php
1 year ago
index.html
7 years ago
simple_html_dom.php
4 years ago
Core.php
557 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 | use Shared; |
| 24 | |
| 25 | /** |
| 26 | * The name of the plugin. |
| 27 | * |
| 28 | * @since 1.0.0 |
| 29 | * @access protected |
| 30 | * |
| 31 | * @var string $pluginName The name of the plugin. |
| 32 | */ |
| 33 | protected $pluginName; |
| 34 | |
| 35 | /** |
| 36 | * The version of the plugin. |
| 37 | * |
| 38 | * @since 1.0.0 |
| 39 | * @access protected |
| 40 | * |
| 41 | * @var string $pluginVersion The version of the plugin. |
| 42 | */ |
| 43 | protected $pluginVersion; |
| 44 | |
| 45 | /** |
| 46 | * An instance of the plugin loader. |
| 47 | * |
| 48 | * @since 1.0.0 |
| 49 | * @access protected |
| 50 | * |
| 51 | * @var Loader $pluginVersion The version of the plugin. |
| 52 | */ |
| 53 | protected $loaderInstance; |
| 54 | |
| 55 | /** |
| 56 | * An associative array storing all registered/active EmbedPress plugins and their namespaces. |
| 57 | * |
| 58 | * @since 1.4.0 |
| 59 | * @access private |
| 60 | * @static |
| 61 | * |
| 62 | * @var array |
| 63 | */ |
| 64 | private static $plugins = []; |
| 65 | |
| 66 | /** |
| 67 | * Initialize the plugin and set its properties. |
| 68 | * |
| 69 | * @return void |
| 70 | * @since 1.0.0 |
| 71 | * |
| 72 | */ |
| 73 | public function __construct () { |
| 74 | $this->pluginName = EMBEDPRESS_PLG_NAME; |
| 75 | $this->pluginVersion = EMBEDPRESS_VERSION; |
| 76 | |
| 77 | $this->loaderInstance = new Loader(); |
| 78 | |
| 79 | add_action('admin_notices',[$this,'embedpress_admin_notice']); |
| 80 | |
| 81 | add_filter('upload_mimes', [$this, 'extended_mime_types']); |
| 82 | |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Method that retrieves the plugin name. |
| 87 | * |
| 88 | * @return string |
| 89 | * @since 1.0.0 |
| 90 | * |
| 91 | */ |
| 92 | public function getPluginName () { |
| 93 | return $this->pluginName; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Method that retrieves the plugin version. |
| 98 | * |
| 99 | * @return string |
| 100 | * @since 1.0.0 |
| 101 | * |
| 102 | */ |
| 103 | public function getPluginVersion () { |
| 104 | return $this->pluginVersion; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * Method that retrieves the loader instance. |
| 109 | * |
| 110 | * @return Loader |
| 111 | * @since 1.0.0 |
| 112 | * |
| 113 | */ |
| 114 | public function getLoader () { |
| 115 | return $this->loaderInstance; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Method responsible to connect all required hooks in order to make the plugin work. |
| 120 | * |
| 121 | * @return void |
| 122 | * @since 1.0.0 |
| 123 | * |
| 124 | */ |
| 125 | public function initialize () { |
| 126 | global $wp_actions; |
| 127 | add_filter('oembed_providers', [$this, 'addOEmbedProviders']); |
| 128 | add_action('rest_api_init', [$this, 'registerOEmbedRestRoutes']); |
| 129 | |
| 130 | $this->start_plugin_tracking(); |
| 131 | |
| 132 | if (is_admin()) { |
| 133 | new EmbedpressSettings(); |
| 134 | $plgSettings = self::getSettings(); |
| 135 | $this->admin_notice(); |
| 136 | add_filter('plugin_action_links_embedpress/embedpress.php', ['\\EmbedPress\\Core', 'handleActionLinks'], 10, |
| 137 | 2); |
| 138 | |
| 139 | add_action('admin_enqueue_scripts', ['\\EmbedPress\\Ends\\Back\\Handler', 'enqueueStyles']); |
| 140 | add_action('wp_ajax_embedpress_notice_dismiss', ['\\EmbedPress\\Ends\\Back\\Handler', 'embedpress_notice_dismiss']); |
| 141 | |
| 142 | $plgHandlerAdminInstance = new EndHandlerAdmin($this->getPluginName(), $this->getPluginVersion()); |
| 143 | |
| 144 | if ( $plgSettings->enablePluginInAdmin ) { |
| 145 | $this->loaderInstance->add_action('admin_enqueue_scripts', $plgHandlerAdminInstance, 'enqueueScripts'); |
| 146 | } |
| 147 | |
| 148 | } else { |
| 149 | $plgHandlerPublicInstance = new EndHandlerPublic($this->getPluginName(), $this->getPluginVersion()); |
| 150 | |
| 151 | $this->loaderInstance->add_action('wp_enqueue_scripts', $plgHandlerPublicInstance, 'enqueueScripts'); |
| 152 | $this->loaderInstance->add_action('wp_enqueue_scripts', $plgHandlerPublicInstance, 'enqueueStyles'); |
| 153 | |
| 154 | unset($plgHandlerPublicInstance); |
| 155 | } |
| 156 | |
| 157 | // Add support for embeds on AMP pages |
| 158 | add_filter('pp_embed_parsed_content', ['\\EmbedPress\\AMP\\EmbedHandler', 'processParsedContent'], 10, 3); |
| 159 | |
| 160 | // Add support for our embeds on Beaver Builder. Without this it only run the native embeds. |
| 161 | add_filter('fl_builder_before_render_shortcodes', |
| 162 | ['\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes']); |
| 163 | $this->loaderInstance->run(); |
| 164 | |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * @param $providers |
| 169 | * |
| 170 | * @return mixed |
| 171 | */ |
| 172 | public function addOEmbedProviders ($providers) { |
| 173 | $newProviders = [ |
| 174 | // Viddler |
| 175 | '#https?://(.+\.)?viddler\.com/v/.+#i' => 'viddler', |
| 176 | |
| 177 | // Deviantart.com (http://www.deviantart.com) |
| 178 | // '#https?://(.+\.)?deviantart\.com/art/.+#i' => 'devianart', |
| 179 | // '#https?://(.+\.)?deviantart\.com/.+#i' => 'devianart', |
| 180 | // '#https?://(.+\.)?deviantart\.com/.*/d.+#i' => 'devianart', |
| 181 | // '#https?://(.+\.)?fav\.me/.+#i' => 'devianart', |
| 182 | // '#https?://(.+\.)?sta\.sh/.+#i' => 'devianart', |
| 183 | |
| 184 | // chirbit.com (http://www.chirbit.com/) |
| 185 | //'#https?://(.+\.)?chirb\.it/.+#i' => 'chirbit', |
| 186 | |
| 187 | |
| 188 | // nfb.ca (http://www.nfb.ca/) |
| 189 | //'#https?://(.+\.)?nfb\.ca/film/.+#i' => 'nfb', |
| 190 | |
| 191 | // Dotsub (http://dotsub.com/) |
| 192 | //'#https?://(.+\.)?dotsub\.com/view/.+#i' => 'dotsub', |
| 193 | |
| 194 | // Rdio (http://rdio.com/) |
| 195 | '#https?://(.+\.)?rdio\.com/(artist|people)/.+#i' => 'rdio', |
| 196 | |
| 197 | // Sapo Videos (http://videos.sapo.pt) |
| 198 | //'#https?://(.+\.)?videos\.sapo\.pt/.+#i' => 'sapo', |
| 199 | |
| 200 | // Official FM (http://official.fm) |
| 201 | '#https?://(.+\.)?official\.fm/(tracks|playlists)/.+#i' => 'officialfm', |
| 202 | |
| 203 | // HuffDuffer (http://huffduffer.com) |
| 204 | //'#https?://(.+\.)?huffduffer\.com/.+#i' => 'huffduffer', |
| 205 | |
| 206 | // Shoudio (http://shoudio.com) |
| 207 | //'#https?://(.+\.)?shoudio\.(com|io)/.+#i' => 'shoudio', |
| 208 | |
| 209 | // Moby Picture (http://www.mobypicture.com) |
| 210 | '#https?://(.+\.)?mobypicture\.com/user/.+/view/.+#i' => 'mobypicture', |
| 211 | '#https?://(.+\.)?moby\.to/.+#i' => 'mobypicture', |
| 212 | |
| 213 | // 23HQ (http://www.23hq.com) |
| 214 | //'#https?://(.+\.)?23hq\.com/.+/photo/.+#i' => '23hq', |
| 215 | |
| 216 | // Cacoo (https://cacoo.com) |
| 217 | '#https?://(.+\.)?cacoo\.com/diagrams/.+#i' => 'cacoo', |
| 218 | |
| 219 | // Dipity (http://www.dipity.com) |
| 220 | '#https?://(.+\.)?dipity\.com/.+#i' => 'dipity', |
| 221 | |
| 222 | // Roomshare (http://roomshare.jp) |
| 223 | //'#https?://(.+\.)?roomshare\.jp/(en/)?post/.+#i' => 'roomshare', |
| 224 | |
| 225 | // Crowd Ranking (http://crowdranking.com) |
| 226 | '#https?://(.+\.)?c9ng\.com/.+#i' => 'crowd', |
| 227 | |
| 228 | // CircuitLab (https://www.circuitlab.com/) |
| 229 | //'#https?://(.+\.)?circuitlab\.com/circuit/.+#i' => 'circuitlab', |
| 230 | |
| 231 | // Coub (http://coub.com/) |
| 232 | //'#https?://(.+\.)?coub\.com/(view|embed)/.+#i' => 'coub', |
| 233 | |
| 234 | // Ustream (http://www.ustream.tv) |
| 235 | //'#https?://(.+\.)?ustream\.(tv|com)/.+#i' => 'ustream', |
| 236 | |
| 237 | // Daily Mile (http://www.dailymile.com) |
| 238 | '#https?://(.+\.)?dailymile\.com/people/.+/entries/.+#i' => 'daily', |
| 239 | |
| 240 | // Sketchfab (http://sketchfab.com) |
| 241 | '#https?://(.+\.)?sketchfab\.com/models/.+#i' => 'sketchfab', |
| 242 | '#https?://(.+\.)?sketchfab\.com/.+/folders/.+#i' => 'sketchfab', |
| 243 | |
| 244 | // AudioSnaps (http://audiosnaps.com) |
| 245 | '#https?://(.+\.)?audiosnaps\.com/k/.+#i' => 'audiosnaps', |
| 246 | |
| 247 | // RapidEngage (https://rapidengage.com) |
| 248 | '#https?://(.+\.)?rapidengage\.com/s/.+#i' => 'rapidengage', |
| 249 | |
| 250 | // Getty Images (http://www.gettyimages.com/) |
| 251 | //'#https?://(.+\.)?gty\.im/.+#i' => 'gettyimages', |
| 252 | //'#https?://(.+\.)?gettyimages\.com/detail/photo/.+#i' => 'gettyimages', |
| 253 | |
| 254 | // amCharts Live Editor (http://live.amcharts.com/) |
| 255 | //'#https?://(.+\.)?live\.amcharts\.com/.+#i' => 'amcharts', |
| 256 | |
| 257 | // Infogram (https://infogr.am/) |
| 258 | //'#https?://(.+\.)?infogr\.am/.+#i' => 'infogram', |
| 259 | //(https://infogram.com/) |
| 260 | //'#https?://(.+\.)?infogram\.com/.+#i' => 'infogram', |
| 261 | |
| 262 | // ChartBlocks (http://www.chartblocks.com/) |
| 263 | //'#https?://(.+\.)?public\.chartblocks\.com/c/.+#i' => 'chartblocks', |
| 264 | |
| 265 | // ReleaseWire (http://www.releasewire.com/) |
| 266 | //'#https?://(.+\.)?rwire\.com/.+#i' => 'releasewire', |
| 267 | |
| 268 | // ShortNote (https://www.shortnote.jp/) |
| 269 | //'#https?://(.+\.)?shortnote\.jp/view/notes/.+#i' => 'shortnote', |
| 270 | |
| 271 | // EgliseInfo (http://egliseinfo.catholique.fr/) |
| 272 | '#https?://(.+\.)?egliseinfo\.catholique\.fr/.+#i' => 'egliseinfo', |
| 273 | |
| 274 | // Silk (http://www.silk.co/) |
| 275 | '#https?://(.+\.)?silk\.co/explore/.+#i' => 'silk', |
| 276 | '#https?://(.+\.)?silk\.co/s/embed/.+#i' => 'silk', |
| 277 | |
| 278 | // http://bambuser.com |
| 279 | '#https?://(.+\.)?bambuser\.com/v/.+#i' => 'bambuser', |
| 280 | |
| 281 | // https://clyp.it |
| 282 | //'#https?://(.+\.)?clyp\.it/.+#i' => 'clyp', |
| 283 | |
| 284 | // https://gist.github.com |
| 285 | // '#https?://(.+\.)?gist\.github\.com/.+#i' => 'github', |
| 286 | |
| 287 | // https://portfolium.com |
| 288 | //'#https?://(.+\.)?portfolium\.com/.+#i' => 'portfolium', |
| 289 | |
| 290 | // http://rutube.ru |
| 291 | '#https?://(.+\.)?rutube\.ru/video/.+#i' => 'rutube', |
| 292 | |
| 293 | // http://www.videojug.com |
| 294 | '#https?://(.+\.)?videojug\.com/.+#i' => 'videojug', |
| 295 | |
| 296 | // https://vine.com |
| 297 | //'#https?://(.+\.)?vine\.co/v/.+#i' => 'vine', |
| 298 | |
| 299 | // Google Shortened Url |
| 300 | '#https?://(.+\.)?goo\.gl/.+#i' => 'google', |
| 301 | |
| 302 | // Google Maps |
| 303 | //'#https?://(.+\.)?google\.com/maps/.+#i' => 'googlemaps', |
| 304 | //'#https?://(.+\.)?maps\.google\.com/.+#i' => 'googlemaps', |
| 305 | |
| 306 | // Google Docs |
| 307 | //'#https?://(.+\.)?docs\.google\.com/(.+/)?(document|presentation|spreadsheets|forms|drawings)/.+#i' => 'googledocs', |
| 308 | |
| 309 | // Twitch.tv |
| 310 | //'#https?://(.+\.)?twitch\.tv/.+#i' => 'twitch', |
| 311 | |
| 312 | // Giphy |
| 313 | //'#https?://(.+\.)?giphy\.com/gifs/.+#i' => 'giphy', |
| 314 | //'#https?://(.+\.)?i\.giphy\.com/.+#i' => 'giphy', |
| 315 | //'#https?://(.+\.)?gph\.is/.+#i' => 'giphy', |
| 316 | |
| 317 | // Wistia |
| 318 | //'#https?://(.+\.)?wistia\.com/medias/.+#i' => 'wistia', |
| 319 | //'#https?://(.+\.)?fast\.wistia\.com/embed/medias/.+#i\.jsonp' => 'wistia', |
| 320 | ]; |
| 321 | |
| 322 | /** |
| 323 | * ======================================== |
| 324 | * Make sure the $wp_write global is set. |
| 325 | * This fix compatibility with JetPack, Classical Editor and Disable Gutenberg. JetPack makes |
| 326 | * the oembed_providers filter be called and this activates our class too, but one dependency |
| 327 | * of the rest_url method is not loaded yet. |
| 328 | */ |
| 329 | global $wp_rewrite; |
| 330 | |
| 331 | if (!class_exists('\\WP_Rewrite')) { |
| 332 | $path = ABSPATH.WPINC.'/class-wp-rewrite.php'; |
| 333 | if (file_exists($path)) { |
| 334 | require_once $path; |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | if (!is_object($wp_rewrite)) { |
| 339 | $wp_rewrite = new \WP_Rewrite(); |
| 340 | $_GLOBALS['wp_write'] = $wp_rewrite; |
| 341 | } |
| 342 | /*========================================*/ |
| 343 | |
| 344 | foreach ($newProviders as $url => &$data) { |
| 345 | $data = [ |
| 346 | rest_url('embedpress/v1/oembed/'.$data), |
| 347 | true, |
| 348 | ]; |
| 349 | } |
| 350 | |
| 351 | $providers = array_merge($providers, $newProviders); |
| 352 | |
| 353 | return $providers; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Register OEmbed Rest Routes |
| 358 | */ |
| 359 | public function registerOEmbedRestRoutes () { |
| 360 | register_rest_route( |
| 361 | 'embedpress/v1', '/oembed/(?P<provider>[a-zA-Z0-9\-]+)', |
| 362 | [ |
| 363 | 'methods' => \WP_REST_Server::READABLE, |
| 364 | 'callback' => ['\\EmbedPress\\RestAPI', 'oembed'], |
| 365 | 'permission_callback' => '__return_true', |
| 366 | ] |
| 367 | ); |
| 368 | register_rest_route( |
| 369 | 'embedpress/v1', '/oembed/(?P<provider>[a-zA-Z0-9\-]+)', |
| 370 | [ |
| 371 | 'methods' => \WP_REST_Server::CREATABLE, |
| 372 | 'callback' => ['\\EmbedPress\\RestAPI', 'oembed'], |
| 373 | 'permission_callback' => '__return_true', |
| 374 | ] |
| 375 | ); |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * Callback called right after the plugin has been activated. |
| 380 | * |
| 381 | * @return void |
| 382 | * @since 1.0.0 |
| 383 | * @static |
| 384 | * |
| 385 | */ |
| 386 | public static function onPluginActivationCallback () { |
| 387 | $dirname = wp_get_upload_dir()['basedir'].'/embedpress'; |
| 388 | if (!file_exists($dirname)) { |
| 389 | mkdir($dirname, 0777); |
| 390 | } |
| 391 | flush_rewrite_rules(); |
| 392 | embedpress_schedule_cache_cleanup(); |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * Callback called right after the plugin has been deactivated. |
| 397 | * |
| 398 | * @return void |
| 399 | * @since 1.0.0 |
| 400 | * @static |
| 401 | * |
| 402 | */ |
| 403 | public static function onPluginDeactivationCallback () { |
| 404 | flush_rewrite_rules(); |
| 405 | embedpress_cache_cleanup(); |
| 406 | $timestamp = wp_next_scheduled( 'embedpress_backup_cleanup_action' ); |
| 407 | if ( $timestamp ) { |
| 408 | wp_unschedule_event( $timestamp, 'embedpress_backup_cleanup_action' ); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | /** |
| 413 | * Method that retrieves all additional service providers defined in the ~<plugin_root_path>/providers.php file. |
| 414 | * |
| 415 | * @return array |
| 416 | * @since 1.0.0 |
| 417 | * @static |
| 418 | * |
| 419 | */ |
| 420 | public static function getAdditionalServiceProviders () { |
| 421 | $additionalProvidersFilePath = EMBEDPRESS_PATH_BASE.'providers.php'; |
| 422 | if (file_exists($additionalProvidersFilePath)) { |
| 423 | include $additionalProvidersFilePath; |
| 424 | |
| 425 | if (isset($additionalServiceProviders)) { |
| 426 | return apply_filters( 'embedpress_additional_service_providers', $additionalServiceProviders); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | return apply_filters( 'embedpress_additional_service_providers', []); |
| 431 | |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Method that checks if an embed of a given service provider can be responsive. |
| 436 | * |
| 437 | * @param string $serviceProviderAlias The service's slug. |
| 438 | * |
| 439 | * @return boolean |
| 440 | * @since 1.0.0 |
| 441 | * @static |
| 442 | * |
| 443 | */ |
| 444 | public static function canServiceProviderBeResponsive ($serviceProviderAlias) { |
| 445 | return in_array($serviceProviderAlias, [ |
| 446 | "dailymotion", |
| 447 | "kickstarter", |
| 448 | "rutube", |
| 449 | "ted", |
| 450 | "vimeo", |
| 451 | "youtube", |
| 452 | "ustream", |
| 453 | "google-docs", |
| 454 | "animatron", |
| 455 | "amcharts", |
| 456 | "on-aol-com", |
| 457 | "animoto", |
| 458 | "videojug", |
| 459 | 'issuu', |
| 460 | ]); |
| 461 | } |
| 462 | |
| 463 | /** |
| 464 | * Method that retrieves the plugin settings defined by the user. |
| 465 | * |
| 466 | * @return object |
| 467 | * @since 1.0.0 |
| 468 | * @static |
| 469 | * |
| 470 | */ |
| 471 | public static function getSettings () { |
| 472 | $settings = get_option(EMBEDPRESS_PLG_NAME); |
| 473 | |
| 474 | if (!isset($settings['enablePluginInAdmin'])) { |
| 475 | $settings['enablePluginInAdmin'] = true; |
| 476 | } |
| 477 | |
| 478 | if (!isset($settings['enablePluginInFront'])) { |
| 479 | $settings['enablePluginInFront'] = true; |
| 480 | } |
| 481 | |
| 482 | if (!isset($settings['enableGlobalEmbedResize'])) { |
| 483 | $settings['enableGlobalEmbedResize'] = false; |
| 484 | } |
| 485 | |
| 486 | if (!isset($settings['enableEmbedResizeHeight'])) { |
| 487 | $settings['enableEmbedResizeHeight'] = 550; // old 552 |
| 488 | } |
| 489 | |
| 490 | if (!isset($settings['enableEmbedResizeWidth'])) { |
| 491 | $settings['enableEmbedResizeWidth'] = 600; // old 652 |
| 492 | } |
| 493 | |
| 494 | return (object) $settings; |
| 495 | } |
| 496 | |
| 497 | |
| 498 | /** |
| 499 | * Retrieve all registered plugins. |
| 500 | * |
| 501 | * @return array |
| 502 | * @since 1.4.0 |
| 503 | * @static |
| 504 | * |
| 505 | */ |
| 506 | public static function getPlugins () { |
| 507 | return self::$plugins; |
| 508 | } |
| 509 | |
| 510 | /** |
| 511 | * Handle links displayed below the plugin name in the WordPress Installed Plugins page. |
| 512 | * |
| 513 | * @return array |
| 514 | * @since 1.4.0 |
| 515 | * @static |
| 516 | * |
| 517 | */ |
| 518 | public static function handleActionLinks($links, $file) |
| 519 | { |
| 520 | $settingsLink = '<a href="' . admin_url('admin.php?page=embedpress') . '" aria-label="' . __('Open settings page', |
| 521 | 'embedpress') . '">' . __('Settings', 'embedpress') . '</a>'; |
| 522 | |
| 523 | array_unshift($links, $settingsLink); |
| 524 | if ( !is_embedpress_pro_active() ) { |
| 525 | $links[] = '<a href="https://wpdeveloper.com/in/upgrade-embedpress" target="_blank" class="embedpress-go-pro-action" style="color: green">'.__('Go Pro', 'embedpress').'</a>'; |
| 526 | } |
| 527 | return $links; |
| 528 | } |
| 529 | |
| 530 | |
| 531 | /** |
| 532 | * Method that ensures the API's url are whitelisted to WordPress external requests. |
| 533 | * |
| 534 | * @param boolean $isAllowed |
| 535 | * @param string $host |
| 536 | * @param string $url |
| 537 | * |
| 538 | * @return boolean |
| 539 | * @since 1.4.0 |
| 540 | * @static |
| 541 | * |
| 542 | */ |
| 543 | public static function allowApiHost ($isAllowed, $host, $url) { |
| 544 | if ($host === EMBEDPRESS_LICENSES_API_HOST) { |
| 545 | $isAllowed = true; |
| 546 | } |
| 547 | |
| 548 | return $isAllowed; |
| 549 | } |
| 550 | |
| 551 | public function extended_mime_types( $mimes ) { |
| 552 | $mimes['ppsx'] = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'; |
| 553 | return $mimes; |
| 554 | } |
| 555 | |
| 556 | } |
| 557 |