wp/wp-includes/class-wp-oembed.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    50 	public function __construct() {
    50 	public function __construct() {
    51 		$host      = urlencode( home_url() );
    51 		$host      = urlencode( home_url() );
    52 		$providers = array(
    52 		$providers = array(
    53 			'#https?://((m|www)\.)?youtube\.com/watch.*#i' => array( 'https://www.youtube.com/oembed', true ),
    53 			'#https?://((m|www)\.)?youtube\.com/watch.*#i' => array( 'https://www.youtube.com/oembed', true ),
    54 			'#https?://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'https://www.youtube.com/oembed', true ),
    54 			'#https?://((m|www)\.)?youtube\.com/playlist.*#i' => array( 'https://www.youtube.com/oembed', true ),
       
    55 			'#https?://((m|www)\.)?youtube\.com/shorts/*#i' => array( 'https://www.youtube.com/oembed', true ),
    55 			'#https?://youtu\.be/.*#i'                     => array( 'https://www.youtube.com/oembed', true ),
    56 			'#https?://youtu\.be/.*#i'                     => array( 'https://www.youtube.com/oembed', true ),
    56 			'#https?://(.+\.)?vimeo\.com/.*#i'             => array( 'https://vimeo.com/api/oembed.{format}', true ),
    57 			'#https?://(.+\.)?vimeo\.com/.*#i'             => array( 'https://vimeo.com/api/oembed.{format}', true ),
    57 			'#https?://(www\.)?dailymotion\.com/.*#i'      => array( 'https://www.dailymotion.com/services/oembed', true ),
    58 			'#https?://(www\.)?dailymotion\.com/.*#i'      => array( 'https://www.dailymotion.com/services/oembed', true ),
    58 			'#https?://dai\.ly/.*#i'                       => array( 'https://www.dailymotion.com/services/oembed', true ),
    59 			'#https?://dai\.ly/.*#i'                       => array( 'https://www.dailymotion.com/services/oembed', true ),
    59 			'#https?://(www\.)?flickr\.com/.*#i'           => array( 'https://www.flickr.com/services/oembed/', true ),
    60 			'#https?://(www\.)?flickr\.com/.*#i'           => array( 'https://www.flickr.com/services/oembed/', true ),
    72 			'#https?://(www\.)?twitter\.com/i/moments/.*#i' => array( 'https://publish.twitter.com/oembed', true ),
    73 			'#https?://(www\.)?twitter\.com/i/moments/.*#i' => array( 'https://publish.twitter.com/oembed', true ),
    73 			'#https?://(www\.)?soundcloud\.com/.*#i'       => array( 'https://soundcloud.com/oembed', true ),
    74 			'#https?://(www\.)?soundcloud\.com/.*#i'       => array( 'https://soundcloud.com/oembed', true ),
    74 			'#https?://(.+?\.)?slideshare\.net/.*#i'       => array( 'https://www.slideshare.net/api/oembed/2', true ),
    75 			'#https?://(.+?\.)?slideshare\.net/.*#i'       => array( 'https://www.slideshare.net/api/oembed/2', true ),
    75 			'#https?://(open|play)\.spotify\.com/.*#i'     => array( 'https://embed.spotify.com/oembed/', true ),
    76 			'#https?://(open|play)\.spotify\.com/.*#i'     => array( 'https://embed.spotify.com/oembed/', true ),
    76 			'#https?://(.+\.)?imgur\.com/.*#i'             => array( 'https://api.imgur.com/oembed', true ),
    77 			'#https?://(.+\.)?imgur\.com/.*#i'             => array( 'https://api.imgur.com/oembed', true ),
    77 			'#https?://(www\.)?meetu(\.ps|p\.com)/.*#i'    => array( 'https://api.meetup.com/oembed', true ),
       
    78 			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'    => array( 'https://issuu.com/oembed_wp', true ),
    78 			'#https?://(www\.)?issuu\.com/.+/docs/.+#i'    => array( 'https://issuu.com/oembed_wp', true ),
    79 			'#https?://(www\.)?mixcloud\.com/.*#i'         => array( 'https://www.mixcloud.com/oembed', true ),
    79 			'#https?://(www\.)?mixcloud\.com/.*#i'         => array( 'https://www.mixcloud.com/oembed', true ),
    80 			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'https://www.ted.com/services/v1/oembed.{format}', true ),
    80 			'#https?://(www\.|embed\.)?ted\.com/talks/.*#i' => array( 'https://www.ted.com/services/v1/oembed.{format}', true ),
    81 			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'https://animoto.com/oembeds/create', true ),
    81 			'#https?://(www\.)?(animoto|video214)\.com/play/.*#i' => array( 'https://animoto.com/oembeds/create', true ),
    82 			'#https?://(.+)\.tumblr\.com/post/.*#i'        => array( 'https://www.tumblr.com/oembed/1.0', true ),
    82 			'#https?://(.+)\.tumblr\.com/post/.*#i'        => array( 'https://www.tumblr.com/oembed/1.0', true ),
   100 			'#https?://(www\.)?z\.cn/.*#i'                 => array( 'https://read.amazon.cn/kp/api/oembed', true ),
   100 			'#https?://(www\.)?z\.cn/.*#i'                 => array( 'https://read.amazon.cn/kp/api/oembed', true ),
   101 			'#https?://www\.someecards\.com/.+-cards/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ),
   101 			'#https?://www\.someecards\.com/.+-cards/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ),
   102 			'#https?://www\.someecards\.com/usercards/viewcard/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ),
   102 			'#https?://www\.someecards\.com/usercards/viewcard/.+#i' => array( 'https://www.someecards.com/v2/oembed/', true ),
   103 			'#https?://some\.ly\/.+#i'                     => array( 'https://www.someecards.com/v2/oembed/', true ),
   103 			'#https?://some\.ly\/.+#i'                     => array( 'https://www.someecards.com/v2/oembed/', true ),
   104 			'#https?://(www\.)?tiktok\.com/.*/video/.*#i'  => array( 'https://www.tiktok.com/oembed', true ),
   104 			'#https?://(www\.)?tiktok\.com/.*/video/.*#i'  => array( 'https://www.tiktok.com/oembed', true ),
       
   105 			'#https?://([a-z]{2}|www)\.pinterest\.com(\.(au|mx))?/.*#i' => array( 'https://www.pinterest.com/oembed.json', true ),
       
   106 			'#https?://(www\.)?wolframcloud\.com/obj/.+#i' => array( 'https://www.wolframcloud.com/oembed', true ),
   105 		);
   107 		);
   106 
   108 
   107 		if ( ! empty( self::$early_providers['add'] ) ) {
   109 		if ( ! empty( self::$early_providers['add'] ) ) {
   108 			foreach ( self::$early_providers['add'] as $format => $data ) {
   110 			foreach ( self::$early_providers['add'] as $format => $data ) {
   109 				$providers[ $format ] = $data;
   111 				$providers[ $format ] = $data;
   143 		 * | SoundCloud   | soundcloud.com                            | 3.5.0   |
   145 		 * | SoundCloud   | soundcloud.com                            | 3.5.0   |
   144 		 * | Dailymotion  | dai.ly                                    | 3.6.0   |
   146 		 * | Dailymotion  | dai.ly                                    | 3.6.0   |
   145 		 * | Flickr       | flic.kr                                   | 3.6.0   |
   147 		 * | Flickr       | flic.kr                                   | 3.6.0   |
   146 		 * | Spotify      | spotify.com                               | 3.6.0   |
   148 		 * | Spotify      | spotify.com                               | 3.6.0   |
   147 		 * | Imgur        | imgur.com                                 | 3.9.0   |
   149 		 * | Imgur        | imgur.com                                 | 3.9.0   |
   148 		 * | Meetup.com   | meetup.com                                | 3.9.0   |
       
   149 		 * | Meetup.com   | meetu.ps                                  | 3.9.0   |
       
   150 		 * | Animoto      | animoto.com                               | 4.0.0   |
   150 		 * | Animoto      | animoto.com                               | 4.0.0   |
   151 		 * | Animoto      | video214.com                              | 4.0.0   |
   151 		 * | Animoto      | video214.com                              | 4.0.0   |
   152 		 * | Issuu        | issuu.com                                 | 4.0.0   |
   152 		 * | Issuu        | issuu.com                                 | 4.0.0   |
   153 		 * | Mixcloud     | mixcloud.com                              | 4.0.0   |
   153 		 * | Mixcloud     | mixcloud.com                              | 4.0.0   |
   154 		 * | Crowdsignal  | poll.fm                                   | 4.0.0   |
   154 		 * | Crowdsignal  | poll.fm                                   | 4.0.0   |
   177 		 * | Amazon       | z.cn                                      | 4.9.0   |
   177 		 * | Amazon       | z.cn                                      | 4.9.0   |
   178 		 * | Someecards   | someecards.com                            | 4.9.0   |
   178 		 * | Someecards   | someecards.com                            | 4.9.0   |
   179 		 * | Someecards   | some.ly                                   | 4.9.0   |
   179 		 * | Someecards   | some.ly                                   | 4.9.0   |
   180 		 * | Crowdsignal  | survey.fm                                 | 5.1.0   |
   180 		 * | Crowdsignal  | survey.fm                                 | 5.1.0   |
   181 		 * | TikTok       | tiktok.com                                | 5.4.0   |
   181 		 * | TikTok       | tiktok.com                                | 5.4.0   |
       
   182 		 * | Pinterest    | pinterest.com                             | 5.9.0   |
       
   183 		 * | WolframCloud | wolframcloud.com                          | 5.9.0   |
   182 		 *
   184 		 *
   183 		 * No longer supported providers:
   185 		 * No longer supported providers:
   184 		 *
   186 		 *
   185 		 * |   Provider   |        Flavor        |   Since   |  Removed  |
   187 		 * |   Provider   |        Flavor        |   Since   |  Removed  |
   186 		 * | ------------ | -------------------- | --------- | --------- |
   188 		 * | ------------ | -------------------- | --------- | --------- |
   198 		 * | Instagram    | instagram.com        | 3.5.0     | 5.5.2     |
   200 		 * | Instagram    | instagram.com        | 3.5.0     | 5.5.2     |
   199 		 * | Instagram    | instagr.am           | 3.5.0     | 5.5.2     |
   201 		 * | Instagram    | instagr.am           | 3.5.0     | 5.5.2     |
   200 		 * | Instagram TV | instagram.com        | 5.1.0     | 5.5.2     |
   202 		 * | Instagram TV | instagram.com        | 5.1.0     | 5.5.2     |
   201 		 * | Instagram TV | instagr.am           | 5.1.0     | 5.5.2     |
   203 		 * | Instagram TV | instagr.am           | 5.1.0     | 5.5.2     |
   202 		 * | Facebook     | facebook.com         | 4.7.0     | 5.5.2     |
   204 		 * | Facebook     | facebook.com         | 4.7.0     | 5.5.2     |
       
   205 		 * | Meetup.com   | meetup.com           | 3.9.0     | 6.0.1     |
       
   206 		 * | Meetup.com   | meetu.ps             | 3.9.0     | 6.0.1     |
   203 		 *
   207 		 *
   204 		 * @see wp_oembed_add_provider()
   208 		 * @see wp_oembed_add_provider()
   205 		 *
   209 		 *
   206 		 * @since 2.9.0
   210 		 * @since 2.9.0
   207 		 *
   211 		 *