| | 440 | /** |
| | 441 | * @ticket 25387 |
| | 442 | * Testing variants of Autoembeds within paragraphs and surrounded by other text/markup |
| | 443 | */ |
| | 444 | function test_autoembed_inline_paragraph() { |
| | 445 | |
| | 446 | $embed = new WP_Embed(); |
| | 447 | $url1 = '<p> |
| | 448 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 449 | </p>'; |
| | 450 | $embed_oembed1 = <<<VIDEOWITHPTAG |
| | 451 | <p>http://www.youtube.com/watch?v=ZJrP9irrLZk</p> |
| | 452 | VIDEOWITHPTAG; |
| | 453 | |
| | 454 | $url2 = '<p>test |
| | 455 | |
| | 456 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 457 | |
| | 458 | test</p>'; |
| | 459 | $embed_oembed2 = <<<VIDEOWITHPTAGANDTEXT |
| | 460 | <p>test |
| | 461 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 462 | test</p> |
| | 463 | VIDEOWITHPTAGANDTEXT; |
| | 464 | |
| | 465 | $url3 = 'http://www.youtube.com/watch?v=ZJrP9irrLZk'; |
| | 466 | $embed_oembed3 = <<<VIDEONOEMBED |
| | 467 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 468 | VIDEONOEMBED; |
| | 469 | |
| | 470 | $embed_oembed4 = <<<VIDEOEMBEDWITHSPACE |
| | 471 | [embed] http://vimeo.com/85107599[/embed] |
| | 472 | VIDEOEMBEDWITHSPACE; |
| | 473 | $url4 = 'http://vimeo.com/85107599'; |
| | 474 | |
| | 475 | $embed_oembed5 = <<<LINKWITHSPACE |
| | 476 | <a href=" http://www.youtube.com/watch?v=ZJrP9irrLZk">Video link not embedded because of space within href attribute</a> |
| | 477 | LINKWITHSPACE; |
| | 478 | $url5 = '<a href=" http://www.youtube.com/watch?v=ZJrP9irrLZk">Video link not embedded because of space within href attribute</a>'; |
| | 479 | |
| | 480 | $embed_oembed6 = <<<URLSWHITESPACE |
| | 481 | So, YouTube video firsthttp://www.youtube.com/watch?v=ZJrP9irrLZk Now, after YouTube comes Vimeo video secondhttp://vimeo.com/85107599 and after Vimeo |
| | 482 | URLSWHITESPACE; |
| | 483 | $url6 = 'So, YouTube video first |
| | 484 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 485 | Now, after YouTube comes Vimeo video second |
| | 486 | http://vimeo.com/85107599 |
| | 487 | and after Vimeo'; |
| | 488 | |
| | 489 | $embed_oembed7 = <<<STANDARDANCHORLINK |
| | 490 | <a href="http://www.youtube.com/watch?v=ZJrP9irrLZk">Sample this should be a link</a> |
| | 491 | STANDARDANCHORLINK; |
| | 492 | $url7 = '<a href="http://www.youtube.com/watch?v=ZJrP9irrLZk">Sample this should be a link</a>'; |
| | 493 | |
| | 494 | $embed_oembed8 = <<<URLWITHMARKUP |
| | 495 | Video url surrounded by span styled with border and background |
| | 496 | <span style="border: 5px solid gray; background: #0000cc;">http://www.youtube.com/watch?v=ZJrP9irrLZk</span> |
| | 497 | URLWITHMARKUP; |
| | 498 | $url8 = 'Video url surrounded by span styled with border and background |
| | 499 | <span style="border: 5px solid gray; background: #0000cc;"> |
| | 500 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 501 | </span>'; |
| | 502 | |
| | 503 | $embed_oembed9 = <<<EMBEDVIDEOPRESS |
| | 504 | VideoPress wrapped in [ e m b e d ] tags |
| | 505 | [embed]http://videos.videopress.com/EsBeI509/video-4f0ea27927_dvd.mp4[/embed] |
| | 506 | EMBEDVIDEOPRESS; |
| | 507 | $url9 = 'VideoPress wrapped in [ e m b e d ] tags |
| | 508 | [embed] |
| | 509 | http://videos.videopress.com/EsBeI509/video-4f0ea27927_dvd.mp4 |
| | 510 | [/embed]'; |
| | 511 | |
| | 512 | $embed_oembed10 = <<<FLICKRFULLURL |
| | 513 | <p>http://www.flickr.com/photos/seanhayes/270924038/</p> |
| | 514 | FLICKRFULLURL; |
| | 515 | $url10 = '<p> |
| | 516 | http://www.flickr.com/photos/seanhayes/270924038/ |
| | 517 | </p>'; |
| | 518 | |
| | 519 | $embed_oembed11 = <<<DAILYMOTIONFULLURL |
| | 520 | <p>http://www.flickr.com/photos/seanhayes/270924038/</p> |
| | 521 | DAILYMOTIONFULLURL; |
| | 522 | $url11 = '<p>http://www.dailymotion.com/video/x1gl4rz_the-rolling-stones-rock-shanghai_news</p>'; |
| | 523 | |
| | 524 | $content1 = $embed->autoembed( $embed_oembed1 ); |
| | 525 | $this->assertContains( $url1, $content1 ); |
| | 526 | |
| | 527 | $content2 = $embed->autoembed( $embed_oembed2 ); |
| | 528 | $this->assertContains( $url2, $content2 ); |
| | 529 | |
| | 530 | $content3 = $embed->autoembed( $embed_oembed3 ); |
| | 531 | $this->assertContains( $url3, $content3 ); |
| | 532 | |
| | 533 | $content4 = $embed->autoembed( $embed_oembed4 ); |
| | 534 | $this->assertContains( $url4, $content4 ); |
| | 535 | |
| | 536 | $content5 = $embed->autoembed( $embed_oembed5 ); |
| | 537 | $this->assertEquals( $url5, $content5 ); |
| | 538 | |
| | 539 | $content6 = $embed->autoembed( $embed_oembed6 ); |
| | 540 | $this->assertContains( $url6, $content6 ); |
| | 541 | |
| | 542 | $content7 = $embed->autoembed( $embed_oembed7 ); |
| | 543 | $this->assertEquals( $url7, $content7 ); |
| | 544 | |
| | 545 | $content8 = $embed->autoembed( $embed_oembed8 ); |
| | 546 | $this->assertEquals( $url8, $content8 ); |
| | 547 | |
| | 548 | $content9 = $embed->autoembed( $embed_oembed9 ); |
| | 549 | $this->assertContains( $url9, $content9 ); |
| | 550 | |
| | 551 | $content10 = $embed->autoembed( $embed_oembed10 ); |
| | 552 | $this->assertEquals( $url10, $content10 ); |
| | 553 | |
| | 554 | $content11 = $embed->autoembed( $embed_oembed11 ); |
| | 555 | $this->assertEquals( $url11, $content11 ); |
| | 556 | } |