| | 721 | |
| | 722 | |
| | 723 | /** |
| | 724 | * @ticket 25387 |
| | 725 | * Testing variants of Autoembeds within paragraphs and surrounded by other text/markup |
| | 726 | */ |
| | 727 | function test_autoembed_inline_paragraph() { |
| | 728 | |
| | 729 | $embed = new WP_Embed(); |
| | 730 | $url1 = '<p> |
| | 731 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 732 | </p>'; |
| | 733 | $embed_oembed1 = <<<VIDEOWITHPTAG |
| | 734 | <p>http://www.youtube.com/watch?v=ZJrP9irrLZk</p> |
| | 735 | VIDEOWITHPTAG; |
| | 736 | |
| | 737 | $url2 = '<p>test |
| | 738 | |
| | 739 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 740 | |
| | 741 | test</p>'; |
| | 742 | $embed_oembed2 = <<<VIDEOWITHPTAGANDTEXT |
| | 743 | <p>test |
| | 744 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 745 | test</p> |
| | 746 | VIDEOWITHPTAGANDTEXT; |
| | 747 | |
| | 748 | $url3 = 'http://www.youtube.com/watch?v=ZJrP9irrLZk'; |
| | 749 | $embed_oembed3 = <<<VIDEONOEMBED |
| | 750 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 751 | VIDEONOEMBED; |
| | 752 | |
| | 753 | $embed_oembed4 = <<<VIDEOEMBEDWITHSPACE |
| | 754 | [embed] http://vimeo.com/85107599[/embed] |
| | 755 | VIDEOEMBEDWITHSPACE; |
| | 756 | $url4 = 'http://vimeo.com/85107599'; |
| | 757 | |
| | 758 | $embed_oembed5 = <<<LINKWITHSPACE |
| | 759 | <a href=" http://www.youtube.com/watch?v=ZJrP9irrLZk">Video link not embedded because of space within href attribute</a> |
| | 760 | LINKWITHSPACE; |
| | 761 | $url5 = '<a href=" http://www.youtube.com/watch?v=ZJrP9irrLZk">Video link not embedded because of space within href attribute</a>'; |
| | 762 | |
| | 763 | $embed_oembed6 = <<<URLSWHITESPACE |
| | 764 | So, YouTube video firsthttp://www.youtube.com/watch?v=ZJrP9irrLZk Now, after YouTube comes Vimeo video secondhttp://vimeo.com/85107599 and after Vimeo |
| | 765 | URLSWHITESPACE; |
| | 766 | $url6 = 'So, YouTube video first |
| | 767 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 768 | Now, after YouTube comes Vimeo video second |
| | 769 | http://vimeo.com/85107599 |
| | 770 | and after Vimeo'; |
| | 771 | |
| | 772 | $embed_oembed7 = <<<STANDARDANCHORLINK |
| | 773 | <a href="http://www.youtube.com/watch?v=ZJrP9irrLZk">Sample this should be a link</a> |
| | 774 | STANDARDANCHORLINK; |
| | 775 | $url7 = '<a href="http://www.youtube.com/watch?v=ZJrP9irrLZk">Sample this should be a link</a>'; |
| | 776 | |
| | 777 | $embed_oembed8 = <<<URLWITHMARKUP |
| | 778 | Video url surrounded by span styled with border and background |
| | 779 | <span style="border: 5px solid gray; background: #0000cc;">http://www.youtube.com/watch?v=ZJrP9irrLZk</span> |
| | 780 | URLWITHMARKUP; |
| | 781 | $url8 = 'Video url surrounded by span styled with border and background |
| | 782 | <span style="border: 5px solid gray; background: #0000cc;"> |
| | 783 | http://www.youtube.com/watch?v=ZJrP9irrLZk |
| | 784 | </span>'; |
| | 785 | |
| | 786 | $embed_oembed9 = <<<EMBEDVIDEOPRESS |
| | 787 | VideoPress wrapped in [ e m b e d ] tags |
| | 788 | [embed]http://videos.videopress.com/EsBeI509/video-4f0ea27927_dvd.mp4[/embed] |
| | 789 | EMBEDVIDEOPRESS; |
| | 790 | $url9 = 'VideoPress wrapped in [ e m b e d ] tags |
| | 791 | [embed] |
| | 792 | http://videos.videopress.com/EsBeI509/video-4f0ea27927_dvd.mp4 |
| | 793 | [/embed]'; |
| | 794 | |
| | 795 | $embed_oembed10 = <<<FLICKRFULLURL |
| | 796 | <p>http://www.flickr.com/photos/seanhayes/270924038/</p> |
| | 797 | FLICKRFULLURL; |
| | 798 | $url10 = '<p> |
| | 799 | http://www.flickr.com/photos/seanhayes/270924038/ |
| | 800 | </p>'; |
| | 801 | |
| | 802 | $embed_oembed11 = <<<DAILYMOTIONFULLURL |
| | 803 | <p>http://www.dailymotion.com/video/x1gl4rz_the-rolling-stones-rock-shanghai_news</p> |
| | 804 | DAILYMOTIONFULLURL; |
| | 805 | $url11 = '<p>http://www.dailymotion.com/video/x1gl4rz_the-rolling-stones-rock-shanghai_news</p>'; |
| | 806 | |
| | 807 | // $content1 = $embed->autoembed( $embed_oembed1 ); |
| | 808 | // $this->assertContains( $url1, $content1 ); |
| | 809 | // |
| | 810 | // $content2 = $embed->autoembed( $embed_oembed2 ); |
| | 811 | // $this->assertContains( $url2, $content2 ); |
| | 812 | // |
| | 813 | // $content3 = $embed->autoembed( $embed_oembed3 ); |
| | 814 | // $this->assertContains( $url3, $content3 ); |
| | 815 | // |
| | 816 | // $content4 = $embed->autoembed( $embed_oembed4 ); |
| | 817 | // $this->assertContains( $url4, $content4 ); |
| | 818 | // |
| | 819 | // $content5 = $embed->autoembed( $embed_oembed5 ); |
| | 820 | // $this->assertEquals( $url5, $content5 ); |
| | 821 | // |
| | 822 | // $content6 = $embed->autoembed( $embed_oembed6 ); |
| | 823 | // $this->assertContains( $url6, $content6 ); |
| | 824 | // |
| | 825 | // $content7 = $embed->autoembed( $embed_oembed7 ); |
| | 826 | // $this->assertEquals( $url7, $content7 ); |
| | 827 | // |
| | 828 | // $content8 = $embed->autoembed( $embed_oembed8 ); |
| | 829 | // $this->assertEquals( $url8, $content8 ); |
| | 830 | // |
| | 831 | // $content9 = $embed->autoembed( $embed_oembed9 ); |
| | 832 | // $this->assertContains( $url9, $content9 ); |
| | 833 | // |
| | 834 | // $content10 = $embed->autoembed( $embed_oembed10 ); |
| | 835 | // $this->assertEquals( $url10, $content10 ); |
| | 836 | |
| | 837 | $content11 = $embed->autoembed( $embed_oembed11 ); |
| | 838 | $this->assertEquals( $url11, $content11 ); |
| | 839 | } |