public function actionDetail() { $data = array(); $alias = urlGETParams('alias'); $query = "SELECT * FROM tbl_youtube WHERE alias = :alias"; $values = array(':alias' => $alias); $row = $this->db->createCommand($query)->bindValues($values)->queryRow(); if (empty($row)) { $this->redirect($this->createUrl('video/index')); } //update so luot view $query = "UPDATE tbl_youtube SET view_real = (view_real + 1), viewer = (viewer+1) WHERE id = " . $row['id']; $this->db->createCommand($query)->execute(); $str_tags = trim($row['tags'], ','); $arr_tags = explode(',', $str_tags); $data['tags'] = $this->getListVideoTags($arr_tags); $keywords = ''; if (!empty($data['tags'])) { $tags = array(); foreach ($data['tags'] as $item) { $tags[] = $item['name']; if (count($tags) == 8) { break; } } $keywords = implode(',', $tags); } $this->_meta = array('title' => $row['title'] . ' - Techz24', 'description' => short_text($row['description'], 160), 'keywords' => short_text($keywords, 85), 'image' => getYoutubeThumbnail($row['thumbnails'], 'standard')); $query = "SELECT * FROM tbl_youtube ORDER BY created DESC LIMIT 18"; $data['listVideo'] = $this->db->createCommand($query)->queryAll(); $this->_style_class = 'page right-sidebar singular fade-imgs-in-appear one-side-wide both-sidebars archive-page'; $data['row'] = $row; $this->render('detail', array('data' => $data)); }
} $channel->feed = $feed; $channel->thumbnail_url = getChannelThumbnail($feed); //Store the bean $id = R::store($channel); $channel->data_source = 'http'; } else { $channel->data_source = 'database'; } if ($cacheAvailable) { $memcache->add("chthmb-{$feed}", $channel->thumbnail_url, false, 1800); } jsonForAjax(R::exportAll($channel)); break; case 'youtube_thumbnail': getYoutubeThumbnail($_GET['id'], isset($_GET['base64'])); break; case 'ads': getAds(); break; case 'sponsored_channel': getSponsoredChannel(); break; } function getChannelThumbnail($feed) { $thumbnail_url = null; if (preg_match("/\\/domain\\//u", $feed) > 0) { $uri = "http://www.reddit.com" . $feed . "/search/.json?restrict_sr=on&sort=top&syntax=cloudsearch&limit=100"; } else { $uri = "http://www.reddit.com" . $feed . "/search/.json?q=%28and+%28or+site%3A%27youtube.com%27+site%3A%27vimeo.com%27+site%3A%27youtu.be%27%29+timestamp%3A" . (time() - 30 * 24 * 60 * 60) . "..%29&restrict_sr=on&sort=top&syntax=cloudsearch&limit=100";
?> <div class="inner" style="margin-bottom: 10px"> <h2> <a class="title" href="<?php echo $video_url; ?> "> <div class="img"> <div class="meta-carousel"> <i class="fa fa-eye"></i> <?php echo $item['viewer']; ?> </div> <div class="play-icon"></div> <img src="<?php echo getYoutubeThumbnail($item['thumbnails']); ?> " alt="<?php echo CHtml::encode($item['title']); ?> "> <div class="title-carousel"> <div class="ticarousel"><?php echo $item['title']; ?> </div> </div> </div> </a>
$i = ($page - 1) * $page_size + 1; foreach ($data['listItem'] as $item) { ?> <tr> <td><?php echo $i++; ?> </td> <td> <a href="<?php echo $this->createUrl('detail', array('id' => $item['id'])); ?> "> <img class="thumbnail" src="<?php echo getYoutubeThumbnail($item['thumbnails'], 'medium'); ?> "/> </a> </td> <td><?php echo $item['channel_name']; ?> </td> <td> <?php echo substr($item['publishedAt'], 1, 10); ?> </td> <td> <a href="<?php