Exemplo n.º 1
0
 function _processWallContent($comment)
 {
     // Convert video link to embedded video
     CFactory::load('helpers', 'videos');
     $comment = CVideosHelper::getVideoLink($comment);
     return $comment;
 }
Exemplo n.º 2
0
 public function get_data($url)
 {
     $jsonurl = str_ireplace("{rand}", rand(100, 999), $this->jsonurl);
     $idandswf = $this->getIdArr($url);
     $jsonurl = str_ireplace("{id}", $idandswf['id'], $jsonurl);
     $dat = CVideosHelper::getVideoInfo($jsonurl);
     $jsonobj = json_decode($dat);
     $this->id = $idandswf['id'];
     $this->swf = $idandswf['swf'];
     $this->thumbnail = $jsonobj->data[0]->logo;
     $this->duration = $jsonobj->data[0]->seconds;
     $this->title = $jsonobj->data[0]->title;
     $this->description = 'test';
 }
Exemplo n.º 3
0
 public function _getVideosHTML($videos)
 {
     $videos = $videos ? CVideosHelper::prepareVideos($videos) : array();
     $my = CFactory::getUser();
     $user = CFactory::getUser(JRequest::getInt('userid'));
     // for featured/unfeatured link
     CFactory::load('helpers', 'owner');
     CFactory::load('libraries', 'featured');
     $featured = new CFeatured(FEATURED_VIDEOS);
     $featuredVideos = $featured->getItemIds();
     $featuredList = array();
     foreach ($featuredVideos as $videoId) {
         $featuredList[] = $videoId;
     }
     $allowManageVideos = true;
     $groupVideo = false;
     $groupId = JRequest::getVar('groupid', '', 'GET');
     $task = JRequest::getVar('task', '', 'GET');
     $redirectUrl = CRoute::getURI(false);
     if (!empty($groupId)) {
         CFactory::load('helpers', 'group');
         $allowManageVideos = CGroupHelper::allowManageVideo($groupId);
         $groupVideo = true;
     }
     CFactory::load('libraries', 'videos');
     CFactory::load('helpers', 'string');
     $tmpl = new CTemplate();
     $tmpl->set('sort', JRequest::getVar('sort', 'latest'));
     $tmpl->set('currentTask', JRequest::getCmd('task', ''));
     $tmpl->set('videos', $videos);
     $tmpl->set('videoThumbWidth', CVideoLibrary::thumbSize('width'));
     $tmpl->set('videoThumbHeight', CVideoLibrary::thumbSize('height'));
     $tmpl->set('redirectUrl', $redirectUrl);
     $tmpl->set('my', $my);
     $tmpl->set('user', $user);
     $tmpl->set('featuredList', $featuredList);
     $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
     $tmpl->set('allowManageVideos', $allowManageVideos);
     $tmpl->set('groupVideo', $groupVideo);
     return $tmpl->fetch('videos.list');
 }
Exemplo n.º 4
0
 public function _getVideosHTML($videos)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $videos = $videos ? CVideosHelper::prepareVideos($videos) : array();
     $my = CFactory::getUser();
     $user = CFactory::getUser($jinput->get('userid', 0, 'Int'));
     // for featured/unfeatured link
     $featured = new CFeatured(FEATURED_VIDEOS);
     $featuredVideos = $featured->getItemIds();
     $featuredList = array();
     foreach ($featuredVideos as $videoId) {
         $featuredList[] = $videoId;
     }
     $allowManageVideos = true;
     $groupVideo = false;
     $groupId = $jinput->get->get('groupid', '', 'INT');
     $task = $jinput->get->get('task', '', 'WORD');
     $redirectUrl = CRoute::getURI(false);
     if (!empty($groupId)) {
         $allowManageVideos = CGroupHelper::allowManageVideo($groupId);
         $groupVideo = true;
     }
     $tmpl = new CTemplate();
     $tmpl->set('sort', $jinput->get('sort', 'latest', 'STRING'));
     $tmpl->set('currentTask', JInput::get('task', ''));
     $tmpl->set('videos', $videos);
     $tmpl->set('videoThumbWidth', CVideoLibrary::thumbSize('width'));
     $tmpl->set('videoThumbHeight', CVideoLibrary::thumbSize('height'));
     $tmpl->set('redirectUrl', $redirectUrl);
     $tmpl->set('my', $my);
     $tmpl->set('user', $user);
     $tmpl->set('featuredList', $featuredList);
     $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
     $tmpl->set('allowManageVideos', $allowManageVideos);
     $tmpl->set('groupVideo', $groupVideo);
     return $tmpl->fetch('videos/list');
 }
