PluginProbe
Embed Privacy / 0.1
Embed Privacy v0.1
1.14.0 1.13.0 trunk 0.1 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.10.1 1.10.10 1.10.2 1.10.3 1.10.4 1.10.5 1.10.6 1.10.7 1.10.8 1.10.9 1.11.0 1.11.1 1.11.2 All 68 releases
← All changes | inc/class-embed-privacy.php +76 -1191 1.10.10 → 0.1 View file →
@@ -1,160 +1,33 @@
1 1 <?php
2 2 namespace epiphyt\Embed_Privacy;
3 3
4 -use epiphyt\Embed_Privacy\admin\Fields;
5 -use epiphyt\Embed_Privacy\admin\Settings;
6 -use epiphyt\Embed_Privacy\admin\User_Interface;
7 -use epiphyt\Embed_Privacy\data\Providers;
8 -use epiphyt\Embed_Privacy\data\Replacer;
9 -use epiphyt\Embed_Privacy\embed\Replacement;
10 -use epiphyt\Embed_Privacy\embed\Template;
11 -use epiphyt\Embed_Privacy\handler\Post;
12 -use epiphyt\Embed_Privacy\handler\Shortcode;
13 -use epiphyt\Embed_Privacy\handler\Theme;
14 -use epiphyt\Embed_Privacy\handler\Widget;
15 -use epiphyt\Embed_Privacy\integration\Activitypub;
16 -use epiphyt\Embed_Privacy\integration\Amp;
17 -use epiphyt\Embed_Privacy\integration\Astra;
18 -use epiphyt\Embed_Privacy\integration\Divi;
19 -use epiphyt\Embed_Privacy\integration\Elementor;
20 -use epiphyt\Embed_Privacy\integration\Instagram_Feed;
21 -use epiphyt\Embed_Privacy\integration\Jetpack;
22 -use epiphyt\Embed_Privacy\integration\Kadence_Blocks;
23 -use epiphyt\Embed_Privacy\integration\Maps_Marker;
24 -use epiphyt\Embed_Privacy\integration\Polylang;
25 -use epiphyt\Embed_Privacy\integration\Shortcodes_Ultimate;
26 -use epiphyt\Embed_Privacy\integration\X;
27 -use epiphyt\Embed_Privacy\thumbnail\Thumbnail;
28 -use ReflectionMethod;
29 -
30 4 /**
31 5 * Two click embed main class.
32 6 *
33 - * @author Epiphyt
34 - * @license GPL2
35 - * @package epiphyt\Embed_Privacy
7 + * @author Epiphyt
8 + * @license GPL2
9 + * @package epiphyt\Embed_Privacy
10 + * @version 0.1
36 11 */
37 12 class Embed_Privacy {
38 13 /**
39 - * @deprecated 1.2.0
40 - * @since 1.1.0
41 - */
42 - const IFRAME_REGEX = '/<iframe(.*?)src="([^"]+)"([^>]*)>((?!<\/iframe).)*<\/iframe>/ms';
43 -
44 - /**
45 - * @since 1.4.0
46 - * @var mixed The cookie content or any error message from json_decode()
47 - */
48 - private $cookie;
49 -
50 - /**
51 - * @since 1.3.5
52 - * @var array Replacements that already have taken place.
53 - */
54 - public $did_replacements = [];
55 -
56 - /**
57 - * @since 1.3.0
58 - * @var array An array of embed providers
59 - */
60 - public $embeds = [];
61 -
62 - /**
63 - * @since 1.10.0
64 - * @var \epiphyt\Embed_Privacy\admin\Fields
65 - */
66 - public $fields;
67 -
68 - /**
69 - * @since 1.10.0
70 - * @var \epiphyt\Embed_Privacy\Frontend
71 - */
72 - public $frontend;
73 -
74 - /**
75 - * @since 1.3.0
76 - * @var bool Whether the current request has any embed processed by Embed Privacy
77 - */
78 - public $has_embed = false;
79 -
80 - /**
81 - * @since 1.10.0
82 - * @var array List of integrations
83 - */
84 - private $integrations = [
85 - Activitypub::class,
86 - Amp::class,
87 - Astra::class,
88 - Divi::class,
89 - Elementor::class,
90 - Instagram_Feed::class,
91 - Jetpack::class,
92 - Kadence_Blocks::class,
93 - Maps_Marker::class,
94 - Polylang::class,
95 - Shortcodes_Ultimate::class,
96 - X::class,
97 - ];
98 -
99 - /**
100 - * @since 1.10.0
101 - * @var bool Whether the current request should be ignored
102 - */
103 - public $is_ignored_request = false;
104 -
105 - /**
106 - * @var \epiphyt\Embed_Privacy\Embed_Privacy
107 - */
108 - public static $instance;
109 -
110 - /**
111 - * @deprecated 1.10.0 Use \EPI_EMBED_PRIVACY_FILE instead
112 - * @var string The full path to the main plugin file
113 - */
114 - public $plugin_file = '';
115 -
116 - /**
117 - * @since 1.10.0
118 - * @var \epiphyt\Embed_Privacy\handler\Shortcode
119 - */
120 - public $shortcode;
121 -
122 - /**
123 - * @deprecated 1.10.0
124 - * @var array Style properties
125 - */
126 - public $style = [
127 - 'container' => [],
128 - 'global' => [],
129 - ];
130 -
131 - /**
132 - * @var \epiphyt\Embed_Privacy\thumbnail\Thumbnail
133 - */
134 - public $thumbnail;
135 -
136 - /**
137 14 * @var bool Determine if we use the cache
138 15 */
139 - public $use_cache;
16 + private $usecache = false;
140 17
141 18 /**
142 - * @deprecated 1.2.0
143 - * @var array The supported media providers
19 + * @var array The supported media providers
144 20 */
145 - public $embed_providers = [ // phpcs:ignore SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys.IncorrectKeyOrder
146 - '.amazon.' => 'Amazon Kindle',
147 - '.amzn.' => 'Amazon Kindle',
148 - 'a.co' => 'Amazon Kindle',
149 - 'z.cn' => 'Amazon Kindle',
21 + public $embed_providers = [
150 22 'animoto.com' => 'Animoto',
151 23 'cloudup.com' => 'Cloudup',
152 - 'crowdsignal.com' => 'Crowdsignal',
24 + 'collegehumor.com' => 'CollegeHumor',
153 25 'dailymotion.com' => 'DailyMotion',
154 26 'facebook.com' => 'Facebook',
155 27 'flickr.com' => 'Flickr',
156 28 'funnyordie.com' => 'Funny Or Die',
29 + 'hulu.com' => 'Hulu',
157 30 'imgur.com' => 'Imgur',
158 31 'instagram.com' => 'Instagram',
159 32 'issuu.com' => 'Issuu',
160 33 'kickstarter.com' => 'Kickstarter',
@@ -160,25 +33,22 @@
160 33 'kickstarter.com' => 'Kickstarter',
161 34 'meetup.com' => 'Meetup',
162 35 'mixcloud.com' => 'Mixcloud',
163 36 'photobucket.com' => 'Photobucket',
164 - 'poll.fm' => 'Crowdsignal',
165 - 'polldaddy.com' => 'Crowdsignal',
37 + 'polldaddy.com' => 'Polldaddy.com',
166 38 'reddit.com' => 'Reddit',
167 39 'reverbnation.com' => 'ReverbNation',
168 40 'scribd.com' => 'Scribd',
169 41 'sketchfab.com' => 'Sketchfab',
170 - 'slideshare.net' => 'SlideShare',
42 + 'slideshare.com' => 'SlideShare',
171 43 'smugmug.com' => 'SmugMug',
172 44 'soundcloud.com' => 'SoundCloud',
173 45 'speakerdeck.com' => 'Speaker Deck',
174 46 'spotify.com' => 'Spotify',
175 - 'survey.fm' => 'Crowdsignal',
176 - 'tiktok.com' => 'TikTok',
177 47 'ted.com' => 'TED',
178 48 'tumblr.com' => 'Tumblr',
179 49 'twitter.com' => 'Twitter',
180 - 'videopress.com' => 'VideoPress',
50 + 'videopress.com' => 'VideoPres',
181 51 'vimeo.com' => 'Vimeo',
182 52 'wordpress.org/plugins' => 'WordPress.org',
183 53 'wordpress.tv' => 'WordPress.tv',
184 54 'youtu.be' => 'YouTube',
@@ -188,1102 +58,117 @@
188 58 /**
189 59 * Embed Privacy constructor.
190 60 */
191 61 public function __construct() {
192 - $this->fields = new Fields();
193 - $this->frontend = new Frontend();
194 - $this->shortcode = new Shortcode();
195 - $this->thumbnail = new Thumbnail();
196 - $this->use_cache = ! \is_admin();
197 - }
198 -
199 - /**
200 - * Initialize the class.
201 - *
202 - * @since 1.2.0
203 - */
204 - public function init() {
205 62 // actions
206 - \add_action( 'init', [ $this, 'load_textdomain' ], 0 );
207 - \add_action( 'init', [ self::class, 'register_post_type' ], 5 );
208 - \add_action( 'plugins_loaded', [ $this, 'init_integrations' ] );
209 - \add_action( 'save_post_epi_embed', [ $this, 'preserve_backslashes' ] );
210 - \add_filter( 'template_include', [ $this, 'set_ignored_request_in_template_include' ], 100 );
63 + \add_action( 'init', [ $this, 'load_textdomain' ] );
64 + \add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_assets' ] );
211 65
66 + $this->usecache = ! \is_admin();
67 +
212 68 // filters
213 - if ( ! $this->use_cache ) {
69 + if ( ! $this->usecache ) {
214 70 // set ttl to 0 in admin
215 - \add_filter( 'oembed_ttl', '__return_zero' );
71 + \add_filter( 'oembed_ttl', function( $time ) {
72 + return 0;
73 + }, 10, 1 );
216 74 }
217 75
218 - Migration::get_instance()->init();
219 - Post::init();
220 - Providers::get_instance()->init();
221 - Settings::init();
222 - User_Interface::init();
223 - Widget::init();
224 - $this->fields->init();
225 - $this->frontend->init();
226 - $this->shortcode->init();
227 - $this->thumbnail->init();
76 + \add_filter( 'embed_oembed_html', [ $this, 'replace_embeds' ], 10, 3 );
228 77 }
229 78
230 79 /**
231 - * Initialize all integrations, if necessary.
232 - */
233 - public function init_integrations() {
234 - /**
235 - * Filter the integrations.
236 - *
237 - * @since 1.10.0
238 - *
239 - * @param array $integrations List of integrations
240 - */
241 - $this->integrations = (array) \apply_filters( 'embed_privacy_integrations', $this->integrations );
242 -
243 - foreach ( $this->integrations as $integration ) {
244 - if ( ! \method_exists( $integration, 'init' ) ) {
245 - continue;
246 - }
247 -
248 - $reflection = new ReflectionMethod( $integration, 'init' );
249 -
250 - if ( $reflection->isStatic() ) {
251 - $integration::init();
252 - }
253 - else {
254 - ( new $integration() )->init(); // phpcs:ignore NeutronStandard.Functions.VariableFunctions.VariableFunction
255 - }
256 - }
257 - }
258 -
259 - /**
260 80 * Embeds are cached in the postmeta database table and need to be removed
261 81 * whenever the plugin will be enabled or disabled.
262 - *
263 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\handler\Post::clear_embed_cache() instead
264 82 */
265 83 public function clear_embed_cache() {
266 - \_doing_it_wrong(
267 - __METHOD__,
268 - \sprintf(
269 - /* translators: alternative method */
270 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
271 - 'epiphyt\Embed_Privacy\handler\Post::clear_embed_cache()'
272 - ),
273 - '1.10.0'
274 - );
275 - Post::clear_embed_cache();
276 - }
277 -
278 - /**
279 - * Deregister assets.
280 - *
281 - * @deprecated 1.10.0
282 - * @since 1.4.6
283 - */
284 - public function deregister_assets() {
285 - \_doing_it_wrong(
286 - __METHOD__,
287 - \esc_html__( 'This method is outdated and will be removed in the future.', 'embed-privacy' ),
288 - '1.10.0'
289 - );
290 - }
291 -
292 - /**
293 - * Enqueue our assets for the frontend.
294 - *
295 - * @deprecated 1.4.4 Use epiphyt\Embed_Privacy\Frontend::print_assets() instead
296 - */
297 - public function enqueue_assets() {
298 - \_doing_it_wrong(
299 - __METHOD__,
300 - \sprintf(
301 - /* translators: alternative method */
302 - \esc_html__( 'Use %s instead.', 'embed-privacy' ),
303 - 'epiphyt\Embed_Privacy\Frontend::print_assets()'
304 - ),
305 - '1.4.4'
306 - );
307 - }
308 -
309 - /**
310 - * Get the Embed Privacy cookie.
311 - *
312 - * @return mixed The content of the cookie
313 - */
314 - public function get_cookie() {
315 - if ( empty( $_COOKIE['embed-privacy'] ) ) {
316 - return '';
317 - }
84 + global $wpdb;
318 85
319 - if ( ! empty( $this->cookie ) ) {
320 - return $this->cookie;
321 - }
86 + // the query to delete cache
87 + $query = "DELETE FROM " . $wpdb->get_blog_prefix() . "postmeta
88 + WHERE meta_key LIKE '%_oembed_%'";
322 89
323 - $this->cookie = \json_decode( \sanitize_text_field( \wp_unslash( $_COOKIE['embed-privacy'] ) ) );
324 -
325 - return $this->cookie;
326 - }
327 -
328 - /**
329 - * Get filters for Elementor.
330 - *
331 - * @deprecated 1.3.5
332 - * @since 1.3.0
333 - */
334 - public function get_elementor_filters() {
335 - \_doing_it_wrong(
336 - __METHOD__,
337 - \esc_html__( 'This method is outdated and will be removed in the future.', 'embed-privacy' ),
338 - '1.3.5'
339 - );
340 -
341 - if ( ! Elementor::is_used() ) {
342 - return;
343 - }
344 -
345 - // doesn't currently run with YouTube
346 - // see https://github.com/elementor/elementor/issues/14276
347 - \add_filter( 'oembed_result', [ $this, 'replace_embeds' ], 10, 3 );
348 - }
349 -
350 - /**
351 - * Get an embed provider by its name.
352 - *
353 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\data\Providers::get_by_name() instead
354 - * @since 1.3.5
355 - *
356 - * @param string $name The name to search for
357 - * @return \WP_Post|null The embed or null
358 - */
359 - public function get_embed_by_name( $name ) {
360 - \_doing_it_wrong(
361 - __METHOD__,
362 - \sprintf(
363 - /* translators: alternative method */
364 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
365 - 'epiphyt\Embed_Privacy\data\Providers::get_by_name()'
366 - ),
367 - '1.10.0'
368 - );
369 -
370 - if ( empty( $name ) ) {
371 - return null;
372 - }
373 -
374 - $embed_providers = $this->get_embeds();
375 - $embed = null;
376 - $pattern = '/^' . \preg_quote( $name, '/' ) . '\-\d+/';
377 -
378 - foreach ( $embed_providers as $embed_provider ) {
379 - if ( $embed_provider->post_name !== $name && ! \preg_match( $pattern, $embed_provider->post_name ) ) {
380 - continue;
381 - }
90 + if ( \is_plugin_active_for_network( 'embed-privacy/embed-privacy.php' ) ) {
91 + // on networks we need to iterate through every site
92 + $sites = \get_sites( 99999 );
382 93
383 - $embed = $embed_provider;
384 - break;
385 - }
386 -
387 - return $embed;
388 - }
389 -
390 - /**
391 - * Get an embed provider overlay.
392 - *
393 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\embed\Replacement::get() instead
394 - * @since 1.3.5
395 - *
396 - * @param \WP_Post $provider An embed provider
397 - * @param string $content The content
398 - * @return string The content with additional overlays of an embed provider
399 - */
400 - public function get_embed_overlay( $provider, $content ) {
401 - \_doing_it_wrong(
402 - __METHOD__,
403 - \sprintf(
404 - /* translators: alternative method */
405 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
406 - 'epiphyt\Embed_Privacy\embed\Replacement::get()'
407 - ),
408 - '1.10.0'
409 - );
410 -
411 - $replacement = new Replacement( $content );
412 -
413 - foreach ( $replacement->get_providers() as $provider ) {
414 - $content = Template::get( $provider, $replacement );
415 - }
416 -
417 - return $content;
418 - }
419 -
420 - /**
421 - * Get a specific type of embeds.
422 - *
423 - * For more information on the accepted arguments in $args, see the
424 - * {@link https://developer.wordpress.org/reference/classes/wp_query/
425 - * WP_Query} documentation in the Developer Handbook.
426 - *
427 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\data\Providers::get_list() instead
428 - * @since 1.3.0
429 - * @since 1.8.0 Added the $args parameter
430 - *
431 - * @param string $type The embed type
432 - * @param array $args Additional arguments
433 - * @return array A list of embeds
434 - */
435 - public function get_embeds( $type = 'all', $args = [] ) {
436 - \_doing_it_wrong(
437 - __METHOD__,
438 - \sprintf(
439 - /* translators: alternative method */
440 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
441 - 'epiphyt\Embed_Privacy\data\Providers::get_list()'
442 - ),
443 - '1.10.0'
444 - );
445 -
446 - if ( ! empty( $this->embeds ) && isset( $this->embeds[ $type ] ) ) {
447 - return $this->embeds[ $type ];
448 - }
449 -
450 - if ( $type === 'all' && isset( $this->embeds['custom'] ) && isset( $this->embeds['oembed'] ) ) {
451 - $this->embeds[ $type ] = \array_merge( $this->embeds['custom'], $this->embeds['oembed'] );
452 -
453 - return $this->embeds[ $type ];
454 - }
455 -
456 - if ( ! empty( $args ) ) {
457 - $hash = \md5( \wp_json_encode( $args ) );
458 - }
459 -
460 - // phpcs:disable WordPress.DB.SlowDBQuery.slow_db_query_meta_query
461 - switch ( $type ) {
462 - case 'custom':
463 - $custom_providers = \get_posts( \array_merge( [
464 - 'meta_query' => [ // phpcs:ignore SlevomatCodingStandard.Arrays.DisallowPartiallyKeyed.DisallowedPartiallyKeyed
465 - 'relation' => 'OR',
466 - [ // phpcs:ignore Universal.Arrays.MixedKeyedUnkeyedArray.Found, Universal.Arrays.MixedArrayKeyTypes.ImplicitNumericKey
467 - 'compare' => 'NOT EXISTS',
468 - 'key' => 'is_system',
469 - 'value' => 'yes',
470 - ],
471 - [ // phpcs:ignore Universal.Arrays.MixedKeyedUnkeyedArray.Found, Universal.Arrays.MixedArrayKeyTypes.ImplicitNumericKey
472 - 'compare' => '!=',
473 - 'key' => 'is_system',
474 - 'value' => 'yes',
475 - ],
476 - ],
477 - 'no_found_rows' => true,
478 - 'numberposts' => -1,
479 - 'order' => 'ASC',
480 - 'orderby' => 'post_title',
481 - 'post_type' => 'epi_embed',
482 - 'update_post_term_cache' => false,
483 - ], $args ) );
484 - $google_provider = \get_posts( \array_merge( [
485 - 'meta_key' => 'is_system',
486 - 'meta_value' => 'yes',
487 - 'name' => 'google-maps',
488 - 'no_found_rows' => true,
489 - 'post_type' => 'epi_embed',
490 - 'update_post_term_cache' => false,
491 - ], $args ) );
94 + foreach ( $sites as $site ) {
95 + \switch_to_blog( $site );
492 96
493 - if ( ! empty( $hash ) ) {
494 - $this->embeds[ $hash ] = \array_merge( $custom_providers, $google_provider );
495 - }
496 - else {
497 - $this->embeds[ $type ] = \array_merge( $custom_providers, $google_provider );
498 - }
499 - break;
500 - case 'oembed':
501 - $embed_providers = \get_posts( \array_merge( [
502 - 'meta_key' => 'is_system',
503 - 'meta_value' => 'yes',
504 - 'no_found_rows' => true,
505 - 'numberposts' => -1,
506 - 'order' => 'ASC',
507 - 'orderby' => 'post_title',
508 - 'post_type' => 'epi_embed',
509 - 'update_post_term_cache' => false,
510 - ], $args ) );
511 -
512 - if ( ! empty( $hash ) ) {
513 - $this->embeds[ $hash ] = $embed_providers;
514 - }
515 - else {
516 - $this->embeds[ $type ] = $embed_providers;
517 - }
518 - break;
519 - case 'all':
520 - default:
521 - $embed_providers = \get_posts( \array_merge( [
522 - 'no_found_rows' => true,
523 - 'numberposts' => -1,
524 - 'order' => 'ASC',
525 - 'orderby' => 'post_title',
526 - 'post_type' => 'epi_embed',
527 - 'update_post_term_cache' => false,
528 - ], $args ) );
529 -
530 - if ( ! empty( $hash ) ) {
531 - $this->embeds[ $hash ] = $embed_providers;
532 - }
533 - else {
534 - $this->embeds['all'] = $embed_providers;
535 - }
536 - break;
97 + $wpdb->query( $query );
98 + }
537 99 }
538 - // phpcs:enable
539 -
540 - if ( ! empty( $hash ) ) {
541 - return $this->embeds[ $hash ];
100 + else {
101 + $wpdb->query( $query );
542 102 }
543 -
544 - return $this->embeds[ $type ];
545 103 }
546 104
547 105 /**
548 - * Get a list with ignored shortcodes.
549 - *
550 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\Shortcode::get_ignored() instead
551 - * @since 1.6.0
552 - *
553 - * @return string[] List with ignored shortcodes
106 + * Enqueue our assets for the frontend.
554 107 */
555 - public function get_ignored_shortcodes() {
556 - \_doing_it_wrong(
557 - __METHOD__,
558 - \sprintf(
559 - /* translators: alternative method */
560 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
561 - 'epiphyt\Embed_Privacy\Shortcode::get_ignored()'
562 - ),
563 - '1.10.0'
564 - );
108 + public function enqueue_assets() {
109 + $suffix = ( \defined( 'DEBUG_MODE' ) && \DEBUG_MODE ? '' : '.min' );
110 + $css_file = \EPI_EMBED_PRIVACY_BASE . 'assets/style/embed-privacy' . $suffix . '.css';
111 + $css_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/style/embed-privacy' . $suffix . '.css';
565 112
566 - return $this->shortcode->get_ignored();
567 - }
568 -
569 - /**
570 - * Get a unique instance of the class.
571 - *
572 - * @since 1.1.0
573 - *
574 - * @return \epiphyt\Embed_Privacy\Embed_Privacy The single instance of this class
575 - */
576 - public static function get_instance() {
577 - if ( self::$instance === null ) {
578 - self::$instance = new self();
579 - }
113 + \wp_enqueue_style( 'embed-privacy', $css_file_url, [], \filemtime( $css_file ) );
580 114
581 - return self::$instance;
582 - }
583 -
584 - /**
585 - * Output a complete template of the overlay.
586 - *
587 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\embed\Template::get() instead
588 - * @since 1.1.0
589 - *
590 - * @param string $embed_provider The embed provider
591 - * @param string $embed_provider_lowercase The embed provider without spaces and in lowercase
592 - * @param string $output The output before replacing it
593 - * @param array $args Additional arguments
594 - * @return string The overlay template
595 - */
596 - public function get_output_template( $embed_provider, $embed_provider_lowercase, $output, $args = [] ) {
597 - \_doing_it_wrong(
598 - __METHOD__,
599 - \sprintf(
600 - /* translators: alternative method */
601 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
602 - 'epiphyt\Embed_Privacy\embed\Template::get()'
603 - ),
604 - '1.10.0'
605 - );
115 + $js_file = \EPI_EMBED_PRIVACY_BASE . 'assets/js/embed-privacy' . $suffix . '.js';
116 + $js_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/js/embed-privacy' . $suffix . '.js';
606 117
607 - return Template::get( $embed_provider, $embed_provider_lowercase, $output, $args );
118 + \wp_enqueue_script( 'two-click_embed', $js_file_url, [], \filemtime( $js_file ) );
608 119 }
609 120
610 121 /**
611 - * Get a single overlay for all matching embeds.
612 - *
613 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\embed\Replacement::get() instead
614 - * @since 1.2.0
615 - *
616 - * @param string $content The original content
617 - * @param string $embed_provider The embed provider
618 - * @param string $embed_provider_lowercase The embed provider without spaces and in lowercase
619 - * @param array $args Additional arguments
620 - * @return string The updated content
621 - */
622 - public function get_single_overlay( $content, $embed_provider, $embed_provider_lowercase, $args ) {
623 - \_doing_it_wrong(
624 - __METHOD__,
625 - \sprintf(
626 - /* translators: alternative method */
627 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
628 - 'epiphyt\Embed_Privacy\embed\Replacement::get()'
629 - ),
630 - '1.10.0'
631 - );
632 -
633 - $overlay = new Replacement( $content );
634 -
635 - return $overlay->get( $args );
636 - }
637 -
638 - /**
639 - * Get dynamically generated style.
640 - *
641 - * @deprecated 1.10.0
642 - *
643 - * @return string Dynamically generated style
644 - */
645 - public function get_style() {
646 - \_doing_it_wrong(
647 - __METHOD__,
648 - \esc_html__( 'This method has no more functionality.', 'embed-privacy' ),
649 - '1.10.0'
650 - );
651 -
652 - /**
653 - * Filter the style properties before generating dynamic styles.
654 - *
655 - * @deprecated 1.10.0
656 - * @since 1.9.0
657 - *
658 - * @param array $style_properties Style properties array
659 - */
660 - $this->style = (array) \apply_filters_deprecated( 'embed_privacy_dynamic_style_properties', $this->style, '1.10.0' );
661 -
662 - /**
663 - * Filter dynamic generated style.
664 - *
665 - * @deprecated 1.10.0
666 - * @since 1.9.0
667 - *
668 - * @param string $style Generated style
669 - * @param array $style_properties Style properties array
670 - */
671 - $style = \apply_filters_deprecated( 'embed_privacy_dynamic_style', '', $this->style, '1.10.0' ); // phpcs:ignore SlevomatCodingStandard.Variables.UselessVariable.UselessVariable
672 -
673 - return $style;
674 - }
675 -
676 - /**
677 - * Check if a post contains an embed.
678 - *
679 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\handler\Post::has_embed() instead
680 - * @since 1.3.0
681 - *
682 - * @param \WP_Post|int|null $post A post object, post ID or null
683 - * @return bool True if a post contains an embed, false otherwise
684 - */
685 - public function has_embed( $post = null ) {
686 - \_doing_it_wrong(
687 - __METHOD__,
688 - \sprintf(
689 - /* translators: alternative method */
690 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
691 - 'epiphyt\Embed_Privacy\handler\Post::has_embed()'
692 - ),
693 - '1.10.0'
694 - );
695 -
696 - return Post::has_embed( $post );
697 - }
698 -
699 - /**
700 - * Check if a provider is always active.
701 - *
702 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\data\Providers::is_always_active() instead
703 - * @since 1.1.0
704 - *
705 - * @param string $provider The embed provider in lowercase
706 - * @return bool True if provider is always active, false otherwise
707 - */
708 - public function is_always_active_provider( $provider ) {
709 - \_doing_it_wrong(
710 - __METHOD__,
711 - \sprintf(
712 - /* translators: alternative method */
713 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
714 - 'epiphyt\Embed_Privacy\data\Providers::is_always_active()'
715 - ),
716 - '1.10.0'
717 - );
718 -
719 - return Providers::is_always_active( $provider );
720 - }
721 -
722 - /**
723 - * Check if a post is written in Elementor.
724 - *
725 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\integration\Elementor::is_used() instead
726 - * @since 1.3.5
727 - *
728 - * @return bool True if Elementor is used, false otherwise
729 - */
730 - public function is_elementor() {
731 - \_doing_it_wrong(
732 - __METHOD__,
733 - \sprintf(
734 - /* translators: alternative method */
735 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
736 - 'epiphyt\Embed_Privacy\integration\Elementor::is_used()'
737 - ),
738 - '1.10.0'
739 - );
740 -
741 - return Elementor::is_used();
742 - }
743 -
744 - /**
745 - * Check if the current theme is matching your name.
746 - *
747 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\handler\Theme::is() instead
748 - * @since 1.3.5
749 - *
750 - * @param string $name The theme name to test
751 - * @return bool True if the current theme is matching, false otherwise
752 - */
753 - public function is_theme( $name ) {
754 - \_doing_it_wrong(
755 - __METHOD__,
756 - \sprintf(
757 - /* translators: alternative method */
758 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
759 - 'epiphyt\Embed_Privacy\handler\Theme::is()'
760 - ),
761 - '1.10.0'
762 - );
763 -
764 - return Theme::is( $name );
765 - }
766 -
767 - /**
768 - * Get the WP_Filesystem object
769 - *
770 - * @return \WP_Filesystem_Direct WP_Filesystem object
771 - */
772 - public static function get_wp_filesystem() {
773 - /** @var \WP_Filesystem_Direct $wp_filesystem */
774 - global $wp_filesystem;
775 -
776 - // initialize the WP filesystem if not exists
777 - if ( empty( $wp_filesystem ) ) {
778 - require_once \ABSPATH . 'wp-admin/includes/file.php';
779 -
780 - \WP_Filesystem();
781 - }
782 -
783 - return $wp_filesystem;
784 - }
785 -
786 - /**
787 122 * Load the translation files.
788 123 */
789 124 public function load_textdomain() {
790 - \load_plugin_textdomain( 'embed-privacy', false, \dirname( \plugin_basename( $this->plugin_file ) ) . '/languages' );
125 + \load_plugin_textdomain( 'embed-privacy', false, \EPI_EMBED_PRIVACY_BASE . 'languages' );
791 126 }
792 127
793 128 /**
794 - * Callback for the page output buffer.
795 - *
796 - * @deprecated 1.10.0
797 - *
798 - * @param string $buffer Current buffer
799 - * @return string Updated buffer
800 - */
801 - public function output_buffer_callback( $buffer ) {
802 - \_doing_it_wrong(
803 - __METHOD__,
804 - \esc_html__( 'This method has no more functionality.', 'embed-privacy' ),
805 - '1.10.0'
806 - );
807 -
808 - return $buffer;
809 - }
810 -
811 - /**
812 - * Preserve backslashes in regex field.
813 - *
814 - * @since 1.4.0
815 - */
816 - public function preserve_backslashes() {
817 - // phpcs:disable WordPress.Security.NonceVerification.Missing
818 - if ( ! isset( $_POST['regex_default'] ) ) {
819 - return;
820 - }
821 -
822 - $_POST['regex_default'] = \wp_slash( $_POST['regex_default'] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
823 - // phpcs:enable
824 - }
825 -
826 - /**
827 - * Handle printing assets.
828 - *
829 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\Frontend::print_assets() instead
830 - * @since 1.3.0
831 - */
832 - public function print_assets() {
833 - \_doing_it_wrong(
834 - __METHOD__,
835 - \sprintf(
836 - /* translators: alternative method */
837 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
838 - 'epiphyt\Embed_Privacy\Frontend::print_assets()'
839 - ),
840 - '1.10.0'
841 - );
842 - $this->frontend->print_assets();
843 - }
844 -
845 - /**
846 - * Register our assets for the frontend.
847 - *
848 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\Frontend::register_assets() instead
849 - * @since 1.4.4
850 - */
851 - public function register_assets() {
852 - \_doing_it_wrong(
853 - __METHOD__,
854 - \sprintf(
855 - /* translators: alternative method */
856 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
857 - 'epiphyt\Embed_Privacy\Frontend::register_assets()'
858 - ),
859 - '1.10.0'
860 - );
861 - $this->frontend->register_assets();
862 - }
863 -
864 - /**
865 - * Register post type in Polylang to allow translation.
866 - *
867 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\integration\Polylang::register_post_type() instead
868 - * @since 1.5.0
869 - *
870 - * @param array $post_types List of current translatable custom post types
871 - * @param bool $is_settings Whether the current page is the settings page
872 - * @return array Updated list of translatable custom post types
873 - */
874 - public function register_polylang_post_type( array $post_types, $is_settings ) {
875 - \_doing_it_wrong(
876 - __METHOD__,
877 - \sprintf(
878 - /* translators: alternative method */
879 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
880 - 'epiphyt\Embed_Privacy\integration\Polylang::register_post_type()'
881 - ),
882 - '1.10.0'
883 - );
884 -
885 - return Polylang::register_post_type( $post_types, $is_settings );
886 - }
887 -
888 - /**
889 - * Register post type.
890 - *
891 - * @since 1.10.0
892 - */
893 - public static function register_post_type() {
894 - \register_post_type(
895 - 'epi_embed',
896 - [ // phpcs:ignore SlevomatCodingStandard.Arrays.AlphabeticallySortedByKeys.IncorrectKeyOrder
897 - 'label' => \__( 'Embeds', 'embed-privacy' ),
898 - 'description' => \__( 'Embeds from Embed Privacy', 'embed-privacy' ),
899 - 'supports' => [
900 - 'custom-fields',
901 - 'editor',
902 - 'revisions',
903 - 'thumbnail',
904 - 'title',
905 - ],
906 - 'hierarchical' => false,
907 - 'public' => false,
908 - 'menu_icon' => 'dashicons-format-video',
909 - 'show_in_admin_bar' => false,
910 - 'show_in_menu' => false,
911 - 'show_in_nav_menus' => false,
912 - 'show_in_rest' => false,
913 - 'show_ui' => true,
914 - 'can_export' => true,
915 - 'has_archive' => false,
916 - 'exclude_from_search' => true,
917 - 'publicly_queryable' => false,
918 - 'rewrite' => [
919 - 'pages' => false,
920 - 'with_front' => false,
921 - ],
922 - ]
923 - );
924 - }
925 -
926 - /**
927 129 * Replace embeds with a container and hide the embed with an HTML comment.
928 130 *
929 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\data\Replacer::replace_embeds() instead
930 - * @since 1.2.0 Changed behavior of the method
931 - * @since 1.6.0 Added optional $tag parameter
932 - *
933 - * @param string $content The original content
934 - * @param string $tag The shortcode tag if called via do_shortcode
935 - * @return string The updated content
131 + * @param string $output
132 + * @param string $url
133 + * @param array $args
134 + * @return string
936 135 */
937 - public function replace_embeds( $content, $tag = '' ) {
938 - \_doing_it_wrong(
939 - __METHOD__,
940 - \sprintf(
941 - /* translators: alternative method */
942 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
943 - 'epiphyt\Embed_Privacy\data\Replacer::replace_embeds()'
944 - ),
945 - '1.10.0'
946 - );
136 + public function replace_embeds( $output, $url, $args ) {
137 + // don't do anything in admin
138 + if ( ! $this->usecache ) return $output;
947 139
948 - return Replacer::replace_embeds( $content, $tag );
949 - }
950 -
951 - /**
952 - * Replace oembed embeds with a container and hide the embed with an HTML comment.
953 - *
954 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\data\Replacer::replace_oembed() instead
955 - * @since 1.2.0
956 - *
957 - * @param string $output The original output
958 - * @param string $url The URL to the embed
959 - * @param array $args Additional arguments of the embed
960 - * @return string The updated embed code
961 - */
962 - public function replace_embeds_oembed( $output, $url, $args ) {
963 - \_doing_it_wrong(
964 - __METHOD__,
965 - \sprintf(
966 - /* translators: alternative method */
967 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
968 - 'epiphyt\Embed_Privacy\data\Replacer::replace_oembed()'
969 - ),
970 - '1.10.0'
971 - );
140 + $embed_provider = '';
972 141
973 - return Replacer::replace_oembed( $output, $url, $args );
974 - }
975 -
976 - /**
977 - * Replace embeds in Divi Builder.
978 - *
979 - * @deprecated 1.10.0
980 - * @since 1.2.0
981 - * @since 1.6.0 Deprecated second parameter
982 - *
983 - * @param string $item_embed The original output
984 - * @param string $url The URL of the embed
985 - * @return string The updated embed code
986 - */
987 - public function replace_embeds_divi( $item_embed, $url ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed
988 - \_doing_it_wrong(
989 - __METHOD__,
990 - \esc_html__( 'This method is outdated and will be removed in the future.', 'embed-privacy' ),
991 - '1.10.0'
992 - );
993 -
994 - return $item_embed;
995 - }
996 -
997 - /**
998 - * Replace X embeds.
999 - *
1000 - * @deprecated 1.6.3
1001 - * @since 1.6.1
1002 - *
1003 - * @param string $output The original output
1004 - * @param string $url The URL to the embed
1005 - * @param array $args Additional arguments of the embed
1006 - * @return string The updated embed code
1007 - */
1008 - public function replace_embeds_twitter( $output, $url, $args ) {
1009 - \_doing_it_wrong(
1010 - __METHOD__,
1011 - \esc_html__( 'This method is outdated and will be removed in the future.', 'embed-privacy' ),
1012 - '1.6.3'
1013 - );
1014 -
1015 - // do nothing in admin
1016 - if ( ! $this->use_cache ) {
1017 - return $output;
142 + // get embed provider name
143 + foreach ( $this->embed_providers as $url_part => $name ) {
144 + // save name of provider and stop loop
145 + if ( \strpos( $url, $url_part ) !== false ) {
146 + $embed_provider = $name;
147 + break;
148 + }
1018 149 }
1019 150
1020 - $provider = Providers::get_instance()->get_by_name( 'x' );
151 + // add two click to markup
152 + $embed_class = ' embed-' . ( ! empty( $embed_provider ) ? \sanitize_title( $embed_provider ) : 'default' );
153 + $height = ( ! empty( $args['height'] ) && $args['height'] <= $args['width'] ? 'height: ' . $args['height'] . 'px;' : 'height: 300px;' );
154 + $width = ( ! empty( $args['width'] ) ? 'width: ' . $args['width'] . 'px;' : '' );
155 + $markup = '<div class="embed-container' . $embed_class . '">';
156 + $markup .= '<div class="embed-overlay" style="' . $height . ' ' . $width . '">';
157 + $markup .= '<h3>';
1021 158
1022 - if ( ! $provider->is_matching( $url ) ) {
1023 - return $output;
159 + if ( ! empty( $embed_provider ) ) {
160 + /* translators: the embed provider */
161 + $markup .= \sprintf( \esc_html__( 'Click here to display content from %s', 'embed-privacy' ), $embed_provider );
1024 162 }
1025 -
1026 - // check for local tweets
1027 - if ( \get_option( 'embed_privacy_local_tweets' ) ) {
1028 - return X::get_local_tweet( $output );
163 + else {
164 + $markup .= \esc_html__( 'Click here to display content from external service', 'embed-privacy' );
1029 165 }
1030 166
1031 - $args['embed_url'] = $url;
1032 - $args['ignore_aspect_ratio'] = true;
1033 - $args['strip_newlines'] = true;
167 + $markup .= '</h3>';
168 + $markup .= '</div>';
169 + $markup .= '<div class="embed-content"><!-- ' . $output . ' --></div>';
170 + $markup .= '</div>';
1034 171
1035 - return Template::get( $provider, $output, $args );
1036 - }
1037 -
1038 - /**
1039 - * Replace Google Maps iframes.
1040 - *
1041 - * @deprecated 1.2.0 Use epiphyt\Embed_Privacy\embed\Replacement::get() instead
1042 - * @since 1.1.0
1043 - *
1044 - * @param string $content The post content
1045 - * @return string The post content
1046 - */
1047 - public function replace_google_maps( $content ) {
1048 - \_doing_it_wrong(
1049 - __METHOD__,
1050 - \sprintf(
1051 - /* translators: alternative method */
1052 - \esc_html__( 'Use %s instead.', 'embed-privacy' ),
1053 - 'epiphyt\Embed_Privacy\embed\Replacement::get()'
1054 - ),
1055 - '1.2.0'
1056 - );
1057 -
1058 - $overlay = new Replacement( $content );
1059 -
1060 - return $overlay->get();
1061 - }
1062 -
1063 - /**
1064 - * Replace Maps Marker (Pro) shortcodes.
1065 - *
1066 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\integration\Maps_Marker::replace() instead
1067 - * @since 1.5.0
1068 - *
1069 - * @param string $output Shortcode output
1070 - * @param string $tag Shortcode tag
1071 - * @return string Updated shortcode output
1072 - */
1073 - public function replace_maps_marker( $output, $tag ) {
1074 - \_doing_it_wrong(
1075 - __METHOD__,
1076 - \sprintf(
1077 - /* translators: alternative method */
1078 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
1079 - 'epiphyt\Embed_Privacy\integration\Maps_Marker::replace()'
1080 - ),
1081 - '1.10.0'
1082 - );
1083 -
1084 - return Maps_Marker::replace( $output, $tag );
1085 - }
1086 -
1087 - /**
1088 - * Replace video shortcode embeds.
1089 - *
1090 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\data\Replacer::replace_video_shortcode() instead
1091 - * @since 1.7.0
1092 - *
1093 - * @param string $output Video shortcode HTML output
1094 - * @param array $atts Array of video shortcode attributes
1095 - * @return string Updated embed code
1096 - */
1097 - public function replace_video_shortcode( $output, $atts ) {
1098 - \_doing_it_wrong(
1099 - __METHOD__,
1100 - \sprintf(
1101 - /* translators: alternative method */
1102 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
1103 - 'epiphyt\Embed_Privacy\data\Replacer::replace_video_shortcode()'
1104 - ),
1105 - '1.10.0'
1106 - );
1107 -
1108 - return Replacer::replace_video_shortcode( $output, $atts );
1109 - }
1110 -
1111 - /**
1112 - * Run a compare check.
1113 - *
1114 - * @since 1.4.4
1115 - *
1116 - * @param mixed $value1 First value to compare
1117 - * @param mixed $value2 Second value to compare
1118 - * @param string $compare Compare operator
1119 - * @return bool Result of comparing the values
1120 - */
1121 - private function run_check_compare( $value1, $value2, $compare ) {
1122 - switch ( $compare ) {
1123 - case '===':
1124 - return $value1 === $value2;
1125 - case '==':
1126 - return $value1 == $value2; // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1127 - case '!==':
1128 - return $value1 !== $value2;
1129 - case '!=':
1130 - return $value1 != $value2; // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
1131 - case '>':
1132 - return $value1 > $value2;
1133 - case '>=':
1134 - return $value1 >= $value2;
1135 - case '<':
1136 - return $value1 < $value2;
1137 - case '<=':
1138 - return $value1 <= $value2;
1139 - default:
1140 - return false;
1141 - }
1142 - }
1143 -
1144 - /**
1145 - * Run additional for a DOM node checks.
1146 - *
1147 - * @since 1.4.4
1148 - * @since 1.10.0 Method is now public
1149 - *
1150 - * @param array $checks A list of checks
1151 - * @param \DOMElement $element The DOM Element
1152 - * @return bool Whether all checks are successful
1153 - */
1154 - public function run_checks( $checks, $element ) {
1155 - if ( empty( $checks ) ) {
1156 - return true;
1157 - }
1158 -
1159 - foreach ( $checks as $check ) {
1160 - if ( $check['type'] === 'attribute' ) {
1161 - $compared = $this->run_check_compare( $element->getAttribute( $check['attribute'] ), $check['value'], $check['compare'] );
1162 -
1163 - if ( ! $compared ) {
1164 - return false;
1165 - }
1166 - }
1167 - }
1168 -
1169 - return true;
1170 - }
1171 -
1172 - /**
1173 - * Check whether this request should be ignored by Embed Privacy.
1174 - *
1175 - * @deprecated 1.10.10 Use epiphyt\Embed_Privacy:\Embed_Privacy:set_ignored_request_in_template_include() instead
1176 - * @since 1.10.0
1177 - */
1178 - public function set_ignored_request() {
1179 - \_doing_it_wrong(
1180 - __METHOD__,
1181 - \sprintf(
1182 - /* translators: alternative method */
1183 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
1184 - 'epiphyt\Embed_Privacy\Embed_Privacy::set_ignored_request_in_template_include()'
1185 - ),
1186 - '1.10.10'
1187 - );
1188 -
1189 - /**
1190 - * Filter whether the current request should be ignored.
1191 - *
1192 - * @since 1.10.0
1193 - *
1194 - * @param bool $is_ignored_request Whether the current request should be ignored
1195 - */
1196 - $this->is_ignored_request = (bool) \apply_filters( 'embed_privacy_is_ignored_request', $this->is_ignored_request );
1197 - }
1198 -
1199 - /**
1200 - * Check whether this request should be ignored by Embed Privacy.
1201 - * Template inclusion
1202 - *
1203 - * @since 1.10.10
1204 - *
1205 - * @param string $template Template path to include
1206 - * @return string $template Template path to include
1207 - */
1208 - public function set_ignored_request_in_template_include( $template ) {
1209 - /**
1210 - * Filter whether the current request should be ignored.
1211 - *
1212 - * @since 1.10.0
1213 - *
1214 - * @param bool $is_ignored_request Whether the current request should be ignored
1215 - */
1216 - $this->is_ignored_request = (bool) \apply_filters( 'embed_privacy_is_ignored_request', $this->is_ignored_request );
1217 -
1218 - return $template;
1219 - }
1220 -
1221 - /**
1222 - * Set the plugin file.
1223 - *
1224 - * @deprecated 1.10.0 Use \EPI_EMBED_PRIVACY_FILE instead
1225 - * @since 1.1.0
1226 - *
1227 - * @param string $file The path to the file
1228 - */
1229 - public function set_plugin_file( $file ) {
1230 - if ( \file_exists( $file ) ) {
1231 - $this->plugin_file = $file;
1232 - }
1233 - }
1234 -
1235 - /**
1236 - * Register post type.
1237 - *
1238 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy:\Embed_Privacy:register_post_type() instead
1239 - * @since 1.2.0
1240 - */
1241 - public function set_post_type() {
1242 - \_doing_it_wrong(
1243 - __METHOD__,
1244 - \sprintf(
1245 - /* translators: alternative method */
1246 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
1247 - 'epiphyt\Embed_Privacy\Embed_Privacy::register_post_type()'
1248 - ),
1249 - '1.10.0'
1250 - );
1251 - self::register_post_type();
1252 - }
1253 -
1254 - /**
1255 - * Display an Opt-out shortcode.
1256 - *
1257 - * @deprecated 1.10.0 Use epiphyt\Embed_Privacy\handler\Shortcode::opt_out() instead
1258 - * @since 1.2.0
1259 - *
1260 - * @param array $attributes Shortcode attributes
1261 - * @return string The shortcode output
1262 - */
1263 - public function shortcode_opt_out( $attributes ) {
1264 - \_doing_it_wrong(
1265 - __METHOD__,
1266 - \sprintf(
1267 - /* translators: alternative method */
1268 - \esc_html__( 'Use %s instead', 'embed-privacy' ),
1269 - 'epiphyt\Embed_Privacy\handler\Shortcode::opt_out()'
1270 - ),
1271 - '1.10.0'
1272 - );
1273 -
1274 - return Shortcode::opt_out( $attributes );
1275 - }
1276 -
1277 - /**
1278 - * Start an output buffer.
1279 - *
1280 - * @deprecated 1.10.0
1281 - */
1282 - public function start_output_buffer() {
1283 - \_doing_it_wrong(
1284 - __METHOD__,
1285 - \esc_html__( 'This method has no more functionality.', 'embed-privacy' ),
1286 - '1.10.0'
1287 - );
172 + return $markup;
1288 173 }
1289 174 }