[wp-trac] [WordPress Trac] #32069: Press This: Check embeds list against oembed providers too.
WordPress Trac
noreply at wordpress.org
Wed Apr 22 20:44:29 UTC 2015
#32069: Press This: Check embeds list against oembed providers too.
-------------------------+--------------------
Reporter: stephdau | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.3
Component: Press This | Version: trunk
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
-------------------------+--------------------
Description changed by stephdau:
Old description:
> We brought the concept of checking pressed URLs against core's list of
> oembed providers, which makes it possible to auto-embed media in the
> editor on page load, when scanning a Youtube page, etc.
>
> The check currently resides in the `_html` method. We should widen the
> scope of this check to the `_limit_embed()` method, so we can do away
> with the tests that check the sent `$src` against page regexes (not
> iframe ones):
> {{{
> } else if ( ! preg_match( '/\/\/(m|www)\.youtube\.com\/watch\?/', $src )
> // Youtube video page (www or mobile)
> && ! preg_match( '/\/youtu\.be\/.+$/', $src )
> // Youtu.be video page
> && ! preg_match( '/\/\/vimeo\.com\/[\d]+$/',
> $src ) // Vimeo video page
> && ! preg_match(
> '/\/\/(www\.)?dailymotion\.com\/video\/.+$/', $src ) // Daily Motion
> video page
> && ! preg_match(
> '/\/\/soundcloud\.com\/.+$/', $src ) // SoundCloud audio
> page
> && ! preg_match(
> '/\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/', $src ) // Twitter status
> page
> && ! preg_match( '/\/\/vine\.co\/v\/[^\/]+/',
> $src ) ) { // Vine video page
> $src = '';
> }
> }}}
>
> Once this is done, we could have the `get_embeds()` method also check the
> page URL, which would then have the embed that is auto-inserted in the
> editor also be part of the list of suggested media. This way, if someone
> lands on, say, a TED page, they will have both the auto-inserted embed,
> as well as a thumbnail to click, should they need it.
>
> Currently, the alternative would be to re-press the page to get the embed
> again.
>
> If we go that route, we'll also need to tweak the related code in the
> bookmarklet.
> {{{
> if ( href.match( /\/\/(www|m)\.youtube\.com\/watch/ ) ||
> href.match( /\/\/vimeo\.com\/(.+\/)?([\d]+)$/ ) ||
> href.match( /\/\/(www\.)?dailymotion\.com\/video\/.+$/ )
> ||
> href.match( /\/\/soundcloud\.com\/.+$/ ) ||
> href.match( /\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/ )
> ||
> href.match( /\/\/vine\.co\/v\/[^\/]+/ ) ) {
>
> add( '_embeds[]', href );
> }
> }}}
>
> I'd do away with it altogether.
New description:
We brought the concept of checking pressed URLs against core's list of
oembed providers, which makes it possible to auto-embed media in the
editor on page load, when scanning a Youtube page, etc.
The check currently resides in the `_html` method. We should widen the
scope of this check to the `_limit_embed()` method, so we can do away with
the tests that check the sent `$src` against page regexes (not iframe
ones):
{{{
} else if ( ! preg_match(
'/\/\/(m|www)\.youtube\.com\/watch\?/', $src ) // Youtube video
page (www or mobile)
&& ! preg_match( '/\/youtu\.be\/.+$/', $src )
// Youtu.be video page
&& ! preg_match( '/\/\/vimeo\.com\/[\d]+$/',
$src ) // Vimeo video page
&& ! preg_match(
'/\/\/(www\.)?dailymotion\.com\/video\/.+$/', $src ) // Daily Motion video
page
&& ! preg_match( '/\/\/soundcloud\.com\/.+$/',
$src ) // SoundCloud audio page
&& ! preg_match(
'/\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/', $src ) // Twitter status
page
&& ! preg_match( '/\/\/vine\.co\/v\/[^\/]+/',
$src ) ) { // Vine video page
$src = '';
}
}}}
Once this is done, we could have the `get_embeds()` method also check the
page URL, which would then have the embed that is auto-inserted in the
editor also be part of the list of suggested media. This way, if someone
lands on, say, a TED page, they will have both the auto-inserted embed, as
well as a thumbnail to click, should they need it.
Currently, the alternative would be to re-press the page to get the embed
again.
If we go that route, we'll also need to tweak the related code in the
bookmarklet.
{{{
if ( href.match( /\/\/(www|m)\.youtube\.com\/watch/ ) ||
href.match( /\/\/vimeo\.com\/(.+\/)?([\d]+)$/ ) ||
href.match( /\/\/(www\.)?dailymotion\.com\/video\/.+$/ )
||
href.match( /\/\/soundcloud\.com\/.+$/ ) ||
href.match( /\/\/twitter\.com\/[^\/]+\/status\/[\d]+$/ )
||
href.match( /\/\/vine\.co\/v\/[^\/]+/ ) ) {
add( '_embeds[]', href );
}
}}}
I'd do away with it altogether.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32069#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list