PluginProbe
Embed Privacy / 1.10.5
Embed Privacy v1.10.5
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
embed-privacy / inc / class-migration.php

class-migration.php in Embed Privacy 1.10.5, at inc/class-migration.php

1,242 lines 41.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace epiphyt\Embed_Privacy;
3
4 use epiphyt\Embed_Privacy\thumbnail\Thumbnail;
5 use FilesystemIterator;
6 use WP_Post;
7
8 /**
9 * Migration class to update data in the database on upgrades.
10 *
11 * @since 1.2.0
12 *
13 * @author Epiphyt
14 * @license GPL2
15 * @package epiphyt\Embed_Privacy
16 */
17 class Migration {
18 /**
19 * @var \epiphyt\Embed_Privacy\Migration
20 */
21 private static $instance;
22
23 /**
24 * @var array Default embed providers
25 */
26 private $providers = [];
27
28 /**
29 * @var string Current migration version
30 * @since 1.2.2
31 */
32 private $version = '1.10.5';
33
34 /**
35 * Migration constructor.
36 */
37 public function __construct() {
38 self::$instance = $this;
39 }
40
41 /**
42 * Initialize functions.
43 */
44 public function init() {
45 // since upgrader_process_complete hook runs the old plugin code,
46 // it is useless for real migrations, unfortunately
47 // thus, we need to check on every page load in the admin if there are
48 // new migrations
49 \add_action( 'admin_init', [ $this, 'migrate' ], 10, 0 );
50 \add_action( 'admin_notices', [ $this, 'register_migration_failed_notice' ] );
51 }
52
53 /**
54 * Add an embed provider post.
55 *
56 * @param array $embed Embed provider information
57 */
58 private function add_embed( array $embed ) {
59 // since meta_input doesn't work on every multisite (I don't know why)
60 // extract metadata and use add_post_meta() afterwards
61 // see: https://github.com/epiphyt/embed-privacy/issues/14
62 if ( ! empty( $embed['meta_input'] ) ) {
63 $meta_data = $embed['meta_input'];
64 unset( $embed['meta_input'] );
65 }
66
67 $post_id = \wp_insert_post( $embed );
68
69 // add meta data
70 if ( \is_int( $post_id ) && isset( $meta_data ) ) {
71 foreach ( $meta_data as $meta_key => $meta_value ) {
72 \add_post_meta( $post_id, $meta_key, $meta_value );
73 }
74 }
75 }
76
77 /**
78 * Create thumbnails directory.
79 *
80 * @since 1.5.0
81 */
82 private function create_thumbnails_dir() {
83 $directory = Thumbnails::get_instance()->get_directory();
84
85 if ( empty( $directory['base_dir'] ) ) {
86 return;
87 }
88
89 if ( \file_exists( $directory['base_dir'] ) && ! \is_dir( $directory['base_dir'] ) ) {
90 return;
91 }
92
93 if ( ! \is_dir( $directory['base_dir'] ) ) {
94 \wp_mkdir_p( $directory['base_dir'] );
95 }
96 }
97
98 /**
99 * Delete an option either from the global multisite settings or the regular site.
100 *
101 * @param string $option The option name
102 * @return bool True if the option was deleted, false otherwise
103 */
104 private function delete_option( $option ) {
105 return \delete_option( 'embed_privacy_' . $option );
106 }
107
108 /**
109 * Get a unique instance of the class.
110 *
111 * @return \epiphyt\Embed_Privacy\Migration The single instance of this class
112 */
113 public static function get_instance() {
114 if ( self::$instance === null ) {
115 self::$instance = new self();
116 }
117
118 return self::$instance;
119 }
120
121 /**
122 * Get an option either from the global multisite settings or the regular site.
123 *
124 * @param string $option The option name
125 * @param mixed $default_value The default value if the option is not set
126 * @return mixed Value set for the option
127 */
128 private function get_option( $option, $default_value = false ) {
129 return \get_option( 'embed_privacy_' . $option, $default_value );
130 }
131
132 /**
133 * Run migrations.
134 *
135 * @param null $deprecated Deprecated, has no function anymore
136 * @param null $deprecated2 Deprecated, has no function anymore
137 */
138 public function migrate( $deprecated = null, $deprecated2 = null ) {
139 if ( $deprecated !== null ) {
140 \_doing_it_wrong(
141 __METHOD__,
142 \sprintf(
143 /* translators: parameter */
144 \esc_html__( 'The function does not support the parameter "%s" anymore.', 'embed-privacy' ),
145 '$plugin'
146 ),
147 '1.4.0'
148 );
149 }
150
151 if ( $deprecated2 !== null ) {
152 \_doing_it_wrong(
153 __METHOD__,
154 \sprintf(
155 /* translators: parameter */
156 \esc_html__( 'The function does not support the parameter "%s" anymore.', 'embed-privacy' ),
157 '$network_wide'
158 ),
159 '1.4.0'
160 );
161 }
162
163 if ( \wp_doing_ajax() ) {
164 return;
165 }
166
167 // check for active migration
168 if (
169 \is_numeric( $this->get_option( 'is_migrating' ) )
170 && $this->get_option( 'is_migrating' ) !== '1' // possible legacy value
171 && (int) $this->get_option( 'is_migrating' ) > \time() - \MINUTE_IN_SECONDS
172 ) {
173 return;
174 }
175
176 $version = $this->get_option( 'migrate_version', 'initial' );
177
178 // get legacy network option
179 if ( $version === 'initial' && \is_multisite() ) {
180 $version = \get_site_option( 'embed_privacy_migrate_version', 'initial' );
181 }
182
183 if ( $version === $this->version ) {
184 return;
185 }
186
187 // start the migration
188 $this->update_option( 'is_migrating', \time() );
189 $this->update_option( 'migration_count', (int) $this->get_option( 'migration_count' ) + 1 );
190 // load textdomain early for migrations
191 \load_plugin_textdomain( 'embed-privacy', false, \dirname( \plugin_basename( Embed_Privacy::get_instance()->plugin_file ) ) . '/languages' );
192 // make sure all default embed providers are avalable and translated
193 $this->register_default_embed_providers();
194
195 switch ( $version ) {
196 case $this->version:
197 // most recent version, do nothing
198 break;
199 case '1.8.0':
200 $this->migrate_1_10_5();
201 break;
202 case '1.7.3':
203 $this->migrate_1_10_5();
204 $this->migrate_1_8_0();
205 break;
206 case '1.7.0':
207 $this->migrate_1_10_5();
208 $this->migrate_1_8_0();
209 $this->migrate_1_7_3();
210 break;
211 case '1.6.0':
212 $this->migrate_1_10_5();
213 $this->migrate_1_8_0();
214 $this->migrate_1_7_3();
215 $this->migrate_1_7_0();
216 break;
217 case '1.5.0':
218 $this->migrate_1_10_5();
219 $this->migrate_1_8_0();
220 $this->migrate_1_7_3();
221 $this->migrate_1_7_0();
222 $this->migrate_1_6_0();
223 break;
224 case '1.4.7':
225 $this->migrate_1_10_5();
226 $this->migrate_1_8_0();
227 $this->migrate_1_7_0();
228 $this->migrate_1_6_0();
229 $this->migrate_1_5_0();
230 break;
231 case '1.4.0':
232 $this->migrate_1_10_5();
233 $this->migrate_1_8_0();
234 $this->migrate_1_7_0();
235 $this->migrate_1_6_0();
236 $this->migrate_1_5_0();
237 $this->migrate_1_4_7();
238 break;
239 case '1.3.0':
240 $this->migrate_1_10_5();
241 $this->migrate_1_8_0();
242 $this->migrate_1_7_0();
243 $this->migrate_1_6_0();
244 $this->migrate_1_5_0();
245 $this->migrate_1_4_0();
246 break;
247 case '1.2.2':
248 $this->migrate_1_10_5();
249 $this->migrate_1_8_0();
250 $this->migrate_1_7_0();
251 $this->migrate_1_6_0();
252 $this->migrate_1_5_0();
253 $this->migrate_1_4_0();
254 $this->migrate_1_3_0();
255 break;
256 case '1.2.1':
257 $this->migrate_1_10_5();
258 $this->migrate_1_8_0();
259 $this->migrate_1_7_0();
260 $this->migrate_1_6_0();
261 $this->migrate_1_5_0();
262 $this->migrate_1_4_0();
263 $this->migrate_1_3_0();
264 $this->migrate_1_2_2();
265 break;
266 case '1.2.0':
267 $this->migrate_1_10_5();
268 $this->migrate_1_8_0();
269 $this->migrate_1_7_0();
270 $this->migrate_1_6_0();
271 $this->migrate_1_5_0();
272 $this->migrate_1_4_0();
273 $this->migrate_1_3_0();
274 $this->migrate_1_2_2();
275 $this->migrate_1_2_1();
276 break;
277 default:
278 // run all migrations
279 $this->migrate_1_2_0();
280 break;
281 }
282
283 // migration done
284 $this->update_option( 'migrate_version', $this->version );
285 $this->delete_option( 'is_migrating' );
286 $this->delete_option( 'migration_count' );
287 }
288
289 /**
290 * Migrations for version 1.2.0.
291 *
292 * @since 1.2.0
293 * @since 1.5.0 Create thumbnails directory
294 *
295 * - Add default embed providers
296 * - Add thumbnails directory
297 */
298 private function migrate_1_2_0() {
299 // add embeds
300 foreach ( $this->providers as $embed ) {
301 $this->add_embed( $embed );
302 }
303
304 $this->create_thumbnails_dir();
305 }
306
307 /**
308 * Migrations for version 1.2.1.
309 *
310 * @since 1.2.1
311 *
312 * - Add missing meta data
313 */
314 private function migrate_1_2_1() {
315 global $wp_filesystem;
316
317 // initialize the WP filesystem if not exists
318 if ( empty( $wp_filesystem ) ) {
319 require_once \ABSPATH . 'wp-admin/includes/file.php';
320 \WP_Filesystem();
321 }
322
323 $available_providers = \get_posts( [
324 'no_found_rows' => true,
325 'numberposts' => -1,
326 'post_type' => 'epi_embed',
327 'update_post_term_cache' => false,
328 ] );
329
330 foreach ( $available_providers as $provider ) {
331 // get according default provider
332 $key = \array_search( $provider->post_title, \array_column( $this->providers, 'post_title' ), true );
333
334 // if no default provider, continue with next available provider
335 if ( $key === false ) {
336 continue;
337 }
338
339 // update default meta data, if missing
340 foreach ( [ 'is_system', 'privacy_policy_url', 'regex_default' ] as $meta_key ) {
341 if ( ! \get_post_meta( $provider->ID, $meta_key, true ) ) {
342 \update_post_meta( $provider->ID, $meta_key, $this->providers[ $key ]['meta_input'][ $meta_key ] );
343 }
344 }
345 }
346 }
347
348 /**
349 * Migrations for version 1.2.2.
350 *
351 * @since 1.2.2
352 *
353 * - Update regex for Amazon Kindle
354 */
355 private function migrate_1_2_2() {
356 $amazon_provider = \get_posts( [
357 'meta_key' => 'is_system',
358 'meta_value' => 'yes',
359 'name' => 'amazon-kindle',
360 'no_found_rows' => true,
361 'post_type' => 'epi_embed',
362 'update_post_term_cache' => false,
363 ] );
364
365 if ( ! empty( $amazon_provider ) ) {
366 $amazon_provider = \reset( $amazon_provider );
367 }
368
369 if ( ! $amazon_provider instanceof WP_Post ) {
370 return;
371 }
372
373 \update_post_meta( $amazon_provider->ID, 'regex_default', '/\\\.?(ama?zo?n\\\.|a\\\.co\\\/|z\\\.cn\\\/)/' );
374 }
375
376 /**
377 * Migrations for version 1.3.0.
378 *
379 * @since 1.3.0
380 *
381 * - Delete post thumbnails
382 * - Update regex for Google Maps
383 */
384 private function migrate_1_3_0() {
385 $providers = Embed_Privacy::get_instance()->get_embeds( 'oembed' );
386 $google_provider = \get_posts( [
387 'meta_key' => 'is_system',
388 'meta_value' => 'yes',
389 'name' => 'google-maps',
390 'no_found_rows' => true,
391 'post_type' => 'epi_embed',
392 'update_post_term_cache' => false,
393 ] );
394 $providers = \array_merge( $providers, $google_provider );
395
396 foreach ( $providers as $provider ) {
397 if ( ! $provider instanceof WP_Post ) {
398 continue;
399 }
400
401 // delete post thumbnails
402 // see https://github.com/epiphyt/embed-privacy/issues/32
403 $thumbnail_id = \get_post_thumbnail_id( $provider->ID );
404
405 if ( $thumbnail_id ) {
406 \delete_post_thumbnail( $provider );
407 \wp_delete_attachment( $thumbnail_id, true );
408 }
409
410 // make regex ungreedy
411 // see https://github.com/epiphyt/embed-privacy/issues/31
412 if ( $provider->post_name === 'google-maps' ) {
413 \update_post_meta( $provider->ID, 'regex_default', '/google\\\.com\\\/maps\\\/embed/' );
414 }
415 }
416 }
417
418 /**
419 * Migrations for version 1.4.0.
420 *
421 * @since 1.4.0
422 *
423 * - Replace duplicate embed providers
424 * - Add missing default embed providers (this also adds new Wolfram Cloud)
425 */
426 private function migrate_1_4_0() {
427 $providers = Embed_Privacy::get_instance()->get_embeds();
428 $missing_providers = $this->providers;
429 $processed_providers = [];
430
431 foreach ( $providers as $provider ) {
432 if ( ! $provider instanceof WP_Post ) {
433 continue;
434 }
435
436 // check only system providers
437 if ( \get_post_meta( $provider->ID, 'is_system', true ) !== 'yes' ) {
438 continue;
439 }
440
441 // since post name differs, use post title to get duplicates
442 if ( \in_array( $provider->post_title, $processed_providers, true ) ) {
443 // delete duplicate providers
444 \wp_delete_post( $provider->ID, true );
445 }
446 else {
447 $processed_providers[] = $provider->post_title;
448 }
449
450 $key = false;
451
452 // delete provider from list of missing providers if it already exists
453 foreach ( $missing_providers as $provider_key => $missing_provider ) {
454 if ( $provider->post_title === $missing_provider['post_title'] ) {
455 $key = $provider_key;
456 break;
457 }
458 }
459
460 if ( $key !== false ) {
461 unset( $missing_providers[ $key ] );
462 }
463 }
464
465 // add missing default providers
466 foreach ( $missing_providers as $missing_provider ) {
467 $this->add_embed( $missing_provider );
468 }
469 }
470
471 /**
472 * Migrations for version 1.4.7.
473 *
474 * @see https://github.com/epiphyt/embed-privacy/issues/120
475 * @since 1.4.7
476 *
477 * - Update regex for Google Maps
478 */
479 private function migrate_1_4_7() {
480 $google_provider = \get_posts( [
481 'meta_key' => 'is_system',
482 'meta_value' => 'yes',
483 'name' => 'google-maps',
484 'no_found_rows' => true,
485 'post_type' => 'epi_embed',
486 'update_post_term_cache' => false,
487 ] );
488 $google_provider = \reset( $google_provider );
489
490 \update_post_meta( $google_provider->ID, 'regex_default', '/google\\\.com\\\/maps\\\/(d\\\/)?embed/' );
491 }
492
493 /**
494 * Migrations for version 1.5.0.
495 *
496 * @see https://github.com/epiphyt/embed-privacy/issues/124
497 * @since 1.5.0
498 *
499 * - Add new embed provider Pocket Casts
500 * - Add new embed provider Maps Marker
501 * - Add thumbnails directory
502 * - Update Google Maps regex
503 */
504 private function migrate_1_5_0() {
505 $this->add_embed( [
506 'meta_input' => [
507 'is_system' => 'yes',
508 'privacy_policy_url' => \__( 'https://support.pocketcasts.com/article/privacy-policy/', 'embed-privacy' ),
509 'regex_default' => '/pca\\\.st/',
510 ],
511 /* translators: embed provider */
512 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Pocket Casts', 'embed provider', 'embed-privacy' ) ),
513 'post_status' => 'publish',
514 'post_title' => \_x( 'Pocket Casts', 'embed provider', 'embed-privacy' ),
515 'post_type' => 'epi_embed',
516 ] );
517 $this->add_embed( [
518 'meta_input' => [
519 'is_system' => 'yes',
520 'privacy_policy_url' => '',
521 'regex_default' => '',
522 ],
523 /* translators: embed provider */
524 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Maps Marker', 'embed provider', 'embed-privacy' ) ),
525 'post_status' => 'publish',
526 'post_title' => \_x( 'Maps Marker', 'embed provider', 'embed-privacy' ),
527 'post_type' => 'epi_embed',
528 ] );
529 $this->create_thumbnails_dir();
530
531 $google_provider = \get_posts( [
532 'meta_key' => 'is_system',
533 'meta_value' => 'yes',
534 'name' => 'google-maps',
535 'no_found_rows' => true,
536 'post_type' => 'epi_embed',
537 'update_post_term_cache' => false,
538 ] );
539 $google_provider = \reset( $google_provider );
540
541 if ( $google_provider instanceof WP_Post ) {
542 \update_post_meta( $google_provider->ID, 'regex_default', '/(google\\\.com\\\/maps\\\/embed|maps\\\.google\\\.com\\\/(maps)?)/' );
543 }
544 }
545
546 /**
547 * Migrations for version 1.6.0.
548 *
549 * @see https://github.com/epiphyt/embed-privacy/issues/124
550 * @since 1.6.0
551 *
552 * - Update Google Maps regex
553 */
554 private function migrate_1_6_0() {
555 $google_provider = \get_posts( [
556 'meta_key' => 'is_system',
557 'meta_value' => 'yes',
558 'name' => 'google-maps',
559 'no_found_rows' => true,
560 'post_type' => 'epi_embed',
561 'update_post_term_cache' => false,
562 ] );
563 $google_provider = \reset( $google_provider );
564
565 if ( $google_provider instanceof WP_Post ) {
566 \update_post_meta( $google_provider->ID, 'regex_default', '/(google\\\.com\\\/maps\\\/embed|maps\\\.google\\\.com\\\/(maps)?)/' );
567 }
568 }
569
570 /**
571 * Migrations for version 1.7.0.
572 *
573 * @see https://github.com/epiphyt/embed-privacy/issues/163
574 * @since 1.7.0
575 *
576 * - Update CrowdSignal regex
577 */
578 private function migrate_1_7_0() {
579 $crowdsignal_provider = \get_posts( [
580 'meta_key' => 'is_system',
581 'meta_value' => 'yes',
582 'name' => 'crowdsignal',
583 'no_found_rows' => true,
584 'post_type' => 'epi_embed',
585 'update_post_term_cache' => false,
586 ] );
587 $crowdsignal_provider = \reset( $crowdsignal_provider );
588
589 if ( $crowdsignal_provider instanceof WP_Post ) {
590 \update_post_meta( $crowdsignal_provider->ID, 'regex_default', '/((poll(\\\.fm|daddy\\\.com))|crowdsignal\\\.(com|net)|survey\\\.fm)/' );
591 }
592 }
593
594 /**
595 * Migrations for version 1.7.3.
596 *
597 * @since 1.7.3
598 *
599 * - Copy thumbnails to different directory
600 */
601 private function migrate_1_7_3() {
602 $this->create_thumbnails_dir();
603
604 $new_dir = Thumbnail::get_directory()['base_dir'];
605 $old_dir = \WP_CONTENT_DIR . '/uploads/embed-privacy/thumbnails';
606
607 // directories are identical, don't do anything
608 if ( $new_dir === $old_dir ) {
609 return;
610 }
611
612 if ( \file_exists( $old_dir ) ) {
613 $post_args = [
614 'fields' => 'ids',
615 'meta_query' => [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
616 [
617 'compare' => '!=',
618 'compare_key' => 'LIKE',
619 'key' => 'embed_privacy_thumbnail_',
620 'value' => '',
621 ],
622 ],
623 'no_found_rows' => true,
624 'offset' => 0,
625 'post_type' => 'any',
626 'update_post_term_cache' => false,
627 ];
628 $posts = \get_posts( $post_args );
629
630 // iterate through posts to get metadata
631 while ( \count( $posts ) ) {
632 foreach ( $posts as $post_id ) {
633 $metadata = \get_post_meta( $post_id );
634
635 foreach ( $metadata as $meta_key => $meta_value ) {
636 if ( ! \str_contains( $meta_key, 'embed_privacy_thumbnail_' ) ) {
637 continue;
638 }
639
640 if ( \str_contains( $meta_key, '_url' ) ) {
641 continue;
642 }
643
644 $filename = \reset( $meta_value );
645
646 // move thumbnail
647 if ( \file_exists( $old_dir . '/' . $filename ) ) {
648 \rename( $old_dir . '/' . $filename, $new_dir . '/' . $filename );
649 }
650 }
651 }
652
653 $post_args['offset'] += 5;
654 $posts = \get_posts( $post_args );
655 }
656
657 // remove old directory if it's empty
658 if ( ! ( new FilesystemIterator( $old_dir ) )->valid() ) {
659 \rmdir( $old_dir );
660
661 if ( ! ( new FilesystemIterator( \dirname( $old_dir ) ) )->valid() ) {
662 \rmdir( \dirname( $old_dir ) );
663 }
664 }
665 }
666 }
667
668 /**
669 * Migrations for version 1.8.0.
670 *
671 * @since 1.8.0
672 *
673 * - Add new embed provider Anghami
674 */
675 private function migrate_1_8_0() {
676 $this->add_embed( [
677 'meta_input' => [
678 'is_system' => 'yes',
679 'privacy_policy_url' => \__( 'https://www.anghami.com/legal', 'embed-privacy' ),
680 'regex_default' => '/anghami\\\.com/',
681 ],
682 /* translators: embed provider */
683 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Anghami', 'embed provider', 'embed-privacy' ) ),
684 'post_status' => 'publish',
685 'post_title' => \_x( 'Anghami', 'embed provider', 'embed-privacy' ),
686 'post_type' => 'epi_embed',
687 ] );
688 }
689
690 /**
691 * Migrations for version 1.10.5.
692 *
693 * @see https://github.com/epiphyt/embed-privacy/issues/235
694 * @since 1.10.5
695 *
696 * - Rename Twitter to X
697 */
698 private function migrate_1_10_5() {
699 $twitter_provider = \get_posts( [
700 'meta_key' => 'is_system',
701 'meta_value' => 'yes',
702 'name' => 'twitter',
703 'no_found_rows' => true,
704 'post_type' => 'epi_embed',
705 'update_post_term_cache' => false,
706 ] );
707 $twitter_provider = \reset( $twitter_provider );
708
709 if ( $twitter_provider instanceof WP_Post ) {
710 $x_provider = [
711 'ID' => $twitter_provider->ID,
712 'post_name' => \sanitize_title( \_x( 'X', 'embed provider', 'embed-privacy' ) ),
713 'post_title' => \_x( 'X', 'embed provider', 'embed-privacy' ),
714 ];
715
716 /* translators: embed provider */
717 if ( $twitter_provider->post_content === \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Twitter', 'embed provider', 'embed-privacy' ) ) ) {
718 /* translators: embed provider */
719 $x_provider['post_content'] = \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'X', 'embed provider', 'embed-privacy' ) );
720 }
721
722 \wp_update_post( $x_provider );
723 \update_post_meta( $twitter_provider->ID, 'privacy_policy_url', \__( 'https://x.com/privacy', 'embed-privacy' ) );
724 \update_post_meta( $twitter_provider->ID, 'regex_default', '/(twitter|x)\\\.com/' );
725 \update_post_meta( $twitter_provider->ID, 'is_system', 'yes' );
726 }
727 }
728
729 /**
730 * Register default embed providers.
731 */
732 public function register_default_embed_providers() {
733 $this->providers = [
734 [
735 'meta_input' => [
736 'is_system' => 'yes',
737 'privacy_policy_url' => \__( 'https://www.amazon.com/gp/help/customer/display.html?nodeId=GX7NJQ4ZB8MHFRNJ', 'embed-privacy' ),
738 'regex_default' => '/\\\.?(ama?zo?n\\\.|a\\\.co\\\/|z\\\.cn\\\/)/',
739 ],
740 /* translators: embed provider */
741 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Amazon Kindle', 'embed provider', 'embed-privacy' ) ),
742 'post_status' => 'publish',
743 'post_title' => \_x( 'Amazon Kindle', 'embed provider', 'embed-privacy' ),
744 'post_type' => 'epi_embed',
745 ],
746 [
747 'meta_input' => [
748 'is_system' => 'yes',
749 'privacy_policy_url' => \__( 'https://www.anghami.com/legal', 'embed-privacy' ),
750 'regex_default' => '/anghami\\\.com/',
751 ],
752 /* translators: embed provider */
753 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Anghami', 'embed provider', 'embed-privacy' ) ),
754 'post_status' => 'publish',
755 'post_title' => \_x( 'Anghami', 'embed provider', 'embed-privacy' ),
756 'post_type' => 'epi_embed',
757 ],
758 [
759 'meta_input' => [
760 'is_system' => 'yes',
761 'privacy_policy_url' => \__( 'https://animoto.com/legal/privacy_policy', 'embed-privacy' ),
762 'regex_default' => '/animoto\\\.com/',
763 ],
764 /* translators: embed provider */
765 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Animoto', 'embed provider', 'embed-privacy' ) ),
766 'post_status' => 'publish',
767 'post_title' => \_x( 'Animoto', 'embed provider', 'embed-privacy' ),
768 'post_type' => 'epi_embed',
769 ],
770 [
771 'meta_input' => [
772 'is_system' => 'yes',
773 'privacy_policy_url' => \__( 'https://automattic.com/privacy/', 'embed-privacy' ),
774 'regex_default' => '/cloudup\\\.com/',
775 ],
776 /* translators: embed provider */
777 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Cloudup', 'embed provider', 'embed-privacy' ) ),
778 'post_status' => 'publish',
779 'post_title' => \_x( 'Cloudup', 'embed provider', 'embed-privacy' ),
780 'post_type' => 'epi_embed',
781 ],
782 [
783 'meta_input' => [
784 'is_system' => 'yes',
785 'privacy_policy_url' => \__( 'https://automattic.com/privacy/', 'embed-privacy' ),
786 'regex_default' => '/((poll(\\\.fm|daddy\\\.com))|crowdsignal\\\.(com|net)|survey\\\.fm)/',
787 ],
788 /* translators: embed provider */
789 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Crowdsignal', 'embed provider', 'embed-privacy' ) ),
790 'post_status' => 'publish',
791 'post_title' => \_x( 'Crowdsignal', 'embed provider', 'embed-privacy' ),
792 'post_type' => 'epi_embed',
793 ],
794 [
795 'meta_input' => [
796 'is_system' => 'yes',
797 'privacy_policy_url' => \__( 'https://www.dailymotion.com/legal/privacy?localization=en', 'embed-privacy' ),
798 'regex_default' => '/dailymotion\\\.com/',
799 ],
800 /* translators: embed provider */
801 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'DailyMotion', 'embed provider', 'embed-privacy' ) ),
802 'post_status' => 'publish',
803 'post_title' => \_x( 'DailyMotion', 'embed provider', 'embed-privacy' ),
804 'post_type' => 'epi_embed',
805 ],
806 [
807 'meta_input' => [
808 'is_system' => 'yes',
809 'privacy_policy_url' => \__( 'https://www.facebook.com/privacy/explanation', 'embed-privacy' ),
810 'regex_default' => '/facebook\\\.com/',
811 ],
812 /* translators: embed provider */
813 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Facebook', 'embed provider', 'embed-privacy' ) ),
814 'post_status' => 'publish',
815 'post_title' => \_x( 'Facebook', 'embed provider', 'embed-privacy' ),
816 'post_type' => 'epi_embed',
817 ],
818 [
819 'meta_input' => [
820 'is_system' => 'yes',
821 'privacy_policy_url' => \__( 'https://www.flickr.com/help/privacy', 'embed-privacy' ),
822 'regex_default' => '/flickr\\\.com/',
823 ],
824 /* translators: embed provider */
825 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Flickr', 'embed provider', 'embed-privacy' ) ),
826 'post_status' => 'publish',
827 'post_title' => \_x( 'Flickr', 'embed provider', 'embed-privacy' ),
828 'post_type' => 'epi_embed',
829 ],
830 [
831 'meta_input' => [
832 'is_system' => 'yes',
833 'privacy_policy_url' => \__( 'https://www.funnyordie.com/legal/privacy-notice', 'embed-privacy' ),
834 'regex_default' => '/funnyordie\\\.com/',
835 ],
836 /* translators: embed provider */
837 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Funny Or Die', 'embed provider', 'embed-privacy' ) ),
838 'post_status' => 'publish',
839 'post_title' => \_x( 'Funny Or Die', 'embed provider', 'embed-privacy' ),
840 'post_type' => 'epi_embed',
841 ],
842 [
843 'meta_input' => [
844 'is_system' => 'yes',
845 'privacy_policy_url' => \__( 'https://policies.google.com/privacy?hl=en', 'embed-privacy' ),
846 'regex_default' => '/(google\\\.com\\\/maps\\\/embed|maps\\\.google\\\.com\\\/(maps)?)/',
847 ],
848 /* translators: embed provider */
849 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Google Maps', 'embed provider', 'embed-privacy' ) ),
850 'post_status' => 'publish',
851 'post_title' => \_x( 'Google Maps', 'embed provider', 'embed-privacy' ),
852 'post_type' => 'epi_embed',
853 ],
854 [
855 'meta_input' => [
856 'is_system' => 'yes',
857 'privacy_policy_url' => \__( 'https://imgur.com/privacy', 'embed-privacy' ),
858 'regex_default' => '/imgur\\\.com/',
859 ],
860 /* translators: embed provider */
861 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Imgur', 'embed provider', 'embed-privacy' ) ),
862 'post_status' => 'publish',
863 'post_title' => \_x( 'Imgur', 'embed provider', 'embed-privacy' ),
864 'post_type' => 'epi_embed',
865 ],
866 [
867 'meta_input' => [
868 'is_system' => 'yes',
869 'privacy_policy_url' => \__( 'https://www.instagram.com/legal/privacy/', 'embed-privacy' ),
870 'regex_default' => '/instagram\\\.com/',
871 ],
872 /* translators: embed provider */
873 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Instagram', 'embed provider', 'embed-privacy' ) ),
874 'post_status' => 'publish',
875 'post_title' => \_x( 'Instagram', 'embed provider', 'embed-privacy' ),
876 'post_type' => 'epi_embed',
877 ],
878 [
879 'meta_input' => [
880 'is_system' => 'yes',
881 'privacy_policy_url' => \__( 'https://issuu.com/legal/privacy', 'embed-privacy' ),
882 'regex_default' => '/issuu\\\.com/',
883 ],
884 /* translators: embed provider */
885 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Issuu', 'embed provider', 'embed-privacy' ) ),
886 'post_status' => 'publish',
887 'post_title' => \_x( 'Issuu', 'embed provider', 'embed-privacy' ),
888 'post_type' => 'epi_embed',
889 ],
890 [
891 'meta_input' => [
892 'is_system' => 'yes',
893 'privacy_policy_url' => \__( 'https://www.kickstarter.com/privacy', 'embed-privacy' ),
894 'regex_default' => '/kickstarter\\\.com/',
895 ],
896 /* translators: embed provider */
897 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Kickstarter', 'embed provider', 'embed-privacy' ) ),
898 'post_status' => 'publish',
899 'post_title' => \_x( 'Kickstarter', 'embed provider', 'embed-privacy' ),
900 'post_type' => 'epi_embed',
901 ],
902 [
903 'meta_input' => [
904 'is_system' => 'yes',
905 'privacy_policy_url' => '',
906 'regex_default' => '',
907 ],
908 /* translators: embed provider */
909 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Maps Marker', 'embed provider', 'embed-privacy' ) ),
910 'post_status' => 'publish',
911 'post_title' => \_x( 'Maps Marker', 'embed provider', 'embed-privacy' ),
912 'post_type' => 'epi_embed',
913 ],
914 [
915 'meta_input' => [
916 'is_system' => 'yes',
917 'privacy_policy_url' => \__( 'https://www.meetup.com/privacy/', 'embed-privacy' ),
918 'regex_default' => '/meetup\\\.com/',
919 ],
920 /* translators: embed provider */
921 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Meetup', 'embed provider', 'embed-privacy' ) ),
922 'post_status' => 'publish',
923 'post_title' => \_x( 'Meetup', 'embed provider', 'embed-privacy' ),
924 'post_type' => 'epi_embed',
925 ],
926 [
927 'meta_input' => [
928 'is_system' => 'yes',
929 'privacy_policy_url' => \__( 'https://www.mixcloud.com/privacy/', 'embed-privacy' ),
930 'regex_default' => '/mixcloud\\\.com/',
931 ],
932 /* translators: embed provider */
933 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Mixcloud', 'embed provider', 'embed-privacy' ) ),
934 'post_status' => 'publish',
935 'post_title' => \_x( 'Mixcloud', 'embed provider', 'embed-privacy' ),
936 'post_type' => 'epi_embed',
937 ],
938 [
939 'meta_input' => [
940 'is_system' => 'yes',
941 'privacy_policy_url' => \__( 'https://app.photobucket.com/privacy', 'embed-privacy' ),
942 'regex_default' => '/photobucket\\\.com/',
943 ],
944 /* translators: embed provider */
945 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Photobucket', 'embed provider', 'embed-privacy' ) ),
946 'post_status' => 'publish',
947 'post_title' => \_x( 'Photobucket', 'embed provider', 'embed-privacy' ),
948 'post_type' => 'epi_embed',
949 ],
950 [
951 'meta_input' => [
952 'is_system' => 'yes',
953 'privacy_policy_url' => \__( 'https://policy.pinterest.com/en/privacy-policy', 'embed-privacy' ),
954 'regex_default' => '/pinterest\\\./',
955 ],
956 /* translators: embed provider */
957 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Pinterest', 'embed provider', 'embed-privacy' ) ),
958 'post_status' => 'publish',
959 'post_title' => \_x( 'Pinterest', 'embed provider', 'embed-privacy' ),
960 'post_type' => 'epi_embed',
961 ],
962 [
963 'meta_input' => [
964 'is_system' => 'yes',
965 'privacy_policy_url' => \__( 'https://support.pocketcasts.com/article/privacy-policy/', 'embed-privacy' ),
966 'regex_default' => '/pca\\\.st/',
967 ],
968 /* translators: embed provider */
969 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Pocket Casts', 'embed provider', 'embed-privacy' ) ),
970 'post_status' => 'publish',
971 'post_title' => \_x( 'Pocket Casts', 'embed provider', 'embed-privacy' ),
972 'post_type' => 'epi_embed',
973 ],
974 [
975 'meta_input' => [
976 'is_system' => 'yes',
977 'privacy_policy_url' => \__( 'https://www.reddit.com/help/privacypolicy', 'embed-privacy' ),
978 'regex_default' => '/reddit\\\.com/',
979 ],
980 /* translators: embed provider */
981 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Reddit', 'embed provider', 'embed-privacy' ) ),
982 'post_status' => 'publish',
983 'post_title' => \_x( 'Reddit', 'embed provider', 'embed-privacy' ),
984 'post_type' => 'epi_embed',
985 ],
986 [
987 'meta_input' => [
988 'is_system' => 'yes',
989 'privacy_policy_url' => \__( 'https://www.reverbnation.com/privacy', 'embed-privacy' ),
990 'regex_default' => '/reverbnation\\\.com/',
991 ],
992 /* translators: embed provider */
993 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'ReverbNation', 'embed provider', 'embed-privacy' ) ),
994 'post_status' => 'publish',
995 'post_title' => \_x( 'ReverbNation', 'embed provider', 'embed-privacy' ),
996 'post_type' => 'epi_embed',
997 ],
998 [
999 'meta_input' => [
1000 'is_system' => 'yes',
1001 'privacy_policy_url' => \__( 'https://scribd.com/privacy', 'embed-privacy' ),
1002 'regex_default' => '/scribd\\\.com/',
1003 ],
1004 /* translators: embed provider */
1005 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Scribd', 'embed provider', 'embed-privacy' ) ),
1006 'post_status' => 'publish',
1007 'post_title' => \_x( 'Scribd', 'embed provider', 'embed-privacy' ),
1008 'post_type' => 'epi_embed',
1009 ],
1010 [
1011 'meta_input' => [
1012 'is_system' => 'yes',
1013 'privacy_policy_url' => \__( 'https://sketchfab.com/privacy', 'embed-privacy' ),
1014 'regex_default' => '/sketchfab\\\.com/',
1015 ],
1016 /* translators: embed provider */
1017 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Sketchfab', 'embed provider', 'embed-privacy' ) ),
1018 'post_status' => 'publish',
1019 'post_title' => \_x( 'Sketchfab', 'embed provider', 'embed-privacy' ),
1020 'post_type' => 'epi_embed',
1021 ],
1022 [
1023 'meta_input' => [
1024 'is_system' => 'yes',
1025 'privacy_policy_url' => \__( 'https://www.slideshare.net/privacy', 'embed-privacy' ),
1026 'regex_default' => '/slideshare\\\.net/',
1027 ],
1028 /* translators: embed provider */
1029 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'SlideShare', 'embed provider', 'embed-privacy' ) ),
1030 'post_status' => 'publish',
1031 'post_title' => \_x( 'SlideShare', 'embed provider', 'embed-privacy' ),
1032 'post_type' => 'epi_embed',
1033 ],
1034 [
1035 'meta_input' => [
1036 'is_system' => 'yes',
1037 'privacy_policy_url' => \__( 'https://www.smugmug.com/about/privacy', 'embed-privacy' ),
1038 'regex_default' => '/smugmug\\\.com/',
1039 ],
1040 /* translators: embed provider */
1041 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'SmugMug', 'embed provider', 'embed-privacy' ) ),
1042 'post_status' => 'publish',
1043 'post_title' => \_x( 'SmugMug', 'embed provider', 'embed-privacy' ),
1044 'post_type' => 'epi_embed',
1045 ],
1046 [
1047 'meta_input' => [
1048 'is_system' => 'yes',
1049 'privacy_policy_url' => \__( 'https://soundcloud.com/pages/privacy', 'embed-privacy' ),
1050 'regex_default' => '/soundcloud\\\.com/',
1051 ],
1052 /* translators: embed provider */
1053 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'SoundCloud', 'embed provider', 'embed-privacy' ) ),
1054 'post_status' => 'publish',
1055 'post_title' => \_x( 'SoundCloud', 'embed provider', 'embed-privacy' ),
1056 'post_type' => 'epi_embed',
1057 ],
1058 [
1059 'meta_input' => [
1060 'is_system' => 'yes',
1061 'privacy_policy_url' => \__( 'https://speakerdeck.com/privacy', 'embed-privacy' ),
1062 'regex_default' => '/speakerdeck\\\.com/',
1063 ],
1064 /* translators: embed provider */
1065 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Speaker Deck', 'embed provider', 'embed-privacy' ) ),
1066 'post_status' => 'publish',
1067 'post_title' => \_x( 'Speaker Deck', 'embed provider', 'embed-privacy' ),
1068 'post_type' => 'epi_embed',
1069 ],
1070 [
1071 'meta_input' => [
1072 'is_system' => 'yes',
1073 'privacy_policy_url' => \__( 'https://www.spotify.com/privacy/', 'embed-privacy' ),
1074 'regex_default' => '/spotify\\\.com/',
1075 ],
1076 /* translators: embed provider */
1077 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Spotify', 'embed provider', 'embed-privacy' ) ),
1078 'post_status' => 'publish',
1079 'post_title' => \_x( 'Spotify', 'embed provider', 'embed-privacy' ),
1080 'post_type' => 'epi_embed',
1081 ],
1082 [
1083 'meta_input' => [
1084 'is_system' => 'yes',
1085 'privacy_policy_url' => \__( 'https://www.tiktok.com/legal/privacy-policy?lang=en-US', 'embed-privacy' ),
1086 'regex_default' => '/tiktok\\\.com/',
1087 ],
1088 /* translators: embed provider */
1089 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'TikTok', 'embed provider', 'embed-privacy' ) ),
1090 'post_status' => 'publish',
1091 'post_title' => \_x( 'TikTok', 'embed provider', 'embed-privacy' ),
1092 'post_type' => 'epi_embed',
1093 ],
1094 [
1095 'meta_input' => [
1096 'is_system' => 'yes',
1097 'privacy_policy_url' => \__( 'https://www.ted.com/about/our-organization/our-policies-terms/privacy-policy', 'embed-privacy' ),
1098 'regex_default' => '/ted\\\.com/',
1099 ],
1100 /* translators: embed provider */
1101 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'TED', 'embed provider', 'embed-privacy' ) ),
1102 'post_status' => 'publish',
1103 'post_title' => \_x( 'TED', 'embed provider', 'embed-privacy' ),
1104 'post_type' => 'epi_embed',
1105 ],
1106 [
1107 'meta_input' => [
1108 'is_system' => 'yes',
1109 'privacy_policy_url' => \__( 'https://www.tumblr.com/privacy_policy', 'embed-privacy' ),
1110 'regex_default' => '/tumblr\\\.com/',
1111 ],
1112 /* translators: embed provider */
1113 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Tumblr', 'embed provider', 'embed-privacy' ) ),
1114 'post_status' => 'publish',
1115 'post_title' => \_x( 'Tumblr', 'embed provider', 'embed-privacy' ),
1116 'post_type' => 'epi_embed',
1117 ],
1118 [
1119 'meta_input' => [
1120 'is_system' => 'yes',
1121 'privacy_policy_url' => \__( 'https://x.com/privacy', 'embed-privacy' ),
1122 'regex_default' => '/(twitter|x)\\\.com/',
1123 ],
1124 /* translators: embed provider */
1125 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'X', 'embed provider', 'embed-privacy' ) ),
1126 'post_status' => 'publish',
1127 'post_title' => \_x( 'X', 'embed provider', 'embed-privacy' ),
1128 'post_type' => 'epi_embed',
1129 ],
1130 [
1131 'meta_input' => [
1132 'is_system' => 'yes',
1133 'privacy_policy_url' => \__( 'https://automattic.com/privacy/', 'embed-privacy' ),
1134 'regex_default' => '/videopress\\\.com/',
1135 ],
1136 /* translators: embed provider */
1137 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'VideoPress', 'embed provider', 'embed-privacy' ) ),
1138 'post_status' => 'publish',
1139 'post_title' => \_x( 'VideoPress', 'embed provider', 'embed-privacy' ),
1140 'post_type' => 'epi_embed',
1141 ],
1142 [
1143 'meta_input' => [
1144 'is_system' => 'yes',
1145 'privacy_policy_url' => \__( 'https://vimeo.com/privacy', 'embed-privacy' ),
1146 'regex_default' => '/vimeo\\\.com/',
1147 ],
1148 /* translators: embed provider */
1149 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Vimeo', 'embed provider', 'embed-privacy' ) ),
1150 'post_status' => 'publish',
1151 'post_title' => \_x( 'Vimeo', 'embed provider', 'embed-privacy' ),
1152 'post_type' => 'epi_embed',
1153 ],
1154 [
1155 'meta_input' => [
1156 'is_system' => 'yes',
1157 'privacy_policy_url' => \__( 'https://www.wolfram.com/legal/privacy/wolfram/', 'embed-privacy' ),
1158 'regex_default' => '/wolframcloud\\\.com/',
1159 ],
1160 /* translators: embed provider */
1161 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'Wolfram Cloud', 'embed provider', 'embed-privacy' ) ),
1162 'post_status' => 'publish',
1163 'post_title' => \_x( 'Wolfram Cloud', 'embed provider', 'embed-privacy' ),
1164 'post_type' => 'epi_embed',
1165 ],
1166 [
1167 'meta_input' => [
1168 'is_system' => 'yes',
1169 'privacy_policy_url' => \__( 'https://wordpress.org/about/privacy/', 'embed-privacy' ),
1170 'regex_default' => '/wordpress\\\.org\\\/plugins/',
1171 ],
1172 /* translators: embed provider */
1173 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'WordPress.org', 'embed provider', 'embed-privacy' ) ),
1174 'post_status' => 'publish',
1175 'post_title' => \_x( 'WordPress.org', 'embed provider', 'embed-privacy' ),
1176 'post_type' => 'epi_embed',
1177 ],
1178 [
1179 'meta_input' => [
1180 'is_system' => 'yes',
1181 'privacy_policy_url' => \__( 'https://wordpress.org/about/privacy/', 'embed-privacy' ),
1182 'regex_default' => '/wordpress\\\.tv\/',
1183 ],
1184 /* translators: embed provider */
1185 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'WordPress.tv', 'embed provider', 'embed-privacy' ) ),
1186 'post_status' => 'publish',
1187 'post_title' => \_x( 'WordPress.tv', 'embed provider', 'embed-privacy' ),
1188 'post_type' => 'epi_embed',
1189 ],
1190 [
1191 'meta_input' => [
1192 'is_system' => 'yes',
1193 'privacy_policy_url' => \__( 'https://policies.google.com/privacy?hl=en', 'embed-privacy' ),
1194 'regex_default' => '/https?:\\\/\\\/(?:.+?.)?youtu(?:.be|be.com)/',
1195 ],
1196 /* translators: embed provider */
1197 'post_content' => \sprintf( \__( 'Click here to display content from %s.', 'embed-privacy' ), \_x( 'YouTube', 'embed provider', 'embed-privacy' ) ),
1198 'post_status' => 'publish',
1199 'post_title' => \_x( 'YouTube', 'embed provider', 'embed-privacy' ),
1200 'post_type' => 'epi_embed',
1201 ],
1202 ];
1203 }
1204
1205 /**
1206 * Add a notice if migration failed.
1207 *
1208 * @since 1.5.0
1209 */
1210 public function register_migration_failed_notice() {
1211 if ( (int) $this->get_option( 'migration_count' ) < 3 ) {
1212 return;
1213 }
1214 ?>
1215 <div class="notice notice-error" data-notice="embed_privacy_migration_failed_notice">
1216 <p>
1217 <?php
1218 \printf(
1219 /* translators: 1: current migration version, 2: target migration version, 3: starting HTML anchor, 4: ending HTML anchor */
1220 \esc_html__( 'Embed Privacy migration from version %1$s to %2$s failed. Please contact the %3$ssupport%4$s for further assistance.', 'embed-privacy' ),
1221 \esc_html( $this->get_option( 'migrate_version' ) ),
1222 \esc_html( $this->version ),
1223 '<a href="' . \esc_url( \__( 'https://wordpress.org/support/plugin/embed-privacy/#new-topic-0', 'embed-privacy' ) ) . '">',
1224 '</a>'
1225 ); ?>
1226 </p>
1227 </div>
1228 <?php
1229 }
1230
1231 /**
1232 * Update an option either from the global multisite settings or the regular site.
1233 *
1234 * @param string $option The option name
1235 * @param mixed $value The value to update
1236 * @return bool Whether the update was successful
1237 */
1238 private function update_option( $option, $value ) {
1239 return \update_option( 'embed_privacy_' . $option, $value );
1240 }
1241 }
1242