Exemplo n.º 5
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $videoId = explode("/", $videoId);
     $xmlContent = CRemoteHelper::getContent('http://xml.truveo.com/apiv3?appid=1x1jhj64466mi12ia&method=truveo.videos.getVideos&query=' . $videoId[2]);
     $parser = JFactory::getXMLParser('Simple');
     $parser->loadString($xmlContent);
     $videoElement = $parser->document;
     //get Video embed code
     $element = $videoElement->getElementByPath('videoset/video/videoresultembedtag');
     $embedTag = $element->data();
     $pattern = "'src=\"(.*?)\"'s";
     preg_match_all($pattern, $embedTag, $matches);
     if ($matches) {
         $flashUrl = ' src="' . rawurldecode($matches[1][0]) . '" ';
         $src = $matches[1][0];
     }
     // 		$pattern	=  "'FlashVars=\'(.*?)\''s";
     // 		$pattern	= '';
     // 		preg_match_all($pattern, $embedTag, $matches);
     // 		if(!empty($matches))
     // 		{
     // 			echo JUtility::dump($matches);
     // 			echo count($matches);
     // 			exit;
     // 			$flashVar = ' FlashVars=\''.rawurldecode($matches[1][0]).'\' ';
     // 		}
     //		$embedCode	= "<embed ".$flashUrl.$flashVar." allowFullScreen='true' width='".$videoWidth."' height='".$videoHeight."' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' allowScriptAccess='always'></embed>";
     $embedCode = "<embed flashvars='fs=1' allowfullscreen='true' src='" . CVideosHelper::getIURL($src) . "' type='application/x-shockwave-flash' width='{$videoWidth}' height='{$videoHeight}' wmode='transparent'></embed>";
     return $embedCode;
 }
Exemplo n.º 6
0
 /**
  * Get video's thumbnail
  *
  * @access 	public
  * @param 	videoid
  * @return url
  */
 public function getThumbnail()
 {
     $thumbnail = '';
     // Store thumbnail
     $pattern = "'<meta name=\"embed_video_thumb_url\" content=\"(.*?)\"( \\/)?(>)'s";
     preg_match_all($pattern, $this->xmlContent, $matches);
     if ($matches) {
         $thumbnail = $matches[1][0];
     }
     return CVideosHelper::getIURL($thumbnail);
 }
Exemplo n.º 7
0
 public static function getMIMEType($videoFile)
 {
     if ($videoFile['type'] === 'application/octet-stream') {
         $fileInfo = pathinfo($videoFile['name']);
         return CVideosHelper::mimeType($fileInfo['extension']);
     }
     return $videoFile['type'];
 }
            <a href="javascript:joms.walls.showVideoWindow('<?php 
echo $video->id;
?>
')" class="cVideo-Thumb">
                <div>
                    <img src="<?php 
echo $video->getThumbnail();
?>
"
                      alt="<?php 
echo $this->escape($video->title);
?>
"
                     />
                    <b><?php 
echo CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
?>
</b>
                </div>
            </a>
        </div>
        <div class="span8">
            <article class="joms-stream-fetch-content" style="margin-left:0; padding-top:0">
                <a href="javascript:joms.walls.showVideoWindow('<?php 
echo $video->id;
?>
')"><?php 
echo $video->title;
?>
</a>
                <div class="separator"></div>
Exemplo n.º 9
0
 /**
  * Get video's thumbnail URL from videoid
  *
  * @access 	public
  * @param 	videoid
  * @return url
  */
 public function getThumbnail()
 {
     return CVideosHelper::getIURL('http://img.youtube.com/vi/' . $this->getId() . '/default.jpg');
 }
Exemplo n.º 10
0
 /**
  * Get video's thumbnail URL from videoid
  *
  * @access 	public
  * @param 	videoid
  * @return url
  */
 public function getThumbnail()
 {
     $thumbnail = '';
     $pattern = "'<img src=\"(.*?)\"'s";
     preg_match_all($pattern, $this->data, $matches);
     if ($matches) {
         $thumbnail = trim($matches[1][0]);
     }
     return CVideosHelper::getIURL($thumbnail);
 }
