Esempio n. 1
0
     $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;
     }
 }
 $media['length'] = $count;
 if (!empty($media)) {