Example #1
0
				</ul>
			</nav>
		</header>
		<section class="presentation">
			<div class="videowrapper">
				<?php 
if ($projet['type_video'] == 'YouTube') {
    ?>
					<?php 
    echo preg_replace("/\\s*[a-zA-Z\\/\\/:\\.]*youtube.com\\/watch\\?v=([a-zA-Z0-9\\-_]+)([a-zA-Z0-9\\/\\*\\-\\_\\?\\&\\;\\%\\=\\.]*)/i", "<iframe width=\"800\" height=\"400\" src=\"//www.youtube.com/embed/\$1\" frameborder=\"0\" allowfullscreen></iframe>", $projet['video_link']);
    ?>
				<?php 
} elseif ($projet['type_video'] == 'Dailymotion') {
    ?>
					<?php 
    $idvideo = daylimotion_id_by_url($projet['video_link']);
    ?>
					<iframe frameborder="0" width="800" height="400" src="//www.dailymotion.com/embed/video/<?php 
    echo $idvideo;
    ?>
" allowfullscreen></iframe><br />
				<?php 
} elseif ($projet['type_video'] == 'Vimeo') {
    ?>
					<?php 
    if (preg_match('/https?:\\/\\/(?:www\\.|player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|video\\/|)(\\d+)(?:$|\\/|\\?)/', $projet['video_link'], $match)) {
        ?>
						<?php 
        $idvideo = $match['3'];
        ?>
						<iframe src="//player.vimeo.com/video/<?php 
Example #2
0
 if ("POST" == $app['request']->getMethod()) {
     $form->handleRequest($app["request"]);
     if ($form->isValid()) {
         $data = $form->getData();
         $type = $data['type_video'];
         switch ($type) {
             case 'YouTube':
                 if (preg_match($rxyoutube, $data['video_link'])) {
                     $idvideo = youtube_id_from_url($data['video_link']);
                     if (!empty($id)) {
                         $imageurl = 'http://img.youtube.com/vi/' . $idvideo . '/0.jpg';
                     }
                 }
                 break;
             case 'Dailymotion':
                 $iddaylimotion = daylimotion_id_by_url($data['video_link']);
                 if (!empty($iddaylimotion)) {
                     $idvideo = $iddaylimotion;
                     $result = file_get_contents('https://api.dailymotion.com/video/' . $idvideo . '?fields=thumbnail_url');
                     $urlarray = json_decode($result);
                     $imageurl = $urlarray->{'thumbnail_url'};
                 }
                 break;
             case 'Vimeo':
                 if (preg_match('/https?:\\/\\/(?:www\\.|player\\.)?vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^\\/]*)\\/videos\\/|album\\/(\\d+)\\/video\\/|video\\/|)(\\d+)(?:$|\\/|\\?)/', $data['video_link'], $match)) {
                     if (!empty($match[3])) {
                         $result = file_get_contents('https://vimeo.com/api/v2/video/' . $match[3] . '.json');
                         $urlarray = json_decode($result, true);
                         $imageurl = $urlarray[0]['thumbnail_large'];
                     }
                 }