/** * Returns class instance * * @return VIDEO_BOL_ClipDao */ public static function getInstance() { if (null === self::$classInstance) { self::$classInstance = new self(); } return self::$classInstance; }
public function findUserVideos($userId, $start, $offset) { $clipDao = VIDEO_BOL_ClipDao::getInstance(); $example = new OW_Example(); $example->andFieldEqual('status', 'approved'); $example->andFieldEqual('userId', $userId); $example->setOrder('`addDatetime` DESC'); $example->setLimitClause($start, $offset); $list = $clipDao->findListByExample($example); $out = array(); foreach ($list as $video) { $id = $video->id; $videoThumb = VIDEO_BOL_ClipService::getInstance()->getClipThumbUrl($id); $out[$id] = array('id' => $id, 'embed' => $video->code, 'title' => UTIL_String::truncate($video->title, 65, ' ...'), 'description' => UTIL_String::truncate($video->description, 130, ' ...'), 'thumb' => $videoThumb == 'undefined' ? null : $videoThumb, 'date' => UTIL_DateTime::formatDate($video->addDatetime), 'permalink' => OW::getRouter()->urlForRoute('view_clip', array('id' => $id))); $out[$id]['oembed'] = json_encode(array('type' => 'video', 'thumbnail_url' => $out[$id]['thumb'], 'html' => $out[$id]['embed'], 'title' => $out[$id]['title'], 'description' => $out[$id]['description'])); } return $out; }
public function cacheThumbnails($limit) { $clips = $this->clipDao->getUncachedThumbsClipsList($limit); if (!$clips) { return true; } foreach ($clips as $clip) { $prov = new VideoProviders($clip->code); if (!$clip->provider) { $clip->provider = $prov->detectProvider(); } $thumbUrl = $prov->getProviderThumbUrl($clip->provider); if ($thumbUrl != VideoProviders::PROVIDER_UNDEFINED) { $clip->thumbUrl = $thumbUrl; } $clip->thumbCheckStamp = time(); $this->clipDao->save($clip); } return true; }
public function countVideos() { return VIDEO_BOL_ClipDao::getInstance()->countClips('latest'); }
/** * Class constructor * */ protected function __construct() { parent::__construct(); }