Example #1
0
 public function testSiteOverride()
 {
     $url = 'https://youtube.com/watch?v=PBLuP2JZcEg';
     $options = array('width' => 640, 'overrides' => array('Phata\\Widgetfy\\Site\\Youtube' => array('width' => 800, 'factor' => 0.75)));
     // test returning embed code
     $embed = Widgetfy::translate($url, $options);
     $this->assertEquals($embed['html'], '<iframe width="800" height="600" ' . 'src="//www.youtube.com/embed/PBLuP2JZcEg" frameborder="0" allowfullscreen></iframe>');
     $this->assertEquals($embed['type'], 'iframe');
     $this->assertEquals($embed['dimension']->width, 800);
     $this->assertEquals($embed['dimension']->height, 600);
     $this->assertEquals($embed['dimension']->factor, 0.75);
 }
Example #2
0
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, user-scalable=no">
<title>Example 1</title>
<link rel="stylesheet" type="text/css" href="./misc/example1.css" />
</head>
<body>
<h1>Example 1</h1>
<section id="content">
    <?php 
foreach ($urls as $url) {
    ?>
    <?php 
    $embed = Widgetfy::translate($url['url'], $options);
    ?>
    <?php 
    $d =& $embed['dimension'];
    ?>
        <div class="videoblock <?php 
    if ($d->dynamic) {
        print 'videoblock-dynamic';
    }
    ?>
" style="<?php 
    print style_block($embed);
    ?>
">
            <h2><?php 
    print $url['name'];