Exemplo n.º 11
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $videoId = explode("/", $videoId);
     $embedCode = '<object width="' . $videoWidth . '" height="' . $videoHeight . '" data="' . CVideosHelper::getIURL('http://flash.revver.com/player/1.0/player.swf?mediaId=' . $videoId[0]) . '" type="application/x-shockwave-flash" id="revvervideo' . $videoId[0] . '"><param name="Movie" value="' . CVideosHelper::getIURL('http://flash.revver.com/player/1.0/player.swf?mediaId=' . $videoId[0]) . '"></param><param name="wmode" value="transparent"/></param><param name="AllowFullScreen" value="true"></param><param name="AllowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="' . CVideosHelper::getIURL('http://flash.revver.com/player/1.0/player.swf?mediaId=' . $videoId[0]) . '" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" flashvars="allowFullScreen=true" allowfullscreen="true" height="' . $videoHeight . '" width="' . $videoWidth . '" wmode="transparent"></embed></object>';
     return $embedCode;
 }
Exemplo n.º 12
0
 /**
  * Get video's thumbnail URL from videoid
  *
  * @access 	public
  * @param 	videoid
  * @return url
  */
 public function getThumbnail()
 {
     $thumbnail = '';
     $pattern = '/og:image"\\s+content="([^"]+)"/i';
     preg_match($pattern, $this->xmlContent, $matches);
     if ($matches) {
         $thumbnail = $matches[1];
     }
     return CVideosHelper::getIURL($thumbnail);
 }
Exemplo n.º 13
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $xmlContent = CRemoteHelper::getContent('http://www.flickr.com/photos/' . $videoId);
     $pattern = "'<link rel=\"video_src\" href=\"(.*?)\"( \\/)?(>)'s";
     preg_match_all($pattern, $xmlContent, $matches);
     if ($matches) {
         $videoUrl = rawurldecode($matches[1][0]);
     }
     return '<embed width="' . $videoWidth . '" height="' . $videoHeight . '" wmode="transparent" allowFullScreen="true" type="application/x-shockwave-flash" src="' . CVideosHelper::getIURL($videoUrl) . '"/>';
 }
Exemplo n.º 14
0
 public function getThumbnail()
 {
     $thumbnail = '';
     $pattern = "'thmb_url\":\"(.*?)\"'s";
     preg_match_all($pattern, $this->xmlContent, $matches);
     $thumbnail = !isset($matches[1][0]) ? '' : stripslashes($matches[1][0]);
     if ($thumbnail == '') {
         $pattern = "'<meta property=\"og:image\" content=\"(.*?)\"'s";
         preg_match_all($pattern, $this->xmlContent, $matches);
         if ($matches && !empty($matches[1][0])) {
             $thumbnail = urldecode($matches[1][0]);
         }
     }
     return CVideosHelper::getIURL($thumbnail);
 }
Exemplo n.º 15
0
    /**
     *
     *
     * @return $embedvideo specific embeded code to play the video
     */
    public function getViewHTML($videoId, $videoWidth, $videoHeight)
    {
        //$config = CFactory::getConfig();
        if (!$videoId) {
            $videoId = $this->getId();
        }
        $html = '';
        //if($config->get('use_youtube_iframe_embed'))
        if (true) {
            // Use new iframe embed method
            $html = '<iframe class="youtube-player" type="text/html" width="' . $videoWidth . '" height="' . $videoHeight . '" src="' . CVideosHelper::getIURL("http://www.youtube.com/embed/" . $videoId) . '" frameborder="0">
				</iframe>';
        } else {
            $html = "<embed src=\"" . CVideosHelper::getIURL("http://www.youtube.com/v/" . $videoId . "&hl=en&fs=1&hd=1&showinfo=0&rel=0") . "\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"" . $videoWidth . "\" height=\"" . $videoHeight . "\" wmode=\"transparent\"></embed>";
        }
        return $html;
    }
Exemplo n.º 16
0
 public function __construct(&$db)
 {
     parent::__construct('#__community_videos', 'id', $db);
     $this->_width = CVideosHelper::getVideoSize('width');
     $this->_height = CVideosHelper::getVideoSize('height');
 }
