After [32258], restore the parts of [31620] and [31626] that weren't changes to the UI, but were improvements to existing code.

* Use `wp.shortcode()` instead of manually constructing a shortcode in `views/embed/link`
* In `WP_Embed`, store the last URL and last set of attributes requested in class properties
* `wp_ajax_parse_embed()`, allow `[embed]`s to have attributes. Return `attr` in the response.

See #31139.


git-svn-id: https://develop.svn.wordpress.org/trunk@32330 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-04-30 21:39:52 +00:00
parent 345d34cad9
commit 625e7135f3
4 changed files with 40 additions and 7 deletions
+8 -1
View File
@@ -11,6 +11,8 @@ class WP_Embed {
public $post_ID;
public $usecache = true;
public $linkifunknown = true;
public $last_attr = array();
public $last_url = '';
/**
* When an URL cannot be embedded, return false instead of returning a link
@@ -134,13 +136,18 @@ class WP_Embed {
$url = $attr['src'];
}
$this->last_url = $url;
if ( empty( $url ) )
if ( empty( $url ) ) {
$this->last_attr = $attr;
return '';
}
$rawattr = $attr;
$attr = wp_parse_args( $attr, wp_embed_defaults( $url ) );
$this->last_attr = $attr;
// kses converts & into & and we need to undo this
// See https://core.trac.wordpress.org/ticket/11311
$url = str_replace( '&', '&', $url );