Esempio n. 1
0
 $mtype = $c->template();
 $title = $c->title() !== null ? $c->title()->value : '';
 $caption_title = $c->captiontitle() !== null ? $c->captiontitle()->value : '';
 $description = $c->text() !== null ? $c->text()->value : '';
 $count++;
 switch ($mtype) {
     case 'image':
         if ($c->images()->first()) {
             $media[] = array('type' => $mtype, 'url' => $c->images()->first()->url(), 'width' => $c->images()->first()->width(), 'height' => $c->images()->first()->height(), 'title' => $title, 'caption_title' => $caption_title, 'description' => $description);
         }
         break;
     case 'video':
         $embed = '';
         $url = $c->video_url()->value;
         if (!isset($c->video_embed()->value) || $c->video_embed()->value == '') {
             $embed = videos::embed($url);
         } else {
             $embed = $c->video_embed()->value;
         }
         $media[] = array('type' => $mtype, 'id' => videos::id($url), 'url' => $c->video_url()->value, 'title' => $title, 'caption_title' => $caption_title, 'description' => $description, 'embed' => $embed, 'thumb' => videos::thumb($url));
         break;
     case 'audio':
         $embed = '';
         $url = $c->audio_url()->value;
         if (!isset($c->audio_embed()->value) || $c->audio_embed()->value == '') {
             $embed = scaudio::embed($url);
         } else {
             $embed = $c->audio_embed()->value;
         }
         $media[] = array('type' => $mtype, 'id' => $url, 'url' => $url, 'title' => $title, 'caption_title' => $caption_title, 'description' => $description, 'embed' => $embed, 'thumb' => scaudio::thumb($url));
         break;