Exemplo n.º 17
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $embedCode = '<iframe src="' . CVideosHelper::getIURL('http://www.dailymotion.com/embed/video/' . $videoId) . '" width="' . $videoWidth . '" height="' . $videoHeight . '" frameborder="0"></iframe>';
     return $embedCode;
 }
Exemplo n.º 18
0
 public static function getVideoLink($content, $videoWidth = '425', $videoHeight = '344')
 {
     $pattern = array();
     $videoLinks = array();
     $pattern = CVideosHelper::getVideoLinkPatterns();
     for ($i = 0; $i < count($pattern); $i++) {
         //Match all video links
         preg_match_all($pattern[$i], $content, $match);
         if ($match) {
             $videoLinks[] = $match[0];
         }
     }
     foreach ($videoLinks as $videoLink) {
         // Replace the URL with the embedded code
         foreach ($videoLink as $videoLinkUrl) {
             $parsedVideoLink = parse_url($videoLinkUrl);
             preg_match('/(?P<domain>[a-z0-9][a-z0-9\\-]{1,63}\\.[a-z\\.]{2,6})$/i', $parsedVideoLink['host'], $matches);
             $domain = $matches['domain'];
             if (!empty($domain)) {
                 $provider = explode('.', $domain);
                 $providerName = JString::strtolower($provider[0]);
                 $libraryPath = COMMUNITY_COM_PATH . DS . 'libraries' . DS . 'videos' . DS . $providerName . '.php';
                 require_once $libraryPath;
                 $className = 'CTableVideo' . JString::ucfirst($providerName);
                 $videoObj = new $className();
                 $videoObj->init($videoLinkUrl);
                 $video_id = $videoObj->getId();
                 $videoPlayer = $videoObj->getViewHTML($video_id, $videoWidth, $videoHeight);
                 $content = str_replace($videoLinkUrl, $videoPlayer, $content);
             }
         }
     }
     return $content;
 }
Exemplo n.º 19
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     $id = explode('-', $videoId);
     $id = $id[count($id) - 1];
     $embedCode = !ctype_digit($id) ? '<object type="application/x-shockwave-flash" data="https://s.yimg.com/rx/fbp/3/player.swf?region=US&amp;site=movies&amp;onet=false&amp;version=10.2.0&amp;allowScriptAccess=always&amp;allowNetworking=all&amp;allowFullscreen=true&amp;ise=false&amp;pv=1&amp;pgsid=2143413669&amp;yvapaid=167&amp;uuid=' . $videoId . '" height="' . $videoHeight . '" width="' . $videoWidth . '" id="' . $videoId . '"> </object>' : '<iframe width="' . $videoWidth . '" height="' . $videoHeight . '" scrolling="no" frameborder="0" src="' . CVideosHelper::getIURL('http://screen.yahoo.com/' . $videoId . '.html?format=embed&player_autoplay=false') . '"></iframe>';
     return $embedCode;
 }
Exemplo n.º 20
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $this->videoId = $videoId;
     $xmlContent = CRemoteHelper::getContent($this->getFeedUrl());
     $pattern = "'<link rel=\"video_src\"(.*?)\\/>'s";
     preg_match_all($pattern, $xmlContent, $matches);
     if ($matches) {
         $pattern = "'href=\"(.*?)\"'s";
         preg_match_all($pattern, $matches[1][0], $matches);
         $videoUrl = rawurldecode($matches[1][0]);
     }
     return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' . $videoWidth . '" height="' . $videoHeight . '" id="viddler"><param name="movie" value="' . CVideosHelper::getIURL($videoUrl) . '" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"/><embed src="' . CVideosHelper::getIURL($videoUrl) . '" width="' . $videoWidth . '" height="' . $videoHeight . '" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler" wmode="transparent"></embed></object>';
 }
Exemplo n.º 21
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $file = 'http://media.photobucket.com/video/' . CString::str_ireplace(" ", "%20", $videoId);
     $xmlContent = CRemoteHelper::getContent($file);
     if ($xmlContent == FALSE) {
         return false;
     }
     $pattern = "'<link rel=\"video_src\" href=\"(.*?)\" \\/>'s";
     preg_match_all($pattern, $xmlContent, $matches);
     if ($matches) {
         $videoUrl = rawurldecode($matches[1][0]);
     }
     $embedCode = '<embed width="' . $videoWidth . '" height="' . $videoHeight . '" type="application/x-shockwave-flash" wmode="transparent" src="' . CVideosHelper::getIURL($videoUrl) . '">';
     return $embedCode;
 }
