Ejemplo n.º 1
0
 function test_request_xml_response_headers()
 {
     if (!function_exists('xdebug_get_headers')) {
         $this->markTestSkipped('xdebug is required for this test');
     }
     $post = self::factory()->post->create_and_get(array('post_title' => 'Hello World'));
     $request = array('url' => get_permalink($post->ID), 'format' => 'xml', 'maxwidth' => 600);
     $legacy_controller = new WP_oEmbed_Controller();
     $legacy_controller->dispatch($request);
     $headers = xdebug_get_headers();
     $this->assertTrue(in_array('Content-Type: text/xml; charset=' . get_option('blog_charset'), $headers));
 }
Ejemplo n.º 2
0
/**
 * Registers the oEmbed REST API route.
 *
 * @since 4.4.0
 */
function wp_oembed_register_route()
{
    $controller = new WP_oEmbed_Controller();
    $controller->register_routes();
}
Ejemplo n.º 3
0
 /**
  * @group multisite
  */
 function test_request_ms_child_in_root_blog()
 {
     if (!is_multisite()) {
         $this->markTestSkipped(__METHOD__ . ' is a multisite-only test.');
     }
     $child = self::factory()->blog->create();
     switch_to_blog($child);
     $post = self::factory()->post->create_and_get(array('post_title' => 'Hello Child Blog'));
     $request = array('url' => get_permalink($post->ID), 'format' => 'json', 'maxwidth' => 600, 'callback' => '');
     $legacy_controller = new WP_oEmbed_Controller();
     $data = json_decode($legacy_controller->dispatch($request), true);
     $this->assertInternalType('array', $data);
     $this->assertNotEmpty($data);
     restore_current_blog();
 }
Ejemplo n.º 4
0
/**
 * Parses an oEmbed API query.
 *
 * @since 4.4.0
 *
 * @see WP_oEmbed_Controller::parse_query()
 *
 * @param WP_Query $wp_query The current WP_Query instance.
 */
function wp_oembed_parse_query($wp_query)
{
    $controller = new WP_oEmbed_Controller();
    $controller->parse_query($wp_query);
}