Commit Graph

11 Commits

Author SHA1 Message Date
Helen Hou-Sandi 3adcda996b Improve oEmbed caching. Introduces the concept of a TTL for oEmbed caches and a filter for `oembed_ttl`.
We will no longer replace previously valid oEmbed responses with an `{{unknown}}` cache value. When this happens due to reaching a rate limit or a service going down, it is data loss, and is not acceptable. This means that oEmbed caches for a post are no longer deleted indiscriminately every time that post is saved.

oEmbed continues to be cached in post meta, with the addition of a separate meta key containing the timestamp of the last retrieval, which is used to avoid re-requesting a recently cached oEmbed response. By default, we consider a valued cached in the past day to be fresh. This can greatly reduce the number of outbound requests, especially in cases where a post containing multiple embeds is saved frequently.

The TTL used to determine whether or not to request a response can be filtered using `oembed_ttl`, thus allowing for the possibility of respecting the optional oEmbed response parameter `cache_age` or altering the period of time a cached value is considered to be fresh.

Now that oEmbeds are previewed in the visual editor as well as the media modal, oEmbed caches are often populated before a post is saved or published. By pre-populating and avoiding having to re-request that response, we also greatly reduce the chances of a stampede happening when a published post is visible before oEmbed caching is complete.

As it previously stood, a stampede was extremely likely to happen, as the AJAX caching was only triggered when `$_GET['message']` was 1. The published message is 6. We now trigger the caching every time `$_GET['message']` is present on the edit screen, as we are able to avoid triggering so many HTTP requests overall.

props markjaquith. fixes #14759. see #17210.


git-svn-id: https://develop.svn.wordpress.org/trunk@28972 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 16:44:15 +00:00
Sergey Biryukov 4176aa347e Pass $url parameter to wp_embed_defaults() and 'embed_defaults' filter.
props wpsmith, sabreuse, jacobdubail.
fixes #20151.

git-svn-id: https://develop.svn.wordpress.org/trunk@28923 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-30 11:15:33 +00:00
Andrew Ozz df6eb733eb Secure embeds in the editor (first run):
- When the user pastes an embeddable http URL, try to get the https embed.
- If an embed provider doesn't support ssl embeds, show a placeholder/error message.
- Revise the way we return error messages.
See #28195, #28507.

git-svn-id: https://develop.svn.wordpress.org/trunk@28919 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-30 05:48:16 +00:00
Scott Taylor 3b060c1931 Read the `src` attribute for the `[embed]` shortcode if the shortcode's body is empty.
These work:
`[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"]`
`[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"][/embed]`

If you do:
`[embed src="https://www.youtube.com/watch?v=ZqD-LPOWIT0"]http://any-other-url.com[/embed]`

... "http://any-other-url.com" will be the URL that is parsed.

Props kovshenin, aaroncampbell for making initial patches.
Fixes #24456.



git-svn-id: https://develop.svn.wordpress.org/trunk@28559 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-23 18:05:24 +00:00
Scott Taylor 26af443ade Add access modifiers to methods/members in `WP_Embed`.
See #27881, #22234.


git-svn-id: https://develop.svn.wordpress.org/trunk@28510 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 05:46:56 +00:00
Drew Jaynes (DrewAPicture) 3c80d5f86a Use a proper docs-specific variable for the first parameter passed to the `embed_oembed_discover` filter.
See #26869.


git-svn-id: https://develop.svn.wordpress.org/trunk@28378 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-13 04:28:30 +00:00
Drew Jaynes (DrewAPicture) b5612f8b80 Priority fixes for various existing hook documentation.
Props kpdesign.
See #26869


git-svn-id: https://develop.svn.wordpress.org/trunk@28083 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-12 00:00:32 +00:00
John Blackbourn 9bd9f00257 Inline documentation for core shortcode attributes.
Props DrewAPicture, johnbillion.
Fixes #25661.


git-svn-id: https://develop.svn.wordpress.org/trunk@26915 602fd350-edb4-49c9-b593-d223f7449a82
2014-01-07 16:06:48 +00:00
Andrew Nacin c87ad6023d Spell out duplicate hook locations.
props DrewAPicture.
fixes #25658.


git-svn-id: https://develop.svn.wordpress.org/trunk@25868 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-22 17:21:32 +00:00
Drew Jaynes d02ef44f33 Inline documentation for hooks in wp-includes/class-wp-embed.php.
Props swissspidy, kpdesign.
Fixes #25515.


git-svn-id: https://develop.svn.wordpress.org/trunk@25726 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-08 04:42:20 +00:00
Andrew Nacin b43712e0f7 New develop.svn.wordpress.org repository based on the old core.svn repository.
* All WordPress files move to a src/ directory.
 * New task runner (Grunt), configured to copy a built WordPress to build/.
 * svn:ignore and .gitignore for Gruntfile.js, wp-config.php, and node.js.
 * Remove Akismet external from develop.svn. Still exists in core.svn.
 * Drop minified files from src/. The build process will now generate these.

props koop.
see #24976.

and see http://wp.me/p2AvED-1AI.



git-svn-id: https://develop.svn.wordpress.org/trunk@25001 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-07 05:25:25 +00:00