Exemplo n.º 22
0
 public static function _processWallContent($comment)
 {
     // Convert video link to embedded video
     $comment = CVideosHelper::getVideoLink($comment);
     return $comment;
 }
Exemplo n.º 23
0
 public function getDurationInHMS()
 {
     if ($this->duration != 0) {
         $duration = CVideosHelper::formatDuration((int) $this->duration, 'HH:MM:SS');
         $duration = CVideosHelper::toNiceHMS($duration);
     } else {
         $duration = JText::_('COM_COMMUNITY_VIDEOS_DURATION_NOT_AVAILABLE');
     }
     return $duration;
 }
Exemplo n.º 24
0
 public static function formatStreamAttachment($obj)
 {
     switch ($obj->app) {
         case 'videos.linking':
             $video = JTable::getInstance('Video', 'CTable');
             $video->load($obj->cid);
             $attachment = new stdClass();
             $attachment->type = 'videos.linking';
             $attachment->type = 'video';
             $attachment->id = $obj->cid;
             $attachment->title = $video->title;
             $attachment->thumbnail = $video->getThumbnail();
             $attachment->description = $video->description;
             $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
             $attachment->access = $obj->access;
             $attachment->video_type = $video->type;
             $attachment->link = $video->path;
             $attachment->video = $video;
             break;
         case 'profile.status.share':
             $params = new CParameter($obj->params);
             $act = JTable::getInstance('Activity', 'CTable');
             $act->load($params->get('activityId'));
             $attachment = self::formatStreamAttachment($act);
             break;
         case 'groups.wall':
         case 'events.wall':
         case 'profile':
             $params = new CParameter($obj->params);
             $headMetas = $params->get('headMetas', NULL);
             $headers = new CParameter($headMetas);
             if (!is_null($headers->get('title'))) {
                 $attachment = new stdClass();
                 $attachment->type = 'fetched';
                 $data = new stdClass();
                 $headers = new CParameter($headMetas);
                 $data->title = $headers->get('title');
                 $data->description = $headers->get('description');
                 $data->thumb = $headers->get('image');
                 $data->app = $obj->app;
                 $data->params = $obj->params;
                 $attachment->message = CActivityStream::formatSharePopup($data)->content;
             } else {
                 $attachment = new stdClass();
                 $attachment->type = 'quote';
                 $attachment->id = $obj->id;
                 $attachment->location = $obj->location;
                 $attachment->message = CActivities::format($obj->title, $params->get('mood'));
             }
             break;
         case 'videos':
             $video = JTable::getInstance('Video', 'CTable');
             $video->load($obj->cid);
             $attachment = new stdClass();
             $attachment->type = 'video';
             $attachment->id = $obj->cid;
             $attachment->title = $video->title;
             $attachment->thumbnail = $video->getThumbnail();
             $attachment->description = $video->description;
             $attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
             $attachment->link = $video->getURL();
             $attachment->video_type = $video->type;
             $attachment->link = $video->path;
             $attachment->video = $video;
             break;
         case 'photos':
             $params = new CParameter($obj->params);
             $count = $params->get('count', 1);
             $photoId = $params->get('photoid', 0);
             $photoIds = explode(',', $params->get('photosId', 0));
             $attachment = new stdClass();
             if ($count == 1 && $photoId > 0) {
                 $attachment->type = 'photo';
                 $photo = JTable::getInstance('Photo', 'CTable');
                 if ($photo->load($photoId) && $photo->status != 'delete') {
                     $attachment->singlephoto = $photo->getImageURI();
                     $attachment->caption = $photo->caption;
                     $attachment->thumbnail = $photo->getThumbURI();
                     $attachment->link = $params->get('photo_url');
                     $attachment->albumid = $photo->albumid;
                     $attachment->id = $photo->id;
                 }
             } elseif ($count > 1 && $photoId > 0) {
                 $attachment->type = 'photos';
                 $album = JTable::getInstance('Album', 'CTable');
                 $album->load($obj->cid);
                 if (count($photoIds) > 1) {
                     foreach ($photoIds as $pid) {
                         $photo = JTable::getInstance('Photo', 'CTable');
                         $photo->load($pid);
                         /* Make sure photo is not deleted */
                         if ($photo->status != 'delete') {
                             $photos[] = $photo;
                         }
                         foreach ($photos as $key => $data) {
                             if ($data->id == $photoId) {
                                 unset($photos[$key]);
                                 /* remove this photo */
                                 array_unshift($photos, $data);
                                 /* move it to beginning of array */
                             }
                         }
                     }
                 } else {
                     $photos = $album->getLatestPhoto($count);
                 }
                 $tmpIdArray = array();
                 $tmpAlbumArray = array();
                 $tmpUrlArray = array();
                 $tmpThumbArray = array();
                 $tmpCaptionArray = array();
                 if ($count >= 5) {
                     $photos = array_slice($photos, 0, 5);
                 }
                 foreach ($photos as $photo) {
                     $tmpIdArray[] = $photo->id;
                     $tmpAlbumArray[] = $photo->albumid;
                     $tmpThumbArray[] = $photo->getImageURI();
                     $tmpUrlArray[] = $photo->getPhotoLink();
                     $tmpCaptionArray[] = $photo->caption;
                 }
                 $attachment->id = $tmpIdArray;
                 $attachment->album = $tmpAlbumArray;
                 $attachment->link = $tmpUrlArray;
                 $attachment->thumbnail = $tmpThumbArray;
                 $attachment->caption = $tmpCaptionArray;
             }
             break;
         case 'groups':
             $attachment = new stdClass();
             $attachment->type = 'group_share';
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($obj->cid);
             $attachment->message = new stdClass();
             $attachment->message->title = $group->name;
             $attachment->message->description = $group->description;
             $attachment->message->link = $group->getLink();
             break;
         case 'events':
             $attachment = new stdClass();
             $attachment->type = 'event_share';
             $event = JTable::getInstance('Event', 'CTable');
             $event->load($obj->cid);
             $attachment->message = $event;
             break;
         case 'cover.upload':
             $params = new CParameter($obj->params);
             $attachment = new stdClass();
             $attachment->type = 'cover';
             $attachment->thumbnail = $params->get('attachment');
             break;
         case 'profile.avatar.upload':
             $params = new CParameter($obj->params);
             $attachment = new stdClass();
             $attachment->type = 'profile_avatar';
             $attachment->thumbnail = $params->get('attachment');
             break;
         default:
             $attachment = new stdClass();
             $attachment->type = '';
             break;
     }
     return $attachment;
 }
