public function asHtml(JBBCode\ElementNode $el) { $content = ""; foreach ($el->getChildren() as $child) { $content .= $child->getAsBBCode(); } $foundMatch = preg_match('/\\[size\\=(.*?)\\](.*?)\\[\\/size\\]/is', $content, $matches); if (!$foundMatch) { return $el->getAsBBCode(); } else { return '<blockquote>' . $matches[0] . '</blockquote>'; } }
public function asHtml(JBBCode\ElementNode $el) { $content = ""; foreach ($el->getChildren() as $child) { $content .= $child->getAsBBCode(); } $foundMatch = preg_match('/v=([A-z0-9=\\-]+?)(&.*)?$/i', $content, $matches); if (!$foundMatch) { return $el->getAsBBCode(); } else { return "<iframe width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/" . $matches[1] . "\" frameborder=\"0\" allowfullscreen></iframe>"; } }
public function asHtml(JBBCode\ElementNode $el) { $content = ""; foreach ($el->getChildren() as $child) { $content .= $child->getAsBBCode(); } // TODO: Das geht doch bestimmt schöner. if ($this->endsWith($content, '.webm')) { return '<div class="embed-responsive embed-responsive-16by9"><video autoplay loop class="embed-responsive-item"><source src="' . $content . '" type=video/webm></video></div>'; } else { if ($this->endsWith($content, '.mp4')) { return '<div class="embed-responsive embed-responsive-16by9"><video autoplay loop class="embed-responsive-item"><source src="' . $content . '" type=video/mp4></video></div>'; } else { $foundMatch = preg_match('/v=([A-z0-9=\\-]+?)(&.*)?$/i', $content, $matches); if ($foundMatch) { return '<div class="embed-responsive embed-responsive-16by9"><iframe class="embed-responsive-item" src="http://www.youtube.com/embed/' . $matches[1] . '"></iframe></div>'; } else { return $el->getAsBBCode(); } } } }