Exemple #1
0
 public function testOembed()
 {
     $replacements = ['https://www.youtube.com/watch?v=5omxorBHiv8' => '<iframe width="459" height="344" src="https://www.youtube.com/embed/5omxorBHiv8?feature=oembed" frameborder="0" allowfullscreen></iframe>', 'https://youtu.be/5omxorBHiv8' => '<iframe width="459" height="344" src="https://www.youtube.com/embed/5omxorBHiv8?feature=oembed" frameborder="0" allowfullscreen></iframe>', '<a href="https://youtu.be/5omxorBHiv8">https://youtu.be/5omxorBHiv8</a>' => '<a href="https://youtu.be/5omxorBHiv8">https://youtu.be/5omxorBHiv8</a>'];
     foreach ($replacements as $original => $after) {
         $this->AssertEquals($after, Str::OEmbed($original));
     }
 }
Exemple #2
0
 public function setTextAttribute($text)
 {
     $text = str_replace('&nbsp;', ' ', $text);
     if ($this->slotname === 'standfirst') {
         $siteText = $text = strip_tags($text);
     } else {
         $text = Str::makeInternalLinksRelative($text);
         $siteText = Str::StorifyEmbed(Str::OEmbed($text));
     }
     $this->attributes['text'] = $text;
     $this->attributes['site_text'] = $siteText;
 }