Exemplo n.º 25
0
$quoteContent = CActivities::format($act->title, $mood);
if (!empty($quoteContent) && $param->get('style') == COMMUNITY_STREAM_STYLE) {
    $attachment = new stdClass();
    $attachment->type = 'text';
    $attachment->message = $quoteContent;
    $attachment->hasMood = is_null($mood) ? false : true;
    /* Temporary fix for sprint 2 */
    if ($this->act instanceof CTableActivity) {
        /* If this's CTableActivity then we use getProperties() */
        $activity = new CActivity($this->act->getProperties());
    } else {
        /* If it's standard object than we just passing it */
        $activity = new CActivity($this->act);
    }
    $attachment->activity = $activity;
    $attachment->address = $activity->getLocation();
    $stream->attachments[] = $attachment;
}
$attachment = new stdClass();
$attachment->type = 'video';
$attachment->id = $act->cid;
$attachment->title = $video->title;
$attachment->thumbnail = $video->getThumbnail();
$attachment->description = $video->description;
$attachment->duration = CVideosHelper::toNiceHMS(CVideosHelper::formatDuration($video->getDuration()));
$attachment->access = $act->access;
$attachment->video_type = $video->type;
$attachment->link = $video->path;
$stream->attachments[] = $attachment;
$this->set('stream', $stream);
$this->load('stream/base-extended');
Exemplo n.º 26
0
 /**
  * This function will regenerate the thumbnail of videos
  * @param int $id
  * @param bool $returnThumb
  * @return bool
  */
 public function _fetchThumbnail($id = 0, $returnThumb = false)
 {
     if (!COwnerHelper::isRegisteredUser()) {
         return;
     }
     if (!$id) {
         return false;
     }
     $table = JTable::getInstance('Video', 'CTable');
     $table->load($id);
     $config = CFactory::getConfig();
     if ($table->type == 'file') {
         // We can only recreate the thumbnail for local video file only
         // it's not possible to process remote video file with ffmpeg
         if ($table->storage != 'file') {
             $this->setError(JText::_('COM_COMMUNITY_INVALID_FILE_REQUEST') . ': ' . 'FFmpeg cannot process remote video.');
             return false;
         }
         $videoLib = new CVideoLibrary();
         $videoFullPath = JPATH::clean(JPATH_ROOT . '/' . $table->path);
         if (!JFile::exists($videoFullPath)) {
             return false;
         }
         // Read duration
         $videoInfo = $videoLib->getVideoInfo($videoFullPath);
         if (!$videoInfo) {
             return false;
         } else {
             $videoFrame = CVideosHelper::formatDuration((int) ($videoInfo['duration']['sec'] / 2), 'HH:MM:SS');
             // Create thumbnail
             $oldThumb = $table->thumb;
             $thumbFolder = CVideoLibrary::getPath($table->creator, 'thumb');
             $thumbSize = CVideoLibrary::thumbSize();
             $thumbFilename = $videoLib->createVideoThumb($videoFullPath, $thumbFolder, $videoFrame, $thumbSize);
         }
         if (!$thumbFilename) {
             return false;
         }
     } else {
         if (!CRemoteHelper::curlExists()) {
             $this->setError(JText::_('COM_COMMUNITY_CURL_NOT_EXISTS'));
             return false;
         }
         $videoLib = new CVideoLibrary();
         $videoObj = $videoLib->getProvider($table->path);
         if ($videoObj == false) {
             $this->setError($videoLib->getError());
             return false;
         }
         if (!$videoObj->isValid()) {
             $this->setError($videoObj->getError());
             return false;
         }
         $remoteThumb = $videoObj->getThumbnail();
         $thumbData = CRemoteHelper::getContent($remoteThumb, true);
         if (empty($thumbData)) {
             $this->setError(JText::_('COM_COMMUNITY_INVALID_FILE_REQUEST') . ': ' . $remoteThumb);
             return false;
         }
         // split the header and body
         list($headers, $body) = explode("\r\n\r\n", $thumbData, 2);
         preg_match('/Content-Type: image\\/(.*)/i', $headers, $matches);
         if (!empty($matches)) {
             $thumbPath = CVideoLibrary::getPath($table->creator, 'thumb');
             $thumbFileName = CFileHelper::getRandomFilename($thumbPath);
             $tmpThumbPath = $thumbPath . '/' . $thumbFileName;
             if (!JFile::write($tmpThumbPath, $body)) {
                 $this->setError(JText::_('COM_COMMUNITY_INVALID_FILE_REQUEST') . ': ' . $thumbFileName);
                 return false;
             }
             // We'll remove the old or none working thumbnail after this
             $oldThumb = $table->thumb;
             // Get the image type first so we can determine what extensions to use
             $info = getimagesize($tmpThumbPath);
             $mime = image_type_to_mime_type($info[2]);
             $thumbExtension = CImageHelper::getExtension($mime);
             $thumbFilename = $thumbFileName . $thumbExtension;
             $thumbPath = $thumbPath . '/' . $thumbFilename;
             if (!JFile::move($tmpThumbPath, $thumbPath)) {
                 $this->setError(JText::_('WARNFS_ERR02') . ': ' . $thumbFileName);
                 return false;
             }
             // Resize the thumbnails
             //CImageHelper::resizeProportional( $thumbPath , $thumbPath , $mime , CVideoLibrary::thumbSize('width') , CVideoLibrary::thumbSize('height') );
             list($width, $height) = explode('x', $config->get('videosThumbSize'));
             CImageHelper::resizeAspectRatio($thumbPath, $thumbPath, $width, $height);
         } else {
             $this->setError(JText::_('COM_COMMUNITY_PHOTOS_IMAGE_NOT_PROVIDED_ERROR'));
             return false;
         }
     }
     // Update the DB with new thumbnail
     $thumb = $config->get('videofolder') . '/' . VIDEO_FOLDER_NAME . '/' . $table->creator . '/' . VIDEO_THUMB_FOLDER_NAME . '/' . $thumbFilename;
     $table->set('thumb', $thumb);
     $table->store();
     // If this video storage is not on local, we move it to remote storage
     // and remove the old thumb if existed
     if ($table->storage != 'file') {
         // && ($table->storage == $storageType))
         $config = CFactory::getConfig();
         $storageType = $config->getString('videostorage');
         $storage = CStorage::getStorage($storageType);
         $storage->delete($oldThumb);
         $localThumb = JPATH::clean(JPATH_ROOT . '/' . $table->thumb);
         $tempThumbname = JPATH::clean(JPATH_ROOT . '/' . md5($table->thumb));
         if (JFile::exists($localThumb)) {
             JFile::copy($localThumb, $tempThumbname);
         }
         if (JFile::exists($tempThumbname)) {
             $storage->put($table->thumb, $tempThumbname);
             JFile::delete($localThumb);
             JFile::delete($tempThumbname);
         }
     } else {
         if (JFile::exists(JPATH_ROOT . '/' . $oldThumb)) {
             JFile::delete(JPATH_ROOT . '/' . $oldThumb);
         }
     }
     if ($returnThumb) {
         return $table->getThumbnail();
     }
     return true;
 }
