Changeset 44154
- Timestamp:
- 12/14/2018 03:19:48 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43810
- Property svn:mergeinfo changed
-
trunk/src/wp-includes/class-oembed.php
r43571 r44154 405 405 * @since 2.9.0 406 406 * 407 * @param string $data The returned oEmbed HTML.408 * @param string $url URL of the content to be embedded.409 * @param array $args Optional arguments, usually passed from a shortcode.407 * @param string|false $data The returned oEmbed HTML (false if unsafe). 408 * @param string $url URL of the content to be embedded. 409 * @param array $args Optional arguments, usually passed from a shortcode. 410 410 */ 411 411 return apply_filters( 'oembed_result', $this->data2html( $data, $url ), $url, $args ); -
trunk/src/wp-includes/class-wp-oembed-controller.php
r43571 r44154 182 182 } 183 183 184 // Short-circuit process for URLs belonging to the current site. 185 $data = get_oembed_response_data_for_url( $url, $args ); 186 187 if ( $data ) { 188 return $data; 189 } 190 184 191 $data = _wp_oembed_get_object()->get_data( $url, $args ); 185 192 … … 187 194 return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) ); 188 195 } 196 197 /** This filter is documented in wp-includes/class-oembed.php */ 198 $data->html = apply_filters( 'oembed_result', _wp_oembed_get_object()->data2html( (object) $data, $url ), $url, $args ); 189 199 190 200 /** -
trunk/src/wp-includes/embed.php
r43571 r44154 62 62 */ 63 63 function wp_embed_defaults( $url = '' ) { 64 if ( ! empty( $GLOBALS['content_width'] ) ) {64 if ( ! empty( $GLOBALS['content_width'] ) ) 65 65 $width = (int) $GLOBALS['content_width']; 66 } 67 68 if ( empty( $width ) ) { 66 67 if ( empty( $width ) ) 69 68 $width = 500; 70 }71 69 72 70 $height = min( ceil( $width * 1.5 ), 1000 ); … … 77 75 * @since 2.9.0 78 76 * 79 * @param int[]$size An array of embed width and height values77 * @param array $size An array of embed width and height values 80 78 * in pixels (in that order). 81 79 * @param string $url The URL that should be embedded. … … 134 132 function wp_oembed_add_provider( $format, $provider, $regex = false ) { 135 133 if ( did_action( 'plugins_loaded' ) ) { 136 $oembed 137 $oembed->providers[ $format] = array( $provider, $regex );134 $oembed = _wp_oembed_get_object(); 135 $oembed->providers[$format] = array( $provider, $regex ); 138 136 } else { 139 137 WP_oEmbed::_add_provider_early( $format, $provider, $regex ); … … 229 227 function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { 230 228 global $wp_embed; 231 $embed = $wp_embed->autoembed( sprintf( 'https://youtube.com/watch?v=%s', urlencode( $matches[2] ) ) );229 $embed = $wp_embed->autoembed( sprintf( "https://youtube.com/watch?v=%s", urlencode( $matches[2] ) ) ); 232 230 233 231 /** … … 398 396 399 397 if ( '' !== $permalink ) { 400 $url = add_query_arg( 401 array( 402 'url' => urlencode( $permalink ), 403 'format' => ( 'json' !== $format ) ? $format : false, 404 ), 405 $url 406 ); 398 $url = add_query_arg( array( 399 'url' => urlencode( $permalink ), 400 'format' => ( 'json' !== $format ) ? $format : false, 401 ), $url ); 407 402 } 408 403 … … 455 450 * and edit wp-embed.js directly. 456 451 */ 457 $output .= 452 $output .=<<<JS 458 453 include "js/wp-embed.min.js" 459 454 JS; … … 523 518 * } 524 519 */ 525 $min_max_width = apply_filters( 526 'oembed_min_max_width', 527 array( 528 'min' => 200, 529 'max' => 600, 530 ) 531 ); 520 $min_max_width = apply_filters( 'oembed_min_max_width', array( 521 'min' => 200, 522 'max' => 600 523 ) ); 532 524 533 525 $width = min( max( $min_max_width['min'], $width ), $min_max_width['max'] ); … … 564 556 } 565 557 558 559 /** 560 * Retrieves the oEmbed response data for a given URL. 561 * 562 * @since 5.0.0 563 * 564 * @param string $url The URL that should be inspected for discovery `<link>` tags. 565 * @param array $args oEmbed remote get arguments. 566 * @return object|false oEmbed response data if the URL does belong to the current site. False otherwise. 567 */ 568 function get_oembed_response_data_for_url( $url, $args ) { 569 $switched_blog = false; 570 571 if ( is_multisite() ) { 572 $url_parts = wp_parse_args( wp_parse_url( $url ), array( 573 'host' => '', 574 'path' => '/', 575 ) ); 576 577 $qv = array( 'domain' => $url_parts['host'], 'path' => '/' ); 578 579 // In case of subdirectory configs, set the path. 580 if ( ! is_subdomain_install() ) { 581 $path = explode( '/', ltrim( $url_parts['path'], '/' ) ); 582 $path = reset( $path ); 583 584 if ( $path ) { 585 $qv['path'] = get_network()->path . $path . '/'; 586 } 587 } 588 589 $sites = get_sites( $qv ); 590 $site = reset( $sites ); 591 592 if ( $site && (int) $site->blog_id !== get_current_blog_id() ) { 593 switch_to_blog( $site->blog_id ); 594 $switched_blog = true; 595 } 596 } 597 598 $post_id = url_to_postid( $url ); 599 600 /** This filter is documented in wp-includes/class-wp-oembed-controller.php */ 601 $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); 602 603 if ( ! $post_id ) { 604 if ( $switched_blog ) { 605 restore_current_blog(); 606 } 607 608 return false; 609 } 610 611 $width = isset( $args['width'] ) ? $args['width'] : 0; 612 613 $data = get_oembed_response_data( $post_id, $width ); 614 615 if ( $switched_blog ) { 616 restore_current_blog(); 617 } 618 619 return $data ? (object) $data : false; 620 } 621 622 566 623 /** 567 624 * Filters the oEmbed response data to return an iframe embed code. … … 591 648 if ( wp_attachment_is_image( $post ) ) { 592 649 $thumbnail_id = $post->ID; 593 } else if ( wp_attachment_is( 'video', $post ) ) {650 } else if ( wp_attachment_is( 'video', $post ) ) { 594 651 $thumbnail_id = get_post_thumbnail_id( $post ); 595 652 $data['type'] = 'video'; … … 599 656 if ( $thumbnail_id ) { 600 657 list( $thumbnail_url, $thumbnail_width, $thumbnail_height ) = wp_get_attachment_image_src( $thumbnail_id, array( $width, 99999 ) ); 601 $data['thumbnail_url'] 602 $data['thumbnail_width'] 603 $data['thumbnail_height'] 658 $data['thumbnail_url'] = $thumbnail_url; 659 $data['thumbnail_width'] = $thumbnail_width; 660 $data['thumbnail_height'] = $thumbnail_height; 604 661 } 605 662 … … 738 795 $allowed_html = array( 739 796 'a' => array( 740 'href' => true,797 'href' => true, 741 798 ), 742 799 'blockquote' => array(), … … 768 825 769 826 $url = esc_url( "{$results[2]}#?secret=$secret" ); 770 $q 827 $q = $results[1]; 771 828 772 829 $html = str_replace( $results[0], ' src=' . $q . $url . $q . ' data-secret=' . $q . $secret . $q, $html ); … … 775 832 776 833 $allowed_html['blockquote']['data-secret'] = true; 777 $allowed_html['iframe']['data-secret'] 834 $allowed_html['iframe']['data-secret'] = true; 778 835 779 836 $html = wp_kses( $html, $allowed_html ); … … 806 863 } 807 864 808 $link = sprintf( 809 '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>', 865 $link = sprintf( '<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>', 810 866 esc_url( get_permalink() ), 811 867 /* translators: %s: Name of current post */ … … 883 939 <style type="text/css"> 884 940 <?php 885 if ( SCRIPT_DEBUG ) {886 readfile( ABSPATH . WPINC . '/css/wp-embed-template.css');887 } else {888 /*889 * If you're looking at a src version of this file, you'll see an "include"890 * statement below. This is used by the `grunt build` process to directly891 * include a minified version of wp-oembed-embed.css, instead of using the892 * readfile() method from above.893 *894 * If you're looking at a build version of this file, you'll see a string of895 * minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG896 * and edit wp-embed-template.css directly.897 */898 ?>899 include "css/wp-embed-template.min.css"900 <?php901 }941 if ( SCRIPT_DEBUG ) { 942 readfile( ABSPATH . WPINC . "/css/wp-embed-template.css" ); 943 } else { 944 /* 945 * If you're looking at a src version of this file, you'll see an "include" 946 * statement below. This is used by the `grunt build` process to directly 947 * include a minified version of wp-oembed-embed.css, instead of using the 948 * readfile() method from above. 949 * 950 * If you're looking at a build version of this file, you'll see a string of 951 * minified CSS. If you need to debug it, please turn on SCRIPT_DEBUG 952 * and edit wp-embed-template.css directly. 953 */ 954 ?> 955 include "css/wp-embed-template.min.css" 956 <?php 957 } 902 958 ?> 903 959 </style> … … 914 970 <script type="text/javascript"> 915 971 <?php 916 if ( SCRIPT_DEBUG ) {917 readfile( ABSPATH . WPINC . '/js/wp-embed-template.js');918 } else {919 /*920 * If you're looking at a src version of this file, you'll see an "include"921 * statement below. This is used by the `grunt build` process to directly922 * include a minified version of wp-embed-template.js, instead of using the923 * readfile() method from above.924 *925 * If you're looking at a build version of this file, you'll see a string of926 * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG927 * and edit wp-embed-template.js directly.928 */929 ?>930 include "js/wp-embed-template.min.js"931 <?php932 }972 if ( SCRIPT_DEBUG ) { 973 readfile( ABSPATH . WPINC . "/js/wp-embed-template.js" ); 974 } else { 975 /* 976 * If you're looking at a src version of this file, you'll see an "include" 977 * statement below. This is used by the `grunt build` process to directly 978 * include a minified version of wp-embed-template.js, instead of using the 979 * readfile() method from above. 980 * 981 * If you're looking at a build version of this file, you'll see a string of 982 * minified JavaScript. If you need to debug it, please turn on SCRIPT_DEBUG 983 * and edit wp-embed-template.js directly. 984 */ 985 ?> 986 include "js/wp-embed-template.min.js" 987 <?php 988 } 933 989 ?> 934 990 </script> … … 1081 1137 */ 1082 1138 function wp_filter_pre_oembed_result( $result, $url, $args ) { 1083 $switched_blog = false; 1084 1085 if ( is_multisite() ) { 1086 $url_parts = wp_parse_args( 1087 wp_parse_url( $url ), 1088 array( 1089 'host' => '', 1090 'path' => '/', 1091 ) 1092 ); 1093 1094 $qv = array( 1095 'domain' => $url_parts['host'], 1096 'path' => '/', 1097 ); 1098 1099 // In case of subdirectory configs, set the path. 1100 if ( ! is_subdomain_install() ) { 1101 $path = explode( '/', ltrim( $url_parts['path'], '/' ) ); 1102 $path = reset( $path ); 1103 1104 if ( $path ) { 1105 $qv['path'] = get_network()->path . $path . '/'; 1106 } 1107 } 1108 1109 $sites = get_sites( $qv ); 1110 $site = reset( $sites ); 1111 1112 if ( $site && (int) $site->blog_id !== get_current_blog_id() ) { 1113 switch_to_blog( $site->blog_id ); 1114 $switched_blog = true; 1115 } 1116 } 1117 1118 $post_id = url_to_postid( $url ); 1119 1120 /** This filter is documented in wp-includes/class-wp-oembed-controller.php */ 1121 $post_id = apply_filters( 'oembed_request_post_id', $post_id, $url ); 1122 1123 if ( ! $post_id ) { 1124 if ( $switched_blog ) { 1125 restore_current_blog(); 1126 } 1127 1128 return $result; 1129 } 1130 1131 $width = isset( $args['width'] ) ? $args['width'] : 0; 1132 1133 $data = get_oembed_response_data( $post_id, $width ); 1134 $data = _wp_oembed_get_object()->data2html( (object) $data, $url ); 1135 1136 if ( $switched_blog ) { 1137 restore_current_blog(); 1138 } 1139 1140 if ( ! $data ) { 1141 return $result; 1142 } 1143 1144 return $data; 1145 } 1139 $data = get_oembed_response_data_for_url( $url, $args ); 1140 1141 if ( $data ) { 1142 return _wp_oembed_get_object()->data2html( $data, $url ); 1143 } 1144 1145 return $result; 1146 } -
trunk/tests/phpunit/tests/oembed/controller.php
r42724 r44154 15 15 const YOUTUBE_VIDEO_ID = 'OQSNhk5ICTI'; 16 16 const INVALID_OEMBED_URL = 'https://www.notreallyanoembedprovider.com/watch?v=awesome-cat-video'; 17 const UNTRUSTED_PROVIDER_URL = 'https://www.untrustedprovider.com'; 17 18 18 19 public static function wpSetUpBeforeClass( $factory ) { … … 50 51 51 52 add_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10, 3 ); 53 add_filter( 'oembed_result', array( $this, 'filter_oembed_result' ), 10, 3 ); 52 54 $this->request_count = 0; 55 56 $this->oembed_result_filter_count = 0; 53 57 } 54 58 … … 60 64 61 65 remove_filter( 'pre_http_request', array( $this, 'mock_embed_request' ), 10 ); 66 remove_filter( 'oembed_result', array( $this, 'filter_oembed_result' ), 10 ); 62 67 } 63 68 … … 68 73 */ 69 74 public $request_count = 0; 75 76 /** 77 * Count of the number of times the oembed_result filter was called. 78 * 79 * @var int 80 */ 81 public $oembed_result_filter_count = 0; 70 82 71 83 /** … … 81 93 82 94 $parsed_url = wp_parse_url( $url ); 83 parse_str( $parsed_url['query'], $query_params ); 95 $query = isset( $parsed_url['query'] ) ? $parsed_url['query'] : ''; 96 parse_str( $query, $query_params ); 84 97 $this->request_count += 1; 85 98 … … 100 113 'thumbnail_height' => $query_params['maxheight'], 101 114 'height' => $query_params['maxheight'], 102 '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>',115 '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>', 103 116 'author_name' => 'Yosemitebear62', 104 117 'thumbnail_url' => 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg', … … 107 120 ), 108 121 ); 109 } else { 122 } 123 124 if ( $url === self::UNTRUSTED_PROVIDER_URL ) { 110 125 return array( 111 126 'response' => array( 112 'code' => 404, 127 'code' => 200, 128 ), 129 'body' => '<html><head><link rel="alternate" type="application/json+oembed" href="' . self::UNTRUSTED_PROVIDER_URL . '" /></head><body></body></html>', 130 ); 131 } 132 133 if ( ! empty( $query_params['url'] ) && false !== strpos( $query_params['url'], self::UNTRUSTED_PROVIDER_URL ) ) { 134 return array( 135 'response' => array( 136 'code' => 200, 137 ), 138 'body' => wp_json_encode( 139 array( 140 'version' => '1.0', 141 'type' => 'rich', 142 'provider_name' => 'Untrusted', 143 'provider_url' => self::UNTRUSTED_PROVIDER_URL, 144 'html' => '<b>Filtered</b><a href="">Unfiltered</a>', 145 'author_name' => 'Untrusted Embed Author', 146 'title' => 'Untrusted Embed', 147 ) 113 148 ), 114 149 ); 115 150 } 151 152 return array( 153 'response' => array( 154 'code' => 404, 155 ), 156 ); 157 } 158 159 /** 160 * Filters 'oembed_result' to ensure correct type. 161 * 162 * @param string|false $data The returned oEmbed HTML. 163 * @param string $url URL of the content to be embedded. 164 * @param array $args Optional arguments, usually passed from a shortcode. 165 * @return string 166 */ 167 public function filter_oembed_result( $data, $url, $args ) { 168 if ( ! is_string( $data ) && false !== $data ) { 169 $this->fail( 'Unexpected type for $data.' ); 170 } 171 $this->assertInternalType( 'string', $url ); 172 $this->assertInternalType( 'array', $args ); 173 $this->oembed_result_filter_count++; 174 return $data; 116 175 } 117 176 … … 544 603 545 604 $this->assertNotEmpty( $data ); 546 $this->assert True( is_object( $data ));605 $this->assertInternalType( 'object', $data ); 547 606 $this->assertEquals( 'YouTube', $data->provider_name ); 548 607 $this->assertEquals( 'https://i.ytimg.com/vi/' . self::YOUTUBE_VIDEO_ID . '/hqdefault.jpg', $data->thumbnail_url ); … … 586 645 $this->assertEquals( $data['code'], 'rest_invalid_param' ); 587 646 } 647 648 /** 649 * @ticket 45142 650 */ 651 function test_proxy_with_internal_url() { 652 wp_set_current_user( self::$editor ); 653 654 $user = self::factory()->user->create_and_get( array( 655 'display_name' => 'John Doe', 656 ) ); 657 $post = self::factory()->post->create_and_get( array( 658 'post_author' => $user->ID, 659 'post_title' => 'Hello World', 660 ) ); 661 662 $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' ); 663 $request->set_param( 'url', get_permalink( $post->ID ) ); 664 $request->set_param( 'maxwidth', 400 ); 665 666 $response = rest_get_server()->dispatch( $request ); 667 $data = $response->get_data(); 668 669 $data = (array) $data; 670 671 $this->assertNotEmpty( $data ); 672 673 $this->assertArrayHasKey( 'version', $data ); 674 $this->assertArrayHasKey( 'provider_name', $data ); 675 $this->assertArrayHasKey( 'provider_url', $data ); 676 $this->assertArrayHasKey( 'author_name', $data ); 677 $this->assertArrayHasKey( 'author_url', $data ); 678 $this->assertArrayHasKey( 'title', $data ); 679 $this->assertArrayHasKey( 'type', $data ); 680 $this->assertArrayHasKey( 'width', $data ); 681 682 $this->assertEquals( '1.0', $data['version'] ); 683 $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] ); 684 $this->assertEquals( get_home_url(), $data['provider_url'] ); 685 $this->assertEquals( $user->display_name, $data['author_name'] ); 686 $this->assertEquals( get_author_posts_url( $user->ID, $user->user_nicename ), $data['author_url'] ); 687 $this->assertEquals( $post->post_title, $data['title'] ); 688 $this->assertEquals( 'rich', $data['type'] ); 689 $this->assertTrue( $data['width'] <= $request['maxwidth'] ); 690 } 691 692 /** 693 * @ticket 45142 694 */ 695 function test_proxy_with_static_front_page_url() { 696 wp_set_current_user( self::$editor ); 697 698 $post = self::factory()->post->create_and_get( array( 699 'post_title' => 'Front page', 700 'post_type' => 'page', 701 'post_author' => 0, 702 ) ); 703 704 update_option( 'show_on_front', 'page' ); 705 update_option( 'page_on_front', $post->ID ); 706 707 $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' ); 708 $request->set_param( 'url', home_url() ); 709 $request->set_param( 'maxwidth', 400 ); 710 711 $response = rest_get_server()->dispatch( $request ); 712 $data = $response->get_data(); 713 714 $this->assertInternalType( 'object', $data ); 715 716 $data = (array) $data; 717 718 $this->assertNotEmpty( $data ); 719 720 $this->assertArrayHasKey( 'version', $data ); 721 $this->assertArrayHasKey( 'provider_name', $data ); 722 $this->assertArrayHasKey( 'provider_url', $data ); 723 $this->assertArrayHasKey( 'author_name', $data ); 724 $this->assertArrayHasKey( 'author_url', $data ); 725 $this->assertArrayHasKey( 'title', $data ); 726 $this->assertArrayHasKey( 'type', $data ); 727 $this->assertArrayHasKey( 'width', $data ); 728 729 $this->assertEquals( '1.0', $data['version'] ); 730 $this->assertEquals( get_bloginfo( 'name' ), $data['provider_name'] ); 731 $this->assertEquals( get_home_url(), $data['provider_url'] ); 732 $this->assertEquals( get_bloginfo( 'name' ), $data['author_name'] ); 733 $this->assertEquals( get_home_url(), $data['author_url'] ); 734 $this->assertEquals( $post->post_title, $data['title'] ); 735 $this->assertEquals( 'rich', $data['type'] ); 736 $this->assertTrue( $data['width'] <= $request['maxwidth'] ); 737 738 update_option( 'show_on_front', 'posts' ); 739 } 740 741 /** 742 * @ticket 45142 743 */ 744 public function test_proxy_filters_result_of_untrusted_oembed_provider() { 745 wp_set_current_user( self::$editor ); 746 747 $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' ); 748 $request->set_param( 'url', self::UNTRUSTED_PROVIDER_URL ); 749 $request->set_param( 'maxwidth', 456 ); 750 $request->set_param( 'maxheight', 789 ); 751 $request->set_param( '_wpnonce', wp_create_nonce( 'wp_rest' ) ); 752 753 $response = rest_get_server()->dispatch( $request ); 754 $data = $response->get_data(); 755 756 $this->assertEquals( 1, $this->oembed_result_filter_count ); 757 $this->assertInternalType( 'object', $data ); 758 $this->assertEquals( 'Untrusted', $data->provider_name ); 759 $this->assertEquals( self::UNTRUSTED_PROVIDER_URL, $data->provider_url ); 760 $this->assertEquals( 'rich', $data->type ); 761 $this->assertFalse( $data->html ); 762 } 763 764 /** 765 * @ticket 45142 766 */ 767 public function test_proxy_does_not_filter_result_of_trusted_oembed_provider() { 768 wp_set_current_user( self::$editor ); 769 770 $request = new WP_REST_Request( 'GET', '/oembed/1.0/proxy' ); 771 $request->set_param( 'url', 'https://www.youtube.com/watch?v=' . self::YOUTUBE_VIDEO_ID ); 772 $request->set_param( 'maxwidth', 456 ); 773 $request->set_param( 'maxheight', 789 ); 774 $request->set_param( '_wpnonce', wp_create_nonce( 'wp_rest' ) ); 775 776 $response = rest_get_server()->dispatch( $request ); 777 $data = $response->get_data(); 778 779 $this->assertEquals( 1, $this->oembed_result_filter_count ); 780 $this->assertInternalType( 'object', $data ); 781 782 $this->assertStringStartsWith( '<b>Unfiltered</b>', $data->html ); 783 } 588 784 } -
trunk/tests/qunit/fixtures/wp-api-generated.js
r44150 r44154 5084 5084 }, 5085 5085 { 5086 "author": 37 5,5086 "author": 376, 5087 5087 "date": "2017-02-14T00:00:00", 5088 5088 "date_gmt": "2017-02-14T00:00:00", 5089 "id": 3 6744,5089 "id": 3162, 5090 5090 "modified": "2017-02-14T00:00:00", 5091 5091 "modified_gmt": "2017-02-14T00:00:00", 5092 "parent": 3 6743,5093 "slug": "3 6743-revision-v1",5092 "parent": 3161, 5093 "slug": "3161-revision-v1", 5094 5094 "guid": { 5095 "rendered": "http://example.org/?p=3 6744"5095 "rendered": "http://example.org/?p=3162" 5096 5096 }, 5097 5097 "title": { … … 5107 5107 "parent": [ 5108 5108 { 5109 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3 6743"5109 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3161" 5110 5110 } 5111 5111 ] … … 5139 5139 mockedApiResponse.postAutosaves = [ 5140 5140 { 5141 "author": 37 5,5141 "author": 376, 5142 5142 "date": "2017-02-14T00:00:00", 5143 5143 "date_gmt": "2017-02-14T00:00:00", 5144 "id": 3 6745,5144 "id": 3163, 5145 5145 "modified": "2017-02-14T00:00:00", 5146 5146 "modified_gmt": "2017-02-14T00:00:00", 5147 "parent": 3 6743,5148 "slug": "3 6743-autosave-v1",5147 "parent": 3161, 5148 "slug": "3161-autosave-v1", 5149 5149 "guid": { 5150 "rendered": "http://example.org/?p=3 6745"5150 "rendered": "http://example.org/?p=3163" 5151 5151 }, 5152 5152 "title": { … … 5162 5162 "parent": [ 5163 5163 { 5164 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3 6743"5164 "href": "http://example.org/index.php?rest_route=/wp/v2/posts/3161" 5165 5165 } 5166 5166 ] … … 5170 5170 5171 5171 mockedApiResponse.autosave = { 5172 "author": 37 5,5172 "author": 376, 5173 5173 "date": "2017-02-14T00:00:00", 5174 5174 "date_gmt": "2017-02-14T00:00:00", 5175 "id": 3 6745,5175 "id": 3163, 5176 5176 "modified": "2017-02-14T00:00:00", 5177 5177 "modified_gmt": "2017-02-14T00:00:00", 5178 "parent": 3 6743,5179 "slug": "3 6743-autosave-v1",5178 "parent": 3161, 5179 "slug": "3161-autosave-v1", 5180 5180 "guid": { 5181 "rendered": "http://example.org/?p=3 6745"5181 "rendered": "http://example.org/?p=3163" 5182 5182 }, 5183 5183 "title": { … … 5344 5344 }, 5345 5345 { 5346 "author": 37 5,5346 "author": 376, 5347 5347 "date": "2017-02-14T00:00:00", 5348 5348 "date_gmt": "2017-02-14T00:00:00", 5349 "id": 3 6747,5349 "id": 3165, 5350 5350 "modified": "2017-02-14T00:00:00", 5351 5351 "modified_gmt": "2017-02-14T00:00:00", 5352 "parent": 3 6746,5353 "slug": "3 6746-revision-v1",5352 "parent": 3164, 5353 "slug": "3164-revision-v1", 5354 5354 "guid": { 5355 "rendered": "http://example.org/?p=3 6747"5355 "rendered": "http://example.org/?p=3165" 5356 5356 }, 5357 5357 "title": { … … 5367 5367 "parent": [ 5368 5368 { 5369 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3 6746"5369 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3164" 5370 5370 } 5371 5371 ] … … 5399 5399 mockedApiResponse.pageAutosaves = [ 5400 5400 { 5401 "author": 37 5,5401 "author": 376, 5402 5402 "date": "2017-02-14T00:00:00", 5403 5403 "date_gmt": "2017-02-14T00:00:00", 5404 "id": 3 6748,5404 "id": 3166, 5405 5405 "modified": "2017-02-14T00:00:00", 5406 5406 "modified_gmt": "2017-02-14T00:00:00", 5407 "parent": 3 6746,5408 "slug": "3 6746-autosave-v1",5407 "parent": 3164, 5408 "slug": "3164-autosave-v1", 5409 5409 "guid": { 5410 "rendered": "http://example.org/?p=3 6748"5410 "rendered": "http://example.org/?p=3166" 5411 5411 }, 5412 5412 "title": { … … 5422 5422 "parent": [ 5423 5423 { 5424 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3 6746"5424 "href": "http://example.org/index.php?rest_route=/wp/v2/pages/3164" 5425 5425 } 5426 5426 ] … … 5430 5430 5431 5431 mockedApiResponse.pageAutosave = { 5432 "author": 37 5,5432 "author": 376, 5433 5433 "date": "2017-02-14T00:00:00", 5434 5434 "date_gmt": "2017-02-14T00:00:00", 5435 "id": 3 6748,5435 "id": 3166, 5436 5436 "modified": "2017-02-14T00:00:00", 5437 5437 "modified_gmt": "2017-02-14T00:00:00", 5438 "parent": 3 6746,5439 "slug": "3 6746-autosave-v1",5438 "parent": 3164, 5439 "slug": "3164-autosave-v1", 5440 5440 "guid": { 5441 "rendered": "http://example.org/?p=3 6748"5441 "rendered": "http://example.org/?p=3166" 5442 5442 }, 5443 5443 "title": {
Note: See TracChangeset
for help on using the changeset viewer.