public function testEmbed() { $expected = '<iframe src="//youtube.com/embed/_9tHtxOCvy4" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" width="100%" height="100%"></iframe>'; $this->assertEquals($expected, embed::youtube('http://www.youtube.com/watch?feature=player_embedded&v=_9tHtxOCvy4')); $expected = '<iframe src="//player.vimeo.com/video/52345557" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" width="100%" height="100%"></iframe>'; $this->assertEquals($expected, embed::vimeo('http://vimeo.com/52345557')); $expected = '<script src="https://gist.github.com/2924148.js"></script>'; $this->assertEquals($expected, embed::gist('https://gist.github.com/2924148')); }
return html::a(url($tag->attr('link')), html($tag->attr('text')), array('rel' => $tag->attr('rel'), 'class' => $tag->attr('class'), 'title' => html($tag->attr('title')), 'target' => $tag->target())); }); // tel tag kirbytext::$tags['tel'] = array('attr' => array('text', 'class', 'title'), 'html' => function ($tag) { $text = $tag->attr('text'); $tel = str_replace(array('/', ' ', '-'), '', $tag->attr('tel')); if (empty($text)) { $text = $tag->attr('tel'); } return html::a('tel:' . $tel, html($text), array('rel' => $tag->attr('rel'), 'class' => $tag->attr('class'), 'title' => html($tag->attr('title')))); }); // twitter tag kirbytext::$tags['twitter'] = array('attr' => array('class', 'title', 'text', 'rel', 'target', 'popup'), 'html' => function ($tag) { // get and sanitize the username $username = str_replace('@', '', $tag->attr('twitter')); // build the profile url $url = 'https://twitter.com/' . $username; // sanitize the link text $text = $tag->attr('text', '@' . $username); // build the final link return html::a($url, $text, array('class' => $tag->attr('class'), 'title' => $tag->attr('title'), 'rel' => $tag->attr('rel'), 'target' => $tag->target())); }); kirbytext::$tags['youtube'] = array('attr' => array('width', 'height', 'class'), 'html' => function ($tag) { return '<figure class="' . $tag->attr('class', kirby()->option('kirbytext.video.class', 'video')) . '">' . embed::youtube($tag->attr('youtube'), array('width' => $tag->attr('width', kirby()->option('kirbytext.video.width')), 'height' => $tag->attr('height', kirby()->option('kirbytext.video.height')))) . '</figure>'; }); kirbytext::$tags['vimeo'] = array('attr' => array('width', 'height', 'class'), 'html' => function ($tag) { return '<figure class="' . $tag->attr('class', kirby()->option('kirbytext.video.class', 'video')) . '">' . embed::vimeo($tag->attr('vimeo'), array('width' => $tag->attr('width', kirby()->option('kirbytext.video.width')), 'height' => $tag->attr('height', kirby()->option('kirbytext.video.height')))) . '</figure>'; }); kirbytext::$tags['gist'] = array('attr' => array('file'), 'html' => function ($tag) { return embed::gist($tag->attr('gist'), $tag->attr('file')); });