Exemplo n.º 27
0
 /**
  *
  *
  * @return $embedCode specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     return "<embed id=\"VideoPlayback\" src=\"" . CVideosHelper::getIURL("http://video.google.com/googleplayer.swf?docid=" . $videoId . "&hl=en&fs=true") . "\" style=\"width:" . $videoWidth . "px;height:" . $videoHeight . "px\" allowFullScreen=\"true\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" wmode=\"transparent\"> </embed>";
 }
Exemplo n.º 28
0
 /**
  *
  *
  * @return $embedCode specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     $videoId = !empty($videoId) ? $videoId : $this->url;
     $xmlContent = CRemoteHelper::getContent('http://www.mtv.com/videos/' . $videoId);
     $videoPath = explode('/', $videoId);
     if ($xmlContent == FALSE) {
         return false;
     }
     // Get Embeded Code
     $pattern = "/http:\\/\\/media.mtvnservices.com\\/mgid:uma:(.*?)\"/i";
     preg_match_all($pattern, $xmlContent, $matches);
     if ($matches[1][0]) {
         $path = $matches[1][0];
         $getId = explode(':', $matches[1][0]);
     }
     if ($getId[0] == 'video') {
         $flashVars = 'flashVars="configParams=vid=' . $getId[2];
     } else {
         $id = explode('=', $videoPath[2]);
         $flashVars = $videoPath[0] == 'movie-trailers' ? NULL : 'flashVars="configParams=id=' . $id[1] . '"';
     }
     $embedCode = '<embed src="' . CVideosHelper::getIURL('http://media.mtvnservices.com/mgid:uma:' . $path) . '" width="' . $videoWidth . '" height="' . $videoHeight . '" ' . $flashVars . '" type="application/x-shockwave-flash" allowFullScreen="true" allowScriptAccess="always" base="." wmode="transparent"></embed>';
     return $embedCode;
 }
Exemplo n.º 29
0
 /**
  *
  *
  * @return $embedvideo specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $remoteFile = 'http://blip.tv/file/' . $videoId . '?skin=rss';
     $xmlContent = CRemoteHelper::getContent($remoteFile);
     // get embedFile
     $pattern = "'<blip:embedLookup>(.*?)<\\/blip:embedLookup>'s";
     $embedFile = '';
     preg_match_all($pattern, $xmlContent, $matches);
     if ($matches) {
         $embedFile = $matches[1][0];
     }
     return '<iframe src="' . CVideosHelper::getIURL('http://blip.tv/play/' . $embedFile . '.x?p=1') . '" width="' . $videoWidth . '" height="' . $videoHeight . '" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="' . CVideosHelper::getIURL('http://a.blip.tv/api.swf#' . $embedFile) . '" style="display:none"></embed>';
 }
Exemplo n.º 30
0
 /**
  *
  *
  * @return $embedCode specific embeded code to play the video
  */
 public function getViewHTML($videoId, $videoWidth, $videoHeight)
 {
     if (!$videoId) {
         $videoId = $this->videoId;
     }
     $embedCode = '<iframe src="' . CVideosHelper::getIURL('http://player.vimeo.com/video/' . $videoId) . '" width="' . $videoWidth . '" height="' . $videoHeight . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
     return $embedCode;
 }