<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[43810] branches/5.0: Embeds: Filter HTML response in oEmbed proxy controller.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/43810">43810</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/43810","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>danielbachhuber</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2018-10-23 17:47:28 +0000 (Tue, 23 Oct 2018)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Embeds: Filter HTML response in oEmbed proxy controller.

Adapts the response from `WP_oEmbed_Controller::get_proxy_item()` so that the response is correctly filtered and embeds work properly in JavaSccript editors. Introduces new `get_oembed_response_data_for_url()` function for preparing internal oEmbed responses.

Props danielbachhuber, imath, swissspidy.
Fixes <a href="https://core.trac.wordpress.org/ticket/45142">#45142</a>. </pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches50srcwpincludesclassoembedphp">branches/5.0/src/wp-includes/class-oembed.php</a></li>
<li><a href="#branches50srcwpincludesclasswpoembedcontrollerphp">branches/5.0/src/wp-includes/class-wp-oembed-controller.php</a></li>
<li><a href="#branches50srcwpincludesembedphp">branches/5.0/src/wp-includes/embed.php</a></li>
<li><a href="#branches50testsphpunittestsoembedcontrollerphp">branches/5.0/tests/phpunit/tests/oembed/controller.php</a></li>
<li><a href="#branches50testsqunitfixtureswpapigeneratedjs">branches/5.0/tests/qunit/fixtures/wp-api-generated.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches50srcwpincludesclassoembedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/src/wp-includes/class-oembed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/src/wp-includes/class-oembed.php     2018-10-23 16:50:33 UTC (rev 43809)
+++ branches/5.0/src/wp-includes/class-oembed.php       2018-10-23 17:47:28 UTC (rev 43810)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -405,9 +405,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 2.9.0
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 * @param string $data The returned oEmbed HTML.
-                * @param string $url  URL of the content to be embedded.
-                * @param array  $args Optional arguments, usually passed from a shortcode.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+          * @param string|false $data The returned oEmbed HTML (false if unsafe).
+                * @param string       $url  URL of the content to be embedded.
+                * @param array        $args Optional arguments, usually passed from a shortcode.
</ins><span class="cx" style="display: block; padding: 0 10px">                  */
</span><span class="cx" style="display: block; padding: 0 10px">                return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span></span></pre></div>
<a id="branches50srcwpincludesclasswpoembedcontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/src/wp-includes/class-wp-oembed-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/src/wp-includes/class-wp-oembed-controller.php       2018-10-23 16:50:33 UTC (rev 43809)
+++ branches/5.0/src/wp-includes/class-wp-oembed-controller.php 2018-10-23 17:47:28 UTC (rev 43810)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -173,6 +173,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $args['height'] = $args['maxheight'];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Short-circuit process for URLs belonging to the current site.
+               $data = get_oembed_response_data_for_url( $url, $args );
+
+               if ( $data ) {
+                       return $data;
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $data = _wp_oembed_get_object()->get_data( $url, $args );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( false === $data ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -179,6 +186,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                /** This filter is documented in wp-includes/class-oembed.php */
+               $data->html = apply_filters( 'oembed_result', _wp_oembed_get_object()->data2html( (object) $data, $url ), $url, $args );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 /**
</span><span class="cx" style="display: block; padding: 0 10px">                 * Filters the oEmbed TTL value (time to live).
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span></span></pre></div>
<a id="branches50srcwpincludesembedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/src/wp-includes/embed.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/src/wp-includes/embed.php    2018-10-23 16:50:33 UTC (rev 43809)
+++ branches/5.0/src/wp-includes/embed.php      2018-10-23 17:47:28 UTC (rev 43810)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -555,7 +555,72 @@
</span><span class="cx" style="display: block; padding: 0 10px">        return apply_filters( 'oembed_response_data', $data, $post, $width, $height );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves the oEmbed response data for a given URL.
+ *
+ * @since 5.0.0
+ *
+ * @param string $url  The URL that should be inspected for discovery `<link>` tags.
+ * @param array  $args oEmbed remote get arguments.
+ * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise.
+ */
+function get_oembed_response_data_for_url( $url, $args ) {
+       $switched_blog = false;
+
+       if ( is_multisite() ) {
+               $url_parts = wp_parse_args( wp_parse_url( $url ), array(
+                       'host'   => '',
+                       'path'   => '/',
+               ) );
+
+               $qv = array( 'domain' => $url_parts['host'], 'path' => '/' );
+
+               // In case of subdirectory configs, set the path.
+               if ( ! is_subdomain_install() ) {
+                       $path = explode( '/', ltrim( $url_parts['path'], '/' ) );
+                       $path = reset( $path );
+
+                       if ( $path ) {
+                               $qv['path'] = get_network()->path . $path . '/';
+                       }
+               }
+
+               $sites = get_sites( $qv );
+               $site  = reset( $sites );
+
+               if ( $site && (int) $site->blog_id !== get_current_blog_id() ) {
+                       switch_to_blog( $site->blog_id );
+                       $switched_blog = true;
+               }
+       }
+
+       $post_id = url_to_postid( $url );
+
+       /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
+       $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );
+
+       if ( ! $post_id ) {
+               if ( $switched_blog ) {
+                       restore_current_blog();
+               }
+
+               return false;
+       }
+
+       $width = isset( $args['width'] ) ? $args['width'] : 0;
+
+       $data = get_oembed_response_data( $post_id, $width );
+
+       if ( $switched_blog ) {
+               restore_current_blog();
+       }
+
+       return $data ? (object) $data : false;
+}
+
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px">  * Filters the oEmbed response data to return an iframe embed code.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 4.4.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1071,60 +1136,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *                     Null if the URL does not belong to the current site.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_filter_pre_oembed_result( $result, $url, $args ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $switched_blog = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $data = get_oembed_response_data_for_url( $url, $args );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( is_multisite() ) {
-               $url_parts = wp_parse_args( wp_parse_url( $url ), array(
-                       'host'   => '',
-                       'path'   => '/',
-               ) );
-
-               $qv = array( 'domain' => $url_parts['host'], 'path' => '/' );
-
-               // In case of subdirectory configs, set the path.
-               if ( ! is_subdomain_install() ) {
-                       $path = explode( '/', ltrim( $url_parts['path'], '/' ) );
-                       $path = reset( $path );
-
-                       if ( $path ) {
-                               $qv['path'] = get_network()->path . $path . '/';
-                       }
-               }
-
-               $sites = get_sites( $qv );
-               $site  = reset( $sites );
-
-               if ( $site && (int) $site->blog_id !== get_current_blog_id() ) {
-                       switch_to_blog( $site->blog_id );
-                       $switched_blog = true;
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $data ) {
+               return _wp_oembed_get_object()->data2html( $data, $url );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $post_id = url_to_postid( $url );
-
-       /** This filter is documented in wp-includes/class-wp-oembed-controller.php */
-       $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );
-
-       if ( ! $post_id ) {
-               if ( $switched_blog ) {
-                       restore_current_blog();
-               }
-
-               return $result;
-       }
-
-       $width = isset( $args['width'] ) ? $args['width'] : 0;
-
-       $data = get_oembed_response_data( $post_id, $width );
-       $data = _wp_oembed_get_object()->data2html( (object) $data, $url );
-
-       if ( $switched_blog ) {
-               restore_current_blog();
-       }
-
-       if ( ! $data ) {
-               return $result;
-       }
-
-       return $data;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $result;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches50testsphpunittestsoembedcontrollerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/tests/phpunit/tests/oembed/controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tests/phpunit/tests/oembed/controller.php    2018-10-23 16:50:33 UTC (rev 43809)
+++ branches/5.0/tests/phpunit/tests/oembed/controller.php      2018-10-23 17:47:28 UTC (rev 43810)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,6 +14,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        protected static $subscriber;
</span><span class="cx" style="display: block; padding: 0 10px">        const YOUTUBE_VIDEO_ID = 'OQSNhk5ICTI';
</span><span class="cx" style="display: block; padding: 0 10px">        const INVALID_OEMBED_URL = 'https://www.notreallyanoembedprovider.com/watch?v=awesome-cat-video';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        const UNTRUSTED_PROVIDER_URL = 'https://www.untrustedprovider.com';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public static function wpSetUpBeforeClass( $factory ) {
</span><span class="cx" style="display: block; padding: 0 10px">                self::$subscriber = $factory->user->create( array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,7 +44,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                do_action( 'rest_api_init', $this->server );
</span><span class="cx" style="display: block; padding: 0 10px">                add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                add_filter( 'oembed_result', array( $this, 'filter_oembed_result' ), 10, 3 );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->request_count = 0;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               $this->oembed_result_filter_count = 0;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        public function tearDown() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -50,6 +54,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                parent::tearDown();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                remove_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10 );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                remove_filter( 'oembed_result', array( $this, 'filter_oembed_result' ), 10 );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,6 +65,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public $request_count = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Count of the number of times the oembed_result filter was called.
+        *
+        * @var int
+        */
+       public $oembed_result_filter_count = 0;
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Intercept oEmbed requests and mock responses.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param mixed  $preempt Whether to preempt an HTTP request's return value. Default false.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -71,7 +83,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                unset( $preempt, $r );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $parsed_url = wp_parse_url( $url );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                parse_str( $parsed_url['query'], $query_params );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $query      = isset( $parsed_url['query'] ) ? $parsed_url['query'] : '';
+               parse_str( $query, $query_params );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->request_count += 1;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Mock request to YouTube Embed.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -80,7 +93,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                'response' => array(
</span><span class="cx" style="display: block; padding: 0 10px">                                        'code' => 200,
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'body' => wp_json_encode(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'body'     => wp_json_encode(
</ins><span class="cx" style="display: block; padding: 0 10px">                                         array(
</span><span class="cx" style="display: block; padding: 0 10px">                                                'version'          => '1.0',
</span><span class="cx" style="display: block; padding: 0 10px">                                                'type'             => 'video',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -90,7 +103,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                'width'            => $query_params['maxwidth'],
</span><span class="cx" style="display: block; padding: 0 10px">                                                'thumbnail_height' => $query_params['maxheight'],
</span><span class="cx" style="display: block; padding: 0 10px">                                                'height'           => $query_params['maxheight'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                'html'             => '<iframe width="' . $query_params['maxwidth'] . '" height="' . $query_params['maxheight'] . '" src="https://www.youtube.com/embed/' . self::YOUTUBE_VIDEO_ID . '?feature=oembed" frameborder="0" allowfullscreen></iframe>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                         'html'             => '<b>Unfiltered</b><iframe width="' . $query_params['maxwidth'] . '" height="' . $query_params['maxheight'] . '" src="https://www.youtube.com/embed/' . self::YOUTUBE_VIDEO_ID . '?feature=oembed" frameborder="0" allowfullscreen></iframe>',
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 'author_name'      => 'Yosemitebear62',
</span><span class="cx" style="display: block; padding: 0 10px">                                                'thumbnail_url'    => 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg',
</span><span class="cx" style="display: block; padding: 0 10px">                                                'title'            => 'Yosemitebear Mountain Double Rainbow 1-8-10',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,15 +110,61 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        )
</span><span class="cx" style="display: block; padding: 0 10px">                                ),
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                } else {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         }
+
+               if ( $url === self::UNTRUSTED_PROVIDER_URL ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return array(
</span><span class="cx" style="display: block; padding: 0 10px">                                'response' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        'code' => 404,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 'code' => 200,
</ins><span class="cx" style="display: block; padding: 0 10px">                                 ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                'body'     => '<html><head><link rel="alternate" type="application/json+oembed" href="' . self::UNTRUSTED_PROVIDER_URL . '" /></head><body></body></html>',
</ins><span class="cx" style="display: block; padding: 0 10px">                         );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               if ( ! empty( $query_params['url'] ) && false !== strpos( $query_params['url'], self::UNTRUSTED_PROVIDER_URL ) ) {
+                       return array(
+                               'response' => array(
+                                       'code' => 200,
+                               ),
+                               'body'     => wp_json_encode(
+                                       array(
+                                               'version'          => '1.0',
+                                               'type'             => 'rich',
+                                               'provider_name'    => 'Untrusted',
+                                               'provider_url'     => self::UNTRUSTED_PROVIDER_URL,
+                                               'html'             => '<b>Filtered</b><a href="">Unfiltered</a>',
+                                               'author_name'      => 'Untrusted Embed Author',
+                                               'title'            => 'Untrusted Embed',
+                                       )
+                               ),
+                       );
+               }
+
+               return array(
+                       'response' => array(
+                               'code' => 404,
+                       ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        /**
+        * Filters 'oembed_result' to ensure correct type.
+        *
+        * @param string|false $data The returned oEmbed HTML.
+        * @param string       $url  URL of the content to be embedded.
+        * @param array        $args Optional arguments, usually passed from a shortcode.
+        * @return string
+        */
+       public function filter_oembed_result( $data, $url, $args ) {
+               if ( ! is_string( $data ) && false !== $data ) {
+                       $this->fail( 'Unexpected type for $data.' );
+               }
+               $this->assertInternalType( 'string', $url );
+               $this->assertInternalType( 'array', $args );
+               $this->oembed_result_filter_count++;
+               return $data;
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">         function test_wp_oembed_ensure_format() {
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( 'json', wp_oembed_ensure_format( 'json' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( 'xml', wp_oembed_ensure_format( 'xml' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -510,7 +569,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertNotEmpty( $data );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $this->assertTrue( is_object( $data ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertInternalType( 'object', $data );
</ins><span class="cx" style="display: block; padding: 0 10px">                 $this->assertEquals( 'YouTube', $data->provider_name );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg', $data->thumbnail_url );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( $data->width, $request['maxwidth'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -552,4 +611,141 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $data = $response->get_data();
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertEquals( $data['code'], 'rest_invalid_param' );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * @ticket 45142
+        */
+       function test_proxy_with_internal_url() {
+               wp_set_current_user( self::$editor );
+
+               $user = self::factory()->user->create_and_get( array(
+                       'display_name' => 'John Doe',
+               ) );
+               $post = self::factory()->post->create_and_get( array(
+                       'post_author' => $user->ID,
+                       'post_title'  => 'Hello World',
+               ) );
+
+               $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
+               $request->set_param( 'url', get_permalink( $post->ID ) );
+               $request->set_param( 'maxwidth', 400 );
+
+               $response = $this->server->dispatch( $request );
+               $data     = $response->get_data();
+
+               $data = (array) $data;
+
+               $this->assertNotEmpty( $data );
+
+               $this->assertArrayHasKey( 'version', $data );
+               $this->assertArrayHasKey( 'provider_name', $data );
+               $this->assertArrayHasKey( 'provider_url', $data );
+               $this->assertArrayHasKey( 'author_name', $data );
+               $this->assertArrayHasKey( 'author_url', $data );
+               $this->assertArrayHasKey( 'title', $data );
+               $this->assertArrayHasKey( 'type', $data );
+               $this->assertArrayHasKey( 'width', $data );
+
+               $this->assertEquals( '1.0', $data['version'] );
+               $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
+               $this->assertEquals( get_home_url(), $data['provider_url'] );
+               $this->assertEquals( $user->display_name, $data['author_name'] );
+               $this->assertEquals( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] );
+               $this->assertEquals( $post->post_title, $data['title'] );
+               $this->assertEquals( 'rich', $data['type'] );
+               $this->assertTrue( $data['width'] <= $request['maxwidth'] );
+       }
+
+       /**
+        * @ticket 45142
+        */
+       function test_proxy_with_static_front_page_url() {
+               wp_set_current_user( self::$editor );
+
+               $post = self::factory()->post->create_and_get( array(
+                       'post_title'  => 'Front page',
+                       'post_type'   => 'page',
+                       'post_author' => 0,
+               ) );
+
+               update_option( 'show_on_front', 'page' );
+               update_option( 'page_on_front', $post->ID );
+
+               $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
+               $request->set_param( 'url', home_url() );
+               $request->set_param( 'maxwidth', 400 );
+
+               $response = $this->server->dispatch( $request );
+               $data     = $response->get_data();
+
+               $this->assertInternalType( 'object', $data );
+
+               $data = (array) $data;
+
+               $this->assertNotEmpty( $data );
+
+               $this->assertArrayHasKey( 'version', $data );
+               $this->assertArrayHasKey( 'provider_name', $data );
+               $this->assertArrayHasKey( 'provider_url', $data );
+               $this->assertArrayHasKey( 'author_name', $data );
+               $this->assertArrayHasKey( 'author_url', $data );
+               $this->assertArrayHasKey( 'title', $data );
+               $this->assertArrayHasKey( 'type', $data );
+               $this->assertArrayHasKey( 'width', $data );
+
+               $this->assertEquals( '1.0', $data['version'] );
+               $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] );
+               $this->assertEquals( get_home_url(), $data['provider_url'] );
+               $this->assertEquals( get_bloginfo( 'name' ), $data['author_name'] );
+               $this->assertEquals( get_home_url(), $data['author_url'] );
+               $this->assertEquals( $post->post_title, $data['title'] );
+               $this->assertEquals( 'rich', $data['type'] );
+               $this->assertTrue( $data['width'] <= $request['maxwidth'] );
+
+               update_option( 'show_on_front', 'posts' );
+       }
+
+       /**
+        * @ticket 45142
+        */
+       public function test_proxy_filters_result_of_untrusted_oembed_provider() {
+               wp_set_current_user( self::$editor );
+
+               $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
+               $request->set_param( 'url', self::UNTRUSTED_PROVIDER_URL );
+               $request->set_param( 'maxwidth', 456 );
+               $request->set_param( 'maxheight', 789 );
+               $request->set_param( '_wpnonce', wp_create_nonce( 'wp_rest' ) );
+
+               $response = $this->server->dispatch( $request );
+               $data     = $response->get_data();
+
+               $this->assertEquals( 1, $this->oembed_result_filter_count );
+               $this->assertInternalType( 'object', $data );
+               $this->assertEquals( 'Untrusted', $data->provider_name );
+               $this->assertEquals( self::UNTRUSTED_PROVIDER_URL, $data->provider_url );
+               $this->assertEquals( 'rich', $data->type );
+               $this->assertFalse( $data->html );
+       }
+
+       /**
+        * @ticket 45142
+        */
+       public function test_proxy_does_not_filter_result_of_trusted_oembed_provider() {
+               wp_set_current_user( self::$editor );
+
+               $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' );
+               $request->set_param( 'url', 'https://www.youtube.com/watch?v=' . self::YOUTUBE_VIDEO_ID );
+               $request->set_param( 'maxwidth', 456 );
+               $request->set_param( 'maxheight', 789 );
+               $request->set_param( '_wpnonce', wp_create_nonce( 'wp_rest' ) );
+
+               $response = $this->server->dispatch( $request );
+               $data     = $response->get_data();
+
+               $this->assertEquals( 1, $this->oembed_result_filter_count );
+               $this->assertInternalType( 'object', $data );
+
+               $this->assertStringStartsWith( '<b>Unfiltered</b>', $data->html );
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches50testsqunitfixtureswpapigeneratedjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/5.0/tests/qunit/fixtures/wp-api-generated.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/5.0/tests/qunit/fixtures/wp-api-generated.js     2018-10-23 16:50:33 UTC (rev 43809)
+++ branches/5.0/tests/qunit/fixtures/wp-api-generated.js       2018-10-23 17:47:28 UTC (rev 43810)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5075,16 +5075,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px">     },
</span><span class="cx" style="display: block; padding: 0 10px">     {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "author": 405,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "author": 406,
</ins><span class="cx" style="display: block; padding: 0 10px">         "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "date_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "id": 1527,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "id": 36717,
</ins><span class="cx" style="display: block; padding: 0 10px">         "modified": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "modified_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "parent": 1526,
-        "slug": "1526-revision-v1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "parent": 36716,
+        "slug": "36716-revision-v1",
</ins><span class="cx" style="display: block; padding: 0 10px">         "guid": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            "rendered": "http://example.org/?p=1527"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+            "rendered": "http://example.org/?p=36717"
</ins><span class="cx" style="display: block; padding: 0 10px">         },
</span><span class="cx" style="display: block; padding: 0 10px">         "title": {
</span><span class="cx" style="display: block; padding: 0 10px">             "rendered": "REST API Client Fixture: Post"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5098,7 +5098,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         "_links": {
</span><span class="cx" style="display: block; padding: 0 10px">             "parent": [
</span><span class="cx" style="display: block; padding: 0 10px">                 {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/1526"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/36716"
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5130,16 +5130,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> mockedApiResponse.postAutosaves = [
</span><span class="cx" style="display: block; padding: 0 10px">     {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "author": 405,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "author": 406,
</ins><span class="cx" style="display: block; padding: 0 10px">         "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "date_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "id": 1528,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "id": 36718,
</ins><span class="cx" style="display: block; padding: 0 10px">         "modified": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "modified_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "parent": 1526,
-        "slug": "1526-autosave-v1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "parent": 36716,
+        "slug": "36716-autosave-v1",
</ins><span class="cx" style="display: block; padding: 0 10px">         "guid": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            "rendered": "http://example.org/?p=1528"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+            "rendered": "http://example.org/?p=36718"
</ins><span class="cx" style="display: block; padding: 0 10px">         },
</span><span class="cx" style="display: block; padding: 0 10px">         "title": {
</span><span class="cx" style="display: block; padding: 0 10px">             "rendered": ""
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5153,7 +5153,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         "_links": {
</span><span class="cx" style="display: block; padding: 0 10px">             "parent": [
</span><span class="cx" style="display: block; padding: 0 10px">                 {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/1526"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                    "href": "http://example.org/index.php?rest_route=/wp/v2/posts/36716"
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5161,16 +5161,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> mockedApiResponse.autosave = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "author": 405,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "author": 406,
</ins><span class="cx" style="display: block; padding: 0 10px">     "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">     "date_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "id": 1528,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "id": 36718,
</ins><span class="cx" style="display: block; padding: 0 10px">     "modified": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">     "modified_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "parent": 1526,
-    "slug": "1526-autosave-v1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "parent": 36716,
+    "slug": "36716-autosave-v1",
</ins><span class="cx" style="display: block; padding: 0 10px">     "guid": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "rendered": "http://example.org/?p=1528"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "rendered": "http://example.org/?p=36718"
</ins><span class="cx" style="display: block; padding: 0 10px">     },
</span><span class="cx" style="display: block; padding: 0 10px">     "title": {
</span><span class="cx" style="display: block; padding: 0 10px">         "rendered": ""
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5335,16 +5335,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px">     },
</span><span class="cx" style="display: block; padding: 0 10px">     {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "author": 405,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "author": 406,
</ins><span class="cx" style="display: block; padding: 0 10px">         "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "date_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "id": 1530,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "id": 36720,
</ins><span class="cx" style="display: block; padding: 0 10px">         "modified": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "modified_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "parent": 1529,
-        "slug": "1529-revision-v1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "parent": 36719,
+        "slug": "36719-revision-v1",
</ins><span class="cx" style="display: block; padding: 0 10px">         "guid": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            "rendered": "http://example.org/?p=1530"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+            "rendered": "http://example.org/?p=36720"
</ins><span class="cx" style="display: block; padding: 0 10px">         },
</span><span class="cx" style="display: block; padding: 0 10px">         "title": {
</span><span class="cx" style="display: block; padding: 0 10px">             "rendered": "REST API Client Fixture: Page"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5358,7 +5358,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         "_links": {
</span><span class="cx" style="display: block; padding: 0 10px">             "parent": [
</span><span class="cx" style="display: block; padding: 0 10px">                 {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/1529"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/36719"
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5390,16 +5390,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> mockedApiResponse.pageAutosaves = [
</span><span class="cx" style="display: block; padding: 0 10px">     {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "author": 405,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "author": 406,
</ins><span class="cx" style="display: block; padding: 0 10px">         "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "date_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "id": 1531,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "id": 36721,
</ins><span class="cx" style="display: block; padding: 0 10px">         "modified": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">         "modified_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "parent": 1529,
-        "slug": "1529-autosave-v1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "parent": 36719,
+        "slug": "36719-autosave-v1",
</ins><span class="cx" style="display: block; padding: 0 10px">         "guid": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-            "rendered": "http://example.org/?p=1531"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+            "rendered": "http://example.org/?p=36721"
</ins><span class="cx" style="display: block; padding: 0 10px">         },
</span><span class="cx" style="display: block; padding: 0 10px">         "title": {
</span><span class="cx" style="display: block; padding: 0 10px">             "rendered": ""
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5413,7 +5413,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         "_links": {
</span><span class="cx" style="display: block; padding: 0 10px">             "parent": [
</span><span class="cx" style="display: block; padding: 0 10px">                 {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/1529"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                    "href": "http://example.org/index.php?rest_route=/wp/v2/pages/36719"
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">             ]
</span><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5421,16 +5421,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> mockedApiResponse.pageAutosave = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "author": 405,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "author": 406,
</ins><span class="cx" style="display: block; padding: 0 10px">     "date": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">     "date_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "id": 1531,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "id": 36721,
</ins><span class="cx" style="display: block; padding: 0 10px">     "modified": "2017-02-14T00:00:00",
</span><span class="cx" style="display: block; padding: 0 10px">     "modified_gmt": "2017-02-14T00:00:00",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-    "parent": 1529,
-    "slug": "1529-autosave-v1",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+    "parent": 36719,
+    "slug": "36719-autosave-v1",
</ins><span class="cx" style="display: block; padding: 0 10px">     "guid": {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        "rendered": "http://example.org/?p=1531"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        "rendered": "http://example.org/?p=36721"
</ins><span class="cx" style="display: block; padding: 0 10px">     },
</span><span class="cx" style="display: block; padding: 0 10px">     "title": {
</span><span class="cx" style="display: block; padding: 0 10px">         "rendered": ""
</span></span></pre>
</div>
</div>

</body>
</html>