public function addVideo($userId, $embed, $title, $description, $thumbnailUrl, $text, $addToFeed = true) { if (!$this->isActive()) { return null; } $title = empty($title) ? $text : $title; $title = empty($title) ? '' : $title; $description = empty($description) ? '' : $description; $clipService = VIDEO_BOL_ClipService::getInstance(); $clip = new VIDEO_BOL_Clip(); $clip->title = $title; $description = UTIL_HtmlTag::stripJs($description); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $clip->description = $description; $clip->userId = $userId; $clip->code = UTIL_HtmlTag::stripJs($embed); $prov = new VideoProviders($clip->code); $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clip->userId, 'action' => 'video_view_video')); $clip->provider = $prov->detectProvider(); $clip->addDatetime = time(); $clip->status = 'approved'; $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $thumbUrl = empty($thumbnailUrl) ? $prov->getProviderThumbUrl($clip->provider) : $thumbnailUrl; if ($thumbUrl != VideoProviders::PROVIDER_UNDEFINED) { $clip->thumbUrl = $thumbUrl; } $clip->thumbCheckStamp = time(); $clipId = $clipService->addClip($clip); if ($addToFeed) { // Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'video', 'entityType' => 'video_comments', 'entityId' => $clipId, 'userId' => $clip->userId), array("content" => array("vars" => array("status" => $text)))); OW::getEventManager()->trigger($event); } return $clipId; }
public static function detectThumbnail($code) { if (!ATTACHMENTS_CLASS_VideoBridge::getInstance()->isActive()) { return null; } $prov = new VideoProviders($code); $provider = $prov->detectProvider(); $thumbUrl = $prov->getProviderThumbUrl($provider); if ($thumbUrl == VideoProviders::PROVIDER_UNDEFINED) { return null; } return $thumbUrl; }
/** * Updates video clip * * @return boolean */ public function process() { $values = $this->getValues(); $clipService = VIDEO_BOL_ClipService::getInstance(); if ($values['id']) { $clip = $clipService->findClipById($values['id']); if ($clip) { $clip->title = htmlspecialchars($values['title']); $description = UTIL_HtmlTag::stripJs($values['description']); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $clip->description = $description; if ($clip->code != $values['code']) { $prov = new VideoProviders($values['code']); $clip->provider = $prov->detectProvider(); $thumbUrl = $prov->getProviderThumbUrl($clip->provider); if ($thumbUrl != VideoProviders::PROVIDER_UNDEFINED) { $clip->thumbUrl = $thumbUrl; } $clip->thumbCheckStamp = time(); } $clip->code = UTIL_HtmlTag::stripJs($values['code']); if ($clipService->updateClip($clip)) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'video', $values['tags']); return array('result' => true, 'id' => $clip->id); } } } else { return array('result' => false, 'id' => null); } return false; }
public function addClip($clipInfo) { $clip = new VIDEO_BOL_Clip(); $clip->title = htmlspecialchars($clipInfo["title"]); $description = UTIL_HtmlTag::stripJs($clipInfo["desc"]); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $description = nl2br($description, true); $clip->description = $description; $clip->userId = OW::getUser()->getId(); $clip->thumbUrl = preg_replace("#(http://|https://)#i", "//", $clipInfo["thumbnail"]); $clip->code = UTIL_HtmlTag::stripJs($clipInfo["code"]); $prov = new VideoProviders($clip->code); $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clip->userId, 'action' => 'video_view_video')); $clip->provider = $prov->detectProvider(); $clip->addDatetime = time(); $clip->status = 'approved'; $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $eventParams = array('pluginKey' => 'video', 'action' => 'add_video'); if (OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true) { OW::getEventManager()->call('usercredits.track_action', $eventParams); } if ($this->clipService->addClip($clip)) { if (isset($clipInfo['tags'])) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'video', explode(',', $clipInfo['tags'])); } // Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'video', 'entityType' => 'video_comments', 'entityId' => $clip->id, 'userId' => $clip->userId)); OW::getEventManager()->trigger($event); return $clip->id; } return false; }
/** * Adds video clip * * @return boolean */ public function process() { $values = $this->getValues(); $clipService = VIDEO_BOL_ClipService::getInstance(); $clip = new VIDEO_BOL_Clip(); $clip->title = htmlspecialchars($values['title']); $description = UTIL_HtmlTag::stripJs($values['description']); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $clip->description = $description; $clip->userId = OW::getUser()->getId(); $clip->code = UTIL_HtmlTag::stripJs($values['code']); $prov = new VideoProviders($clip->code); $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clip->userId, 'action' => 'video_view_video')); $clip->provider = $prov->detectProvider(); $clip->addDatetime = time(); $clip->status = 'approved'; $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $thumbUrl = $prov->getProviderThumbUrl($clip->provider); if ($thumbUrl != VideoProviders::PROVIDER_UNDEFINED) { $clip->thumbUrl = $thumbUrl; } $clip->thumbCheckStamp = time(); $eventParams = array('pluginKey' => 'video', 'action' => 'add_video'); if (OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true) { OW::getEventManager()->call('usercredits.track_action', $eventParams); } if ($clipService->addClip($clip)) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'video', $values['tags']); // Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'video', 'entityType' => 'video_comments', 'entityId' => $clip->id, 'userId' => $clip->userId)); OW::getEventManager()->trigger($event); return array('result' => true, 'id' => $clip->id); } return false; }
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; }
private function init() { if (!isset(self::$provArr)) { self::$provArr = array(self::PROVIDER_YOUTUBE => '//www.youtube(-nocookie)?.com/', self::PROVIDER_GOOGLEVIDEO => 'http://video.google.com/', self::PROVIDER_METACAFE => 'http://www.metacafe.com/', self::PROVIDER_DAILYMOTION => 'http://www.dailymotion.com/', self::PROVIDER_PORNHUB => 'http://www.pornhub.com/', self::PROVIDER_MYSPACE => 'http://mediaservices.myspace.com/', self::PROVIDER_VIMEO => 'http://(player\\.)?vimeo.com/', self::PROVIDER_BLIPTV => 'http://blip.tv/', self::PROVIDER_GUBA => 'http://www.guba.com/', self::PROVIDER_BIGTUBE => 'http://www.bigtube.com/', self::PROVIDER_TNAFLIX => 'http://www.tnaflix.com/', self::PROVIDER_XHAMSTER => 'http://xhamster.com/'); } }
public function addClip(OW_Event $e) { $params = $e->getParams(); if (empty($params['userId']) || empty($params['title']) || empty($params['code'])) { $e->setData(array('result' => false)); } else { $clipService = VIDEO_BOL_ClipService::getInstance(); $clip = new VIDEO_BOL_Clip(); $clip->title = htmlspecialchars($params['title']); if (!empty($params['description'])) { $clip->description = UTIL_HtmlTag::stripJs($params['description']); $clip->description = UTIL_HtmlTag::stripTags($clip->description, array('frame', 'style'), array(), true); } $clip->userId = $params['userId']; $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clip->userId, 'action' => 'video_view_video')); $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $prov = new VideoProviders($params['code']); $clip->provider = $prov->detectProvider(); $clip->addDatetime = time(); $clip->status = 'approved'; $thumbUrl = $prov->getProviderThumbUrl($clip->provider); if ($thumbUrl != VideoProviders::PROVIDER_UNDEFINED) { $clip->thumbUrl = $thumbUrl; } $clip->thumbCheckStamp = time(); $clip->code = $clipService->validateClipCode($params['code'], $clip->provider); if ($clipService->addClip($clip)) { BOL_AuthorizationService::getInstance()->trackAction('video', 'add'); if (!empty($params['tags'])) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'video', $params['tags']); } // Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'video', 'entityType' => VIDEO_BOL_ClipService::ENTITY_TYPE, 'entityId' => $clip->id, 'userId' => $clip->userId)); OW::getEventManager()->trigger($event); OW::getEventManager()->trigger(new OW_Event(VIDEO_BOL_ClipService::EVENT_AFTER_ADD, array('clipId' => $clip->id))); $status = $clipService->findClipById($clip->id)->status; $e->setData(array('result' => true, 'id' => $clip->id, "status" => $status)); } } }
/** * Adds vwvr clip * * @return boolean */ public function process() { $values = $this->getValues(); $clipService = VWVR_BOL_ClipService::getInstance(); $clip = new VWVR_BOL_Clip(); $clip->room_name = htmlspecialchars($values['room_name']); $description = UTIL_HtmlTag::stripJs($values['description']); $description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true); $clip->description = $description; $clip->userId = OW::getUser()->getId(); $room_nameArr = explode("-", $_COOKIE["video_recorded"]); $room_namex = $room_nameArr[0]; // title $recordingIdx = $room_nameArr[1]; $clip->recordingId = "-" . $recordingIdx; $clip->title = $room_namex; // $clip->code = UTIL_HtmlTag::stripJs($values['code']); // $prov = new VideoProviders($clip->code); $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clip->userId, 'action' => 'videorecorder_view_video')); // $clip->provider = $prov->detectProvider(); $clip->addDatetime = time(); $config = OW::getConfig(); $status = $config->getValue('vwvr', 'status'); $clip->status = $status; $clip->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $eventParams = array('pluginKey' => 'vwvr', 'action' => 'add_vwvr'); if (OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true) { OW::getEventManager()->call('usercredits.track_action', $eventParams); } // add clip to video plugin $isVideoActive = OW::getPluginManager()->isPluginActive('video'); if ($isVideoActive) { $clipServiceVideo = VIDEO_BOL_ClipService::getInstance(); $clipVideo = new VIDEO_BOL_Clip(); $clipVideo->title = htmlspecialchars($values['room_name']); $clipVideo->description = $description; $clipVideo->userId = OW::getUser()->getId(); $clipVideo->code = '<iframe width="420" height="315" src="' . $config->getValue('vwvr', 'baseSwf_url') . 'streamplayer.swf?streamName=' . $room_namex . $clip->recordingId . '&serverRTMP=' . $config->getValue('vwvr', 'server') . '&templateURL=" frameborder="0" allowfullscreen="allowfullscreen"></iframe>'; $prov = new VideoProviders($clipVideo->code); $clipVideo->provider = $prov->detectProvider(); $privacy = OW::getEventManager()->call('plugin.privacy.get_privacy', array('ownerId' => $clipVideo->userId, 'action' => 'video_view_video')); $clipVideo->addDatetime = time(); $clipVideo->status = 'approved'; $clipVideo->privacy = mb_strlen($privacy) ? $privacy : 'everybody'; $clipServiceVideo->addClip($clipVideo); } // videowhisper // get record path $recordPath = $config->getValue('vwvr', 'recordPath'); $recordPathArr = explode('/', $recordPath); $recordPathArrCount = count($recordPathArr); for ($i = 1; $i < $recordPathArrCount; $i++) { $recorded .= "/" . $recordPathArr[$i]; if (!is_dir($recorded)) { mkdir($recorded); } } // get streams directory $dirname = 'streams'; if (file_exists('../../' . $dirname)) { $dir = '../../' . $dirname; } elseif (file_exists('../../../' . $dirname)) { $dir = '../../../' . $dirname; } elseif (file_exists('../../../../' . $dirname)) { $dir = '../../../../' . $dirname; } elseif (file_exists('../../../../../' . $dirname)) { $dir = '../../../../../' . $dirname; } elseif (file_exists('../../../../../../' . $dirname)) { $dir = '../../../../../../' . $dirname; } // $streamsPath = realpath($dir); $streamsPath = realpath("../" . $dir); // convert and copy, or just copy $filename = $_COOKIE["video_recorded"]; $old = $streamsPath . "/streams/" . $filename; $new = $recordPath . "/" . $filename; $ffmpeg = trim(shell_exec('type -P ffmpeg')); if (empty($ffmpeg)) { copy($old . '.flv', $new . '.flv'); } else { shell_exec($ffmpeg . ' -i ' . $old . '.flv -sameq -ar 22050 ' . $new . '.mp4'); } if ($clipService->addClip($clip)) { BOL_TagService::getInstance()->updateEntityTags($clip->id, 'vwvr', TagsField::getTags($values['tags'])); // Newsfeed $event = new OW_Event('feed.action', array('pluginKey' => 'vwvr', 'entityType' => 'vwvr_comments', 'entityId' => $clip->id, 'userId' => $clip->userId)); OW::getEventManager()->trigger($event); return array('result' => true, 'id' => $clip->id); } return false; }