From a161b38e65fa698133402f4fb23548242f494018 Mon Sep 17 00:00:00 2001
From: Dave Tosh
Date: Tue, 23 Mar 2010 17:30:14 +0000
Subject: This videolist plugin shows real promise so we shall work on it for
v1.8 then release it back to the community.
---
actions/addvideo.php | 216 ++
actions/comments_delete/add.php | 58 +
actions/delete.php | 44 +
actions/save.php | 16 +
actions/tubesearch.php | 330 ++
browse.php | 44 +
graphics/Video_Icon.jpg | Bin 0 -> 64088 bytes
graphics/badge3.gif | Bin 0 -> 16801 bytes
graphics/logo_videos.png | Bin 0 -> 6333 bytes
graphics/metacafe.jpg | Bin 0 -> 5523 bytes
graphics/pic_youtubelogo_123x63.gif | Bin 0 -> 3457 bytes
graphics/play.jpg | Bin 0 -> 15987 bytes
graphics/vimeo_logo.gif | Bin 0 -> 3811 bytes
graphics/youtube.jpg | Bin 0 -> 6877 bytes
graphics/youtube_logo.jpg | Bin 0 -> 16791 bytes
index.php | 46 +
languages/en.php | 56 +
manifest.xml | 9 +
models/lib/class.vimeo.php | 3583 ++++++++++++++++++++
new.php | 47 +
start.php | 216 ++
views/default/forms/add.php | 176 +
views/default/forms/browsetube.php | 257 ++
views/default/forms/labels/googlevideos.php | 34 +
views/default/forms/labels/metacafe.php | 34 +
views/default/forms/labels/vimeo.php | 34 +
views/default/forms/labels/youtube.php | 34 +
views/default/object/videolist.php | 91 +
views/default/object/watch.php | 45 +
views/default/river/object/videolist/annotate.php | 13 +
views/default/river/object/videolist/create.php | 18 +
views/default/staticvideo/index.php | 62 +
views/default/videolist/css.php | 199 ++
views/default/videolist/groupprofile_videolist.php | 62 +
views/default/videolist/icon.php | 41 +
views/default/videolist/notfound.php | 21 +
views/default/videolist/videoprofile.php | 0
views/default/widgets/videolist_view/edit.php | 21 +
views/default/widgets/videolist_view/view.php | 58 +
views/rss/videolist/contentwrapper.php | 15 +
views/rss/videolist/videolist.php | 17 +
watch.php | 44 +
world.php | 38 +
43 files changed, 5979 insertions(+)
create mode 100644 actions/addvideo.php
create mode 100644 actions/comments_delete/add.php
create mode 100644 actions/delete.php
create mode 100644 actions/save.php
create mode 100644 actions/tubesearch.php
create mode 100644 browse.php
create mode 100644 graphics/Video_Icon.jpg
create mode 100644 graphics/badge3.gif
create mode 100644 graphics/logo_videos.png
create mode 100644 graphics/metacafe.jpg
create mode 100644 graphics/pic_youtubelogo_123x63.gif
create mode 100644 graphics/play.jpg
create mode 100644 graphics/vimeo_logo.gif
create mode 100644 graphics/youtube.jpg
create mode 100644 graphics/youtube_logo.jpg
create mode 100644 index.php
create mode 100644 languages/en.php
create mode 100644 manifest.xml
create mode 100644 models/lib/class.vimeo.php
create mode 100644 new.php
create mode 100644 start.php
create mode 100644 views/default/forms/add.php
create mode 100644 views/default/forms/browsetube.php
create mode 100644 views/default/forms/labels/googlevideos.php
create mode 100644 views/default/forms/labels/metacafe.php
create mode 100644 views/default/forms/labels/vimeo.php
create mode 100644 views/default/forms/labels/youtube.php
create mode 100644 views/default/object/videolist.php
create mode 100644 views/default/object/watch.php
create mode 100644 views/default/river/object/videolist/annotate.php
create mode 100644 views/default/river/object/videolist/create.php
create mode 100644 views/default/staticvideo/index.php
create mode 100644 views/default/videolist/css.php
create mode 100644 views/default/videolist/groupprofile_videolist.php
create mode 100644 views/default/videolist/icon.php
create mode 100644 views/default/videolist/notfound.php
create mode 100644 views/default/videolist/videoprofile.php
create mode 100644 views/default/widgets/videolist_view/edit.php
create mode 100644 views/default/widgets/videolist_view/view.php
create mode 100644 views/rss/videolist/contentwrapper.php
create mode 100644 views/rss/videolist/videolist.php
create mode 100644 watch.php
create mode 100644 world.php
diff --git a/actions/addvideo.php b/actions/addvideo.php
new file mode 100644
index 000000000..519f6ae04
--- /dev/null
+++ b/actions/addvideo.php
@@ -0,0 +1,216 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+
+// Get the current page's owner
+set_page_owner($_SESSION['container_guid']);
+
+$page_owner = page_owner_entity();
+
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
+
+if($page_owner->type == "group")
+ $entity_referer = $page_owner->type.":".$page_owner->getGUID();
+else
+ $entity_referer = $page_owner->username;
+
+require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
+
+function fetchyoutubeDatatitle($videoid){
+ $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
+ /**
+ ** generate XML View
+ **/
+ $xml_buffer = new SimpleXMLElement($buffer);
+ $vidDataTitle = $xml_buffer->video_details->title;
+ return $vidDataTitle;
+ //return "";
+}
+
+function fetchyoutubeDatadesc($videoid){
+ $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
+ /**
+ ** generate XML View
+ **/
+ $xml_buffer = new SimpleXMLElement($buffer);
+ $vidDataDesc = $xml_buffer->video_details->description;
+ return $vidDataDesc;
+ //return "";
+}
+
+function getVimeoInfoDataTitle($iGetVideoId){
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ $title = $aoVideos->getTitle();
+ return $title;
+}
+
+function getVimeoInfoDataDesc($iGetVideoId){
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ $description = $aoVideos->getCaption();
+ return $description;
+}
+
+function getVimeoInfoImage($iGetVideoId){
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ //get all thumbnails
+
+ $aThumbnails = array();
+ foreach($aoVideos->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
+ }
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+
+ return $thumbnail;
+}
+
+function fetchyoutubeDatathumbnail($videoId){
+ $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";
+ return $thumbnail;
+}
+
+function metacafeFetchData($getVideoId){
+ $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $myitem = $sxml->getElementsByTagName('item');
+ return $myitem;
+}
+
+function fetchmetacafeTitle($getVideoId){
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+ }
+ return $valueTitle;
+}
+
+function fetchmetacafeDesc($getVideoId){
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+ }
+ return $desc_src;
+}
+
+function fetchmetacafeImg($getVideoId){
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+ $pattern = '/ ]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+ }
+ return $thumbnail;
+}
+
+ $pageContainer = $_SESSION['Pagecontainer'];
+
+
+ // Initialise a new ElggObject
+ $videolist = new ElggObject();
+ // Tell the system it's a blog post
+ $videolist->subtype = "videolist";
+ // Set its owner to the current user
+ $videolist->owner_guid = $_SESSION['user']->getGUID();
+
+ // Set container of the video whether it was uploaded to groups or profile
+ $videolist->container_guid = $_SESSION['container_guid'];
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $videolist->access_id = $_SESSION['candidate_profile_video_access_id'];
+
+ // In order to Set its title and description appropriately WE need the video ID
+ $videolist->url = $_SESSION['candidate_profile_video'];
+
+ if($pageContainer == "youtube"){
+ $videoIDArray = split("/v/", $videolist->url);
+ $videolist->video_id = $videoIDArray[1];
+ // Now set the video title and description appropriately
+ $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);
+ $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);
+ $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);
+ $videolist->videotype = "youtube";
+ }
+ else if($pageContainer == "metacafe"){
+ $videolist->video_id = $_SESSION['candidate_profile_video'];
+ // Now set the video title and description appropriately
+ $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);
+ $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);
+ $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);
+ $videolist->videotype = "metacafe";
+ }
+ else if($pageContainer == "vimeo"){
+ $videolist->video_id = $_SESSION['candidate_profile_video'];
+
+ // Now set the video title and description appropriately
+ $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);
+ $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);
+ $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);
+ $videolist->videotype = "vimeo";
+ }
+
+ // Before we can set metadata, we need to save the blog post
+ if (!$videolist->save()) {
+ register_error(elgg_echo("videolist:error"));
+ forward("pg/videolist/new");
+ }
+ //add video tags
+ $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);
+ if (is_array($videolist_tags_array)) {
+ $videolist->tags = $videolist_tags_array;
+ }
+
+ // add to river
+ add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);
+
+ // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
+ // Success message
+ system_message(elgg_echo("videolist:posted"));
+ // Remove the videolist cache
+ unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
+ unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);
+ // Forward to the main videolist page
+
+forward("pg/videolist/owned/".page_owner_entity()->username);
+
+// Remove the videolist cache
+ unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
+ unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);
+
+?>
diff --git a/actions/comments_delete/add.php b/actions/comments_delete/add.php
new file mode 100644
index 000000000..a2d672fe9
--- /dev/null
+++ b/actions/comments_delete/add.php
@@ -0,0 +1,58 @@
+
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in; forward to the front page if not
+ gatekeeper();
+ action_gatekeeper();
+
+ // Get input
+ $entity_guid = (int) get_input('entity_guid');
+ $comment_text = get_input('generic_comment');
+
+ // Let's see if we can get an entity with the specified GUID
+ if ($entity = get_entity($entity_guid)) {
+
+ // If posting the comment was successful, say so
+ if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
+
+ if ($entity->owner_guid != $_SESSION['user']->getGUID())
+ notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
+ sprintf(
+ elgg_echo('generic_comment:email:body'),
+ $entity->title,
+ $_SESSION['user']->name,
+ $comment_text,
+ $entity->getURL(),
+ $_SESSION['user']->name,
+ $_SESSION['user']->getURL()
+ )
+ );
+
+ system_message(elgg_echo("generic_comment:posted"));
+ //add to river
+ add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
+
+
+ } else {
+ register_error(elgg_echo("generic_comment:failure"));
+ }
+
+ } else {
+
+ register_error(elgg_echo("generic_comment:notfound"));
+
+ }
+
+ // Forward to the
+ forward($_SERVER['HTTP_REFERER']);
+
+?>
diff --git a/actions/delete.php b/actions/delete.php
new file mode 100644
index 000000000..da3ad0c3b
--- /dev/null
+++ b/actions/delete.php
@@ -0,0 +1,44 @@
+
+ * @copyright Prateek Choudhary
+ */
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ // Get input data
+ $guid = (int) get_input('video_id');
+
+ // Make sure we actually have permission to edit
+ $videos = get_entity($guid);
+ if ($videos->getSubtype() == "videolist" && $videos->canEdit()) {
+
+ // Get owning user
+ $owner = get_entity($videos->getOwner());
+ // Delete it!
+ $rowsaffected = $videos->delete();
+ if ($rowsaffected > 0) {
+ // Success message
+ system_message(elgg_echo("videos:deleted"));
+ } else {
+ register_error(elgg_echo("videos:notdeleted"));
+ }
+ // Forward to the main video list page
+ //forward("pg/videolist/owned/" . page_owner_entity()->username);
+ forward($_SERVER['HTTP_REFERER']);
+
+ }
+
+?>
diff --git a/actions/save.php b/actions/save.php
new file mode 100644
index 000000000..61f3eb401
--- /dev/null
+++ b/actions/save.php
@@ -0,0 +1,16 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+
+
+
+?>
diff --git a/actions/tubesearch.php b/actions/tubesearch.php
new file mode 100644
index 000000000..d1a83722c
--- /dev/null
+++ b/actions/tubesearch.php
@@ -0,0 +1,330 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+// Get the current page's owner
+//set_page_owner($_SESSION['container_guid']);
+
+$page_ownerx = get_entity(get_input('container'));
+if(!$page_ownerx)
+ $page_ownerx = get_user_by_username(get_input('container'));
+set_page_owner($page_ownerx->getGUID());
+$page_owner = page_owner_entity();
+
+if($page_owner->type == "group")
+ $container = "group:".$page_ownerx->getGUID();
+else
+ $container = $page_ownerx->username;
+
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
+
+global $CONFIG;
+ $queryFeed = get_input('q');
+ $start_index = get_input('start_index');
+ $results_perpage = 10;
+ $queryCatgory = get_input('page');
+if (!isset($queryFeed) || empty($queryFeed)) {
+
+}
+else
+{
+ $q = $queryFeed;
+ if($queryCatgory == "youtube")
+ {
+ $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
+ $sxml = simplexml_load_file($feedURL);
+
+ $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
+ $total = $counts->totalResults;
+ $startOffset = $counts->startIndex;
+ $endOffset = ($startOffset-1) + $counts->itemsPerPage;
+
+ $body = '';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $body .= '';
+ $k = 0;$counter = 0;
+ foreach ($sxml->entry as $entry) {
+ $k++;
+ $media = $entry->children('http://search.yahoo.com/mrss/');
+ $attrs = $media->group->player->attributes();
+ $watch = $attrs['url'];
+ $vid_array = explode("?v=", $watch);
+ if(preg_match("/&/", $vid_array[1])){
+ $vid_array = explode("&", $vid_array[1]);
+ $vid_array[1] = $vid_array[0];
+ }
+
+ $attrs = $media->group->thumbnail[0]->attributes();
+ $thumbnail = $attrs['url'];
+ $yt = $media->children('http://gdata.youtube.com/schemas/2007');
+ $attrs = $yt->duration->attributes();
+ $length = $attrs['seconds'];
+ $gd = $entry->children('http://schemas.google.com/g/2005');
+ if ($gd->rating) {
+ $attrs = $gd->rating->attributes();
+ $rating = $attrs['average'];
+ } else {
+ $rating = 0;
+ }
+ $tags = array();
+ $tags[] = $media->group->keywords;
+ $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
+ $body .= '
';
+ }
+ $body .= '
';
+ print $body;
+ }
+ else if($queryCatgory == "metacafe")
+ {
+
+
+ $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
+
+
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $total = 999;
+ $startOffset = $start_index;
+ $endOffset = ($startOffset-1) + $results_perpage;
+
+ $body = '';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $k = 0;
+ $body .= '';
+ $myitem = $sxml->getElementsByTagName('item');
+ foreach($myitem as $searchNode){
+ $k++;
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+
+ $xmlLink = $searchNode->getElementsByTagName("link");
+ $valueLink = $xmlLink->item(0)->nodeValue;
+
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+
+ $pattern = '/
]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+
+ $pattern = '/
]+href[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $anchor_src = $match[1];
+ }
+
+ $encodedVideoUrlArray = explode("/watch/", $valueLink);
+ $showEncodedVideo = $encodedVideoUrlArray[1];
+ $metacafevideoIdArray = explode("/", $showEncodedVideo);
+
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+
+ $body .= '';
+ $body .= '
';
+ $body .= '
';
+ }
+ $body .= ' ';
+ print $body;
+ }
+ else if($queryCatgory == "vimeo")
+ {
+ require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::search($queryFeed);
+
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideos();
+
+ // Just for code completion
+ $oVideo = new VimeoVideoEntity();
+
+ $total = count($aoVideos);
+ $startOffset = $start_index;
+
+ $endOffset = ($startOffset-1) + $results_perpage;
+ $body = '';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $body .= '';
+ $counter = 0;$k = 0;
+ foreach($aoVideos as $oVideo) {
+ $k++;
+ if(($counter > $startOffset) && ($counter < $endOffset))
+ {
+ //get all thumbnails
+ $aThumbnails = array();
+ foreach($oVideo->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
+ }
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+ //print_r($oVideo);
+ $title = $oVideo->getTitle();
+ $description = $oVideo->getCaption();
+ $url = $oVideo->getUrl();
+ $rating = $oVideo->getNumberOfLikes();
+ $playedTimes = $oVideo->getNumberOfPlays();
+ // Print all tags
+ $aTags = array();
+ foreach($oVideo->getTags() as $oTag) {
+ $aTags[] = $oTag->getTag();
+ }
+ $play_idArray = explode("http://vimeo.com/", $url);
+ $embedidArray = explode("/", $play_idArray[1]);
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+ }
+ $counter++;
+ }
+ $body .= '
';
+ print $body;
+ }
+}
+exit;
+?>
diff --git a/browse.php b/browse.php
new file mode 100644
index 000000000..064ce9574
--- /dev/null
+++ b/browse.php
@@ -0,0 +1,44 @@
+
+ * @copyright Prateek Choudhary
+ */
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ //get videolist GUID
+ $container_guid = get_input('container');
+ $parent_container = "";
+ if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if($container_guid[0] == "group"){
+ $container = get_entity($container_guid[1]);
+ set_page_owner($container->getGUID());
+ $page_owner = page_owner_entity();
+ set_context("groupsvideos");
+ }
+ else{
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+ }
+ }
+ // Get the current page's owner
+
+
+ $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name);
+
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view("forms/browsetube");
+
+ $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
+
+ page_draw($title, $body);
+?>
diff --git a/graphics/Video_Icon.jpg b/graphics/Video_Icon.jpg
new file mode 100644
index 000000000..6a22c3e88
Binary files /dev/null and b/graphics/Video_Icon.jpg differ
diff --git a/graphics/badge3.gif b/graphics/badge3.gif
new file mode 100644
index 000000000..6dc0c1007
Binary files /dev/null and b/graphics/badge3.gif differ
diff --git a/graphics/logo_videos.png b/graphics/logo_videos.png
new file mode 100644
index 000000000..3a626d314
Binary files /dev/null and b/graphics/logo_videos.png differ
diff --git a/graphics/metacafe.jpg b/graphics/metacafe.jpg
new file mode 100644
index 000000000..a74ab75f9
Binary files /dev/null and b/graphics/metacafe.jpg differ
diff --git a/graphics/pic_youtubelogo_123x63.gif b/graphics/pic_youtubelogo_123x63.gif
new file mode 100644
index 000000000..f66c93730
Binary files /dev/null and b/graphics/pic_youtubelogo_123x63.gif differ
diff --git a/graphics/play.jpg b/graphics/play.jpg
new file mode 100644
index 000000000..1e701c853
Binary files /dev/null and b/graphics/play.jpg differ
diff --git a/graphics/vimeo_logo.gif b/graphics/vimeo_logo.gif
new file mode 100644
index 000000000..2c3c65b5c
Binary files /dev/null and b/graphics/vimeo_logo.gif differ
diff --git a/graphics/youtube.jpg b/graphics/youtube.jpg
new file mode 100644
index 000000000..19a0d1673
Binary files /dev/null and b/graphics/youtube.jpg differ
diff --git a/graphics/youtube_logo.jpg b/graphics/youtube_logo.jpg
new file mode 100644
index 000000000..59d8e0d36
Binary files /dev/null and b/graphics/youtube_logo.jpg differ
diff --git a/index.php b/index.php
new file mode 100644
index 000000000..95026ec24
--- /dev/null
+++ b/index.php
@@ -0,0 +1,46 @@
+
+ * @copyright Prateek Choudhary
+ */
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $owner = page_owner_entity();
+
+ //get videolist GUID
+ $container_guid = get_input('username');
+ if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if($container_guid[0] == "group"){
+ $container = get_entity($container_guid[1]);
+ set_context("groupsvideos");
+ //$page_owner = page_owner_entity();
+ }
+ else{
+
+ }
+ }
+ //set page owner
+ //set_page_owner($videolist_guid);
+
+ $title = sprintf(elgg_echo("videolist:home"), "$owner->name");
+
+ // Get objects
+ $area2 = elgg_view_title($title);
+ //set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities("object","videolist", page_owner(), 10);
+
+ //$area2 .= elgg_view("staticvideo/index");
+
+ set_context('videolist');
+ $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
+?>
diff --git a/languages/en.php b/languages/en.php
new file mode 100644
index 000000000..d0c5555b0
--- /dev/null
+++ b/languages/en.php
@@ -0,0 +1,56 @@
+
+ * @copyright Prateek Choudhary
+ */
+ $english = array(
+ "videolist" => "My Videos",
+
+ "videolist:home" => '%s \'s Videos',
+ "videolist:new" => 'Add a Video',
+ "videolist:find" => 'All Site videos',
+ "videolist:search" => "All Site videos",
+ "videolist:title_videourl" => 'Enter Video Url',
+ "videolist:submit" => 'Submit',
+ "videolist:videoTitle" => "Title",
+ "videolist:error" => 'There was an error in saving the video, please try after sometime',
+ "videolist:posted" => 'Your video has been saved successfully!',
+ "video:more" => "View all videos",
+ "video:none" => "sorry, no videos were found",
+ "candidateprofile:candidatevideo" => "My videos",
+ "videos:deleted" => "Your Video was removed successfully!",
+ "videos:notdeleted" => "Unfortunately, this video could not be removed now. Please try again later",
+ "videolist:widget" => "Videos",
+ "videolist:widget:description" => "Your personal video playlist",
+ "videolist:num_videos" => "Number of videos to display",
+ 'videolist:widget' => "My Videos",
+ "videolist:widget:description" => "Showcase your personal video gallery from youtube",
+ "profile:videoheader" => "My Video Gallery",
+ "videolist:title_access" => "Access",
+ "item:object:videolist" => "Videos",
+ "videolist:tags" => "Add Tags",
+ "videolist:browse" => "Find Videos - %s",
+ "videolist:browsemenu" => "Find Videos",
+ "videolist:title_search_tube" => "Search Videos From",
+ "videolist:searchTubeVideos" => "Search youtube.com",
+ "videolist:comments" => "Comments",
+ "videolist:commentspost" => "Post",
+ "videolist:river:annotate" => "%s commented on",
+ "videolist:river:item" => "a video",
+ "videolist:river:created" => "%s added",
+ "videolist:searchTubeVideos:metacafe" => "Search metacafe.com",
+ "videolist:searchTubeVideos:vimeo" => "Search vimeo.com",
+ "videolist:searchTubeVideos:googlevideos" => "Search video.google.com",
+ "videolist:group" => "Group Videos",
+ "videolist:groupall" => "All Group Videos",
+ "videolist:none" => "This group does not have any videos yet",
+ );
+
+ add_translation("en",$english);
+
+?>
diff --git a/manifest.xml b/manifest.xml
new file mode 100644
index 000000000..0c2db8e00
--- /dev/null
+++ b/manifest.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/models/lib/class.vimeo.php b/models/lib/class.vimeo.php
new file mode 100644
index 000000000..03508d148
--- /dev/null
+++ b/models/lib/class.vimeo.php
@@ -0,0 +1,3583 @@
+
+* @link http://code.google.com/p/php5-simplevimeo/
+*/
+
+/**
+* Enable debug to output raw request and response information
+*/
+
+define('VIMEO_DEBUG_REQUEST', true);
+define('VIMEO_DEBUG_RESPONSE', true);
+
+/**
+* Vimeo base class
+*
+* Provides vital functions to API (access, permission and object handling)
+*
+* @package SimpleVimeo
+* @subpackage Base
+*/
+
+class VimeoBase {
+
+ const PROJECT_NAME = 'php5-simplevimeo';
+
+ /**
+ * Currently logged in user object
+ * @var VimeoUserEntity
+ */
+ private static $oUser = false;
+
+ /**
+ * Currently logged in user permission
+ * @var string
+ */
+ private static $ePermission = false;
+
+ /**
+ * Currently logged in user token
+ * @var string
+ */
+ private static $sToken = false;
+
+ /**
+ * Vimeo Application API key
+ * @var string
+ */
+ private static $sApiKey = '7a223534b3c1d0979a954f93cb746173 ';
+
+ /**
+ * Vimeo Application API secret key
+ * @var string
+ */
+ private static $sApiSecret = 'b11e83370';
+
+ const VIMEO_REST_URL = 'http://vimeo.com/api/rest/';
+ const VIMEO_AUTH_URL = 'http://vimeo.com/services/auth/';
+ const VIMEO_UPLOAD_URL = 'http://vimeo.com/services/upload/';
+ const VIMEO_LOGIN_URL = 'http://vimeo.com/log_in';
+
+ /**
+ * You can choose between the following engines:
+ * executeRemoteCall_FSOCK = PHP5 file_get_content and stream_contexts (bad error handling)
+ * executeRemoteCall_CURL = CURL is used for file transfer (better error handling)
+ */
+ const REQUEST_ENGINE_CURL = 'executeRemoteCall_CURL';
+ const VIDEOPOST_ENGINE_FSOCK = 'executeVideopostCall_CURL';
+
+ const PERMISSION_NONE = false;
+ const PERMISSION_READ = 'read';
+ const PERMISSION_WRITE = 'write';
+ const PERMISSION_DELETE = 'delete';
+
+ const COOKIE_FILE = '/tmp/simplevimeo.cookies';
+
+ const DEBUG_ENABLE = false;
+ const DEBUG_LOGFILE = '/tmp/simplevimeo.debug';
+
+ /**
+ * Debug output function
+ */
+ public static function debug($sTitle, $sContent) {
+ if(self::DEBUG_ENABLE) {
+ $sMessage = 'DEBUG ' . date('Y-m-d H:i:s', time()) . "\n";
+ $sMessage .= 'CONTENT: ' . $sContent . "\n";
+ $sMesasge .= $sContent . "\n\n";
+
+ $fhLog = fopen(self::DEBUG_LOGFILE, 'a+');
+
+ if(!$fhLog) {
+ throw new VimeoBaseException('Debug Logfile "' . self::DEBUG_LOGFILE . '" could not be found or written');
+ } else {
+ fputs($fhLog, $sMessage);
+ fclose($fhLog);
+ }
+ }
+ }
+
+ /**
+ * Update Authentication
+ *
+ * Initializes user and permission information if a token is present.
+ * You can alter this method or skip it if you store user information
+ * and permission in an external database. Then i would recommend a
+ * VimeoAuthRequest::checkLoogin for confirmation.
+ *
+ * @access private
+ * @return void
+ */
+ private function updateAuthentication() {
+ if(self::$sToken && (!self::$ePermission || !self::$oUser)) {
+ $oResponse = VimeoAuthRequest::checkToken(self::$sToken);
+
+ // Parse user
+ self::$oUser = $oResponse->getUser();
+
+ // Parse permission
+ self::$ePermission = $oResponse->getPermission();
+ }
+ }
+
+ /**
+ * Check permission
+ *
+ * Checks the current user permission with the given one. This will be
+ * heavily used by the executeRemoteCall method to ensure the user
+ * will not run into trouble.
+ *
+ * @access public
+ * @param string Needed Permission
+ * @return boolean TRUE if access can be granted, FALSE if permission denied
+ */
+ public function checkPermission($ePermissionNeeded) {
+ // Update authentication data before permission check
+ self::updateAuthentication();
+
+ // Permission DELETE check
+ if($ePermissionNeeded == self::PERMISSION_DELETE && self::$ePermission == self::PERMISSION_DELETE) {
+ return true;
+ }
+
+ // Permission WRITE check
+ if($ePermissionNeeded == self::PERMISSION_WRITE && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE)) {
+ return true;
+ }
+
+ // Permission READ check
+ if($ePermissionNeeded == self::PERMISSION_READ && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE || self::$ePermission == self::PERMISSION_READ)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Proxy for API queries
+ *
+ * Will check permission for the requested API method as well as type
+ * of the object result response or exception. Will call the given
+ * API query handler method (default: executeRemoteCall_CURL) for
+ * the raw connection stuff
+ *
+ * @access public
+ * @param string API method name
+ * @param array Additional arguments that need to be passed to the API
+ * @return VimeoResponse Response object of API corresponding query (for vimeo.test.login you will get VimeoTestLoginResponse object)
+ */
+ public function executeRemoteCall($sMethod, $aArgs = array()) {
+ // Get exception handler
+ $sExceptionClass = VimeoMethod::getExceptionObjectForMethod($sMethod);
+
+ // Check for errors in parameters
+ $sTargetClass = VimeoMethod::getTargetObjectForMethod($sMethod);
+
+ // Get the permission needed to run this method
+ $ePermissionNeeded = VimeoMethod::getPermissionRequirementForMethod($sMethod);
+
+ // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
+ if($ePermissionNeeded != VimeoBase::PERMISSION_NONE && !self::checkPermission($ePermissionNeeded)) {
+ throw new $sExceptionClass('Permission error: "' . VimeoMethod::getPermissionRequirementForMethod($sMethod) . '" needed, "' . self::$ePermission . '" given');
+ }
+
+ // Append method to request arguments
+ $aArgs['method'] = $sMethod;
+
+ // Check that the API query handler method exists and can be called
+ if(!method_exists(__CLASS__, self::REQUEST_ENGINE_CURL)) {
+ throw new VimeoBaseException('Internal error: Request engine handler method not found', 2);
+ }
+
+ // Build up the needed API arguments
+
+ // Set API key
+ $aArgs['api_key'] = self::$sApiKey;
+
+ // Set request format
+ $aArgs['format'] = 'php';
+
+ // Set token
+ if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
+
+ // Generate signature
+ $aArgs['api_sig'] = self::buildSignature($aArgs);
+
+ // Do the request
+ $aResponse = call_user_func(array(__CLASS__, self::REQUEST_ENGINE_CURL), $aArgs);
+
+ // Debug request
+ if(defined('VIMEO_DEBUG_REQUEST') && VIMEO_DEBUG_REQUEST) {
+ self::debug('API request', print_r($aArgs, true));
+ }
+
+ // Debug response
+ if(defined('VIMEO_DEBUG_RESPONSE') && VIMEO_DEBUG_RESPONSE) {
+ self::debug('API response', print_r($aResponse, true));
+ }
+
+ // Transform the result into a result class
+ $oResult = new $sTargetClass($aResponse);
+
+ // Check if request was successfull
+ if(!$oResult->getStatus()) {
+ // If not, create an given exception class for the given method and pass through error code and message
+ throw new $sExceptionClass($oResult->getError()->getMessage(), $oResult->getError()->getCode());
+ }
+
+ // Return the base class object instance for the corresponding API query
+ return $oResult;
+ }
+
+ /**
+ * Execute raw API query with CURL
+ *
+ * Implements CURL API queries in php format response
+ *
+ * @author Ted Roden
+ * @access private
+ * @param array Additional arguments for the API query
+ * @return stdClass Simple PHP object enclosing the API result
+ */
+ private function executeRemoteCall_CURL($aArgs) {
+ $ch = curl_init(self::VIMEO_REST_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+
+ $data = curl_exec($ch);
+ if(curl_errno($ch))
+ throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
+ else {
+ curl_close($ch);
+
+ if(!$data || strlen(trim($data)) < 2) {
+ throw new VimeoRequestException('API request error: No result returned.', 1);
+ }
+ return unserialize($data);
+ }
+ }
+
+ /**
+ * Execute raw API query with FSOCK
+ *
+ * Implements FSOCK API queries in php format response
+ *
+ * @access private
+ * @param array Additional arguemnts for the API query
+ * @return stdClass Simple PHP object enclosing the API result
+ */
+ private function executeRemoteCall_FSOCK($aArgs) {
+ $sResponse = file_get_contents(self::VIMEO_REST_URL, NULL, stream_context_create(array('http' => array('method' => 'POST', 'header'=> 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($aArgs)))));
+ if(!$sResponse || strlen(trim($sResponse)) < 2) {
+ throw new VimeoRequestException('API request error: No result returned.', 1);
+ } else {
+ return unserialize($sResponse);
+ }
+ }
+
+ /**
+ * Proxy for video uploads
+ *
+ * Will call the given video upload handler method (default: executeVideopostCall_FSOCK)
+ * for the raw connection and send stuff
+ *
+ * @access public
+ * @param string Local filename to be transfered
+ * @param string Ticket
+ * @return string VimeoVideosCheckUploadStatusResponse
+ */
+ public function executeVideopostCall($sFilename, $sTicket = false) {
+ // Check that the upload query handler method exists and can be called
+ if(!method_exists(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK)) {
+ throw new VimeoUploadException('Upload error: Videopost engine handler method not found', 1);
+ }
+
+ // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
+ if(!self::checkPermission(VimeoBase::PERMISSION_WRITE)) {
+ throw new VimeoUploadException('Upload error: Missing "write" permission for current user', 2);
+ }
+
+ // Check that the file exists
+ if(!file_exists($sFilename)) {
+ throw new VimeoUploadException('Upload error: Local file does not exists', 3);
+ }
+
+ // Check that the file is readable
+ if(!is_readable($sFilename)) {
+ throw new VimeoUploadException('Upload error: Local file is not readable', 4);
+ }
+
+ // Check that the file size is not larger then the allowed size you can upload
+ $oResponse = VimeoPeopleRequest::getUploadStatus();
+ if(filesize($sFilename) > $oResponse->getRemainingBytes()) {
+ throw new VimeoUploadException('Upload error: Videosize exceeds remaining bytes', 5);
+ }
+
+ // Try to get a upload ticket
+ if(!$sTicket) {
+ $oResponse = VimeoVideosRequest::getUploadTicket();
+ $sTicket = $oResponse->getTicket();
+ }
+
+ // Build up the needed API arguments
+
+ // Set API key
+ $aArgs['api_key'] = self::$sApiKey;
+
+ // Set request format
+ $aArgs['format'] = 'php';
+
+ // Set token
+ if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
+
+ // Set ticket
+ $aArgs['ticket_id'] = $sTicket;
+
+ // Generate signature
+ $aArgs['api_sig'] = self::buildSignature($aArgs);
+
+ // Set file
+ $aArgs['file'] = "@$sFilename";
+
+ // Do the upload
+ $sResponse = call_user_func(array(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK), $aArgs);
+
+ // Call vimeo.videos.checkUploadStatus to prevent abandoned status
+ return VimeoVideosRequest::checkUploadStatus($sTicket);
+ }
+
+ private function executeVideopostCall_CURL($aArgs) {
+ // Disable time limit
+ set_time_limit(0);
+
+ $ch = curl_init(self::VIMEO_UPLOAD_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+
+ $data = curl_exec($ch);
+ if(curl_errno($ch))
+ throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
+ else {
+ curl_close($ch);
+ return unserialize($data);
+ }
+ }
+
+ /**
+ * Build API query signature
+ *
+ * Composes the signature needed to verify its really us doing the query
+ *
+ * @author Ted Roden
+ * @access private
+ * @param array Additional arguments for the API query
+ * @return string MD5 signature
+ */
+ private static function buildSignature($aArgs) {
+ $s = '';
+
+ // sort by name
+ ksort($aArgs);
+
+ foreach($aArgs as $k => $v)
+ $s .= $k . $v;
+
+ return(md5(self::$sApiSecret . $s));
+ }
+
+ /**
+ * Build authentication URL
+ *
+ * Easy way to build a correct authentication url. You can use this
+ * to link the user directly to the correct vimeo authentication page.
+ *
+ * @access public
+ * @param string Permission level you need the user to give you (i.e. VimeoBase::PERMISSION_READ)
+ * @return string URL you can use to directly link the user to the vimeo authentication page
+ */
+ public static function buildAuthenticationUrl($ePermission) {
+
+ $aArgs = array(
+ 'api_key' => self::$sApiKey,
+ 'perms' => $ePermission
+ );
+
+ return self::VIMEO_AUTH_URL . '?api_key=' . self::$sApiKey . '&perms=' . $ePermission . '&api_sig=' . self::buildSignature($aArgs);
+ }
+
+ /**
+ * Get current logged in user token
+ *
+ * @access public
+ * @return string Token or FALSE if not logged in
+ */
+ public static function getToken() {
+ return self::$sToken;
+ }
+
+ /**
+ * Set current logged in user token
+ *
+ * @access public
+ * @param string Authentication token
+ * @return void
+ */
+ public static function setToken($sToken) {
+ self::$sToken = $sToken;
+ }
+
+ /**
+ * Clear current logged in user token
+ *
+ * Removes the current logged in user from the cache. Next API query
+ * will be made as clean, not logged in, request.
+ *
+ * @access public
+ * @return void
+ */
+ public static function clearToken() {
+ self::$sToken = false;
+ }
+
+ /**
+ * Execute a permit request
+ *
+ * ONLY USED IN SITE-MODE, see howto.autologin.php
+ * Permits the current CURL cached user with your vimeo API application
+ *
+ * @access public
+ * @param string Permission
+ * @return string Vimeo Token
+ */
+ public function permit($ePermission) {
+ // Disable time limit
+ set_time_limit(0);
+
+ // Construct login data
+ $aArgs = array(
+ 'api_key' => VimeoBase::$sApiKey,
+ 'perms' => $ePermission,
+ 'accept' => 'yes'
+ );
+ $ch = curl_init(VimeoBase::buildAuthenticationUrl($ePermission));
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
+ curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
+
+ $sPageContent = curl_exec($ch);
+ if(curl_errno($ch)) {
+ throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
+ return false;
+ } else {
+ $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+
+ }
+ return $sPageContent;
+ }
+
+ /**
+ * Ensures that the user is logged in
+ *
+ * ONLY USED IN SITE-MODE, see howto.autologin.php
+ * Ensures the site-account is logged in
+ *
+ * @access public
+ * @param string Username
+ * @param string Password
+ * @return boolean TRUE if user could be logged in, FALSE if an error occured (try manually to see error)
+ */
+ public function login($sUsername, $sPassword) {
+ // Disable time limit
+ set_time_limit(0);
+
+ // Construct login data
+ $aArgs = array(
+ 'sign_in[email]' => $sUsername,
+ 'sign_in[password]' => $sPassword,
+ 'redirect' => ''
+ );
+
+ $ch = curl_init(VimeoBase::VIMEO_LOGIN_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
+ curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
+
+ $sPageContent = curl_exec($ch);
+
+ if(curl_errno($ch)) {
+ throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
+ return false;
+ } else {
+ $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+ curl_close($ch);
+ }
+
+ if(stristr($sResponseUrl, 'log_in') !== false) {
+ // Login failed
+ return false;
+ } else {
+ return true;
+ }
+ }
+}
+
+/**
+* Vimeo base exception class
+*
+* Every exception caused by VimeoBase class will be of this type
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoBaseException extends VimeoException {}
+
+/**
+* Vimeo request exception class
+*
+* Exception thrown when requesting the API failed
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoRequestException extends VimeoException {}
+
+/**
+* Vimeo upload exception class
+*
+* Exception thrown when uploading a video failed
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoUploadException extends VimeoException {}
+
+/**
+* Vimeo API method handler class
+*
+* This class will ensure that only functions can be called if the method is implemented
+* and the permission is right (p). It also states what the source (s), result (t) and
+* exception (e) object will be.
+*
+* @package SimpleVimeo
+* @subpackage Base
+*/
+
+class VimeoMethod {
+
+ private static $aMethods = array(
+ // Vimeo Test methods
+ 'vimeo.test.login' => array( 's' => 'VimeoTestRequest',
+ 't' => 'VimeoTestLoginResponse',
+ 'e' => 'VimeoTestLoginException',
+ 'p' => VimeoBase::PERMISSION_READ),
+
+ 'vimeo.test.echo' => array( 's' => 'VimeoTestRequest',
+ 't' => 'VimeoTestEchoResponse',
+ 'e' => 'VimeoTestEchoException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.test.null' => array( 's' => 'VimeoTestRequest',
+ 't' => 'VimeoTestNullResponse',
+ 'e' => 'VimeoTestNullException',
+ 'p' => VimeoBase::PERMISSION_READ),
+
+ // Vimeo Auth methods
+ 'vimeo.auth.getToken' => array( 's' => 'VimeoAuthRequest',
+ 't' => 'VimeoAuthGetTokenResponse',
+ 'e' => 'VimeoAuthGetTokenException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.auth.getFrob' => array( 's' => 'VimeoAuthRequest',
+ 't' => 'VimeoAuthGetFrobResponse',
+ 'e' => 'VimeoAuthGetFrobException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.auth.checkToken' => array( 's' => 'VimeoAuthRequest',
+ 't' => 'VimeoAuthCheckTokenResponse',
+ 'e' => 'VimeoAuthCheckTokenException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ // Vimeo Videos methods
+ 'vimeo.videos.getList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetListResponse',
+ 'e' => 'VimeoVideosGetListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getUploadedList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetUploadedListResponse',
+ 'e' => 'VimeoVideosGetUploadedListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getAppearsInList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetAppearsInListResponse',
+ 'e' => 'VimeoVideosGetAppearsInListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getSubscriptionsList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetSubscriptionsListResponse',
+ 'e' => 'VimeoVideosGetSubscriptionsListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getListByTag' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetListByTagResponse',
+ 'e' => 'VimeoVideosGetListByTagException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getLikeList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetLikeListResponse',
+ 'e' => 'VimeoVideosGetLikeListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getContactsList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetContactsListResponse',
+ 'e' => 'VimeoVideosGetContactsListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getContactsLikeList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetContactsLikeListResponse',
+ 'e' => 'VimeoVideosGetContactsLikeListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.search' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSearchResponse',
+ 'e' => 'VimeoVideosSearchException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getInfo' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetInfoResponse',
+ 'e' => 'VimeoVideosGetInfoException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getUploadTicket' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetUploadTicketResponse',
+ 'e' => 'VimeoVideosGetUploadTicketException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.checkUploadStatus' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosCheckUploadStatusResponse',
+ 'e' => 'VimeoVideosCheckUploadStatusException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.delete' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosDeleteResponse',
+ 'e' => 'VimeoVideosDeleteException',
+ 'p' => VimeoBase::PERMISSION_DELETE),
+
+ 'vimeo.videos.setTitle' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetTitleResponse',
+ 'e' => 'VimeoVideosSetTitleException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.setCaption' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetCaptionResponse',
+ 'e' => 'VimeoVideosSetCaptionException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.setFavorite' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetFavoriteResponse',
+ 'e' => 'VimeoVideosSetFavoriteException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.addTags' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosAddTagsResponse',
+ 'e' => 'VimeoVideosAddTagsException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.removeTag' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosRemoveTagResponse',
+ 'e' => 'VimeoVideosRemoveTagException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.clearTags' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosClearTagsResponse',
+ 'e' => 'VimeoVideosClearTagsException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.setPrivacy' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetPrivacyResponse',
+ 'e' => 'VimeoVideosSetPrivacyException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ // Vimeo People methods
+ 'vimeo.people.findByUserName' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleFindByUsernameResponse',
+ 'e' => 'VimeoPeopleFindByUsernameException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.findByEmail' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleFindByEmailResponse',
+ 'e' => 'VimeoPeopleFindByEmailException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.getInfo' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleGetInfoResponse',
+ 'e' => 'VimeoPeopleGetInfoException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.getPortraitUrl' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleGetPortraitUrlResponse',
+ 'e' => 'VimeoPeopleGetPortraitUrlException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.addContact' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleAddContactResponse',
+ 'e' => 'VimeoPeopleAddContactException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.people.removeContact' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleRemoveContactResponse',
+ 'e' => 'VimeoPeopleRemoveContactException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.people.getUploadStatus' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleGetUploadStatusResponse',
+ 'e' => 'VimeoPeopleGetUploadStatusException',
+ 'p' => VimeoBase::PERMISSION_READ),
+
+ 'vimeo.people.addSubscription' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleAddSubscriptionResponse',
+ 'e' => 'VimeoPeopleAddSubscriptionException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.people.removeSubscription' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleRemoveSubscriptionResponse',
+ 'e' => 'VimeoPeopleRemoveSubscriptionException',
+ 'p' => VimeoBase::PERMISSION_WRITE)
+ );
+
+ public static function getSourceObjectForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['s'];
+ }
+
+ public static function getTargetObjectForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['t'];
+ }
+
+ public static function getExceptionObjectForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['e'];
+ }
+
+ public static function getPermissionRequirementForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['p'];
+ }
+
+ public static function checkMethod($sMethod) {
+ // Check if the method can be handled
+ if(!isset(self::$aMethods[$sMethod])) {
+ throw new VimeoMethodException('Unhandled vimeo method "' . $sMethod . '" given', 2);
+ }
+ }
+}
+
+/**
+* Vimeo method exception class
+*
+* Every exception caused by VimeoMethod class will be of this type
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoMethodException extends Exception {}
+
+/*
+* Abstract class constructs that the whole api stuff will be based on
+*/
+
+/**
+* Vimeo exception class
+*
+* Every exception the whole SimpleVimeo throws will be extended of this base
+* class. You can extend this one to alter all exceptions.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+* @abstract
+*/
+
+abstract class VimeoException extends Exception {}
+
+/**
+* Vimeo array of object handler class
+*
+* This class is for array of object handling. i.e.: An array of video objects.
+* It ensures that you can work with foreach and count without getting into a hassle.
+*
+* @package SimpleVimeo
+* @subpackage Base
+* @abstract
+*/
+
+abstract class VimeoObjectList implements Iterator, Countable {
+ /**
+ * Array for instanced objects
+ * @var array
+ */
+ private $aInstances = array();
+
+ /**
+ * Integer how many results
+ * @var integer
+ */
+ private $iCount = 0;
+
+ /**
+ * Class name
+ * @var string
+ */
+ private $sClassName;
+
+ private $aIDs = array();
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct() {
+ // Parse class name
+ $this->sClassName = str_replace('List', '', get_class($this));
+ }
+
+ /**
+ * Add object to array
+ *
+ * @access public
+ * @param object Object to be added to array
+ * @param integer Array index to be used for the given object
+ * @return void
+ */
+ public function add($oObject, $iID = false) {
+ if($iID !== false) {
+ $this->aInstances[$iID] = $oObject;
+ } else {
+ $this->aInstances[] = $oObject;
+ }
+
+ $this->aIDs[] = $iID;
+
+ $this->iCount++;
+ }
+
+ /**
+ * Returns all array indexes for further parsing
+ *
+ * @access public
+ * @return array Array with object array indexes
+ */
+ public function getAllUniqueIDs() {
+ return $this->getIDs();
+ }
+
+ /**
+ * @ignore
+ */
+ public function rewind() {
+ reset($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function current() {
+ return current($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function key() {
+ return key($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function next() {
+ return next($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function valid() {
+ return $this->current() !== FALSE;
+ }
+
+ /**
+ * @ignore
+ */
+ public function count() {
+ return $this->iCount;
+ }
+}
+
+/**
+* Vimeo request class
+*
+* Every API query collection class will be based on this.
+*
+* @package SimpleVimeo
+* @subpackage ApiRequest
+* @abstract
+*/
+
+abstract class VimeoRequest {}
+
+/**
+* Vimeo response class
+*
+* Every API response class will be based on this. It also handles
+* everytime response variables like if the query was successfull and
+* the generation time.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+* @abstract
+*/
+
+abstract class VimeoResponse {
+ private $bStatus = false;
+ private $fPerformance = false;
+ private $iErrorCode = false;
+ private $oError = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ * You dont need to pass a response if you need to give a hint your coding tool for code completion
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ if($aResponse) {
+ // Parse status
+ $this->setStatus($aResponse->stat);
+
+ // Parse performance
+ $this->fPerformance = (float) $aResponse->generated_in;
+
+ // Parse error information
+ if(!$this->bStatus) {
+ $this->oError = new VimeoErrorEntity($aResponse->err->code, $aResponse->err->msg);
+ }
+ }
+ }
+
+ private function setStatus($sStatus) {
+ if($sStatus === 'ok') {
+ $this->bStatus = true;
+ }
+ }
+
+ public function getStatus() {
+ return $this->bStatus;
+ }
+
+ public function getPerformance() {
+ return $this->fPerformance;
+ }
+
+ public function getError() {
+ return $this->oError;
+ }
+}
+
+/*
+* Entity classes for default instances of users etc. they are always the same
+* and their array of object handlers
+*/
+
+/**
+* Vimeo API error entity class
+*
+* Implements API delivered error entities into an PHP 5 object with given result parameters.
+*
+* @package SimpleVimeo
+* @subpackage Entities
+*/
+
+class VimeoErrorEntity {
+ private $iErrorCode = false;
+ private $sErrorMessage = false;
+
+ public function __construct($iErrorCode, $sErrorMessage) {
+ $this->iErrorCode = $iErrorCode;
+ $this->sErrorMessage = $sErrorMessage;
+ }
+
+ public function getCode() {
+ return $this->iErrorCode;
+ }
+
+ public function getMessage() {
+ return $this->sErrorMessage;
+ }
+}
+
+/**
+* Vimeo API user entity class
+*
+* Implements API delivered user entities into an PHP 5 object with given result parameters.
+*
+* @package SimpleVimeo
+* @subpackage Entities
+*/
+
+class VimeoUserEntity {
+ private $iUserNsId = false;
+ private $iUserId = false;
+ private $sUsername = false;
+ private $sFullname = false;
+
+ // Optional information when vimeo.person.getInfo is called
+ private $sLocation = false;
+ private $sUrl = false;
+ private $iNumberOfContacts = false;
+ private $iNumberOfUploads = false;
+ private $iNumberOfLikes = false;
+ private $iNumberOfVideos = false;
+ private $iNumberOfVideosAppearsIn = false;
+ private $sProfileUrl = false;
+ private $sVideosUrl = false;
+
+ public function __construct($aResponseSnippet) {
+ if(isset($aResponseSnippet->id)) {
+ $this->iUserId = $aResponseSnippet->id;
+ }
+
+ if(isset($aResponseSnippet->nsid)) {
+ $this->iUserNsId = $aResponseSnippet->nsid;
+ }
+
+ if(isset($aResponseSnippet->username)) {
+ $this->sUsername = $aResponseSnippet->username;
+ }
+
+ if(isset($aResponseSnippet->fullname)) {
+ $this->sFullname = $aResponseSnippet->fullname;
+ }
+
+ if(isset($aResponseSnippet->display_name)) {
+ $this->sFullname = $aResponseSnippet->display_name;
+ }
+
+ // Optional stuff
+ if(isset($aResponseSnippet->location)) {
+ $this->sLocation = $aResponseSnippet->location;
+ }
+
+ if(isset($aResponseSnippet->url)) {
+ $this->sUrl = $aResponseSnippet->url;
+ }
+
+ if(isset($aResponseSnippet->number_of_contacts)) {
+ $this->iNumberOfContacts = $aResponseSnippet->number_of_contacts;
+ }
+
+ if(isset($aResponseSnippet->number_of_uploads)) {
+ $this->iNumberOfUploads = $aResponseSnippet->number_of_uploads;
+ }
+
+ if(isset($aResponseSnippet->number_of_likes)) {
+ $this->iNumberOfLikes = $aResponseSnippet->number_of_likes;
+ }
+
+ if(isset($aResponseSnippet->number_of_videos)) {
+ $this->iNumberOfVideos = $aResponseSnippet->number_of_videos;
+ }
+
+ if(isset($aResponseSnippet->number_of_videos_appears_in)) {
+ $this->iNumberOfVideosAppearsIn = $aResponseSnippet->number_of_videos_appears_in;
+ }
+
+ if(isset($aResponseSnippet->profileurl)) {
+ $this->sProfileUrl = $aResponseSnippet->profileurl;
+ }
+
+ if(isset($aResponseSnippet->videosurl)) {
+ $this->sVideosUrl = $aResponseSnippet->videosurl;
+ }
+ }
+
+ public function getNsID() {
+ return $this->iUserNsId;
+ }
+
+ public function getID() {
+ return $this->iUserId;
+ }
+
+ public function getUsername() {
+ return $this->sUsername;
+ }
+
+ public function getFullname() {
+ return $this->sFullname;
+ }
+
+ public function getLocation() {
+ return $this->sLocation;
+ }
+
+ public function getUrl() {
+ return $this->sUrl;
+ }
+
+ public function getNumberOfContacts() {
+ return $this->iNumberOfContacts;
+ }
+
+ public function getNumberOfUploads() {
+ return $this->iNumberOfUploads;
+ }
+
+ public function getNumberOfLikes() {
+ return $this->iNumberOfLikes;
+ }
+
+ public function getNumberOfVideos() {
+ return $this->iNumberOfVideos;
+ }
+
+ public function getNumberOfVideosAppearsIn() {
+ return $this->iNumberOfVideosAppearsIn;
+ }
+
+ public function getProfileUrl() {
+ return $this->sProfileUrl;
+ }
+
+ public function getVideosUrl() {
+ return $this->sVideosUrl;
+ }
+}
+
+/**
+* Vimeo API video entity class
+*
+* Implements API delivered video into an PHP 5 object with given result parameters.
+*
+* @package SimpleVimeo
+* @subpackage Entities
+*/
+
+class VimeoVideoEntity {
+ private $iID = false;
+ private $ePrivacy = false;
+ private $bIsUploading = false;
+ private $bIsTranscoding = false;
+ private $bIsHD = false;
+
+ private $sTitle = false;
+ private $sCaption = false;
+ private $iUploadTime = false;
+ private $iNumberOfLikes = false;
+ private $iNumberOfPlays = false;
+ private $iNumberOfComments = false;
+
+ private $sUrl = false;
+
+ private $iWidth = false;
+ private $iHeight = false;
+ private $oOwner = false;
+
+ private $oTagList = false;
+
+ private $oThumbnailList = false;
+
+ public function __construct($aResponseSnippet = false) {
+ if($aResponseSnippet) {
+ // Set basic information
+ $this->iID = $aResponseSnippet->id;
+ $this->ePrivacy = $aResponseSnippet->privacy;
+ $this->bIsUploading = $aResponseSnippet->is_uploading;
+ $this->bIsTranscoding = $aResponseSnippet->is_transcoding;
+ $this->bIsHD = $aResponseSnippet->is_hd;
+
+ $this->sTitle = $aResponseSnippet->title;
+ $this->sCaption = $aResponseSnippet->caption;
+ $this->iUploadTime = strtotime($aResponseSnippet->upload_date);
+ $this->iNumberOfLikes = (int) $aResponseSnippet->number_of_likes;
+ $this->iNumberOfPlays = (int) $aResponseSnippet->number_of_plays;
+ $this->iNumberOfComments = (int) $aResponseSnippet->number_of_comments;
+
+ $this->sUrl = $aResponseSnippet->urls->url->_content;
+
+ $this->iWidth = (int) $aResponseSnippet->width;
+ $this->iHeight = (int) $aResponseSnippet->height;
+
+ $this->oOwner = new VimeoUserEntity($aResponseSnippet->owner);
+
+ // Parse Tags
+ $this->oTagList = new VimeoTagList();
+ if(isset($aResponseSnippet->tags->tag)) {
+ foreach($aResponseSnippet->tags->tag as $aTagInformation) {
+ $oTag = new VimeoTagEntity($aTagInformation);
+ $this->oTagList->add($oTag, $oTag->getID());
+ }
+ }
+
+ // Parse Thumbnails
+ $this->oThumbnailList = new VimeoThumbnailList();
+ if(isset($aResponseSnippet->thumbnails->thumbnail)) {
+ foreach($aResponseSnippet->thumbnails->thumbnail as $aThumbnailInformation) {
+ $oThumbnail = new VimeoThumbnailEntity($aThumbnailInformation);
+ $this->oThumbnailList->add($oThumbnail, ($oThumbnail->getWidth() * $oThumbnail->getHeight()));
+ }
+ }
+ }
+ }
+
+ public function getID() {
+ return $this->iID;
+ }
+
+ public function getPrivacy() {
+ return $this->ePrivacy;
+ }
+
+ public function isUploading() {
+ return $this->bIsUploading;
+ }
+
+ public function isTranscoding() {
+ return $this->bIsTranscoding;
+ }
+
+ public function isHD() {
+ return $this->bIsHD;
+ }
+
+ public function getTitle() {
+ return $this->sTitle;
+ }
+
+ public function getCaption() {
+ return $this->sCaption;
+ }
+
+ public function getUploadTimestamp() {
+ return $this->iUploadTime;
+ }
+
+ public function getNumberOfLikes() {
+ return (int) $this->iNumberOfLikes;
+ }
+
+ public function getNumberOfPlays() {
+ return (int) $this->iNumberOfPlays;
+ }
+
+ public function getNumberOfComments() {
+ return (int) $this->iNumberOfComments;
+ }
+
+ public function getWidth() {
+ return (int) $this->iWidth;
+ }
+
+ public function getHeight() {
+ return (int) $this->iHeight;
+ }
+
+ public function getOwner() {
+ return $this->oOwner;
+ }
+
+ public function getTags() {
+ return $this->oTagList;
+ }
+
+ public function getUrl() {
+ return $this->sUrl;
+ }
+
+ public function getThumbnails() {
+ return $this->oThumbnailList;
+ }
+}
+
+/**
+* Vimeo API video list class
+*
+* Implements API delivered video list entities into an PHP 5 array of objects.
+*
+* @package SimpleVimeo
+* @subpackage Lists
+*/
+
+class VimeoVideoList extends VimeoObjectList {}
+
+/**
+* Vimeo API tag entity class
+*
+* Implements API delivered tag entities into an PHP 5 object with given result parameters.
+*
+* @package SimpleVimeo
+* @subpackage Entities
+*/
+
+class VimeoTagEntity {
+ private $iID = false;
+ private $sContent = false;
+
+ public function __construct($aResponseSnippet = false) {
+ if($aResponseSnippet) {
+ $this->iID = $aResponseSnippet->id;
+ $this->sContent = $aResponseSnippet->_content;
+ }
+ }
+
+ public function getID() {
+ return $this->iID;
+ }
+
+ public function getTag() {
+ return $this->sContent;
+ }
+}
+
+/**
+* Vimeo API tag list class
+*
+* Implements API delivered tag list entities into an PHP 5 array of objects.
+*
+* @package SimpleVimeo
+* @subpackage Lists
+*/
+
+class VimeoTagList extends VimeoObjectList {}
+
+/**
+* Vimeo API thumbnail entity class
+*
+* Implements API delivered thumbnail entities into an PHP 5 object with given result parameters.
+*
+* @package SimpleVimeo
+* @subpackage Entities
+*/
+
+class VimeoThumbnailEntity {
+ private $iWidth = false;
+ private $iHeight = false;
+ private $sContent = false;
+
+ public function __construct($aResponseSnippet = false) {
+ if($aResponseSnippet) {
+ $this->iWidth = (int) $aResponseSnippet->width;
+ $this->iHeight = (int) $aResponseSnippet->height;
+ $this->sContent = $aResponseSnippet->_content;
+ }
+ }
+
+ public function getWidth() {
+ return (int) $this->iWidth;
+ }
+
+ public function getHeight() {
+ return (int) $this->iHeight;
+ }
+
+ public function getImageContent() {
+ return $this->sContent;
+ }
+}
+
+/**
+* Vimeo API thumbnail list class
+*
+* Implements API delivered thumbnail list entities into an PHP 5 array of objects.
+*
+* @package SimpleVimeo
+* @subpackage Lists
+*/
+
+class VimeoThumbnailList extends VimeoObjectList {
+ public function getByWidth($iWidth, $bAlsoLower = false) {
+ /**
+ * @todo
+ */
+ }
+
+ public function getByHeight($iHeight, $bAlsoLower = false) {
+ /**
+ * @todo
+ */
+ }
+
+ public function getByWidthAndHeight($iWidth, $iHeight, $bAlsoLower = false) {
+ /**
+ * @todo
+ */
+ }
+}
+
+
+/*
+* vimeo.test.* methods
+*/
+
+/**
+* Vimeo Test request handler class
+*
+* Implements all API queries in the vimeo.test.* category
+*
+* @package SimpleVimeo
+* @subpackage ApiRequest
+*/
+
+class VimeoTestRequest extends VimeoRequest {
+
+ /**
+ * Is the user logged in?
+ *
+ * @access public
+ * @return VimeoTestLoginResponse
+ */
+
+ public function login() {
+ return VimeoBase::executeRemoteCall('vimeo.test.login');
+ }
+
+ /**
+ * This will just repeat back any parameters that you send.
+ *
+ * @access public
+ * @param array Additional arguments that need to be passed to the API
+ * @return VimeoTestEchoResponse
+ */
+
+ public function echoback($aArgs) {
+ return VimeoBase::executeRemoteCall('vimeo.test.echo', $aArgs);
+ }
+
+ /**
+ * This is just a simple null/ping test...
+ *
+ * @access public
+ * @return VimeoTestNullResponse
+ */
+
+ public function ping() {
+ return VimeoBase::executeRemoteCall('vimeo.test.null');
+ }
+}
+
+/**
+* Vimeo Test Login response handler class
+*
+* Handles the API response for vimeo.test.login queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoTestLoginResponse extends VimeoResponse {}
+
+/**
+* Vimeo Test Login exception handler class
+*
+* Handles exceptions caused by API response for vimeo.test.login queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoTestLoginException extends VimeoException {}
+
+/**
+* Vimeo Test Echo response handler class
+*
+* Handles the API response for vimeo.test.echo queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoTestEchoResponse extends VimeoResponse {
+ private $aArgs = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->aArgs = get_object_vars($aResponse);
+
+ // Unset default response stuff
+ if(isset($this->aArgs['stat'])) unset($this->aArgs['stat']);
+ if(isset($this->aArgs['generated_in'])) unset($this->aArgs['generated_in']);
+ }
+
+ /**
+ * Returns an array of variables the request bounced back
+ *
+ * @access public
+ * @return array Echoed variables
+ */
+ public function getResponseArray() {
+ return $this->aArgs;
+ }
+}
+
+/**
+* Vimeo Test Echo exception handler class
+*
+* Handles exceptions caused by API response for vimeo.test.echo queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoTestEchoException extends VimeoException {}
+
+/**
+* Vimeo Test Null response handler class
+*
+* Handles the API response for vimeo.test.null queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoTestNullResponse extends VimeoResponse {}
+
+/**
+* Vimeo Test Null exception handler class
+*
+* Handles exceptions caused by API response for vimeo.test.null queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoTestNullException extends VimeoException {}
+
+/*
+* vimeo.auth.* methods
+*/
+
+/**
+* Vimeo Auth request handler class
+*
+* Implements all API queries in the vimeo.auth.* category
+*
+* @package SimpleVimeo
+* @subpackage ApiRequest
+*/
+
+class VimeoAuthRequest extends VimeoRequest {
+
+ /**
+ * Get Token
+ *
+ * @access public
+ * @param string Frob taken from the vimeo authentication
+ * @return VimeoAuthGetTokenResponse
+ */
+ public function getToken($sFrob) {
+ $aArgs = array(
+ 'frob' => $sFrob
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.auth.getToken', $aArgs);
+ }
+
+ /**
+ * Check Token
+ *
+ * Checks the validity of the token. Returns the user associated with it.
+ * Returns the same as vimeo.auth.getToken
+ *
+ * @access public
+ * @param string Authentication token
+ * @return VimeoAuthCheckTokenResponse
+ */
+ public function checkToken($sToken = false) {
+ if(!$sToken) $sToken = VimeoBase::getToken();
+
+ $aArgs = array(
+ 'auth_token' => $sToken
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.auth.checkToken', $aArgs);
+ }
+
+ /**
+ * Get Frob
+ *
+ * This is generally used by desktop applications. If the user doesn't already have
+ * a token, you'll need to get the frob, send it to us at /services/auth. Then,
+ * after the user, clicks continue on your app, you call vimeo.auth.getToken($frob)
+ * and we give you the actual token.
+ *
+ * @access public
+ * @return VimeoAuthGetFrobResponse
+ */
+ public function getFrob() {
+ return VimeoBase::executeRemoteCall('vimeo.auth.getFrob');
+ }
+}
+
+/**
+* Vimeo Auth GetToken response handler class
+*
+* Handles the API response for vimeo.auth.getToken queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoAuthGetTokenResponse extends VimeoResponse {
+
+ private $sToken = false;
+ private $ePermission = false;
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ $this->sToken = $aResponse->auth->token;
+ $this->ePermission = $aResponse->auth->perms;
+
+ $this->oUser = new VimeoUserEntity($aResponse->auth->user);
+ }
+
+ /**
+ * Get token value
+ *
+ * @access public
+ * @return token
+ */
+ public function getToken() {
+ return $this->sToken;
+ }
+
+ /**
+ * Get permission value
+ *
+ * @access public
+ * @return permission
+ */
+
+ public function getPermission() {
+ return $this->ePermission;
+ }
+
+ /**
+ * Get user information object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
+}
+
+/**
+* Vimeo Auth GetToken exception handler class
+*
+* Handles exceptions caused by API response for vimeo.auth.getToken queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoAuthGetTokenException extends Exception {}
+
+/**
+* Vimeo Auth CheckToken response handler class
+*
+* Handles the API response for vimeo.auth.checkToken queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoAuthCheckTokenResponse extends VimeoAuthGetTokenResponse {}
+
+/**
+* Vimeo Auth CheckToken exception handler class
+*
+* Handles exceptions caused by API response for vimeo.auth.checkToken queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoAuthCheckTokenException extends VimeoAuthGetTokenException {}
+
+/**
+* Vimeo Auth GetFrob response handler class
+*
+* Handles the API response for vimeo.auth.getFrob queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoAuthGetFrobResponse extends VimeoResponse {
+ private $sFrob = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ $this->sFrob = $aResponse->frob;
+ }
+
+ /**
+ * Get Frob value
+ *
+ * @access public
+ * @return frob
+ */
+ public function getFrob() {
+ return $this->sFrob;
+ }
+}
+
+/**
+* Vimeo Auth GetFrob exception handler class
+*
+* Handles exceptions caused by API response for vimeo.auth.getFrob queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoAuthGetFrobException extends VimeoException {}
+
+/**
+* vimeo.videos.* methods
+*/
+
+/**
+* Vimeo Videos request handler class
+*
+* Implements all API queries in the vimeo.videos.* category
+*
+* @package SimpleVimeo
+* @subpackage ApiRequest
+*/
+
+class VimeoVideosRequest extends VimeoRequest {
+
+ const PRIVACY_ANYBODY = 'anybody';
+ const PRIVACY_CONTACTS = 'contacts';
+ const PRIVACY_NOBODY = 'nobody';
+ const PRIVACY_USERS = 'users';
+
+ /**
+ * Search videos!
+ *
+ * If the calling user is logged in, this will return information that calling user
+ * has access to (including private videos). If the calling user is not authenticated,
+ * this will only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param string Search query
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param boolean If TRUE, we'll only search the users contacts. If this is set, you must specifiy a User ID. Otherwise it will be ignored without error.
+ * @param integer ow many results per page?
+ * @return VimeoVideosSearchResponse
+ */
+ public function search($sQuery, $iUserID = false, $bContactsOnly = false, $iItemsPerPage = false) {
+
+ // Pass query (required)
+ $aArgs = array(
+ 'query' => $sQuery
+ );
+
+ // Pass user
+ if($iUserID) {
+ $aArgs['user_id'] = $iUserID;
+ }
+
+ // Pass contacts
+ if($bContactsOnly) {
+ $aArgs['contacts_only'] = $bContactsOnly;
+ }
+
+ // Pass items
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.search', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos for the specified user.
+ *
+ * This is the functionality of "My Videos" or "Ted's Videos." At the moment, this is the same list
+ * as vimeo.videos.getAppearsInList. If you need uploaded or appears in, those are available too.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetListResponse
+ */
+ public function getList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getList', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos uploaded by the specified user.
+ *
+ * If the calling user is logged in, this will return information that calling user has access to
+ * (including private videos). If the calling user is not authenticated, this will only return
+ * public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetUploadedListResponse
+ */
+ public function getUploadedList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getUploadedList', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos that the specified user appears in.
+ *
+ * If the calling user is logged in, this will return information that calling user has access
+ * to (including private videos). If the calling user is not authenticated, this will only return
+ * public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetAppearsInListResponse
+ */
+ public function getAppearsInList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getAppearsInList', $aArgs);
+ }
+
+ /**
+ * This gets a list of subscribed videos for a particular user.
+ *
+ * If the calling user is logged in, this will return information that calling user
+ * has access to (including private videos). If the calling user is not authenticated,
+ * this will only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetSubscriptionsListResponse
+ */
+ public function getSubscriptionsList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getSubscriptionsList', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos by tag
+ *
+ * If you specify a user_id, we'll only get video uploaded by that user with the specified tag.
+ * If the calling user is logged in, this will return information that calling user has access
+ * to (including private videos). If the calling user is not authenticated, this will only
+ * return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param string A single tag: "cat" "new york" "cheese"
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetListByTagResponse
+ */
+ public function getListByTag($sTag, $iUserID = false, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'tag' => $sTag
+ );
+
+ if($iUserID) {
+ $aArgs['user_id'] = $iUserID;
+ }
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getListByTag', $aArgs);
+ }
+
+ /**
+ * Get a list of videos that the specified user likes.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetLikeListResponse
+ */
+ public function getLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getLikeList', $aArgs);
+ }
+
+ /**
+ * Get a list of videos made by the contacts of a specific user.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetContactsListResponse
+ */
+ public function getContactsList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getContactsList', $aArgs);
+ }
+
+ /**
+ * Get a list of videos that the specified users contacts like.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetContactsLikeListResponse
+ */
+ public function getContactsLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getContactsLikeList', $aArgs);
+ }
+
+ /**
+ * Get all kinds of information about a photo.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer Video ID
+ * @return VimeoVideosGetInfoResponse
+ */
+ public function getInfo($iVideoID) {
+ // Extend query
+ $aArgs = array(
+ 'video_id' => $iVideoID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getInfo', $aArgs);
+ }
+
+ /**
+ * Generate a new upload Ticket.
+ *
+ * You'll need to pass this to the uploader. It's only good for one upload, only good for one user.
+ *
+ * @access public
+ * @return VimeoVideosGetUploadTicketResponse
+ */
+ public function getUploadTicket() {
+ return VimeoBase::executeRemoteCall('vimeo.videos.getUploadTicket');
+ }
+
+ /**
+ * Check the status of an upload started via the API
+ *
+ * This is how you get the video_id of a clip uploaded from the API
+ * If you never call this to check in, we assume it was abandoned and don't process it
+ *
+ * @access public
+ * @param string The ticket number of the upload
+ * @return VimeoVideosCheckUploadStatusResponse
+ */
+ public function checkUploadStatus($sTicket) {
+ $aArgs = array(
+ 'ticket_id' => $sTicket
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.checkUploadStatus', $aArgs);
+ }
+
+ /**
+ * Simple video upload
+ *
+ * @access public
+ * @param string Absolute path to file
+ * @param string Existing ticket or false to generate a new one
+ * @return VimeoVideosCheckUploadStatusResponse
+ */
+ public function doUpload($sFilename, $sTicket = false) {
+ return VimeoBase::executeVideopostCall($sFilename, $sTicket);
+ }
+
+ /**
+ * Delete a video
+ *
+ * The authenticated user must own the video and have granted delete permission
+ *
+ * @access public
+ * @param integer Video ID
+ * @return VimeoVideosDeleteResponse
+ */
+ public function delete($iVideoID) {
+ $aArgs = array(
+ 'video_id' => $iVideoID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.delete', $aArgs);
+ }
+
+ /**
+ * Set the title of a video (overwrites previous title)
+ *
+ * @access public
+ * @param integer Video ID
+ * @param string Title
+ * @return VimeoVideosSetTitleResponse
+ */
+ public function setTitle($iVideoID, $sVideoTitle) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'title' => $sVideoTitle
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setTitle', $aArgs);
+ }
+
+ /**
+ * Set a new caption for a video (overwrites previous caption)
+ *
+ * @access public
+ * @param integer Video ID
+ * @param string Caption
+ * @return VimeoVideosSetCaptionResponse
+ */
+ public function setCaption($iVideoID, $sVideoCaption) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'caption' => $sVideoCaption
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setCaption', $aArgs);
+ }
+
+ /**
+ * Set a video as a favorite.
+ *
+ * @access public
+ * @param integer Video ID
+ * @param boolean TRUE to favorite, FALSE to return to normal
+ * @return VimeoVideosSetFavoriteResponse
+ */
+ public function setFavorite($iVideoID, $bFavorite = true) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'favorite' => (int) $bFavorite
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setFavorite', $aArgs);
+ }
+
+ /**
+ * Add specified tags to the video, this does not replace any tags.
+ *
+ * Tags should be comma separated lists.
+ *
+ * If the calling user is logged in, this will return information that calling
+ * user has access to (including private videos). If the calling user is not authenticated,
+ * this will only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer Video ID
+ * @param mixed Array with tags or Comma separated list of tags ("lions, tigers, bears")
+ * @return VimeoVideosAddTagsResponse
+ */
+ public function addTags($iVideoID, $mTags) {
+ // Catch array of tags
+ if(is_array($mTags)) {
+ $mTags = implode(',', $mTags);
+ }
+
+ // Prepare arguments
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'tags' => $mTags
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.addTags', $aArgs);
+ }
+
+ /**
+ * Remove specified tag from the video.
+ *
+ * @access public
+ * @param integer Video ID
+ * @param integer Tag ID, this should be a tag id returned by vimeo.videos.getInfo
+ * @return VimeoVideosRemoveTagResponse
+ */
+ public function removeTag($iVideoID, $iTagID) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'tag_id' => $iTagID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.removeTag', $aArgs);
+ }
+
+ /**
+ * Remove ALL of the tags from the video
+ *
+ * @access public
+ * @param integer Video ID
+ * @return VimeoVideosClearTags
+ */
+ public function clearTags($iVideoID) {
+ $aArgs = array(
+ 'video_id' => $iVideoID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.clearTags', $aArgs);
+ }
+
+ /**
+ * Set the privacy of the video
+ *
+ * @access public
+ * @param integer Video ID
+ * @param integer Privacy enum see VimeoVideosRequest::PRIVACY_*
+ * @param mixed Array or comma separated list of users who can view the video. PRIVACY_USERS must be set.
+ */
+ public function setPrivacy($iVideoID, $ePrivacy, $mUsers = array()) {
+ // Catch array of users
+ if(is_array($mUsers)) {
+ $mUsers = implode(', ', $mUsers);
+ }
+
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'privacy' => $ePrivacy,
+ 'users' => $mUsers
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setPrivacy', $aArgs);
+ }
+}
+
+/**
+* Vimeo Videos Search response handler class
+*
+* Handles the API response for vimeo.videos.search queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosSearchResponse extends VimeoResponse {
+ private $iPage = false;
+ private $iItemsPerPage = false;
+ private $iOnThisPage = false;
+
+ private $aoVideos = array();
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ // Parse information
+ if($aResponse && isset($aResponse->videos) && $this->getStatus()) {
+ // Create an video list instance
+ $this->aoVideos = new VimeoVideoList();
+
+ // Page information
+ $this->iPage = $aResponse->videos->page;
+ $this->iItemsPerPage = $aResponse->videos->perpage;
+ $this->iOnThisPage = $aResponse->videos->on_this_page;
+
+ // Parse videos
+ if(isset($aResponse->videos->video)) {
+ // We should check if the subelement is an object (single hit) or an result array (multiple hits)
+ if(is_array($aResponse->videos->video)) {
+ // We got a couple of results
+ $aParseableData = $aResponse->videos->video;
+ } else {
+ // We only got one result
+ $aParseableData = array(
+ 0 => $aResponse->videos->video
+ );
+ }
+
+ // Parse the results
+ foreach($aParseableData as $aVideoInformation) {
+ $oVideo = new VimeoVideoEntity($aVideoInformation);
+
+ $this->aoVideos->add($oVideo, $oVideo->getID());
+ }
+ }
+ }
+ }
+
+ /**
+ * Current page
+ *
+ * @access public
+ * @return integer Page number
+ */
+ public function getPage() {
+ return $this->iPage;
+ }
+
+ /**
+ * Items per page
+ *
+ * @access public
+ * @return integer Items per page
+ */
+
+ public function getItemsPerPage() {
+ return $this->iItemsPerPage;
+ }
+
+ /**
+ * Items on the current page
+ *
+ * @access public
+ * @return integer Items on the current page
+ */
+
+ public function getOnThisPage() {
+ return $this->iOnThisPage;
+ }
+
+ /**
+ * Get array of video objects
+ *
+ * @access public
+ * @return array Video objects
+ */
+
+ public function getVideos() {
+ return $this->aoVideos;
+ }
+}
+
+/**
+* Vimeo Videos Search exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.search queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosSearchException extends VimeoException {}
+
+/**
+* Vimeo Videos GetList response handler class
+*
+* Handles the API response for vimeo.videos.getList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos Search exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.search queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetListException extends VimeoException {}
+
+/**
+* Vimeo Videos GetUploadedList response handler class
+*
+* Handles the API response for vimeo.videos.getUploadedList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetUploadedListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos GetUploadedList exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getUploadedList queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetUploadedListException extends VimeoException {}
+
+/**
+* Vimeo Videos GetAppearsInList response handler class
+*
+* Handles the API response for vimeo.videos.getAppearsInList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetAppearsInListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos GetAppearsInList exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getAppearsInList queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetAppearsInListException extends VimeoException {}
+
+/**
+* Vimeo Videos GetSubscriptionsList response handler class
+*
+* Handles the API response for vimeo.videos.getSubscriptionsList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetSubscriptionsListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos GetSubscriptionsList exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getSubscriptionsList queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetSubscriptionsListException extends VimeoException {}
+
+/**
+* Vimeo Videos GetListByTag response handler class
+*
+* Handles the API response for vimeo.videos.getListByTag queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetListByTagResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos GetListByTag exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getListByTag queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetListByTagException extends VimeoException {}
+
+/**
+* Vimeo Videos GetLikeList response handler class
+*
+* Handles the API response for vimeo.videos.getLikeList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetLikeListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos GetLikeList exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getLikeList queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetLikeListException extends VimeoException {}
+
+/**
+* Vimeo Videos GetContactsList response handler class
+*
+* Handles the API response for vimeo.videos.getContactsList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetContactsListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos GetContactsList exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getContactsList queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetContactsListException extends VimeoException {}
+
+/**
+* Vimeo Videos getContactsLikeList response handler class
+*
+* Handles the API response for vimeo.videos.getContactsLikeList queries.
+* Currently the response is exact the same as vimeo.videos.search
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosgetContactsLikeListResponse extends VimeoVideosSearchResponse {}
+
+/**
+* Vimeo Videos getContactsLikeList exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getContactsLikeList queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetContactsLikeListException extends VimeoException {}
+
+/**
+* Vimeo Videos GetInfo response handler class
+*
+* Handles the API response for vimeo.videos.getInfo queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetInfoResponse extends VimeoResponse {
+ private $oVideo = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ $this->oVideo = new VimeoVideoEntity($aResponse->video);
+ }
+
+ /**
+ * Get video information as object
+ *
+ * @access public
+ * @return VimeoVideoEntity
+ */
+ public function getVideo() {
+ return $this->oVideo;
+ }
+}
+
+/**
+* Vimeo Videos GetInfo exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getInfo queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetInfoException extends VimeoException {}
+
+/**
+* Vimeo Videos getUploadTicket response handler class
+*
+* Handles the API response for vimeo.videos.getUploadTicket queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosGetUploadTicketResponse extends VimeoResponse {
+ private $sTicket = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->sTicket = $aResponse->ticket->id;
+ }
+
+ /**
+ * Get generated upload ticket
+ *
+ * @access public
+ * @return string The ticket number of the upload
+ */
+ public function getTicket() {
+ return $this->sTicket;
+ }
+}
+
+/**
+* Vimeo Videos getUploadTicket exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.getUploadTicket queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosGetUploadTicketException extends VimeoException {}
+
+/**
+* Vimeo Videos checkUploadStatus response handler class
+*
+* Handles the API response for vimeo.videos.checkUploadStatus queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosCheckUploadStatusResponse extends VimeoResponse {
+ private $sTicket = false;
+ private $iVideoID = false;
+ private $bIsUploading = false;
+ private $bIsTranscoding = false;
+ private $iTranscodingProgress = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->sTicket = $aResponse->ticket->id;
+ $this->iVideoID = $aResponse->ticket->video_id;
+ $this->bIsUploading = (bool) $aResponse->ticket->is_uploading;
+ $this->bIsTranscoding = (bool) $aResponse->ticket->is_transcoding;
+ $this->iTranscodingProgress = $aResponse->ticket->transcoding_progress;
+ }
+
+ /**
+ * Get Ticket
+ *
+ * @access public
+ * @return string Ticket
+ */
+ public function getTicket() {
+ return $this->sTicket;
+ }
+
+ /**
+ * Get Video ID
+ *
+ * @access public
+ * @return integer Video ID
+ */
+ public function getVideoID() {
+ return $this->iVideoID;
+ }
+
+ /**
+ * Is the video uploading?
+ *
+ * @access public
+ * @return boolean TRUE if uploading, FALSE if not
+ */
+ public function isUploading() {
+ return $this->bIsUploading;
+ }
+
+ /**
+ * Is the video transcoding?
+ *
+ * Also check getTranscodingProgress() for percentage in transcoding
+ *
+ * @access public
+ * @return boolean TRUE if uploading, FALSE if not
+ */
+ public function isTranscoding() {
+ return $this->bIsTranscoding;
+ }
+
+ /**
+ * Get the transcoding progress
+ *
+ * Should only be called if isTranscoding() returns true
+ *
+ * @access public
+ * @return integer Percentage
+ */
+ public function getTranscodingProgress() {
+ return $this->iTranscodingProgress;
+ }
+}
+
+/**
+* Vimeo Videos checkUploadStatus exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.checkUploadStatus queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosCheckUploadStatusException extends VimeoException {}
+
+/**
+* Vimeo Videos delete response handler class
+*
+* Handles the API response for vimeo.videos.delete queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosDeleteResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos delete exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.delete queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosDeleteException extends VimeoException {}
+
+/**
+* Vimeo Videos setTitle response handler class
+*
+* Handles the API response for vimeo.videos.setTitle queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosSetTitleResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos setTitle exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.setTitle queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosSetTitleException extends VimeoException {}
+
+/**
+* Vimeo Videos setCaption response handler class
+*
+* Handles the API response for vimeo.videos.setCaption queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosSetCaptionResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos setCaption exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.setCaption queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosSetCaptionException extends VimeoException {}
+
+/**
+* Vimeo Videos setFavorite response handler class
+*
+* Handles the API response for vimeo.videos.setFavorite queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosSetFavoriteResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos setFavorite exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.setFavorite queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosSetFavoriteException extends VimeoException {}
+
+/**
+* Vimeo Videos addTags response handler class
+*
+* Handles the API response for vimeo.videos.addTags queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosAddTagsResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos addTags exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.addTags queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosAddTagsException extends VimeoException {}
+
+/**
+* Vimeo Videos removeTag response handler class
+*
+* Handles the API response for vimeo.videos.removeTag queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosRemoveTagResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos removeTag exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.removeTag queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosRemoveTagException extends VimeoException {}
+
+/**
+* Vimeo Videos clearTags response handler class
+*
+* Handles the API response for vimeo.videos.clearTags queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosClearTagsResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos clearTags exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.clearTags queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosClearTagsException extends VimeoException {}
+
+/**
+* Vimeo Videos setPrivacy response handler class
+*
+* Handles the API response for vimeo.videos.setPrivacy queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoVideosSetPrivacyResponse extends VimeoResponse {}
+
+/**
+* Vimeo Videos setPrivacy exception handler class
+*
+* Handles exceptions caused by API response for vimeo.videos.setPrivacy queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoVideosSetPrivacyException extends VimeoException {}
+
+/**
+* vimeo.people.* methods
+*/
+
+/**
+* Vimeo People request handler class
+*
+* Implements all API queries in the vimeo.people.* category
+*
+* @package SimpleVimeo
+* @subpackage ApiRequest
+*/
+
+class VimeoPeopleRequest extends VimeoRequest {
+ const TYPE_LIKES = 'likes';
+ const TYPE_APPEARS = 'appears';
+ const TYPE_BOTH = 'likes,appears';
+
+ /**
+ * Get a user id and full/display name with a username.
+ *
+ * You shouldn't need this to get the User ID, we allow you to use the
+ * username instead of User ID everywhere, it's much nicer that way.
+ *
+ * @access public
+ * @param string The username to lookup
+ * @return VimeoPeopleFindByUsernameResponse
+ */
+ public function findByUsername($sUsername) {
+ $aArgs = array(
+ 'username' => $sUsername
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.findByUserName', $aArgs);
+ }
+
+ /**
+ * Get tons of info about a user.
+ *
+ * @access public
+ * @param integer The id of the user we want.
+ * @return VimeoPeopleGetInfoResponse
+ */
+ public function getInfo($iUserID) {
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.getInfo', $aArgs);
+ }
+
+ /**
+ * Get a user id and full/display name via an Email Address.
+ *
+ * You shouldn't need to use this to get the User ID, we allow you
+ * to use the username instead of User ID everywhere, it's much nicer that way.
+ *
+ * @access public
+ * @param string Email
+ * @return VimeoPeopleFindByEmailResponse
+ */
+ public function findByEmail($sEmail) {
+ $aArgs = array(
+ 'find_email' => $sEmail
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.findByEmail', $aArgs);
+ }
+
+ /**
+ * Get a portrait URL for a given user/size
+ *
+ * Portraits are square, so you only need to pass one size parameter.
+ * Possible sizes are 20, 24, 28, 30, 40, 50, 60, 75, 100, 140, 278 and 300
+ *
+ * @access public
+ * @param string The username to lookup
+ * @param integer The size of the portrait you you want. (defaults to 75)
+ * @return VimeoPeopleGetPortraitUrlResponse
+ *
+ * @todo Check functionality. Did not work, god knows why
+ */
+ public function getPortraitUrl($sUser, $iSize = false) {
+ $aArgs = array(
+ 'user' => $sUser
+ );
+
+ if($iSize) {
+ $aArgs['size'] = $iSize;
+ }
+
+ return VimeoBase::executeRemoteCall('vimeo.people.getPortraitUrl', $aArgs);
+ }
+
+ /**
+ * Add a user as a contact for the authenticated user.
+ *
+ * If Jim is authenticated, and the $user is sally. Sally will be Jim's contact.
+ * It won't work the other way around. Depending on Sally's settings, this may
+ * send her an email notifying her that Jim Added her as a contact.
+ *
+ * @access public
+ * @param string The user to add. User ID, this can be the ID number (151542) or the username (ted)
+ * @return VimeoPeopleAddContactResponse
+ */
+ public function addContact($sUser) {
+ $aArgs = array(
+ 'user' => $sUser
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.addContact', $aArgs);
+ }
+
+ /**
+ * Remove a user as a contact for the authenticated user.
+ *
+ * @access public
+ * @param string The user to remove. User ID, this can be the ID number (151542) or the username (ted)
+ * @return VimeoPeopleRemoveContactResponse
+ */
+ public function removeContact($sUser) {
+ $aArgs = array(
+ 'user' => $sUser
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.removeContact', $aArgs);
+ }
+
+ /**
+ * This tells you how much space the user has remaining for uploads.
+ *
+ * We provide info in bytes and kilobytes. It probably makes sense for you to use kilobytes.
+ *
+ * @access public
+ * @return VimeoPeopleGetUploadStatusResponse
+ */
+ public function getUploadStatus() {
+ return VimeoBase::executeRemoteCall('vimeo.people.getUploadStatus');
+ }
+
+ /**
+ * Subscribe to a user's videos.
+ *
+ * Just like on the site, you can subscribe to videos a user "appears" in or "likes." Or both!
+ * This will not remove any subscriptions. So if the user is subscribed to a user for both "likes"
+ * and "appears," this will not change anything if you only specify one of them. If you want to
+ * remove one, you must call vimeo.people.removeSubscription().
+ *
+ * @access public
+ * @param string User ID, this can be the ID number (151542) or the username (ted)
+ * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
+ * @return VimeoPeopleAddSubscriptionResponse
+ */
+ public function addSubscription($sUser, $eType = self::TYPE_BOTH) {
+ $aArgs = array(
+ 'user' => $sUser,
+ 'type' => $eType
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.addSubscription', $aArgs);
+ }
+
+ /**
+ * Unsubscribe to a user's videos.
+ *
+ * @access public
+ * @param string User ID, this can be the ID number (151542) or the username (ted)
+ * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
+ * @return VimeoPeopleRemoveSubscriptionResponse
+ */
+ public function removeSubscription($sUser, $eType = self::TYPE_BOTH) {
+ $aArgs = array(
+ 'user' => $sUser,
+ 'type' => $eType
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.removeSubscription', $aArgs);
+ }
+}
+
+/**
+* Vimeo People FindByUserName response handler class
+*
+* Handles the API response for vimeo.people.findByUserName queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleFindByUserNameResponse extends VimeoResponse {
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->oUser = new VimeoUserEntity($aResponse->user);
+ }
+
+ /**
+ * Get user entity object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
+}
+
+/**
+* Vimeo People FindByUserName exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.findByUserName queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleFindByUserNameException extends VimeoException {}
+
+/**
+* Vimeo People FindByEmail response handler class
+*
+* Handles the API response for vimeo.people.findByEmail queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleFindByEmailResponse extends VimeoResponse {
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->oUser = new VimeoUserEntity($aResponse->user);
+ }
+
+ /**
+ * Get user entity object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
+}
+
+/**
+* Vimeo People FindByEmail exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.findByEmail queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleFindByEmailException extends VimeoException {}
+
+/**
+* Vimeo People GetInfo response handler class
+*
+* Handles the API response for vimeo.people.getInfo queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleGetInfoResponse extends VimeoResponse {
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->oUser = new VimeoUserEntity($aResponse->person);
+ }
+
+ /**
+ * Get user entity object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
+}
+
+/**
+* Vimeo People GetInfo exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.getInfo queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleGetInfoException extends VimeoException {}
+
+/**
+* Vimeo People getPortraitUrl response handler class
+*
+* Handles the API response for vimeo.people.getPortraitUrl queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleGetPortraitUrlResponse extends VimeoResponse {}
+
+/**
+* Vimeo People getPortraitUrl exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.getPortraitUrl queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleGetPortraitUrlException extends VimeoException {}
+
+/**
+* Vimeo People addContact response handler class
+*
+* Handles the API response for vimeo.people.addContact queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleAddContactResponse extends VimeoResponse {}
+
+/**
+* Vimeo People addContact exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.addContact queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleAddContactException extends VimeoException {}
+
+/**
+* Vimeo People removeContact response handler class
+*
+* Handles the API response for vimeo.people.removeContact queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleRemoveContactResponse extends VimeoResponse {}
+
+/**
+* Vimeo People removeContact exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.removeContact queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleRemoveContactException extends VimeoException {}
+
+/**
+* Vimeo People getUploadStatus response handler class
+*
+* Handles the API response for vimeo.people.getUploadStatus queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleGetUploadStatusResponse extends VimeoResponse {
+ private $iMaxBytes = false;
+ private $iMaxKBytes = false;
+
+ private $iUsedBytes = false;
+ private $iUsedKBytes = false;
+
+ private $iRemainingBytes = false;
+ private $iRemainingKBytes = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->iMaxBytes = $aResponse->user->bandwidth->maxbytes;
+ $this->iMaxKBytes = $aResponse->user->bandwidth->maxkb;
+
+ $this->iUsedBytes = $aResponse->user->bandwidth->usedbytes;
+ $this->iUsedKBytes = $aResponse->user->bandwidth->usedkb;
+
+ $this->iRemainingBytes = $aResponse->user->bandwidth->remainingbytes;
+ $this->iRemainingKBytes = $aResponse->user->bandwidth->remainingkb;
+ }
+
+ /**
+ * Get maximum upload for this week in BYTES
+ *
+ * @access public
+ * @return integer Maximum bytes this week
+ */
+ public function getMaxBytes() {
+ return $this->iMaxBytes;
+ }
+
+ /**
+ * Get maximum upload for this week in KILOBYTES
+ *
+ * @access public
+ * @return integer Maximum kbytes this week
+ */
+ public function getMaxKiloBytes() {
+ return $this->iMaxKBytes;
+ }
+
+ /**
+ * Get used upload for this week in BYTES
+ *
+ * @access public
+ * @return integer Used bytes this week
+ */
+ public function getUsedBytes() {
+ return $this->iUsedBytes;
+ }
+
+ /**
+ * Get used upload for this week in KILOBYTES
+ *
+ * @access public
+ * @return integer Used kbytes this week
+ */
+ public function getUsedKiloBytes() {
+ return $this->iUsedKBytes;
+ }
+
+ /**
+ * Get remaining upload for this week in BYTES
+ *
+ * @access public
+ * @return integer Remaining bytes this week
+ */
+ public function getRemainingBytes() {
+ return $this->iRemainingBytes;
+ }
+
+ /**
+ * Get remaining upload for this week in KILOBYTES
+ *
+ * @access public
+ * @return integer Remaining kbytes this week
+ */
+ public function getRemainingKiloBytes() {
+ return $this->iRemainingKBytes;
+ }
+}
+
+/**
+* Vimeo People getUploadStatus exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.getUploadStatus queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleGetUploadStatusException extends VimeoException {}
+
+/**
+* Vimeo People addSubscription response handler class
+*
+* Handles the API response for vimeo.people.addSubscription queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleAddSubscriptionResponse extends VimeoResponse {}
+
+/**
+* Vimeo People addSubscription exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.addSubscription queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleAddSubscriptionException extends VimeoException {}
+
+/**
+* Vimeo People removeSubscription response handler class
+*
+* Handles the API response for vimeo.people.removeSubscription queries.
+*
+* @package SimpleVimeo
+* @subpackage ApiResponse
+*/
+
+class VimeoPeopleRemoveSubscriptionResponse extends VimeoResponse {}
+
+/**
+* Vimeo People removeSubscription exception handler class
+*
+* Handles exceptions caused by API response for vimeo.people.removeSubscription queries.
+*
+* @package SimpleVimeo
+* @subpackage Exceptions
+*/
+
+class VimeoPeopleRemoveSubscriptionException extends VimeoException {}
+
+?>
diff --git a/new.php b/new.php
new file mode 100644
index 000000000..726245eb5
--- /dev/null
+++ b/new.php
@@ -0,0 +1,47 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+
+ // Render the video upload page
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+
+ //get videolist GUID
+ $container_guid = get_input('container');
+ if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if($container_guid[0] == "group"){
+ $container = get_entity($container_guid[1]);
+ set_page_owner($container->getGUID());
+ $page_owner = page_owner_entity();
+ set_context("groupsvideos");
+ set_input("container_guid", $container->getGUID());
+ }
+ else{
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ set_input("container_guid", $_SESSION['guid']);
+ }
+ }
+ }
+
+ $title = sprintf(elgg_echo("videolist:new"), $page_owner->name);
+
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view("forms/add");
+ $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
+
+ page_draw($title, $body);
+?>
diff --git a/start.php b/start.php
new file mode 100644
index 000000000..fffc04c34
--- /dev/null
+++ b/start.php
@@ -0,0 +1,216 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+ function videolist_init() {
+
+ // Load system configuration
+ global $CONFIG;
+ if (isloggedin())
+ {
+ add_menu(elgg_echo('videolist'), $CONFIG->wwwroot . "pg/videolist/owned/" . $_SESSION['user']->username);
+ }
+
+ // Extend system CSS with our own styles
+ extend_view('css','videolist/css');
+ // Load the language file - default is english
+ register_translations($CONFIG->pluginspath . "videolist/languages/");
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('videolist','videolist_page_handler');
+
+ //extend this plugin for groups
+ extend_view('groups/left_column','videolist/groupprofile_videolist');
+
+ // Add a new videolist widget
+ add_widget_type('videolist_view',elgg_echo("videolist:widget"),elgg_echo("videolist:widget:description"), 'profile');
+
+ if (is_callable('register_notification_object'))
+ register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
+ register_plugin_hook('object:notifications','object','videolist_object_notifications_intercept');
+
+ // Register URL handler
+ register_entity_url_handler('video_url','object', 'videolist');
+ register_entity_url_handler('video_url','object', 'watch');
+
+ //register entity url handler
+ register_entity_url_handler('videolist_url','object','videolist');
+ // Register entity type
+ register_entity_type('object','videolist');
+
+
+
+
+ }
+
+ /**
+ * videolist page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
+ function videolist_page_handler($page) {
+
+ if (isset($page[0])) {
+ switch($page[0]) {
+ case "owned": if (isset($page[1])) set_input('username',$page[1]);
+ @include(dirname(__FILE__) . "/index.php");
+ break;
+ case "search": @include(dirname(__FILE__) . "/world.php");
+ break;
+ case "video": @include(dirname(__FILE__) . "/video.php");
+ break;
+ case "new": if (isset($page[3])) set_input('add_videourl',$page[3]);
+ if (isset($page[5])) set_input('page',$page[5]);
+ if (isset($page[1])) set_input('container',$page[1]);
+ @include(dirname(__FILE__) . "/new.php");
+ break;
+ case "watch": set_input('video_id',$page[1]);
+ @include(dirname(__FILE__) . "/watch.php");
+ break;
+ case "browse": if (isset($page[1])) set_input('container',$page[1]);
+ @include(dirname(__FILE__) . "/browse.php");
+ break;
+ default : if (isset($page[1])) set_input('username',$page[1]);
+ @include(dirname(__FILE__) . "/index.php");
+ break;
+ }
+ // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file
+ } else {
+ if (isset($page[1])) set_input('username',$page[1]);
+ @include(dirname(__FILE__) . "/index.php");
+ return true;
+ }
+
+ return false;
+
+ }
+
+
+ function videolist_pagesetup() {
+
+ global $CONFIG;
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup && get_context() == "groups") {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ }
+ //add submenu options
+ else if (get_context() == "videolist") {
+ /**********************************************************************************************
+ ****if user is OR is not registered user then show him following page menus to choose from
+ ***********************************************************************************************/
+ /*
+ add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username);
+
+ add_submenu_item(elgg_echo('videolist:new'),$CONFIG->wwwroot."pg/videolist/new");
+
+ add_submenu_item(elgg_echo('videolist:find'),$CONFIG->wwwroot."pg/videolist/search/");
+ */
+ if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/");
+ } else if (page_owner() && $page_owner instanceof ElggUser) {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username);
+ }
+ }
+ else if (get_context() == "groupsvideos") {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ if ($page_owner->canEdit()) {
+ add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
+ }
+ }
+ }
+
+
+ function video_url($entity) {
+ global $CONFIG;
+ $video_id = $entity->video_id;
+ return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;
+
+ }
+
+ function videolist_url($videolistpage) {
+
+ global $CONFIG;
+ $owner = $videolistpage->container_guid;
+ $userdata = get_entity($owner);
+ $title = $videolistpage->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();
+ }
+
+ /**
+ * Event handler for videolist
+ *
+ */
+ function videolist_object_notifications($event, $object_type, $object) {
+
+ static $flag;
+ if (!isset($flag)) $flag = 0;
+
+ if (is_callable('object_notifications'))
+ if ($object instanceof ElggObject) {
+ if ($object->getSubtype() == 'videolist') {
+ if ($flag == 0) {
+ $flag = 1;
+ object_notifications($event, $object_type, $object);
+ }
+ }
+ }
+ }
+
+ /**
+ * Intercepts the notification on an event of new video being created and prevents a notification from going out
+ * (because one will be sent on the annotation)
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
+ if (isset($params)) {
+ if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
+ if ($params['object']->getSubtype() == 'videolist') {
+ return true;
+ }
+ }
+ }
+ return null;
+ }
+
+ // Register a handler for adding videos
+ register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');
+
+ // Register a handler for delete videos
+ register_elgg_event_handler('delete', 'videolist', 'videolist_delete_event_listener');
+
+ // Make sure the status initialisation function is called on initialisation
+ register_elgg_event_handler('init','system','videolist_init');
+
+ register_elgg_event_handler('pagesetup','system','videolist_pagesetup');
+ register_elgg_event_handler('annotate','all','videolist_object_notifications');
+
+ // Register actions
+ global $CONFIG;
+
+ register_action("videolist/addvideo", false, $CONFIG->pluginspath . "videolist/actions/addvideo.php");
+ register_action("videolist/tubesearch", false, $CONFIG->pluginspath . "videolist/actions/tubesearch.php");
+ //register_action("videolist/addcomment", false, $CONFIG->pluginspath . "videolist/actions/comments/add.php");
+ register_action("videolist/remove", false, $CONFIG->pluginspath . "videolist/actions/delete.php");
+
+
+?>
diff --git a/views/default/forms/add.php b/views/default/forms/add.php
new file mode 100644
index 000000000..f9837ede4
--- /dev/null
+++ b/views/default/forms/add.php
@@ -0,0 +1,176 @@
+
+ * @copyright Prateek Choudhary
+ */
+// Make sure we're logged in (send us to the front page if not)
+ gatekeeper();
+ $page_owner = page_owner_entity();
+ $error = array(
+ 'no-video' => 1
+ );
+ $error_msg = array(
+ 'no-video' => "Please enter a valid video url"
+ );
+
+ $container_guid = get_input("container_guid");
+ set_page_owner($container_guid);
+
+ $confirm_action = get_input('video_action');
+ $guid = get_input('guid');
+ $access_id = get_input('access_id');
+ $title_videourl = get_input('title_videourl');
+ $Pagecontainer = get_input('page');
+ $get_addvideourl = get_input('add_videourl');
+ $timestamp = time();
+ $token = generate_action_token(time());
+ if(!empty($get_addvideourl) && ($Pagecontainer == "youtube"))
+ $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
+ else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe"))
+ $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
+ else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo"))
+ $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
+ else
+ $title_add_videourl = "";
+
+
+ $tags = get_input('videolisttags');
+
+ function video_youtube_parse_url($url)
+ {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches))
+ {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches))
+ {
+ return false;
+ }
+
+ $hash = $matches[2];
+
+
+ return $domain . 'v/' . $hash;
+ }
+
+ function video_vimeo_parse_url($url)
+ {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches))
+ {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+
+ return $domain . '/' . $hash;
+ }
+
+ function video_metacafe_parse_url($url)
+ {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches))
+ {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+
+ return $domain . '/' . $hash;
+ }
+
+ if(isset($confirm_action) && ($confirm_action == 'add_video'))
+ {
+ if(isset($title_videourl) && ($title_videourl != ''))
+ {
+ if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
+ if(preg_match("/youtube/i", $title_videourl))
+ $Pagecontainer = "youtube";
+ if(preg_match("/vimeo/i", $title_videourl))
+ $Pagecontainer = "vimeo";
+ if(preg_match("/metacafe/i", $title_videourl))
+ $Pagecontainer = "metacafe";
+ }
+ if($Pagecontainer == "youtube")
+ $is_valid_video = video_youtube_parse_url($title_videourl);
+ else if($Pagecontainer == "vimeo"){
+ $is_valid_video = video_vimeo_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ }
+ else if($Pagecontainer == "metacafe"){
+ $is_valid_video = video_metacafe_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ }
+ if($is_valid_video)
+ {
+ $error['no-video'] = 1;
+ $_SESSION['candidate_profile_video'] = $is_valid_video;
+ $_SESSION['candidate_profile_video_access_id'] = $access_id;
+ $_SESSION['videolisttags'] = $tags;
+ $_SESSION['Pagecontainer'] = $Pagecontainer;
+ $_SESSION['container_guid'] = $container_guid;
+ //echo $_SESSION['candidate_profile_video'];
+ $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}";
+ forward($url);
+ }
+ else
+ $error['no-video'] = 0;
+ }
+ else
+ {
+ $error['no-video'] = 0;
+ }
+ }
+
+
+
+ $body = '';
+
+ $body .= '
';
+ $body .= '
';
+
+ print $body." ";
+
+
+?>
+
+
diff --git a/views/default/forms/browsetube.php b/views/default/forms/browsetube.php
new file mode 100644
index 000000000..50fa7b164
--- /dev/null
+++ b/views/default/forms/browsetube.php
@@ -0,0 +1,257 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+$getcontainer_guid = get_input("container");
+$container_guid = explode(":", $getcontainer_guid);
+if($container_guid[0] == "group"){
+ $container = $container_guid[1];
+}
+else{
+ $container = $getcontainer_guid;
+}
+ $error = array(
+ 'no-search' => 1
+ );
+ $error_msg = array(
+ 'no-search' => "Please enter a valid search term"
+ );
+ $browseCat = get_input('q');
+ if(empty($browseCat) || !isset($browseCat))
+ $browseCat = "youtube";
+ $confirm_action = get_input('video_action');
+
+ if(isset($confirm_action) && ($confirm_action == 'search_video'))
+ {
+ if(isset($title_search) && ($title_search != ''))
+ $error['no-search'] = 0;
+ else
+ $error['no-search'] = 1;
+ }
+
+
+ //$body = '';
+ //Load youtube menu
+ $body .= "
";
+ $body .= "
";
+ $body .= "";
+ $body .= "YouTube ";
+ $body .= " ";
+ $body .= "";
+ $body .= "Metacafe ";
+ $body .= " ";
+ $body .= "";
+ $body .= "Vimeo ";
+ $body .= " ";
+ /*
+ $body .= "";
+ $body .= "Google Videos ";
+ $body .= " ";
+ */
+ $body .= " ";
+ $body .= "
";
+
+ $body .= "
";
+
+ //$body .= "
";
+ $body .= '';
+ //$body .= '
';
+ //$body .= '
';
+
+ $body .= '';
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+
+ print $body." ";
+
+
+?>
+
+
diff --git a/views/default/forms/labels/googlevideos.php b/views/default/forms/labels/googlevideos.php
new file mode 100644
index 000000000..de263c1c9
--- /dev/null
+++ b/views/default/forms/labels/googlevideos.php
@@ -0,0 +1,34 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+ $body = ''.elgg_echo("videolist:title_search_tube").' ';
+ //$body .= elgg_view("input/text",array('internalname' => 'title_search','value' => '', 'id' => 'title_search'));
+ $body .= "";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ if($error['no-search'] == 0)
+ {
+ $body .= '
'.$error_msg['no-search'].'
';
+ }
+ $body .= "
";
+ //$body .= "
";
+ //$body .= ' ';
+ $body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
+ //$body .= "
";
+ $body .= "
";
+ $body .= '
';
+ $body .= 'Loading...
';
+ print $body;
+?>
diff --git a/views/default/forms/labels/metacafe.php b/views/default/forms/labels/metacafe.php
new file mode 100644
index 000000000..79e87d1be
--- /dev/null
+++ b/views/default/forms/labels/metacafe.php
@@ -0,0 +1,34 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+ $body = ''.elgg_echo("videolist:title_search_tube").' ';
+ //$body .= elgg_view("input/text",array('internalname' => 'title_search','value' => '', 'id' => 'title_search'));
+ $body .= "";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ if($error['no-search'] == 0)
+ {
+ $body .= '
'.$error_msg['no-search'].'
';
+ }
+ $body .= "
";
+ //$body .= "
";
+ //$body .= ' ';
+ $body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:metacafe')));
+ //$body .= "
";
+ $body .= "
";
+ $body .= '
';
+
+ print $body;
+?>
diff --git a/views/default/forms/labels/vimeo.php b/views/default/forms/labels/vimeo.php
new file mode 100644
index 000000000..e5cf21235
--- /dev/null
+++ b/views/default/forms/labels/vimeo.php
@@ -0,0 +1,34 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+ $body = ''.elgg_echo("videolist:title_search_tube").' ';
+ //$body .= elgg_view("input/text",array('internalname' => 'title_search','value' => '', 'id' => 'title_search'));
+ $body .= "";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ if($error['no-search'] == 0)
+ {
+ $body .= '
'.$error_msg['no-search'].'
';
+ }
+ $body .= "
";
+ //$body .= "
";
+ //$body .= ' ';
+ $body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
+ //$body .= "
";
+ $body .= "
";
+ $body .= '
';
+
+ print $body;
+?>
diff --git a/views/default/forms/labels/youtube.php b/views/default/forms/labels/youtube.php
new file mode 100644
index 000000000..40be100ee
--- /dev/null
+++ b/views/default/forms/labels/youtube.php
@@ -0,0 +1,34 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+ $body = ''.elgg_echo("videolist:title_search_tube").' ';
+ //$body .= elgg_view("input/text",array('internalname' => 'title_search','value' => '', 'id' => 'title_search'));
+ $body .= "";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ $body .= "
";
+ if($error['no-search'] == 0)
+ {
+ $body .= '
'.$error_msg['no-search'].'
';
+ }
+ $body .= "
";
+ //$body .= "
";
+ //$body .= ' ';
+ $body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos')));
+ //$body .= "
";
+ $body .= "
";
+ $body .= '
';
+
+ print $body;
+?>
diff --git a/views/default/object/videolist.php b/views/default/object/videolist.php
new file mode 100644
index 000000000..23754a899
--- /dev/null
+++ b/views/default/object/videolist.php
@@ -0,0 +1,91 @@
+
+ /* YouTube/vimeo/metacafe video Object file
+ /* @copyright Prateek.Choudhary
+ /*****************************************************************************************/
+
+ global $CONFIG;
+
+ $video_file = $vars['entity'];
+
+ if(!empty($video_file))
+ {
+ $url = $video_file->url;
+ $title = $video_file->title;
+ $video_guid = $video_file->guid;
+ $video_id = $video_file->video_id;
+ $videotype = $video_file->videotype;
+ $videothumbnail = $video_file->thumbnail;
+ $owner = $vars['entity']->getOwnerEntity();
+ $friendlytime = friendly_time($vars['entity']->time_created);
+
+ $mime = "image/html";
+ $thumbnail = $videothumbnail;
+ $watch_URL = $vars['url']."pg/videolist/watch/".$video_guid;
+ if (get_input('search_viewtype') == "gallery")
+ {
+ $videodiv .= "";
+ $videodiv .= "
";
+ //$videodiv .= "
";
+ //$videodiv .= "".elgg_echo('videolist:videoTitle')." : ".$title." ";
+ //$videodiv .= "
";
+
+ $numcomments = elgg_count_comments($video_file);
+ $videodiv .= "
";
+ if ($numcomments)
+ $videodiv .= "
" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ") ";
+ if($video_file->canEdit())
+ {
+
+ $videodiv .= elgg_view("output/confirmlink", array(
+ 'href' => $vars['url'] . "action/videolist/remove?video_id=" . $video_guid,
+ 'text' => elgg_echo('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ ));
+ }
+
+ $videodiv .= "
";
+ $videodiv .= "
";
+ print $videodiv;
+ }
+ else if(get_input('show_viewtype') == "all")
+ {
+ $info .= ''.$title.'
';
+ $info .= "username}\">{$owner->name} {$friendlytime}";
+ $info .= "
";
+ $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
+
+ echo elgg_view_listing($icon, $info);
+ }
+ else
+ {
+ /*
+ $videodiv .= "";
+ $videodiv .= " ";
+ $videodiv .= " Title : ".$title;
+ $videodiv .= " ";
+ */
+ //video list-entity view
+ $info = ''.$title.'
';
+ $info .= "username}\">{$owner->name} {$friendlytime}";
+ $info .= "
";
+ $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
+
+ echo elgg_view_listing($icon, $info);
+ }
+
+
+ }
+ else
+ {
+ echo "No videos were found.";
+ }
+?>
diff --git a/views/default/object/watch.php b/views/default/object/watch.php
new file mode 100644
index 000000000..c33a7b988
--- /dev/null
+++ b/views/default/object/watch.php
@@ -0,0 +1,45 @@
+
+ * @copyright Prateek Choudhary
+ */
+$videodiv = '';
+$width = "600";
+$height = "400";
+$file = $vars['entity'];
+if(isset($vars['entity']))
+{
+
+$videos = get_entity($vars['entity']);
+$title = $videos->title;
+$url = $videos->url;
+$videoid = $videos->video_id;
+$videodiv = "".$title." ";
+if($videos->videotype == "youtube"){
+ $videodiv .= "";
+}
+else if($videos->videotype == "metacafe"){
+ $videoid_id = $videoid;
+ $path = explode("/", $videos->thumbnail);
+ $path = array_reverse($path);
+ $thumbnailArray = explode(".", $path[0]);
+ $videoid = $videoid_id."/".$thumbnailArray[0].".swf";
+ $videodiv .= "
";
+
+}
+else if($videos->videotype == "vimeo"){
+ $videodiv .= "
";
+$videodiv .= elgg_view_likes($videos);
+$videodiv .= elgg_view_comments($videos);
+print $videodiv;
+
+//echo elgg_view_comments($videos);
+}
+?>
diff --git a/views/default/river/object/videolist/annotate.php b/views/default/river/object/videolist/annotate.php
new file mode 100644
index 000000000..d243c7ef3
--- /dev/null
+++ b/views/default/river/object/videolist/annotate.php
@@ -0,0 +1,13 @@
+getSubject();
+ $object = $statement->getObject();
+
+ $url = "
getURL()}\">{$performed_by->name} ";
+ $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " ";
+ $string .= "
getURL() . "\">" . elgg_echo("videolist:river:item") . " ";
+
+ echo $string;
+
+?>
diff --git a/views/default/river/object/videolist/create.php b/views/default/river/object/videolist/create.php
new file mode 100644
index 000000000..061d01dd5
--- /dev/null
+++ b/views/default/river/object/videolist/create.php
@@ -0,0 +1,18 @@
+subject_guid); // $statement->getSubject();
+ $object = get_entity($vars['item']->object_guid);
+ $thumbnail = $object->thumbnail;
+ //$url = $object->getURL();
+
+ $url = "
getURL()}\">{$performed_by->name} ";
+ $title = $object->title;
+ if(!$title)
+ $title = "untitled";
+ $string = sprintf(elgg_echo("videolist:river:created"),$url) . " ";
+ $string .= elgg_echo("videolist:river:item") . " titled
getURL() . "\">" . $title . " ";
+ $string .= "
";
+ $string .= "
getURL() . "\"> ";
+ $string .= "
";
+
+ echo $string;
\ No newline at end of file
diff --git a/views/default/staticvideo/index.php b/views/default/staticvideo/index.php
new file mode 100644
index 000000000..a95625f3c
--- /dev/null
+++ b/views/default/staticvideo/index.php
@@ -0,0 +1,62 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+
+$owner = $_SESSION['guid'];
+$number = 10;
+$owner_videos = get_entities("object", "videolist", $_SESSION['guid'], $number);
+$videodiv = '';
+$width = "390";
+$height = "275";
+?>
+
+url;
+ $title = $node->title;
+ $video_guid = $node->guid;
+ $video_id = $node->video_id;
+ $videodiv .= "
";
+ $videodiv .= "
";
+ $videodiv .= "Title : ".$title." ";
+ $videodiv .= "
";
+
+ $videodiv .= "
";
+ $videodiv .= elgg_view("output/confirmlink", array(
+ 'href' => $vars['url'] . "action/videolist/remove?video_id=" . $video_guid,
+ 'text' => elgg_echo('delete'),
+ 'confirm' => elgg_echo('deleteconfirm'),
+ ));
+ /*
+ $videodiv .= "
";
+ $videodiv .= "delete";
+ $videodiv .= " ";
+ */
+ $videodiv .= "
";
+ $videodiv .= "
";
+ }
+ print $videodiv;
+}
+else
+{
+ echo "No videos were found.";
+}
+?>
+
+
diff --git a/views/default/videolist/css.php b/views/default/videolist/css.php
new file mode 100644
index 000000000..76f23941d
--- /dev/null
+++ b/views/default/videolist/css.php
@@ -0,0 +1,199 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+
+?>
+
+.error{
+color:red;
+font-weight:bold;
+font-size:11px;
+}
+#video-list-main{
+padding:10px;
+}
+#videocontainer{
+width:100%;
+margin-bottom:10px;
+}
+.search_gallery_item{
+border:0px solid #CCCCCC;
+}
+#videobox{
+width:98%;
+text-align:center;
+margin-top:10px;
+}
+#videoDescbox{
+width:95%;
+margin:0px 5px 0px 8px;
+}
+#videoActionbox{
+width:90%;
+margin:0px 5px 0px 8px;
+float:left;
+}
+#videothumbnail-box{
+float:left;
+width:35%;
+background: #333333;
+text-align:center;
+padding:3px 1px 3px 0px;
+}
+#videotitle-box{
+width:60%;
+float:left;
+font-size:12px;
+font-weight:bold;
+text-align:left;
+padding-left:5px;
+color:#474B9F;
+}
+.title{
+font-weight:bold;
+}
+#profile_video_widget_container{
+margin:0px 10px 10px 10px;
+padding:8px;
+-moz-border-radius-topleft:8px;
+-moz-border-radius-topright:8px;
+-moz-border-radius-bottomleft:8px;
+-moz-border-radius-bottomright:8px;
+border:0px solid #C3C3C3;
+background: #FFFFFF;
+max-height:250px;
+overflow-y:auto;
+}
+#profile_video_image_container{
+float:left;
+width:95%;
+margin:6px 2px 0px 6px;
+border-bottom:1px solid #CCC;
+padding-bottom:3px;
+}
+
+#widget_container_header{
+color:#474B9F;
+margin:0px 0px 5px 0px;
+font-weight:bold;
+font-size:13px;
+}
+#loadingSearch{
+width:100%;
+}
+#SearchContainer{
+width:100%;
+}
+#responseSearch{
+padding:15px;
+}
+#paginateSearch{
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+padding:2px 5px 2px 0px;
+text-align:right;
+background:#FFF;
+border:0px solid #CCC;
+color:#666;
+}
+th{
+text-align:center;
+font-weight:bold;
+font-size:13px;
+}
+#parentTab{
+-moz-border-radius-bottomleft:8px;
+-moz-border-radius-bottomright:8px;
+-moz-border-radius-topleft:8px;
+-moz-border-radius-topright:8px;
+border-top:1px solid #CCC;
+border-bottom:6px solid #CCC;
+border-left:1px solid #CCC;
+border-right:5px solid #CCC;
+background:#FFFFFF;
+margin-top:7px;
+}
+.tabcellDesc{
+padding:5px 5px 5px 10px;
+text-align: left;
+}
+.tabcellText{
+padding:5px;
+text-align: center;
+}
+.videoDisp{
+position:absolute;
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #000000;
+display:none;
+padding:10px;
+margin-left:120px;
+margin-top:-100px;
+background:#FFFFFF;
+z-index:300000;
+}
+.videolist-content{
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #C3C3C3;
+width:675px;
+margin:10px 0px 10px 10px;
+padding:10px;
+background:#FFFFFF;
+}
+.tubesearch{
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #666666;
+}
+#comment_area_video_title{
+padding:10px;
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #CCCCCC;
+border:1px solid #CCCCCC;
+background:#FFFFFF;
+}
+.vid-comment-widget{
+font-size:11px;
+font-weight:normal;
+}
+.searchvideorow{
+padding:10px;
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #CCCCCC;
+}
+#videosearch-tablecontainer{
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #CCCCCC;
+background:#FFF;
+padding:10px;
+}
+#videosearch-interface{
+border-color:#CCCCCC;
+border-style:solid;
+border-width:0 1px 1px;
+margin-top:-15px;
+padding:15px 0 15px 20px;
+}
diff --git a/views/default/videolist/groupprofile_videolist.php b/views/default/videolist/groupprofile_videolist.php
new file mode 100644
index 000000000..279f2af81
--- /dev/null
+++ b/views/default/videolist/groupprofile_videolist.php
@@ -0,0 +1,62 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+?>
+
+
diff --git a/views/default/videolist/icon.php b/views/default/videolist/icon.php
new file mode 100644
index 000000000..1d25329ea
--- /dev/null
+++ b/views/default/videolist/icon.php
@@ -0,0 +1,41 @@
+wwwroot}mod/videolist/graphics/icons/Video_Icon.jpg\" border=\"0\" />";
+}
+else{
+
+ $mime = $vars['mimetype'];
+ if (isset($vars['thumbnail'])) {
+ $thumbnail = $vars['thumbnail'];
+ } else {
+ $thumbnail = false;
+ }
+
+ $size = $vars['size'];
+ if ($size != 'large') {
+ $size = 'small';
+ }
+
+ if ($thumbnail && strpos($mime, "image/")!==false)
+ echo "
";
+ else
+ {
+ if ($size == 'large')
+ echo "
";
+ else
+ echo "
wwwroot}mod/videolist/graphics/icons/Video_Icon.jpg\" border=\"0\" />";
+ }
+}
+?>
diff --git a/views/default/videolist/notfound.php b/views/default/videolist/notfound.php
new file mode 100644
index 000000000..79df22779
--- /dev/null
+++ b/views/default/videolist/notfound.php
@@ -0,0 +1,21 @@
+
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+?>
+
+
+
+
diff --git a/views/default/videolist/videoprofile.php b/views/default/videolist/videoprofile.php
new file mode 100644
index 000000000..e69de29bb
diff --git a/views/default/widgets/videolist_view/edit.php b/views/default/widgets/videolist_view/edit.php
new file mode 100644
index 000000000..ec5b34bae
--- /dev/null
+++ b/views/default/widgets/videolist_view/edit.php
@@ -0,0 +1,21 @@
+
+ :
+
+
+ if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;
+ ?>
+
+ num_display == 1) echo "SELECTED"; ?>>1
+ num_display == 2) echo "SELECTED"; ?>>2
+ num_display == 3) echo "SELECTED"; ?>>3
+ num_display == 4) echo "SELECTED"; ?>>4
+ num_display == 5) echo "SELECTED"; ?>>5
+ num_display == 6) echo "SELECTED"; ?>>6
+ num_display == 7) echo "SELECTED"; ?>>7
+ num_display == 8) echo "SELECTED"; ?>>8
+ num_display == 9) echo "SELECTED"; ?>>9
+ num_display == 10) echo "SELECTED"; ?>>10
+ num_display == 15) echo "SELECTED"; ?>>15
+ num_display == 20) echo "SELECTED"; ?>>20
+
+
diff --git a/views/default/widgets/videolist_view/view.php b/views/default/widgets/videolist_view/view.php
new file mode 100644
index 000000000..889ee5726
--- /dev/null
+++ b/views/default/widgets/videolist_view/view.php
@@ -0,0 +1,58 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+
+ //the number of files to display
+ $number = (int) $vars['entity']->num_display;
+ if (!$number)
+ $number = 5;
+
+ $owner = page_owner_entity();
+ $owner_videos = get_entities("object", "videolist", page_owner(), $order_by="time_created desc", $limit=$number);
+ //echo "
";
+ if ($owner_videos) {
+ echo '
";
+ echo "
";
+ //get a link to the users videos
+ $users_video_url = $vars['url'] . "pg/videolist/owned/" . $owner->username;
+ echo "
";
+ echo "
";
+ }
+ else {
+ echo elgg_echo("album:none");
+ }
+
+?>
diff --git a/views/rss/videolist/contentwrapper.php b/views/rss/videolist/contentwrapper.php
new file mode 100644
index 000000000..b967ab371
--- /dev/null
+++ b/views/rss/videolist/contentwrapper.php
@@ -0,0 +1,15 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+
+ echo $vars['body'];
+
+?>
diff --git a/views/rss/videolist/videolist.php b/views/rss/videolist/videolist.php
new file mode 100644
index 000000000..f88300d98
--- /dev/null
+++ b/views/rss/videolist/videolist.php
@@ -0,0 +1,17 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+ if ($foreach = get_entities('object','',$vars['entity']->guid)) {
+ foreach($foreach as $videos)
+ echo elgg_view_entity($videos);
+ }
+
+?>
diff --git a/watch.php b/watch.php
new file mode 100644
index 000000000..6d0542a2f
--- /dev/null
+++ b/watch.php
@@ -0,0 +1,44 @@
+
+ * @copyright Prateek Choudhary
+ */
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+
+ // Get objects
+ $video_id = (int) get_input('video_id');
+
+ // If we can get out the video corresponding to video_id object ...
+ if ($videos = get_entity($video_id)) {
+ set_page_owner($videos->container_guid);
+ $videos_container = get_entity($videos->container_guid);
+ if($videos_container->type == "group")
+ set_context("groupsvideos");
+ $page_owner = page_owner_entity();
+ $title = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name);
+ // Display it
+ $area2 = elgg_view("object/watch",array(
+ 'entity' => $video_id,
+ 'entity_owner' => $page_owner,
+ 'full' => true
+ ));
+ //$area2 .= elgg_view("videolist/comments", array('entity' => $videos));
+ $body = elgg_view_layout("one_column_with_sidebar", $area1 . $area2);
+ }
+ else
+ {
+ // Display the 'post not found' page instead
+ $body = elgg_view("videolist/notfound");
+ $title = elgg_echo("video:none");
+
+ }
+ // Finally draw the page
+ page_draw($title, $body);
+?>
diff --git a/world.php b/world.php
new file mode 100644
index 000000000..57af731de
--- /dev/null
+++ b/world.php
@@ -0,0 +1,38 @@
+
+ * @copyright Prateek Choudhary
+ */
+// Render the video upload page
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ $title = sprintf(elgg_echo("videolist:search"));
+
+ // Get objects
+ $area2 = elgg_view_title($title);
+ set_input('show_viewtype', 'all');
+ $area2 .= list_entities("object","videolist", 0, 10, $fullview=true, $viewtypetoggle=false,$pagination=true);
+
+ //$area2 .= elgg_view("staticvideo/index");
+
+ set_context('videolist');
+ $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
+
+?>
--
cgit v1.2.3
From d3c679b5112754ccc8fc7e301075175523b59185 Mon Sep 17 00:00:00 2001
From: Ben Werdmuller
Date: Thu, 25 Mar 2010 22:33:11 +0000
Subject: Test commit for new security.
---
start.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/start.php b/start.php
index fffc04c34..0ce127782 100644
--- a/start.php
+++ b/start.php
@@ -1,5 +1,4 @@
Date: Thu, 25 Mar 2010 22:36:25 +0000
Subject: Test commit for restricted access.
---
start.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/start.php b/start.php
index 0ce127782..4158dd35a 100644
--- a/start.php
+++ b/start.php
@@ -8,7 +8,6 @@
* @author Prateek Choudhary
* @copyright Prateek Choudhary
*/
-
function videolist_init() {
// Load system configuration
--
cgit v1.2.3
From a8aa4bceed8e7ad0c5af2646a83d6a2da2e0b23a Mon Sep 17 00:00:00 2001
From: Brett Profitt
Date: Fri, 26 Mar 2010 21:07:39 +0000
Subject: Changed line endings to unix-style for videolist plugin.
---
actions/addvideo.php | 432 +++++++-------
actions/comments_delete/add.php | 114 ++--
actions/delete.php | 74 +--
actions/save.php | 16 +-
actions/tubesearch.php | 660 ++++++++++-----------
browse.php | 88 +--
index.php | 92 +--
languages/en.php | 33 +-
manifest.xml | 2 +-
new.php | 94 +--
start.php | 253 ++++----
views/default/forms/add.php | 352 +++++------
views/default/forms/browsetube.php | 514 ++++++++--------
views/default/forms/labels/googlevideos.php | 18 +-
views/default/forms/labels/metacafe.php | 18 +-
views/default/forms/labels/vimeo.php | 16 +-
views/default/forms/labels/youtube.php | 18 +-
views/default/object/watch.php | 90 +--
views/default/river/object/videolist/annotate.php | 24 +-
views/default/river/object/videolist/create.php | 34 +-
views/default/staticvideo/index.php | 16 +-
views/default/videolist/css.php | 398 ++++++-------
views/default/videolist/groupprofile_videolist.php | 106 ++--
views/default/videolist/notfound.php | 40 +-
views/default/widgets/videolist_view/edit.php | 42 +-
views/default/widgets/videolist_view/view.php | 16 +-
views/rss/videolist/contentwrapper.php | 24 +-
views/rss/videolist/videolist.php | 30 +-
watch.php | 88 +--
world.php | 76 +--
30 files changed, 1890 insertions(+), 1888 deletions(-)
diff --git a/actions/addvideo.php b/actions/addvideo.php
index 519f6ae04..40c231518 100644
--- a/actions/addvideo.php
+++ b/actions/addvideo.php
@@ -1,216 +1,216 @@
-
- * @copyright Prateek Choudhary
- */
-
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-
-// Get the current page's owner
-set_page_owner($_SESSION['container_guid']);
-
-$page_owner = page_owner_entity();
-
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
-}
-
-if($page_owner->type == "group")
- $entity_referer = $page_owner->type.":".$page_owner->getGUID();
-else
- $entity_referer = $page_owner->username;
-
-require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
-
-function fetchyoutubeDatatitle($videoid){
- $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
- /**
- ** generate XML View
- **/
- $xml_buffer = new SimpleXMLElement($buffer);
- $vidDataTitle = $xml_buffer->video_details->title;
- return $vidDataTitle;
- //return "";
-}
-
-function fetchyoutubeDatadesc($videoid){
- $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
- /**
- ** generate XML View
- **/
- $xml_buffer = new SimpleXMLElement($buffer);
- $vidDataDesc = $xml_buffer->video_details->description;
- return $vidDataDesc;
- //return "";
-}
-
-function getVimeoInfoDataTitle($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- $title = $aoVideos->getTitle();
- return $title;
-}
-
-function getVimeoInfoDataDesc($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- $description = $aoVideos->getCaption();
- return $description;
-}
-
-function getVimeoInfoImage($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- //get all thumbnails
-
- $aThumbnails = array();
- foreach($aoVideos->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
-
- return $thumbnail;
-}
-
-function fetchyoutubeDatathumbnail($videoId){
- $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";
- return $thumbnail;
-}
-
-function metacafeFetchData($getVideoId){
- $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $myitem = $sxml->getElementsByTagName('item');
- return $myitem;
-}
-
-function fetchmetacafeTitle($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
- }
- return $valueTitle;
-}
-
-function fetchmetacafeDesc($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
- }
- return $desc_src;
-}
-
-function fetchmetacafeImg($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
- $pattern = '/ ]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
- }
- }
- return $thumbnail;
-}
-
- $pageContainer = $_SESSION['Pagecontainer'];
-
-
- // Initialise a new ElggObject
- $videolist = new ElggObject();
- // Tell the system it's a blog post
- $videolist->subtype = "videolist";
- // Set its owner to the current user
- $videolist->owner_guid = $_SESSION['user']->getGUID();
-
- // Set container of the video whether it was uploaded to groups or profile
- $videolist->container_guid = $_SESSION['container_guid'];
- // For now, set its access to public (we'll add an access dropdown shortly)
- $videolist->access_id = $_SESSION['candidate_profile_video_access_id'];
-
- // In order to Set its title and description appropriately WE need the video ID
- $videolist->url = $_SESSION['candidate_profile_video'];
-
- if($pageContainer == "youtube"){
- $videoIDArray = split("/v/", $videolist->url);
- $videolist->video_id = $videoIDArray[1];
- // Now set the video title and description appropriately
- $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);
- $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);
- $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);
- $videolist->videotype = "youtube";
- }
- else if($pageContainer == "metacafe"){
- $videolist->video_id = $_SESSION['candidate_profile_video'];
- // Now set the video title and description appropriately
- $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);
- $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);
- $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);
- $videolist->videotype = "metacafe";
- }
- else if($pageContainer == "vimeo"){
- $videolist->video_id = $_SESSION['candidate_profile_video'];
-
- // Now set the video title and description appropriately
- $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);
- $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);
- $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);
- $videolist->videotype = "vimeo";
- }
-
- // Before we can set metadata, we need to save the blog post
- if (!$videolist->save()) {
- register_error(elgg_echo("videolist:error"));
- forward("pg/videolist/new");
- }
- //add video tags
- $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);
- if (is_array($videolist_tags_array)) {
- $videolist->tags = $videolist_tags_array;
- }
-
- // add to river
- add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);
-
- // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
- // Success message
- system_message(elgg_echo("videolist:posted"));
- // Remove the videolist cache
- unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
- unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);
- // Forward to the main videolist page
-
-forward("pg/videolist/owned/".page_owner_entity()->username);
-
-// Remove the videolist cache
- unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
- unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);
-
-?>
+
+ * @copyright Prateek Choudhary
+ */
+
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+
+// Get the current page's owner
+set_page_owner($_SESSION['container_guid']);
+
+$page_owner = page_owner_entity();
+
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
+
+if($page_owner->type == "group")
+ $entity_referer = $page_owner->type.":".$page_owner->getGUID();
+else
+ $entity_referer = $page_owner->username;
+
+require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
+
+function fetchyoutubeDatatitle($videoid){
+ $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
+ /**
+ ** generate XML View
+ **/
+ $xml_buffer = new SimpleXMLElement($buffer);
+ $vidDataTitle = $xml_buffer->video_details->title;
+ return $vidDataTitle;
+ //return "";
+}
+
+function fetchyoutubeDatadesc($videoid){
+ $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
+ /**
+ ** generate XML View
+ **/
+ $xml_buffer = new SimpleXMLElement($buffer);
+ $vidDataDesc = $xml_buffer->video_details->description;
+ return $vidDataDesc;
+ //return "";
+}
+
+function getVimeoInfoDataTitle($iGetVideoId){
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ $title = $aoVideos->getTitle();
+ return $title;
+}
+
+function getVimeoInfoDataDesc($iGetVideoId){
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ $description = $aoVideos->getCaption();
+ return $description;
+}
+
+function getVimeoInfoImage($iGetVideoId){
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ //get all thumbnails
+
+ $aThumbnails = array();
+ foreach($aoVideos->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
+ }
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+
+ return $thumbnail;
+}
+
+function fetchyoutubeDatathumbnail($videoId){
+ $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";
+ return $thumbnail;
+}
+
+function metacafeFetchData($getVideoId){
+ $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $myitem = $sxml->getElementsByTagName('item');
+ return $myitem;
+}
+
+function fetchmetacafeTitle($getVideoId){
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+ }
+ return $valueTitle;
+}
+
+function fetchmetacafeDesc($getVideoId){
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+ }
+ return $desc_src;
+}
+
+function fetchmetacafeImg($getVideoId){
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+ $pattern = '/ ]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+ }
+ return $thumbnail;
+}
+
+ $pageContainer = $_SESSION['Pagecontainer'];
+
+
+ // Initialise a new ElggObject
+ $videolist = new ElggObject();
+ // Tell the system it's a blog post
+ $videolist->subtype = "videolist";
+ // Set its owner to the current user
+ $videolist->owner_guid = $_SESSION['user']->getGUID();
+
+ // Set container of the video whether it was uploaded to groups or profile
+ $videolist->container_guid = $_SESSION['container_guid'];
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $videolist->access_id = $_SESSION['candidate_profile_video_access_id'];
+
+ // In order to Set its title and description appropriately WE need the video ID
+ $videolist->url = $_SESSION['candidate_profile_video'];
+
+ if($pageContainer == "youtube"){
+ $videoIDArray = split("/v/", $videolist->url);
+ $videolist->video_id = $videoIDArray[1];
+ // Now set the video title and description appropriately
+ $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);
+ $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);
+ $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);
+ $videolist->videotype = "youtube";
+ }
+ else if($pageContainer == "metacafe"){
+ $videolist->video_id = $_SESSION['candidate_profile_video'];
+ // Now set the video title and description appropriately
+ $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);
+ $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);
+ $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);
+ $videolist->videotype = "metacafe";
+ }
+ else if($pageContainer == "vimeo"){
+ $videolist->video_id = $_SESSION['candidate_profile_video'];
+
+ // Now set the video title and description appropriately
+ $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);
+ $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);
+ $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);
+ $videolist->videotype = "vimeo";
+ }
+
+ // Before we can set metadata, we need to save the blog post
+ if (!$videolist->save()) {
+ register_error(elgg_echo("videolist:error"));
+ forward("pg/videolist/new");
+ }
+ //add video tags
+ $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);
+ if (is_array($videolist_tags_array)) {
+ $videolist->tags = $videolist_tags_array;
+ }
+
+ // add to river
+ add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);
+
+ // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
+ // Success message
+ system_message(elgg_echo("videolist:posted"));
+ // Remove the videolist cache
+ unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
+ unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);
+ // Forward to the main videolist page
+
+forward("pg/videolist/owned/".page_owner_entity()->username);
+
+// Remove the videolist cache
+ unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
+ unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);
+
+?>
diff --git a/actions/comments_delete/add.php b/actions/comments_delete/add.php
index a2d672fe9..d65e6c05b 100644
--- a/actions/comments_delete/add.php
+++ b/actions/comments_delete/add.php
@@ -1,58 +1,58 @@
-
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in; forward to the front page if not
- gatekeeper();
- action_gatekeeper();
-
- // Get input
- $entity_guid = (int) get_input('entity_guid');
- $comment_text = get_input('generic_comment');
-
- // Let's see if we can get an entity with the specified GUID
- if ($entity = get_entity($entity_guid)) {
-
- // If posting the comment was successful, say so
- if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
-
- if ($entity->owner_guid != $_SESSION['user']->getGUID())
- notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
- sprintf(
- elgg_echo('generic_comment:email:body'),
- $entity->title,
- $_SESSION['user']->name,
- $comment_text,
- $entity->getURL(),
- $_SESSION['user']->name,
- $_SESSION['user']->getURL()
- )
- );
-
- system_message(elgg_echo("generic_comment:posted"));
- //add to river
- add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
-
-
- } else {
- register_error(elgg_echo("generic_comment:failure"));
- }
-
- } else {
-
- register_error(elgg_echo("generic_comment:notfound"));
-
- }
-
- // Forward to the
- forward($_SERVER['HTTP_REFERER']);
-
+
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in; forward to the front page if not
+ gatekeeper();
+ action_gatekeeper();
+
+ // Get input
+ $entity_guid = (int) get_input('entity_guid');
+ $comment_text = get_input('generic_comment');
+
+ // Let's see if we can get an entity with the specified GUID
+ if ($entity = get_entity($entity_guid)) {
+
+ // If posting the comment was successful, say so
+ if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
+
+ if ($entity->owner_guid != $_SESSION['user']->getGUID())
+ notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
+ sprintf(
+ elgg_echo('generic_comment:email:body'),
+ $entity->title,
+ $_SESSION['user']->name,
+ $comment_text,
+ $entity->getURL(),
+ $_SESSION['user']->name,
+ $_SESSION['user']->getURL()
+ )
+ );
+
+ system_message(elgg_echo("generic_comment:posted"));
+ //add to river
+ add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
+
+
+ } else {
+ register_error(elgg_echo("generic_comment:failure"));
+ }
+
+ } else {
+
+ register_error(elgg_echo("generic_comment:notfound"));
+
+ }
+
+ // Forward to the
+ forward($_SERVER['HTTP_REFERER']);
+
?>
diff --git a/actions/delete.php b/actions/delete.php
index da3ad0c3b..3b5b6ddde 100644
--- a/actions/delete.php
+++ b/actions/delete.php
@@ -1,44 +1,44 @@
- * @copyright Prateek Choudhary
+/**
+ * Elgg Videolist Plugin -
+ * This plugin allows users to delete videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
-
- // Get input data
- $guid = (int) get_input('video_id');
-
- // Make sure we actually have permission to edit
- $videos = get_entity($guid);
- if ($videos->getSubtype() == "videolist" && $videos->canEdit()) {
-
- // Get owning user
+gatekeeper();
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ // Get input data
+ $guid = (int) get_input('video_id');
+
+ // Make sure we actually have permission to edit
+ $videos = get_entity($guid);
+ if ($videos->getSubtype() == "videolist" && $videos->canEdit()) {
+
+ // Get owning user
$owner = get_entity($videos->getOwner());
- // Delete it!
- $rowsaffected = $videos->delete();
- if ($rowsaffected > 0) {
- // Success message
- system_message(elgg_echo("videos:deleted"));
- } else {
- register_error(elgg_echo("videos:notdeleted"));
- }
- // Forward to the main video list page
+ // Delete it!
+ $rowsaffected = $videos->delete();
+ if ($rowsaffected > 0) {
+ // Success message
+ system_message(elgg_echo("videos:deleted"));
+ } else {
+ register_error(elgg_echo("videos:notdeleted"));
+ }
+ // Forward to the main video list page
//forward("pg/videolist/owned/" . page_owner_entity()->username);
- forward($_SERVER['HTTP_REFERER']);
+ forward($_SERVER['HTTP_REFERER']);
+
+ }
- }
-
?>
diff --git a/actions/save.php b/actions/save.php
index 61f3eb401..fa6ff585e 100644
--- a/actions/save.php
+++ b/actions/save.php
@@ -1,13 +1,13 @@
- * @copyright Prateek Choudhary
+ /**
+ * Elgg Candidate Profile Video Plugin
+ * This plugin allows users to create a library of youtube videos
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
diff --git a/actions/tubesearch.php b/actions/tubesearch.php
index d1a83722c..3930aaaa0 100644
--- a/actions/tubesearch.php
+++ b/actions/tubesearch.php
@@ -1,330 +1,330 @@
-
- * @copyright Prateek Choudhary
- */
-
-// Get the current page's owner
-//set_page_owner($_SESSION['container_guid']);
-
-$page_ownerx = get_entity(get_input('container'));
-if(!$page_ownerx)
- $page_ownerx = get_user_by_username(get_input('container'));
-set_page_owner($page_ownerx->getGUID());
-$page_owner = page_owner_entity();
-
-if($page_owner->type == "group")
- $container = "group:".$page_ownerx->getGUID();
-else
- $container = $page_ownerx->username;
-
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
-}
-
-global $CONFIG;
- $queryFeed = get_input('q');
- $start_index = get_input('start_index');
- $results_perpage = 10;
- $queryCatgory = get_input('page');
-if (!isset($queryFeed) || empty($queryFeed)) {
-
-}
-else
-{
- $q = $queryFeed;
- if($queryCatgory == "youtube")
- {
- $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
- $sxml = simplexml_load_file($feedURL);
-
- $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
- $total = $counts->totalResults;
- $startOffset = $counts->startIndex;
- $endOffset = ($startOffset-1) + $counts->itemsPerPage;
-
- $body = '';
- $rem = floor($total/10);
- $rem*=10;
- if($rem<$total)
- $last = $rem+1;
- $lpVid = $total - $rem;
- if($startOffset==1 && ($endOffset)==$total){}
- else if($startOffset==1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- $body .= '
';
- $body .= '';
- $k = 0;$counter = 0;
- foreach ($sxml->entry as $entry) {
- $k++;
- $media = $entry->children('http://search.yahoo.com/mrss/');
- $attrs = $media->group->player->attributes();
- $watch = $attrs['url'];
- $vid_array = explode("?v=", $watch);
- if(preg_match("/&/", $vid_array[1])){
- $vid_array = explode("&", $vid_array[1]);
- $vid_array[1] = $vid_array[0];
- }
-
- $attrs = $media->group->thumbnail[0]->attributes();
- $thumbnail = $attrs['url'];
- $yt = $media->children('http://gdata.youtube.com/schemas/2007');
- $attrs = $yt->duration->attributes();
- $length = $attrs['seconds'];
- $gd = $entry->children('http://schemas.google.com/g/2005');
- if ($gd->rating) {
- $attrs = $gd->rating->attributes();
- $rating = $attrs['average'];
- } else {
- $rating = 0;
- }
- $tags = array();
- $tags[] = $media->group->keywords;
- $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
- $body .= '
';
- }
- $body .= '
';
- print $body;
- }
- else if($queryCatgory == "metacafe")
- {
-
-
- $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
-
-
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $total = 999;
- $startOffset = $start_index;
- $endOffset = ($startOffset-1) + $results_perpage;
-
- $body = '';
- $rem = floor($total/10);
- $rem*=10;
- if($rem<$total)
- $last = $rem+1;
- $lpVid = $total - $rem;
- if($startOffset==1 && ($endOffset)==$total){}
- else if($startOffset==1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- $body .= '
';
- $k = 0;
- $body .= '';
- $myitem = $sxml->getElementsByTagName('item');
- foreach($myitem as $searchNode){
- $k++;
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
-
- $xmlLink = $searchNode->getElementsByTagName("link");
- $valueLink = $xmlLink->item(0)->nodeValue;
-
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
-
- $pattern = '/
]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
- }
-
- $pattern = '/
]+href[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $anchor_src = $match[1];
- }
-
- $encodedVideoUrlArray = explode("/watch/", $valueLink);
- $showEncodedVideo = $encodedVideoUrlArray[1];
- $metacafevideoIdArray = explode("/", $showEncodedVideo);
-
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
-
- $body .= '';
- $body .= '
';
- $body .= '
';
- }
- $body .= ' ';
- print $body;
- }
- else if($queryCatgory == "vimeo")
- {
- require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::search($queryFeed);
-
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideos();
-
- // Just for code completion
- $oVideo = new VimeoVideoEntity();
-
- $total = count($aoVideos);
- $startOffset = $start_index;
-
- $endOffset = ($startOffset-1) + $results_perpage;
- $body = '';
- $rem = floor($total/10);
- $rem*=10;
- if($rem<$total)
- $last = $rem+1;
- $lpVid = $total - $rem;
- if($startOffset==1 && ($endOffset)==$total){}
- else if($startOffset==1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- $body .= '
';
- $body .= '';
- $counter = 0;$k = 0;
- foreach($aoVideos as $oVideo) {
- $k++;
- if(($counter > $startOffset) && ($counter < $endOffset))
- {
- //get all thumbnails
- $aThumbnails = array();
- foreach($oVideo->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
- //print_r($oVideo);
- $title = $oVideo->getTitle();
- $description = $oVideo->getCaption();
- $url = $oVideo->getUrl();
- $rating = $oVideo->getNumberOfLikes();
- $playedTimes = $oVideo->getNumberOfPlays();
- // Print all tags
- $aTags = array();
- foreach($oVideo->getTags() as $oTag) {
- $aTags[] = $oTag->getTag();
- }
- $play_idArray = explode("http://vimeo.com/", $url);
- $embedidArray = explode("/", $play_idArray[1]);
- $body .= '
';
- $body .= '
';
- $body .= '
';
- }
- $counter++;
- }
- $body .= '
';
- print $body;
- }
-}
-exit;
-?>
+
+ * @copyright Prateek Choudhary
+ */
+
+// Get the current page's owner
+//set_page_owner($_SESSION['container_guid']);
+
+$page_ownerx = get_entity(get_input('container'));
+if(!$page_ownerx)
+ $page_ownerx = get_user_by_username(get_input('container'));
+set_page_owner($page_ownerx->getGUID());
+$page_owner = page_owner_entity();
+
+if($page_owner->type == "group")
+ $container = "group:".$page_ownerx->getGUID();
+else
+ $container = $page_ownerx->username;
+
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
+
+global $CONFIG;
+ $queryFeed = get_input('q');
+ $start_index = get_input('start_index');
+ $results_perpage = 10;
+ $queryCatgory = get_input('page');
+if (!isset($queryFeed) || empty($queryFeed)) {
+
+}
+else
+{
+ $q = $queryFeed;
+ if($queryCatgory == "youtube")
+ {
+ $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
+ $sxml = simplexml_load_file($feedURL);
+
+ $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
+ $total = $counts->totalResults;
+ $startOffset = $counts->startIndex;
+ $endOffset = ($startOffset-1) + $counts->itemsPerPage;
+
+ $body = '';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $body .= '';
+ $k = 0;$counter = 0;
+ foreach ($sxml->entry as $entry) {
+ $k++;
+ $media = $entry->children('http://search.yahoo.com/mrss/');
+ $attrs = $media->group->player->attributes();
+ $watch = $attrs['url'];
+ $vid_array = explode("?v=", $watch);
+ if(preg_match("/&/", $vid_array[1])){
+ $vid_array = explode("&", $vid_array[1]);
+ $vid_array[1] = $vid_array[0];
+ }
+
+ $attrs = $media->group->thumbnail[0]->attributes();
+ $thumbnail = $attrs['url'];
+ $yt = $media->children('http://gdata.youtube.com/schemas/2007');
+ $attrs = $yt->duration->attributes();
+ $length = $attrs['seconds'];
+ $gd = $entry->children('http://schemas.google.com/g/2005');
+ if ($gd->rating) {
+ $attrs = $gd->rating->attributes();
+ $rating = $attrs['average'];
+ } else {
+ $rating = 0;
+ }
+ $tags = array();
+ $tags[] = $media->group->keywords;
+ $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
+ $body .= '
';
+ }
+ $body .= '
';
+ print $body;
+ }
+ else if($queryCatgory == "metacafe")
+ {
+
+
+ $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
+
+
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $total = 999;
+ $startOffset = $start_index;
+ $endOffset = ($startOffset-1) + $results_perpage;
+
+ $body = '';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $k = 0;
+ $body .= '';
+ $myitem = $sxml->getElementsByTagName('item');
+ foreach($myitem as $searchNode){
+ $k++;
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+
+ $xmlLink = $searchNode->getElementsByTagName("link");
+ $valueLink = $xmlLink->item(0)->nodeValue;
+
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+
+ $pattern = '/
]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+
+ $pattern = '/
]+href[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $anchor_src = $match[1];
+ }
+
+ $encodedVideoUrlArray = explode("/watch/", $valueLink);
+ $showEncodedVideo = $encodedVideoUrlArray[1];
+ $metacafevideoIdArray = explode("/", $showEncodedVideo);
+
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+
+ $body .= '';
+ $body .= '
';
+ $body .= '
';
+ }
+ $body .= ' ';
+ print $body;
+ }
+ else if($queryCatgory == "vimeo")
+ {
+ require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::search($queryFeed);
+
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideos();
+
+ // Just for code completion
+ $oVideo = new VimeoVideoEntity();
+
+ $total = count($aoVideos);
+ $startOffset = $start_index;
+
+ $endOffset = ($startOffset-1) + $results_perpage;
+ $body = '';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $body .= '';
+ $counter = 0;$k = 0;
+ foreach($aoVideos as $oVideo) {
+ $k++;
+ if(($counter > $startOffset) && ($counter < $endOffset))
+ {
+ //get all thumbnails
+ $aThumbnails = array();
+ foreach($oVideo->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
+ }
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+ //print_r($oVideo);
+ $title = $oVideo->getTitle();
+ $description = $oVideo->getCaption();
+ $url = $oVideo->getUrl();
+ $rating = $oVideo->getNumberOfLikes();
+ $playedTimes = $oVideo->getNumberOfPlays();
+ // Print all tags
+ $aTags = array();
+ foreach($oVideo->getTags() as $oTag) {
+ $aTags[] = $oTag->getTag();
+ }
+ $play_idArray = explode("http://vimeo.com/", $url);
+ $embedidArray = explode("/", $play_idArray[1]);
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+ }
+ $counter++;
+ }
+ $body .= '
';
+ print $body;
+ }
+}
+exit;
+?>
diff --git a/browse.php b/browse.php
index 064ce9574..b5ef13987 100644
--- a/browse.php
+++ b/browse.php
@@ -1,44 +1,44 @@
-
- * @copyright Prateek Choudhary
- */
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- //get videolist GUID
- $container_guid = get_input('container');
- $parent_container = "";
- if(isset($container_guid) && !empty($container_guid)){
- $container_guid = explode(":", $container_guid);
- if($container_guid[0] == "group"){
- $container = get_entity($container_guid[1]);
- set_page_owner($container->getGUID());
- $page_owner = page_owner_entity();
- set_context("groupsvideos");
- }
- else{
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
- }
- }
- // Get the current page's owner
-
-
- $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name);
-
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view("forms/browsetube");
-
- $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
-
- page_draw($title, $body);
-?>
+
+ * @copyright Prateek Choudhary
+ */
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ //get videolist GUID
+ $container_guid = get_input('container');
+ $parent_container = "";
+ if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if($container_guid[0] == "group"){
+ $container = get_entity($container_guid[1]);
+ set_page_owner($container->getGUID());
+ $page_owner = page_owner_entity();
+ set_context("groupsvideos");
+ }
+ else{
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+ }
+ }
+ // Get the current page's owner
+
+
+ $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name);
+
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view("forms/browsetube");
+
+ $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
+
+ page_draw($title, $body);
+?>
diff --git a/index.php b/index.php
index 95026ec24..9c2b446a4 100644
--- a/index.php
+++ b/index.php
@@ -1,46 +1,46 @@
-
- * @copyright Prateek Choudhary
- */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- $owner = page_owner_entity();
-
- //get videolist GUID
- $container_guid = get_input('username');
- if(isset($container_guid) && !empty($container_guid)){
- $container_guid = explode(":", $container_guid);
- if($container_guid[0] == "group"){
- $container = get_entity($container_guid[1]);
- set_context("groupsvideos");
- //$page_owner = page_owner_entity();
- }
- else{
-
- }
- }
- //set page owner
- //set_page_owner($videolist_guid);
-
- $title = sprintf(elgg_echo("videolist:home"), "$owner->name");
-
- // Get objects
- $area2 = elgg_view_title($title);
- //set_input('search_viewtype', 'gallery');
- $area2 .= list_entities("object","videolist", page_owner(), 10);
-
- //$area2 .= elgg_view("staticvideo/index");
-
- set_context('videolist');
- $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
-
- // Finally draw the page
- page_draw($title, $body);
-?>
+
+ * @copyright Prateek Choudhary
+ */
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ $owner = page_owner_entity();
+
+ //get videolist GUID
+ $container_guid = get_input('username');
+ if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if($container_guid[0] == "group"){
+ $container = get_entity($container_guid[1]);
+ set_context("groupsvideos");
+ //$page_owner = page_owner_entity();
+ }
+ else{
+
+ }
+ }
+ //set page owner
+ //set_page_owner($videolist_guid);
+
+ $title = sprintf(elgg_echo("videolist:home"), "$owner->name");
+
+ // Get objects
+ $area2 = elgg_view_title($title);
+ //set_input('search_viewtype', 'gallery');
+ $area2 .= list_entities("object","videolist", page_owner(), 10);
+
+ //$area2 .= elgg_view("staticvideo/index");
+
+ set_context('videolist');
+ $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
+?>
diff --git a/languages/en.php b/languages/en.php
index d0c5555b0..7ea20abfe 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -1,14 +1,15 @@
-
- * @copyright Prateek Choudhary
- */
- $english = array(
+
+ * @copyright Prateek Choudhary
+ */
+ $english = array(
+
"videolist" => "My Videos",
"videolist:home" => '%s \'s Videos',
@@ -48,9 +49,9 @@
"videolist:searchTubeVideos:googlevideos" => "Search video.google.com",
"videolist:group" => "Group Videos",
"videolist:groupall" => "All Group Videos",
- "videolist:none" => "This group does not have any videos yet",
- );
-
- add_translation("en",$english);
-
+ "videolist:none" => "This group does not have any videos yet",
+ );
+
+ add_translation("en",$english);
+
?>
diff --git a/manifest.xml b/manifest.xml
index 0c2db8e00..36b3dc842 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -4,6 +4,6 @@
-
+
diff --git a/new.php b/new.php
index 726245eb5..aa092284f 100644
--- a/new.php
+++ b/new.php
@@ -1,47 +1,47 @@
-
- * @copyright Prateek Choudhary
- */
-
-
- // Render the video upload page
- // Load Elgg engine
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
-
- //get videolist GUID
- $container_guid = get_input('container');
- if(isset($container_guid) && !empty($container_guid)){
- $container_guid = explode(":", $container_guid);
- if($container_guid[0] == "group"){
- $container = get_entity($container_guid[1]);
- set_page_owner($container->getGUID());
- $page_owner = page_owner_entity();
- set_context("groupsvideos");
- set_input("container_guid", $container->getGUID());
- }
- else{
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- set_input("container_guid", $_SESSION['guid']);
- }
- }
- }
-
- $title = sprintf(elgg_echo("videolist:new"), $page_owner->name);
-
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view("forms/add");
- $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
-
- page_draw($title, $body);
-?>
+
+ * @copyright Prateek Choudhary
+ */
+
+
+ // Render the video upload page
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+
+ //get videolist GUID
+ $container_guid = get_input('container');
+ if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if($container_guid[0] == "group"){
+ $container = get_entity($container_guid[1]);
+ set_page_owner($container->getGUID());
+ $page_owner = page_owner_entity();
+ set_context("groupsvideos");
+ set_input("container_guid", $container->getGUID());
+ }
+ else{
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ set_input("container_guid", $_SESSION['guid']);
+ }
+ }
+ }
+
+ $title = sprintf(elgg_echo("videolist:new"), $page_owner->name);
+
+ $area2 = elgg_view_title($title);
+ $area2 .= elgg_view("forms/add");
+ $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
+
+ page_draw($title, $body);
+?>
diff --git a/start.php b/start.php
index 4158dd35a..e7f6d6085 100644
--- a/start.php
+++ b/start.php
@@ -1,126 +1,127 @@
-
- * @copyright Prateek Choudhary
- */
- function videolist_init() {
-
- // Load system configuration
- global $CONFIG;
+
+ * @copyright Prateek Choudhary
+ */
+ function videolist_init() {
+
+ // Load system configuration
+ global $CONFIG;
if (isloggedin())
{
add_menu(elgg_echo('videolist'), $CONFIG->wwwroot . "pg/videolist/owned/" . $_SESSION['user']->username);
}
-
+
// Extend system CSS with our own styles
- extend_view('css','videolist/css');
- // Load the language file - default is english
+ extend_view('css','videolist/css');
+
+ // Load the language file - default is english
register_translations($CONFIG->pluginspath . "videolist/languages/");
- // Register a page handler, so we can have nice URLs
+ // Register a page handler, so we can have nice URLs
register_page_handler('videolist','videolist_page_handler');
//extend this plugin for groups
extend_view('groups/left_column','videolist/groupprofile_videolist');
- // Add a new videolist widget
+ // Add a new videolist widget
add_widget_type('videolist_view',elgg_echo("videolist:widget"),elgg_echo("videolist:widget:description"), 'profile');
- if (is_callable('register_notification_object'))
- register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
+ if (is_callable('register_notification_object'))
+ register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
register_plugin_hook('object:notifications','object','videolist_object_notifications_intercept');
// Register URL handler
- register_entity_url_handler('video_url','object', 'videolist');
+ register_entity_url_handler('video_url','object', 'videolist');
register_entity_url_handler('video_url','object', 'watch');
//register entity url handler
register_entity_url_handler('videolist_url','object','videolist');
- // Register entity type
+ // Register entity type
register_entity_type('object','videolist');
-
- }
-
- /**
- * videolist page handler; allows the use of fancy URLs
- *
- * @param array $page From the page_handler function
- * @return true|false Depending on success
- */
+
+ }
+
+ /**
+ * videolist page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
function videolist_page_handler($page) {
-
- if (isset($page[0])) {
- switch($page[0]) {
+
+ if (isset($page[0])) {
+ switch($page[0]) {
case "owned": if (isset($page[1])) set_input('username',$page[1]);
@include(dirname(__FILE__) . "/index.php");
break;
- case "search": @include(dirname(__FILE__) . "/world.php");
+ case "search": @include(dirname(__FILE__) . "/world.php");
+ break;
+ case "video": @include(dirname(__FILE__) . "/video.php");
break;
- case "video": @include(dirname(__FILE__) . "/video.php");
- break;
case "new": if (isset($page[3])) set_input('add_videourl',$page[3]);
if (isset($page[5])) set_input('page',$page[5]);
if (isset($page[1])) set_input('container',$page[1]);
- @include(dirname(__FILE__) . "/new.php");
+ @include(dirname(__FILE__) . "/new.php");
break;
case "watch": set_input('video_id',$page[1]);
- @include(dirname(__FILE__) . "/watch.php");
+ @include(dirname(__FILE__) . "/watch.php");
break;
case "browse": if (isset($page[1])) set_input('container',$page[1]);
- @include(dirname(__FILE__) . "/browse.php");
+ @include(dirname(__FILE__) . "/browse.php");
break;
default : if (isset($page[1])) set_input('username',$page[1]);
@include(dirname(__FILE__) . "/index.php");
- break;
- }
- // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file
+ break;
+ }
+ // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file
} else {
if (isset($page[1])) set_input('username',$page[1]);
@include(dirname(__FILE__) . "/index.php");
- return true;
- }
-
- return false;
-
- }
+ return true;
+ }
+
+ return false;
+
+ }
- function videolist_pagesetup() {
-
- global $CONFIG;
+ function videolist_pagesetup() {
+
+ global $CONFIG;
$page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup && get_context() == "groups") {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
- }
- //add submenu options
- else if (get_context() == "videolist") {
+ if ($page_owner instanceof ElggGroup && get_context() == "groups") {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ }
+ //add submenu options
+ else if (get_context() == "videolist") {
/**********************************************************************************************
****if user is OR is not registered user then show him following page menus to choose from
***********************************************************************************************/
/*
- add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username);
+ add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username);
add_submenu_item(elgg_echo('videolist:new'),$CONFIG->wwwroot."pg/videolist/new");
add_submenu_item(elgg_echo('videolist:find'),$CONFIG->wwwroot."pg/videolist/search/");
*/
- if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
- add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
- add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/");
- } else if (page_owner() && $page_owner instanceof ElggUser) {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username);
- }
+ add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/");
+ } else if (page_owner() && $page_owner instanceof ElggUser) {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username);
+ }
}
else if (get_context() == "groupsvideos") {
add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
@@ -128,87 +129,87 @@
add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
}
- }
- }
+ }
+ }
- function video_url($entity) {
+ function video_url($entity) {
global $CONFIG;
- $video_id = $entity->video_id;
- return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;
-
+ $video_id = $entity->video_id;
+ return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;
+
}
- function videolist_url($videolistpage) {
-
+ function videolist_url($videolistpage) {
+
global $CONFIG;
$owner = $videolistpage->container_guid;
- $userdata = get_entity($owner);
- $title = $videolistpage->title;
+ $userdata = get_entity($owner);
+ $title = $videolistpage->title;
$title = friendly_title($title);
- return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();
+ return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();
}
- /**
- * Event handler for videolist
- *
- */
- function videolist_object_notifications($event, $object_type, $object) {
-
- static $flag;
- if (!isset($flag)) $flag = 0;
-
- if (is_callable('object_notifications'))
- if ($object instanceof ElggObject) {
- if ($object->getSubtype() == 'videolist') {
- if ($flag == 0) {
- $flag = 1;
- object_notifications($event, $object_type, $object);
- }
- }
- }
+ /**
+ * Event handler for videolist
+ *
+ */
+ function videolist_object_notifications($event, $object_type, $object) {
+
+ static $flag;
+ if (!isset($flag)) $flag = 0;
+
+ if (is_callable('object_notifications'))
+ if ($object instanceof ElggObject) {
+ if ($object->getSubtype() == 'videolist') {
+ if ($flag == 0) {
+ $flag = 1;
+ object_notifications($event, $object_type, $object);
+ }
+ }
+ }
}
- /**
- * Intercepts the notification on an event of new video being created and prevents a notification from going out
- * (because one will be sent on the annotation)
- *
- * @param unknown_type $hook
- * @param unknown_type $entity_type
- * @param unknown_type $returnvalue
- * @param unknown_type $params
- * @return unknown
- */
- function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
- if (isset($params)) {
- if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
- if ($params['object']->getSubtype() == 'videolist') {
- return true;
- }
- }
- }
- return null;
+ /**
+ * Intercepts the notification on an event of new video being created and prevents a notification from going out
+ * (because one will be sent on the annotation)
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
+ if (isset($params)) {
+ if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
+ if ($params['object']->getSubtype() == 'videolist') {
+ return true;
+ }
+ }
+ }
+ return null;
}
-
- // Register a handler for adding videos
- register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');
-
- // Register a handler for delete videos
+
+ // Register a handler for adding videos
+ register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');
+
+ // Register a handler for delete videos
register_elgg_event_handler('delete', 'videolist', 'videolist_delete_event_listener');
-
- // Make sure the status initialisation function is called on initialisation
- register_elgg_event_handler('init','system','videolist_init');
+
+ // Make sure the status initialisation function is called on initialisation
+ register_elgg_event_handler('init','system','videolist_init');
register_elgg_event_handler('pagesetup','system','videolist_pagesetup');
- register_elgg_event_handler('annotate','all','videolist_object_notifications');
+ register_elgg_event_handler('annotate','all','videolist_object_notifications');
- // Register actions
- global $CONFIG;
+ // Register actions
+ global $CONFIG;
register_action("videolist/addvideo", false, $CONFIG->pluginspath . "videolist/actions/addvideo.php");
register_action("videolist/tubesearch", false, $CONFIG->pluginspath . "videolist/actions/tubesearch.php");
//register_action("videolist/addcomment", false, $CONFIG->pluginspath . "videolist/actions/comments/add.php");
register_action("videolist/remove", false, $CONFIG->pluginspath . "videolist/actions/delete.php");
-
+
?>
diff --git a/views/default/forms/add.php b/views/default/forms/add.php
index f9837ede4..b387731f8 100644
--- a/views/default/forms/add.php
+++ b/views/default/forms/add.php
@@ -1,176 +1,176 @@
-
- * @copyright Prateek Choudhary
- */
-// Make sure we're logged in (send us to the front page if not)
- gatekeeper();
- $page_owner = page_owner_entity();
- $error = array(
- 'no-video' => 1
- );
- $error_msg = array(
- 'no-video' => "Please enter a valid video url"
- );
-
- $container_guid = get_input("container_guid");
- set_page_owner($container_guid);
-
- $confirm_action = get_input('video_action');
- $guid = get_input('guid');
- $access_id = get_input('access_id');
- $title_videourl = get_input('title_videourl');
- $Pagecontainer = get_input('page');
- $get_addvideourl = get_input('add_videourl');
- $timestamp = time();
- $token = generate_action_token(time());
- if(!empty($get_addvideourl) && ($Pagecontainer == "youtube"))
- $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
- else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe"))
- $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
- else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo"))
- $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
- else
- $title_add_videourl = "";
-
-
- $tags = get_input('videolisttags');
-
- function video_youtube_parse_url($url)
- {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches))
- {
- return false;
- }
-
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches))
- {
- return false;
- }
-
- $hash = $matches[2];
-
-
- return $domain . 'v/' . $hash;
- }
-
- function video_vimeo_parse_url($url)
- {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches))
- {
- return false;
- }
-
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- $hash = $matches[2];
-
-
- return $domain . '/' . $hash;
- }
-
- function video_metacafe_parse_url($url)
- {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches))
- {
- return false;
- }
-
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- $hash = $matches[2];
-
-
- return $domain . '/' . $hash;
- }
-
- if(isset($confirm_action) && ($confirm_action == 'add_video'))
- {
- if(isset($title_videourl) && ($title_videourl != ''))
- {
- if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
- if(preg_match("/youtube/i", $title_videourl))
- $Pagecontainer = "youtube";
- if(preg_match("/vimeo/i", $title_videourl))
- $Pagecontainer = "vimeo";
- if(preg_match("/metacafe/i", $title_videourl))
- $Pagecontainer = "metacafe";
- }
- if($Pagecontainer == "youtube")
- $is_valid_video = video_youtube_parse_url($title_videourl);
- else if($Pagecontainer == "vimeo"){
- $is_valid_video = video_vimeo_parse_url($title_videourl);
- $is_valid_video = $get_addvideourl;
- }
- else if($Pagecontainer == "metacafe"){
- $is_valid_video = video_metacafe_parse_url($title_videourl);
- $is_valid_video = $get_addvideourl;
- }
- if($is_valid_video)
- {
- $error['no-video'] = 1;
- $_SESSION['candidate_profile_video'] = $is_valid_video;
- $_SESSION['candidate_profile_video_access_id'] = $access_id;
- $_SESSION['videolisttags'] = $tags;
- $_SESSION['Pagecontainer'] = $Pagecontainer;
- $_SESSION['container_guid'] = $container_guid;
- //echo $_SESSION['candidate_profile_video'];
- $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}";
- forward($url);
- }
- else
- $error['no-video'] = 0;
- }
- else
- {
- $error['no-video'] = 0;
- }
- }
-
-
-
- $body = '';
-
- $body .= '
';
- $body .= '
';
-
- print $body." ";
-
-
-?>
-
-
+
+ * @copyright Prateek Choudhary
+ */
+// Make sure we're logged in (send us to the front page if not)
+ gatekeeper();
+ $page_owner = page_owner_entity();
+ $error = array(
+ 'no-video' => 1
+ );
+ $error_msg = array(
+ 'no-video' => "Please enter a valid video url"
+ );
+
+ $container_guid = get_input("container_guid");
+ set_page_owner($container_guid);
+
+ $confirm_action = get_input('video_action');
+ $guid = get_input('guid');
+ $access_id = get_input('access_id');
+ $title_videourl = get_input('title_videourl');
+ $Pagecontainer = get_input('page');
+ $get_addvideourl = get_input('add_videourl');
+ $timestamp = time();
+ $token = generate_action_token(time());
+ if(!empty($get_addvideourl) && ($Pagecontainer == "youtube"))
+ $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
+ else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe"))
+ $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
+ else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo"))
+ $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
+ else
+ $title_add_videourl = "";
+
+
+ $tags = get_input('videolisttags');
+
+ function video_youtube_parse_url($url)
+ {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches))
+ {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches))
+ {
+ return false;
+ }
+
+ $hash = $matches[2];
+
+
+ return $domain . 'v/' . $hash;
+ }
+
+ function video_vimeo_parse_url($url)
+ {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches))
+ {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+
+ return $domain . '/' . $hash;
+ }
+
+ function video_metacafe_parse_url($url)
+ {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches))
+ {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+
+ return $domain . '/' . $hash;
+ }
+
+ if(isset($confirm_action) && ($confirm_action == 'add_video'))
+ {
+ if(isset($title_videourl) && ($title_videourl != ''))
+ {
+ if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
+ if(preg_match("/youtube/i", $title_videourl))
+ $Pagecontainer = "youtube";
+ if(preg_match("/vimeo/i", $title_videourl))
+ $Pagecontainer = "vimeo";
+ if(preg_match("/metacafe/i", $title_videourl))
+ $Pagecontainer = "metacafe";
+ }
+ if($Pagecontainer == "youtube")
+ $is_valid_video = video_youtube_parse_url($title_videourl);
+ else if($Pagecontainer == "vimeo"){
+ $is_valid_video = video_vimeo_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ }
+ else if($Pagecontainer == "metacafe"){
+ $is_valid_video = video_metacafe_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ }
+ if($is_valid_video)
+ {
+ $error['no-video'] = 1;
+ $_SESSION['candidate_profile_video'] = $is_valid_video;
+ $_SESSION['candidate_profile_video_access_id'] = $access_id;
+ $_SESSION['videolisttags'] = $tags;
+ $_SESSION['Pagecontainer'] = $Pagecontainer;
+ $_SESSION['container_guid'] = $container_guid;
+ //echo $_SESSION['candidate_profile_video'];
+ $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}";
+ forward($url);
+ }
+ else
+ $error['no-video'] = 0;
+ }
+ else
+ {
+ $error['no-video'] = 0;
+ }
+ }
+
+
+
+ $body = '';
+
+ $body .= '
';
+ $body .= '
';
+
+ print $body." ";
+
+
+?>
+
+
diff --git a/views/default/forms/browsetube.php b/views/default/forms/browsetube.php
index 50fa7b164..601fb4e6a 100644
--- a/views/default/forms/browsetube.php
+++ b/views/default/forms/browsetube.php
@@ -1,257 +1,257 @@
-
- * @copyright Prateek Choudhary
- */
-
-$getcontainer_guid = get_input("container");
-$container_guid = explode(":", $getcontainer_guid);
-if($container_guid[0] == "group"){
- $container = $container_guid[1];
-}
-else{
- $container = $getcontainer_guid;
-}
- $error = array(
- 'no-search' => 1
- );
- $error_msg = array(
- 'no-search' => "Please enter a valid search term"
- );
- $browseCat = get_input('q');
- if(empty($browseCat) || !isset($browseCat))
- $browseCat = "youtube";
- $confirm_action = get_input('video_action');
-
- if(isset($confirm_action) && ($confirm_action == 'search_video'))
- {
- if(isset($title_search) && ($title_search != ''))
- $error['no-search'] = 0;
- else
- $error['no-search'] = 1;
- }
-
-
- //$body = '';
- //Load youtube menu
- $body .= "
";
- $body .= "
";
- $body .= "";
- $body .= "YouTube ";
- $body .= " ";
- $body .= "";
- $body .= "Metacafe ";
- $body .= " ";
- $body .= "";
- $body .= "Vimeo ";
- $body .= " ";
- /*
- $body .= "";
- $body .= "Google Videos ";
- $body .= " ";
- */
- $body .= " ";
- $body .= "
";
-
- $body .= "
";
-
- //$body .= "
";
- $body .= '';
- //$body .= '
';
- //$body .= '
';
-
- $body .= '';
- $body .= '
';
- $body .= '
';
- $body .= '
';
- $body .= '
';
- $body .= '
';
-
- print $body." ";
-
-
-?>
-
-
+
+ * @copyright Prateek Choudhary
+ */
+
+$getcontainer_guid = get_input("container");
+$container_guid = explode(":", $getcontainer_guid);
+if($container_guid[0] == "group"){
+ $container = $container_guid[1];
+}
+else{
+ $container = $getcontainer_guid;
+}
+ $error = array(
+ 'no-search' => 1
+ );
+ $error_msg = array(
+ 'no-search' => "Please enter a valid search term"
+ );
+ $browseCat = get_input('q');
+ if(empty($browseCat) || !isset($browseCat))
+ $browseCat = "youtube";
+ $confirm_action = get_input('video_action');
+
+ if(isset($confirm_action) && ($confirm_action == 'search_video'))
+ {
+ if(isset($title_search) && ($title_search != ''))
+ $error['no-search'] = 0;
+ else
+ $error['no-search'] = 1;
+ }
+
+
+ //$body = '';
+ //Load youtube menu
+ $body .= "
";
+ $body .= "
";
+ $body .= "";
+ $body .= "YouTube ";
+ $body .= " ";
+ $body .= "";
+ $body .= "Metacafe ";
+ $body .= " ";
+ $body .= "";
+ $body .= "Vimeo ";
+ $body .= " ";
+ /*
+ $body .= "";
+ $body .= "Google Videos ";
+ $body .= " ";
+ */
+ $body .= " ";
+ $body .= "
";
+
+ $body .= "
";
+
+ //$body .= "
";
+ $body .= '';
+ //$body .= '
';
+ //$body .= '
';
+
+ $body .= '';
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+ $body .= '
';
+
+ print $body." ";
+
+
+?>
+
+
diff --git a/views/default/forms/labels/googlevideos.php b/views/default/forms/labels/googlevideos.php
index de263c1c9..76673c10b 100644
--- a/views/default/forms/labels/googlevideos.php
+++ b/views/default/forms/labels/googlevideos.php
@@ -1,13 +1,13 @@
- * @copyright Prateek Choudhary
+ /**
+ * Elgg User Profile Video Plugin
+ * This plugin allows users to browse youtube videos
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
$body = ''.elgg_echo("videolist:title_search_tube").' ';
@@ -27,7 +27,7 @@
//$body .= ' ';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
//$body .= "
";
- $body .= "";
+ $body .= "";
$body .= '
';
$body .= 'Loading...
';
print $body;
diff --git a/views/default/forms/labels/metacafe.php b/views/default/forms/labels/metacafe.php
index 79e87d1be..7003b6743 100644
--- a/views/default/forms/labels/metacafe.php
+++ b/views/default/forms/labels/metacafe.php
@@ -1,13 +1,13 @@
- * @copyright Prateek Choudhary
+ /**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ * @file - load metacafe label
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
$body = ''.elgg_echo("videolist:title_search_tube").' ';
@@ -27,7 +27,7 @@
//$body .= ' ';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:metacafe')));
//$body .= "";
- $body .= "";
+ $body .= "";
$body .= '
';
print $body;
diff --git a/views/default/forms/labels/vimeo.php b/views/default/forms/labels/vimeo.php
index e5cf21235..6a15909b4 100644
--- a/views/default/forms/labels/vimeo.php
+++ b/views/default/forms/labels/vimeo.php
@@ -1,13 +1,13 @@
- * @copyright Prateek Choudhary
+ * @file - load vimeo label
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
$body = ''.elgg_echo("videolist:title_search_tube").' ';
@@ -27,7 +27,7 @@
//$body .= ' ';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
//$body .= "";
- $body .= "";
+ $body .= "";
$body .= '
';
print $body;
diff --git a/views/default/forms/labels/youtube.php b/views/default/forms/labels/youtube.php
index 40be100ee..4ec53b27a 100644
--- a/views/default/forms/labels/youtube.php
+++ b/views/default/forms/labels/youtube.php
@@ -1,13 +1,13 @@
- * @copyright Prateek Choudhary
+ /**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ * @file - load youtube label
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
$body = ''.elgg_echo("videolist:title_search_tube").' ';
@@ -27,7 +27,7 @@
//$body .= ' ';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos')));
//$body .= "";
- $body .= "";
+ $body .= "";
$body .= '
';
print $body;
diff --git a/views/default/object/watch.php b/views/default/object/watch.php
index c33a7b988..9b3de9626 100644
--- a/views/default/object/watch.php
+++ b/views/default/object/watch.php
@@ -1,45 +1,45 @@
-
- * @copyright Prateek Choudhary
- */
-$videodiv = '';
-$width = "600";
-$height = "400";
-$file = $vars['entity'];
-if(isset($vars['entity']))
-{
-
-$videos = get_entity($vars['entity']);
-$title = $videos->title;
-$url = $videos->url;
-$videoid = $videos->video_id;
-$videodiv = "".$title." ";
-if($videos->videotype == "youtube"){
- $videodiv .= "";
-}
-else if($videos->videotype == "metacafe"){
- $videoid_id = $videoid;
- $path = explode("/", $videos->thumbnail);
- $path = array_reverse($path);
- $thumbnailArray = explode(".", $path[0]);
- $videoid = $videoid_id."/".$thumbnailArray[0].".swf";
- $videodiv .= "
";
-
-}
-else if($videos->videotype == "vimeo"){
- $videodiv .= "
";
-$videodiv .= elgg_view_likes($videos);
-$videodiv .= elgg_view_comments($videos);
-print $videodiv;
-
-//echo elgg_view_comments($videos);
-}
-?>
+
+ * @copyright Prateek Choudhary
+ */
+$videodiv = '';
+$width = "600";
+$height = "400";
+$file = $vars['entity'];
+if(isset($vars['entity']))
+{
+
+$videos = get_entity($vars['entity']);
+$title = $videos->title;
+$url = $videos->url;
+$videoid = $videos->video_id;
+$videodiv = "
".$title." ";
+if($videos->videotype == "youtube"){
+ $videodiv .= "
";
+}
+else if($videos->videotype == "metacafe"){
+ $videoid_id = $videoid;
+ $path = explode("/", $videos->thumbnail);
+ $path = array_reverse($path);
+ $thumbnailArray = explode(".", $path[0]);
+ $videoid = $videoid_id."/".$thumbnailArray[0].".swf";
+ $videodiv .= "
";
+
+}
+else if($videos->videotype == "vimeo"){
+ $videodiv .= "
";
+$videodiv .= elgg_view_likes($videos);
+$videodiv .= elgg_view_comments($videos);
+print $videodiv;
+
+//echo elgg_view_comments($videos);
+}
+?>
diff --git a/views/default/river/object/videolist/annotate.php b/views/default/river/object/videolist/annotate.php
index d243c7ef3..6c03d4445 100644
--- a/views/default/river/object/videolist/annotate.php
+++ b/views/default/river/object/videolist/annotate.php
@@ -1,13 +1,13 @@
-getSubject();
- $object = $statement->getObject();
-
- $url = "
getURL()}\">{$performed_by->name} ";
- $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " ";
- $string .= "
getURL() . "\">" . elgg_echo("videolist:river:item") . " ";
-
- echo $string;
-
+getSubject();
+ $object = $statement->getObject();
+
+ $url = "
getURL()}\">{$performed_by->name} ";
+ $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " ";
+ $string .= "
getURL() . "\">" . elgg_echo("videolist:river:item") . " ";
+
+ echo $string;
+
?>
diff --git a/views/default/river/object/videolist/create.php b/views/default/river/object/videolist/create.php
index 061d01dd5..0ed570378 100644
--- a/views/default/river/object/videolist/create.php
+++ b/views/default/river/object/videolist/create.php
@@ -1,18 +1,18 @@
-subject_guid); // $statement->getSubject();
- $object = get_entity($vars['item']->object_guid);
- $thumbnail = $object->thumbnail;
- //$url = $object->getURL();
-
- $url = "
getURL()}\">{$performed_by->name} ";
- $title = $object->title;
- if(!$title)
- $title = "untitled";
- $string = sprintf(elgg_echo("videolist:river:created"),$url) . " ";
- $string .= elgg_echo("videolist:river:item") . " titled
getURL() . "\">" . $title . " ";
- $string .= "
";
- $string .= "
getURL() . "\"> ";
- $string .= "
";
-
+subject_guid); // $statement->getSubject();
+ $object = get_entity($vars['item']->object_guid);
+ $thumbnail = $object->thumbnail;
+ //$url = $object->getURL();
+
+ $url = "
getURL()}\">{$performed_by->name} ";
+ $title = $object->title;
+ if(!$title)
+ $title = "untitled";
+ $string = sprintf(elgg_echo("videolist:river:created"),$url) . " ";
+ $string .= elgg_echo("videolist:river:item") . " titled
getURL() . "\">" . $title . " ";
+ $string .= "
";
+ $string .= "
getURL() . "\"> ";
+ $string .= "
";
+
echo $string;
\ No newline at end of file
diff --git a/views/default/staticvideo/index.php b/views/default/staticvideo/index.php
index a95625f3c..1b32f316b 100644
--- a/views/default/staticvideo/index.php
+++ b/views/default/staticvideo/index.php
@@ -1,12 +1,12 @@
- * @copyright Prateek Choudhary
+/**
+ * Elgg Candidate Profile Plugin - file search.php
+ * This plugin allows users to create custom candidate profile
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
diff --git a/views/default/videolist/css.php b/views/default/videolist/css.php
index 76f23941d..8c52b0e6c 100644
--- a/views/default/videolist/css.php
+++ b/views/default/videolist/css.php
@@ -1,199 +1,199 @@
-
- * @copyright Prateek Choudhary
- */
-
-
-?>
-
-.error{
-color:red;
-font-weight:bold;
-font-size:11px;
-}
-#video-list-main{
-padding:10px;
-}
-#videocontainer{
-width:100%;
-margin-bottom:10px;
-}
-.search_gallery_item{
-border:0px solid #CCCCCC;
-}
-#videobox{
-width:98%;
-text-align:center;
-margin-top:10px;
-}
-#videoDescbox{
-width:95%;
-margin:0px 5px 0px 8px;
-}
-#videoActionbox{
-width:90%;
-margin:0px 5px 0px 8px;
-float:left;
-}
-#videothumbnail-box{
-float:left;
-width:35%;
-background: #333333;
-text-align:center;
-padding:3px 1px 3px 0px;
-}
-#videotitle-box{
-width:60%;
-float:left;
-font-size:12px;
-font-weight:bold;
-text-align:left;
-padding-left:5px;
-color:#474B9F;
-}
-.title{
-font-weight:bold;
-}
-#profile_video_widget_container{
-margin:0px 10px 10px 10px;
-padding:8px;
--moz-border-radius-topleft:8px;
--moz-border-radius-topright:8px;
--moz-border-radius-bottomleft:8px;
--moz-border-radius-bottomright:8px;
-border:0px solid #C3C3C3;
-background: #FFFFFF;
-max-height:250px;
-overflow-y:auto;
-}
-#profile_video_image_container{
-float:left;
-width:95%;
-margin:6px 2px 0px 6px;
-border-bottom:1px solid #CCC;
-padding-bottom:3px;
-}
-
-#widget_container_header{
-color:#474B9F;
-margin:0px 0px 5px 0px;
-font-weight:bold;
-font-size:13px;
-}
-#loadingSearch{
-width:100%;
-}
-#SearchContainer{
-width:100%;
-}
-#responseSearch{
-padding:15px;
-}
-#paginateSearch{
--moz-border-radius-topleft:5px;
--moz-border-radius-topright:5px;
-padding:2px 5px 2px 0px;
-text-align:right;
-background:#FFF;
-border:0px solid #CCC;
-color:#666;
-}
-th{
-text-align:center;
-font-weight:bold;
-font-size:13px;
-}
-#parentTab{
--moz-border-radius-bottomleft:8px;
--moz-border-radius-bottomright:8px;
--moz-border-radius-topleft:8px;
--moz-border-radius-topright:8px;
-border-top:1px solid #CCC;
-border-bottom:6px solid #CCC;
-border-left:1px solid #CCC;
-border-right:5px solid #CCC;
-background:#FFFFFF;
-margin-top:7px;
-}
-.tabcellDesc{
-padding:5px 5px 5px 10px;
-text-align: left;
-}
-.tabcellText{
-padding:5px;
-text-align: center;
-}
-.videoDisp{
-position:absolute;
--moz-border-radius-topleft:5px;
--moz-border-radius-topright:5px;
--moz-border-radius-bottomleft:5px;
--moz-border-radius-bottomright:5px;
-border:1px solid #000000;
-display:none;
-padding:10px;
-margin-left:120px;
-margin-top:-100px;
-background:#FFFFFF;
-z-index:300000;
-}
-.videolist-content{
--moz-border-radius-topleft:5px;
--moz-border-radius-topright:5px;
--moz-border-radius-bottomleft:5px;
--moz-border-radius-bottomright:5px;
-border:1px solid #C3C3C3;
-width:675px;
-margin:10px 0px 10px 10px;
-padding:10px;
-background:#FFFFFF;
-}
-.tubesearch{
--moz-border-radius-topleft:5px;
--moz-border-radius-topright:5px;
--moz-border-radius-bottomleft:5px;
--moz-border-radius-bottomright:5px;
-border:1px solid #666666;
-}
-#comment_area_video_title{
-padding:10px;
--moz-border-radius-topleft:5px;
--moz-border-radius-topright:5px;
--moz-border-radius-bottomleft:5px;
--moz-border-radius-bottomright:5px;
-border:1px solid #CCCCCC;
-border:1px solid #CCCCCC;
-background:#FFFFFF;
-}
-.vid-comment-widget{
-font-size:11px;
-font-weight:normal;
-}
-.searchvideorow{
-padding:10px;
--moz-border-radius-topleft:5px;
--moz-border-radius-topright:5px;
--moz-border-radius-bottomleft:5px;
--moz-border-radius-bottomright:5px;
-border:1px solid #CCCCCC;
-}
-#videosearch-tablecontainer{
--moz-border-radius-bottomleft:5px;
--moz-border-radius-bottomright:5px;
-border:1px solid #CCCCCC;
-background:#FFF;
-padding:10px;
-}
-#videosearch-interface{
-border-color:#CCCCCC;
-border-style:solid;
-border-width:0 1px 1px;
-margin-top:-15px;
-padding:15px 0 15px 20px;
-}
+
+ * @copyright Prateek Choudhary
+ */
+
+
+?>
+
+.error{
+color:red;
+font-weight:bold;
+font-size:11px;
+}
+#video-list-main{
+padding:10px;
+}
+#videocontainer{
+width:100%;
+margin-bottom:10px;
+}
+.search_gallery_item{
+border:0px solid #CCCCCC;
+}
+#videobox{
+width:98%;
+text-align:center;
+margin-top:10px;
+}
+#videoDescbox{
+width:95%;
+margin:0px 5px 0px 8px;
+}
+#videoActionbox{
+width:90%;
+margin:0px 5px 0px 8px;
+float:left;
+}
+#videothumbnail-box{
+float:left;
+width:35%;
+background: #333333;
+text-align:center;
+padding:3px 1px 3px 0px;
+}
+#videotitle-box{
+width:60%;
+float:left;
+font-size:12px;
+font-weight:bold;
+text-align:left;
+padding-left:5px;
+color:#474B9F;
+}
+.title{
+font-weight:bold;
+}
+#profile_video_widget_container{
+margin:0px 10px 10px 10px;
+padding:8px;
+-moz-border-radius-topleft:8px;
+-moz-border-radius-topright:8px;
+-moz-border-radius-bottomleft:8px;
+-moz-border-radius-bottomright:8px;
+border:0px solid #C3C3C3;
+background: #FFFFFF;
+max-height:250px;
+overflow-y:auto;
+}
+#profile_video_image_container{
+float:left;
+width:95%;
+margin:6px 2px 0px 6px;
+border-bottom:1px solid #CCC;
+padding-bottom:3px;
+}
+
+#widget_container_header{
+color:#474B9F;
+margin:0px 0px 5px 0px;
+font-weight:bold;
+font-size:13px;
+}
+#loadingSearch{
+width:100%;
+}
+#SearchContainer{
+width:100%;
+}
+#responseSearch{
+padding:15px;
+}
+#paginateSearch{
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+padding:2px 5px 2px 0px;
+text-align:right;
+background:#FFF;
+border:0px solid #CCC;
+color:#666;
+}
+th{
+text-align:center;
+font-weight:bold;
+font-size:13px;
+}
+#parentTab{
+-moz-border-radius-bottomleft:8px;
+-moz-border-radius-bottomright:8px;
+-moz-border-radius-topleft:8px;
+-moz-border-radius-topright:8px;
+border-top:1px solid #CCC;
+border-bottom:6px solid #CCC;
+border-left:1px solid #CCC;
+border-right:5px solid #CCC;
+background:#FFFFFF;
+margin-top:7px;
+}
+.tabcellDesc{
+padding:5px 5px 5px 10px;
+text-align: left;
+}
+.tabcellText{
+padding:5px;
+text-align: center;
+}
+.videoDisp{
+position:absolute;
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #000000;
+display:none;
+padding:10px;
+margin-left:120px;
+margin-top:-100px;
+background:#FFFFFF;
+z-index:300000;
+}
+.videolist-content{
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #C3C3C3;
+width:675px;
+margin:10px 0px 10px 10px;
+padding:10px;
+background:#FFFFFF;
+}
+.tubesearch{
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #666666;
+}
+#comment_area_video_title{
+padding:10px;
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #CCCCCC;
+border:1px solid #CCCCCC;
+background:#FFFFFF;
+}
+.vid-comment-widget{
+font-size:11px;
+font-weight:normal;
+}
+.searchvideorow{
+padding:10px;
+-moz-border-radius-topleft:5px;
+-moz-border-radius-topright:5px;
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #CCCCCC;
+}
+#videosearch-tablecontainer{
+-moz-border-radius-bottomleft:5px;
+-moz-border-radius-bottomright:5px;
+border:1px solid #CCCCCC;
+background:#FFF;
+padding:10px;
+}
+#videosearch-interface{
+border-color:#CCCCCC;
+border-style:solid;
+border-width:0 1px 1px;
+margin-top:-15px;
+padding:15px 0 15px 20px;
+}
diff --git a/views/default/videolist/groupprofile_videolist.php b/views/default/videolist/groupprofile_videolist.php
index 279f2af81..1df34a7b2 100644
--- a/views/default/videolist/groupprofile_videolist.php
+++ b/views/default/videolist/groupprofile_videolist.php
@@ -1,62 +1,62 @@
-
- * @copyright Prateek Choudhary
+
+ * @copyright Prateek Choudhary
*/
?>
-
diff --git a/views/default/videolist/notfound.php b/views/default/videolist/notfound.php
index 79df22779..ec69b700c 100644
--- a/views/default/videolist/notfound.php
+++ b/views/default/videolist/notfound.php
@@ -1,21 +1,21 @@
-
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
-?>
-
-
-
+
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+?>
+
+
+
diff --git a/views/default/widgets/videolist_view/edit.php b/views/default/widgets/videolist_view/edit.php
index ec5b34bae..936d37c34 100644
--- a/views/default/widgets/videolist_view/edit.php
+++ b/views/default/widgets/videolist_view/edit.php
@@ -1,21 +1,21 @@
-
- :
-
-
- if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;
- ?>
-
- num_display == 1) echo "SELECTED"; ?>>1
- num_display == 2) echo "SELECTED"; ?>>2
- num_display == 3) echo "SELECTED"; ?>>3
- num_display == 4) echo "SELECTED"; ?>>4
- num_display == 5) echo "SELECTED"; ?>>5
- num_display == 6) echo "SELECTED"; ?>>6
- num_display == 7) echo "SELECTED"; ?>>7
- num_display == 8) echo "SELECTED"; ?>>8
- num_display == 9) echo "SELECTED"; ?>>9
- num_display == 10) echo "SELECTED"; ?>>10
- num_display == 15) echo "SELECTED"; ?>>15
- num_display == 20) echo "SELECTED"; ?>>20
-
-
+
+ :
+
+
+ if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;
+ ?>
+
+ num_display == 1) echo "SELECTED"; ?>>1
+ num_display == 2) echo "SELECTED"; ?>>2
+ num_display == 3) echo "SELECTED"; ?>>3
+ num_display == 4) echo "SELECTED"; ?>>4
+ num_display == 5) echo "SELECTED"; ?>>5
+ num_display == 6) echo "SELECTED"; ?>>6
+ num_display == 7) echo "SELECTED"; ?>>7
+ num_display == 8) echo "SELECTED"; ?>>8
+ num_display == 9) echo "SELECTED"; ?>>9
+ num_display == 10) echo "SELECTED"; ?>>10
+ num_display == 15) echo "SELECTED"; ?>>15
+ num_display == 20) echo "SELECTED"; ?>>20
+
+
diff --git a/views/default/widgets/videolist_view/view.php b/views/default/widgets/videolist_view/view.php
index 889ee5726..aac2a288b 100644
--- a/views/default/widgets/videolist_view/view.php
+++ b/views/default/widgets/videolist_view/view.php
@@ -1,12 +1,12 @@
- * @copyright Prateek Choudhary
+/**
+ * Elgg Videolist Plugin
+ * This plugin allows users to create a library of youtube videos
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
*/
diff --git a/views/rss/videolist/contentwrapper.php b/views/rss/videolist/contentwrapper.php
index b967ab371..c8e2438d5 100644
--- a/views/rss/videolist/contentwrapper.php
+++ b/views/rss/videolist/contentwrapper.php
@@ -1,15 +1,15 @@
-
- * @copyright Prateek Choudhary
+
+ * @copyright Prateek Choudhary
*/
-
- echo $vars['body'];
-
+
+ echo $vars['body'];
+
?>
diff --git a/views/rss/videolist/videolist.php b/views/rss/videolist/videolist.php
index f88300d98..86ea686ba 100644
--- a/views/rss/videolist/videolist.php
+++ b/views/rss/videolist/videolist.php
@@ -1,17 +1,17 @@
-
- * @copyright Prateek Choudhary
+
+ * @copyright Prateek Choudhary
*/
-
- if ($foreach = get_entities('object','',$vars['entity']->guid)) {
- foreach($foreach as $videos)
- echo elgg_view_entity($videos);
- }
-
+
+ if ($foreach = get_entities('object','',$vars['entity']->guid)) {
+ foreach($foreach as $videos)
+ echo elgg_view_entity($videos);
+ }
+
?>
diff --git a/watch.php b/watch.php
index 6d0542a2f..982bb8851 100644
--- a/watch.php
+++ b/watch.php
@@ -1,44 +1,44 @@
-
- * @copyright Prateek Choudhary
- */
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-
- // Get objects
- $video_id = (int) get_input('video_id');
-
- // If we can get out the video corresponding to video_id object ...
- if ($videos = get_entity($video_id)) {
- set_page_owner($videos->container_guid);
- $videos_container = get_entity($videos->container_guid);
- if($videos_container->type == "group")
- set_context("groupsvideos");
- $page_owner = page_owner_entity();
- $title = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name);
- // Display it
- $area2 = elgg_view("object/watch",array(
- 'entity' => $video_id,
- 'entity_owner' => $page_owner,
- 'full' => true
- ));
- //$area2 .= elgg_view("videolist/comments", array('entity' => $videos));
- $body = elgg_view_layout("one_column_with_sidebar", $area1 . $area2);
- }
- else
- {
- // Display the 'post not found' page instead
- $body = elgg_view("videolist/notfound");
- $title = elgg_echo("video:none");
-
- }
- // Finally draw the page
- page_draw($title, $body);
-?>
+
+ * @copyright Prateek Choudhary
+ */
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+
+ // Get objects
+ $video_id = (int) get_input('video_id');
+
+ // If we can get out the video corresponding to video_id object ...
+ if ($videos = get_entity($video_id)) {
+ set_page_owner($videos->container_guid);
+ $videos_container = get_entity($videos->container_guid);
+ if($videos_container->type == "group")
+ set_context("groupsvideos");
+ $page_owner = page_owner_entity();
+ $title = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name);
+ // Display it
+ $area2 = elgg_view("object/watch",array(
+ 'entity' => $video_id,
+ 'entity_owner' => $page_owner,
+ 'full' => true
+ ));
+ //$area2 .= elgg_view("videolist/comments", array('entity' => $videos));
+ $body = elgg_view_layout("one_column_with_sidebar", $area1 . $area2);
+ }
+ else
+ {
+ // Display the 'post not found' page instead
+ $body = elgg_view("videolist/notfound");
+ $title = elgg_echo("video:none");
+
+ }
+ // Finally draw the page
+ page_draw($title, $body);
+?>
diff --git a/world.php b/world.php
index 57af731de..34817bc5b 100644
--- a/world.php
+++ b/world.php
@@ -1,38 +1,38 @@
-
- * @copyright Prateek Choudhary
- */
-// Render the video upload page
- // Load Elgg engine
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
-
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
-
- $title = sprintf(elgg_echo("videolist:search"));
-
- // Get objects
- $area2 = elgg_view_title($title);
- set_input('show_viewtype', 'all');
- $area2 .= list_entities("object","videolist", 0, 10, $fullview=true, $viewtypetoggle=false,$pagination=true);
-
- //$area2 .= elgg_view("staticvideo/index");
-
- set_context('videolist');
- $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
-
- // Finally draw the page
- page_draw($title, $body);
-
-?>
+
+ * @copyright Prateek Choudhary
+ */
+// Render the video upload page
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+ $title = sprintf(elgg_echo("videolist:search"));
+
+ // Get objects
+ $area2 = elgg_view_title($title);
+ set_input('show_viewtype', 'all');
+ $area2 .= list_entities("object","videolist", 0, 10, $fullview=true, $viewtypetoggle=false,$pagination=true);
+
+ //$area2 .= elgg_view("staticvideo/index");
+
+ set_context('videolist');
+ $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
+
+ // Finally draw the page
+ page_draw($title, $body);
+
+?>
--
cgit v1.2.3
From 52255de580654f351205b19565be601bd4caaacb Mon Sep 17 00:00:00 2001
From: Brett Profitt
Date: Fri, 26 Mar 2010 22:44:48 +0000
Subject: First pass at cleaning up videolist.
---
actions/addvideo.php | 327 +-
actions/comments_delete/add.php | 97 +-
actions/delete.php | 71 +-
actions/save.php | 23 +-
actions/tubesearch.php | 522 +-
browse.php | 75 +-
index.php | 82 +-
languages/en.php | 106 +-
manifest.xml | 12 +-
models/lib/class.vimeo.php | 5122 ++++++++++----------
new.php | 84 +-
start.php | 387 +-
views/default/forms/add.php | 322 +-
views/default/forms/browsetube.php | 355 +-
views/default/forms/labels/googlevideos.php | 60 +-
views/default/forms/labels/metacafe.php | 60 +-
views/default/forms/labels/vimeo.php | 60 +-
views/default/forms/labels/youtube.php | 60 +-
views/default/object/videolist.php | 168 +-
views/default/object/watch.php | 59 +-
views/default/river/object/videolist/annotate.php | 18 +-
views/default/river/object/videolist/create.php | 33 +-
views/default/staticvideo/index.php | 34 +-
views/default/videolist/css.php | 270 +-
views/default/videolist/groupprofile_videolist.php | 96 +-
views/default/videolist/icon.php | 41 +-
views/default/videolist/notfound.php | 30 +-
views/default/widgets/videolist_view/edit.php | 40 +-
views/default/widgets/videolist_view/view.php | 108 +-
watch.php | 76 +-
world.php | 65 +-
31 files changed, 4383 insertions(+), 4480 deletions(-)
diff --git a/actions/addvideo.php b/actions/addvideo.php
index 40c231518..8be09ca3a 100644
--- a/actions/addvideo.php
+++ b/actions/addvideo.php
@@ -1,19 +1,19 @@
- * @copyright Prateek Choudhary
- */
-
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
+
// Make sure we're logged in (send us to the front page if not)
gatekeeper();
-// Get the current page's owner
+// Get the current page's owner
set_page_owner($_SESSION['container_guid']);
$page_owner = page_owner_entity();
@@ -23,194 +23,193 @@ if ($page_owner === false || is_null($page_owner)) {
set_page_owner($_SESSION['guid']);
}
-if($page_owner->type == "group")
+if($page_owner->type == "group") {
$entity_referer = $page_owner->type.":".$page_owner->getGUID();
-else
+} else {
$entity_referer = $page_owner->username;
+}
require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
function fetchyoutubeDatatitle($videoid){
- $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
- /**
- ** generate XML View
+ $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
+ /**
+ ** generate XML View
**/
$xml_buffer = new SimpleXMLElement($buffer);
- $vidDataTitle = $xml_buffer->video_details->title;
- return $vidDataTitle;
- //return "";
+ $vidDataTitle = $xml_buffer->video_details->title;
+ return $vidDataTitle;
+ //return "";
}
function fetchyoutubeDatadesc($videoid){
- $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
- /**
- ** generate XML View
- **/
- $xml_buffer = new SimpleXMLElement($buffer);
- $vidDataDesc = $xml_buffer->video_details->description;
- return $vidDataDesc;
- //return "";
+ $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);
+ /**
+ ** generate XML View
+ **/
+ $xml_buffer = new SimpleXMLElement($buffer);
+ $vidDataDesc = $xml_buffer->video_details->description;
+ return $vidDataDesc;
+ //return "";
}
function getVimeoInfoDataTitle($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- $title = $aoVideos->getTitle();
- return $title;
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ $title = $aoVideos->getTitle();
+ return $title;
}
function getVimeoInfoDataDesc($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- $description = $aoVideos->getCaption();
- return $description;
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ $description = $aoVideos->getCaption();
+ return $description;
}
function getVimeoInfoImage($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- //get all thumbnails
-
- $aThumbnails = array();
- foreach($aoVideos->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
-
- return $thumbnail;
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideo();
+ //get all thumbnails
+
+ $aThumbnails = array();
+ foreach($aoVideos->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
+ }
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+
+ return $thumbnail;
}
function fetchyoutubeDatathumbnail($videoId){
- $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";
- return $thumbnail;
+ $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";
+ return $thumbnail;
}
function metacafeFetchData($getVideoId){
- $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $myitem = $sxml->getElementsByTagName('item');
- return $myitem;
+ $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $myitem = $sxml->getElementsByTagName('item');
+ return $myitem;
}
function fetchmetacafeTitle($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
- }
- return $valueTitle;
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+ }
+ return $valueTitle;
}
function fetchmetacafeDesc($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
- }
- return $desc_src;
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+ }
+ return $desc_src;
}
function fetchmetacafeImg($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
- $pattern = '/ ]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
- }
- }
- return $thumbnail;
-}
-
- $pageContainer = $_SESSION['Pagecontainer'];
-
-
- // Initialise a new ElggObject
- $videolist = new ElggObject();
- // Tell the system it's a blog post
- $videolist->subtype = "videolist";
- // Set its owner to the current user
- $videolist->owner_guid = $_SESSION['user']->getGUID();
-
- // Set container of the video whether it was uploaded to groups or profile
- $videolist->container_guid = $_SESSION['container_guid'];
- // For now, set its access to public (we'll add an access dropdown shortly)
- $videolist->access_id = $_SESSION['candidate_profile_video_access_id'];
-
- // In order to Set its title and description appropriately WE need the video ID
- $videolist->url = $_SESSION['candidate_profile_video'];
-
- if($pageContainer == "youtube"){
- $videoIDArray = split("/v/", $videolist->url);
- $videolist->video_id = $videoIDArray[1];
- // Now set the video title and description appropriately
- $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);
- $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);
- $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);
- $videolist->videotype = "youtube";
- }
- else if($pageContainer == "metacafe"){
- $videolist->video_id = $_SESSION['candidate_profile_video'];
- // Now set the video title and description appropriately
- $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);
- $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);
- $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);
- $videolist->videotype = "metacafe";
- }
- else if($pageContainer == "vimeo"){
- $videolist->video_id = $_SESSION['candidate_profile_video'];
-
- // Now set the video title and description appropriately
- $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);
- $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);
- $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);
- $videolist->videotype = "vimeo";
- }
-
- // Before we can set metadata, we need to save the blog post
- if (!$videolist->save()) {
- register_error(elgg_echo("videolist:error"));
- forward("pg/videolist/new");
- }
- //add video tags
- $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);
- if (is_array($videolist_tags_array)) {
- $videolist->tags = $videolist_tags_array;
- }
-
- // add to river
- add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);
-
- // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
- // Success message
- system_message(elgg_echo("videolist:posted"));
- // Remove the videolist cache
- unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
- unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);
- // Forward to the main videolist page
-
-forward("pg/videolist/owned/".page_owner_entity()->username);
+ $myitem = metacafeFetchData($getVideoId);
+ foreach($myitem as $searchNode){
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+ $pattern = '/ ]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+ }
+ return $thumbnail;
+}
+
+$pageContainer = $_SESSION['Pagecontainer'];
+
+// Initialise a new ElggObject
+$videolist = new ElggObject();
+// Tell the system it's a blog post
+$videolist->subtype = "videolist";
+// Set its owner to the current user
+$videolist->owner_guid = $_SESSION['user']->getGUID();
+
+// Set container of the video whether it was uploaded to groups or profile
+$videolist->container_guid = $_SESSION['container_guid'];
+// For now, set its access to public (we'll add an access dropdown shortly)
+$videolist->access_id = $_SESSION['candidate_profile_video_access_id'];
+
+// In order to Set its title and description appropriately WE need the video ID
+$videolist->url = $_SESSION['candidate_profile_video'];
+
+if($pageContainer == "youtube"){
+ $videoIDArray = split("/v/", $videolist->url);
+ $videolist->video_id = $videoIDArray[1];
+ // Now set the video title and description appropriately
+ $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);
+ $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);
+ $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);
+ $videolist->videotype = "youtube";
+}
+else if($pageContainer == "metacafe"){
+ $videolist->video_id = $_SESSION['candidate_profile_video'];
+ // Now set the video title and description appropriately
+ $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);
+ $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);
+ $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);
+ $videolist->videotype = "metacafe";
+}
+else if($pageContainer == "vimeo"){
+ $videolist->video_id = $_SESSION['candidate_profile_video'];
+
+ // Now set the video title and description appropriately
+ $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);
+ $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);
+ $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);
+ $videolist->videotype = "vimeo";
+}
+
+// Before we can set metadata, we need to save the blog post
+if (!$videolist->save()) {
+ register_error(elgg_echo("videolist:error"));
+ forward("pg/videolist/new");
+}
+//add video tags
+$videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);
+if (is_array($videolist_tags_array)) {
+ $videolist->tags = $videolist_tags_array;
+}
+
+// add to river
+add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);
+
+// add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
+// Success message
+system_message(elgg_echo("videolist:posted"));
// Remove the videolist cache
- unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
- unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);
+unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
+unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);
+// Forward to the main videolist page
-?>
+forward("pg/videolist/owned/".page_owner_entity()->username);
+
+// Remove the videolist cache
+unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
+unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);
diff --git a/actions/comments_delete/add.php b/actions/comments_delete/add.php
index d65e6c05b..209561e04 100644
--- a/actions/comments_delete/add.php
+++ b/actions/comments_delete/add.php
@@ -1,58 +1,51 @@
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.org/
- */
+/**
+ * Elgg add comment action
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
- // Make sure we're logged in; forward to the front page if not
- gatekeeper();
- action_gatekeeper();
-
- // Get input
- $entity_guid = (int) get_input('entity_guid');
- $comment_text = get_input('generic_comment');
-
- // Let's see if we can get an entity with the specified GUID
- if ($entity = get_entity($entity_guid)) {
-
- // If posting the comment was successful, say so
- if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
-
- if ($entity->owner_guid != $_SESSION['user']->getGUID())
- notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
- sprintf(
- elgg_echo('generic_comment:email:body'),
- $entity->title,
- $_SESSION['user']->name,
- $comment_text,
- $entity->getURL(),
- $_SESSION['user']->name,
- $_SESSION['user']->getURL()
- )
- );
-
- system_message(elgg_echo("generic_comment:posted"));
- //add to river
- add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
+// Make sure we're logged in; forward to the front page if not
+gatekeeper();
+action_gatekeeper();
-
- } else {
- register_error(elgg_echo("generic_comment:failure"));
- }
-
- } else {
-
- register_error(elgg_echo("generic_comment:notfound"));
-
+// Get input
+$entity_guid = (int) get_input('entity_guid');
+$comment_text = get_input('generic_comment');
+
+// Let's see if we can get an entity with the specified GUID
+if ($entity = get_entity($entity_guid)) {
+ // If posting the comment was successful, say so
+ if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
+
+ if ($entity->owner_guid != $_SESSION['user']->getGUID()) {
+ notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
+ sprintf(
+ elgg_echo('generic_comment:email:body'),
+ $entity->title,
+ $_SESSION['user']->name,
+ $comment_text,
+ $entity->getURL(),
+ $_SESSION['user']->name,
+ $_SESSION['user']->getURL()
+ )
+ );
}
-
- // Forward to the
- forward($_SERVER['HTTP_REFERER']);
-?>
+ system_message(elgg_echo("generic_comment:posted"));
+ //add to river
+ add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
+ } else {
+ register_error(elgg_echo("generic_comment:failure"));
+ }
+} else {
+ register_error(elgg_echo("generic_comment:notfound"));
+}
+
+// Forward to the
+forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
diff --git a/actions/delete.php b/actions/delete.php
index 3b5b6ddde..e98e81b67 100644
--- a/actions/delete.php
+++ b/actions/delete.php
@@ -1,44 +1,41 @@
- * @copyright Prateek Choudhary
- */
+ * Elgg Videolist Plugin -
+ * This plugin allows users to delete videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
// Make sure we're logged in (send us to the front page if not)
gatekeeper();
-
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
- // Get input data
- $guid = (int) get_input('video_id');
+// Get the current page's owner
+$page_owner = page_owner_entity();
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
- // Make sure we actually have permission to edit
- $videos = get_entity($guid);
- if ($videos->getSubtype() == "videolist" && $videos->canEdit()) {
-
- // Get owning user
- $owner = get_entity($videos->getOwner());
- // Delete it!
- $rowsaffected = $videos->delete();
- if ($rowsaffected > 0) {
+// Get input data
+$guid = (int) get_input('video_id');
+
+// Make sure we actually have permission to edit
+$videos = get_entity($guid);
+if ($videos->getSubtype() == "videolist" && $videos->canEdit()) {
+ // Get owning user
+ $owner = get_entity($videos->getOwner());
+
+ // Delete it!
+ $rowsaffected = $videos->delete();
+ if ($rowsaffected > 0) {
// Success message
- system_message(elgg_echo("videos:deleted"));
- } else {
- register_error(elgg_echo("videos:notdeleted"));
- }
- // Forward to the main video list page
- //forward("pg/videolist/owned/" . page_owner_entity()->username);
- forward($_SERVER['HTTP_REFERER']);
-
- }
-
-?>
+ system_message(elgg_echo("videos:deleted"));
+ } else {
+ register_error(elgg_echo("videos:notdeleted"));
+ }
+ // Forward to the main video list page
+ //forward("pg/videolist/owned/" . page_owner_entity()->username);
+ forward($_SERVER['HTTP_REFERER']);
+}
\ No newline at end of file
diff --git a/actions/save.php b/actions/save.php
index fa6ff585e..3f7391fbf 100644
--- a/actions/save.php
+++ b/actions/save.php
@@ -1,16 +1,11 @@
- * @copyright Prateek Choudhary
- */
-
-
-
-?>
+/**
+ * Elgg Candidate Profile Video Plugin
+ * This plugin allows users to create a library of youtube videos
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
diff --git a/actions/tubesearch.php b/actions/tubesearch.php
index 3930aaaa0..51bc6a990 100644
--- a/actions/tubesearch.php
+++ b/actions/tubesearch.php
@@ -1,109 +1,108 @@
-
- * @copyright Prateek Choudhary
- */
-
-// Get the current page's owner
+
+ * @copyright Prateek Choudhary
+ */
+
+// Get the current page's owner
//set_page_owner($_SESSION['container_guid']);
$page_ownerx = get_entity(get_input('container'));
-if(!$page_ownerx)
+if(!$page_ownerx) {
$page_ownerx = get_user_by_username(get_input('container'));
+}
set_page_owner($page_ownerx->getGUID());
$page_owner = page_owner_entity();
-if($page_owner->type == "group")
+if($page_owner->type == "group") {
$container = "group:".$page_ownerx->getGUID();
-else
+} else {
$container = $page_ownerx->username;
+}
if ($page_owner === false || is_null($page_owner)) {
$page_owner = $_SESSION['user'];
set_page_owner($_SESSION['guid']);
}
-global $CONFIG;
- $queryFeed = get_input('q');
- $start_index = get_input('start_index');
- $results_perpage = 10;
- $queryCatgory = get_input('page');
+global $CONFIG;
+$queryFeed = get_input('q');
+$start_index = get_input('start_index');
+$results_perpage = 10;
+$queryCatgory = get_input('page');
if (!isset($queryFeed) || empty($queryFeed)) {
-
-}
-else
-{
- $q = $queryFeed;
- if($queryCatgory == "youtube")
- {
- $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
- $sxml = simplexml_load_file($feedURL);
-
- $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
- $total = $counts->totalResults;
- $startOffset = $counts->startIndex;
- $endOffset = ($startOffset-1) + $counts->itemsPerPage;
-
- $body = '';
- $rem = floor($total/10);
- $rem*=10;
- if($rem<$total)
- $last = $rem+1;
- $lpVid = $total - $rem;
- if($startOffset==1 && ($endOffset)==$total){}
- else if($startOffset==1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- $body .= '
';
- $body .= '';
- $k = 0;$counter = 0;
- foreach ($sxml->entry as $entry) {
- $k++;
- $media = $entry->children('http://search.yahoo.com/mrss/');
- $attrs = $media->group->player->attributes();
- $watch = $attrs['url'];
- $vid_array = explode("?v=", $watch);
- if(preg_match("/&/", $vid_array[1])){
- $vid_array = explode("&", $vid_array[1]);
- $vid_array[1] = $vid_array[0];
- }
-
- $attrs = $media->group->thumbnail[0]->attributes();
- $thumbnail = $attrs['url'];
- $yt = $media->children('http://gdata.youtube.com/schemas/2007');
- $attrs = $yt->duration->attributes();
- $length = $attrs['seconds'];
- $gd = $entry->children('http://schemas.google.com/g/2005');
- if ($gd->rating) {
- $attrs = $gd->rating->attributes();
- $rating = $attrs['average'];
- } else {
- $rating = 0;
- }
- $tags = array();
- $tags[] = $media->group->keywords;
- $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
+
+} else {
+ $q = $queryFeed;
+ if($queryCatgory == "youtube") {
+ $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
+ $sxml = simplexml_load_file($feedURL);
+
+ $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
+ $total = $counts->totalResults;
+ $startOffset = $counts->startIndex;
+ $endOffset = ($startOffset-1) + $counts->itemsPerPage;
+
+ $body = '
';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total)
+ $last = $rem+1;
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total){}
+ else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $body .= '
';
+ $k = 0;$counter = 0;
+ foreach ($sxml->entry as $entry) {
+ $k++;
+ $media = $entry->children('http://search.yahoo.com/mrss/');
+ $attrs = $media->group->player->attributes();
+ $watch = $attrs['url'];
+ $vid_array = explode("?v=", $watch);
+ if(preg_match("/&/", $vid_array[1])){
+ $vid_array = explode("&", $vid_array[1]);
+ $vid_array[1] = $vid_array[0];
+ }
+
+ $attrs = $media->group->thumbnail[0]->attributes();
+ $thumbnail = $attrs['url'];
+ $yt = $media->children('http://gdata.youtube.com/schemas/2007');
+ $attrs = $yt->duration->attributes();
+ $length = $attrs['seconds'];
+ $gd = $entry->children('http://schemas.google.com/g/2005');
+ if ($gd->rating) {
+ $attrs = $gd->rating->attributes();
+ $rating = $attrs['average'];
+ } else {
+ $rating = 0;
+ }
+ $tags = array();
+ $tags[] = $media->group->keywords;
+
+ $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
$body .= '
';
$body .= '';
@@ -123,208 +122,201 @@ else
$body .= ' ';
$body .= '
';
- }
+ }
$body .= '
';
print $body;
+ } else if($queryCatgory == "metacafe") {
+ $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
+
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $total = 999;
+ $startOffset = $start_index;
+ $endOffset = ($startOffset-1) + $results_perpage;
+
+ $body = '
';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total) {
+ $last = $rem+1;
}
- else if($queryCatgory == "metacafe")
- {
-
-
- $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
-
-
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $total = 999;
- $startOffset = $start_index;
- $endOffset = ($startOffset-1) + $results_perpage;
-
- $body = '
';
- $rem = floor($total/10);
- $rem*=10;
- if($rem<$total)
- $last = $rem+1;
- $lpVid = $total - $rem;
- if($startOffset==1 && ($endOffset)==$total){}
- else if($startOffset==1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset)<$total){
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total) {
+
+ } else if($startOffset==1 && ($endOffset)<$total){
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ } else if($startOffset>1 && ($endOffset)<$total) {
$body .= '
first | ';
$body .= '
previous | ';
$body .= '
next | ';
$body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ } else if($startOffset>1 && ($endOffset+$lpVid)>=$total) {
$body .= '
first | ';
$body .= '
previous | ';
$body .= '
next | ';
$body .= '
last ';
- }
- $body .= '
';
- $k = 0;
- $body .= '
';
- $myitem = $sxml->getElementsByTagName('item');
- foreach($myitem as $searchNode){
- $k++;
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
-
- $xmlLink = $searchNode->getElementsByTagName("link");
- $valueLink = $xmlLink->item(0)->nodeValue;
-
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
-
- $pattern = '/
]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
+ }
+
+ $body .= '
';
+ $k = 0;
+ $body .= '
';
+ $myitem = $sxml->getElementsByTagName('item');
+ foreach($myitem as $searchNode) {
+ $k++;
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+
+ $xmlLink = $searchNode->getElementsByTagName("link");
+ $valueLink = $xmlLink->item(0)->nodeValue;
+
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+
+ $pattern = '/
]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+
+ $pattern = '/
]+href[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $anchor_src = $match[1];
+ }
+
+ $encodedVideoUrlArray = explode("/watch/", $valueLink);
+ $showEncodedVideo = $encodedVideoUrlArray[1];
+ $metacafevideoIdArray = explode("/", $showEncodedVideo);
+
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+
+ $body .= '';
+ $body .= '
';
+ $body .= '
';
+ }
+ $body .= ' ';
+ print $body;
+ } else if($queryCatgory == "vimeo") {
+ require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::search($queryFeed);
+
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideos();
+
+ // Just for code completion
+ $oVideo = new VimeoVideoEntity();
+
+ $total = count($aoVideos);
+ $startOffset = $start_index;
+
+ $endOffset = ($startOffset-1) + $results_perpage;
+ $body = '
';
+ $rem = floor($total/10);
+ $rem*=10;
+ if($rem<$total) {
+ $last = $rem+1;
+ }
+ $lpVid = $total - $rem;
+ if($startOffset==1 && ($endOffset)==$total) {
+
+ } else if($startOffset==1 && ($endOffset)<$total) {
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ } else if($startOffset>1 && ($endOffset)<$total) {
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ } else if($startOffset>1 && ($endOffset+$lpVid)>=$total) {
+ $body .= '
first | ';
+ $body .= '
previous | ';
+ $body .= '
next | ';
+ $body .= '
last ';
+ }
+ $body .= '
';
+ $body .= '
';
+ $counter = 0;$k = 0;
+ foreach($aoVideos as $oVideo) {
+ $k++;
+ if(($counter > $startOffset) && ($counter < $endOffset)) {
+ //get all thumbnails
+ $aThumbnails = array();
+ foreach($oVideo->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
}
-
- $pattern = '/
]+href[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $anchor_src = $match[1];
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+ //print_r($oVideo);
+ $title = $oVideo->getTitle();
+ $description = $oVideo->getCaption();
+ $url = $oVideo->getUrl();
+ $rating = $oVideo->getNumberOfLikes();
+ $playedTimes = $oVideo->getNumberOfPlays();
+ // Print all tags
+ $aTags = array();
+ foreach($oVideo->getTags() as $oTag) {
+ $aTags[] = $oTag->getTag();
}
-
- $encodedVideoUrlArray = explode("/watch/", $valueLink);
- $showEncodedVideo = $encodedVideoUrlArray[1];
- $metacafevideoIdArray = explode("/", $showEncodedVideo);
-
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
-
+ $play_idArray = explode("http://vimeo.com/", $url);
+ $embedidArray = explode("/", $play_idArray[1]);
$body .= '';
$body .= '
';
$body .= '
';
}
- $body .= ' ';
- print $body;
+ $counter++;
}
- else if($queryCatgory == "vimeo")
- {
- require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::search($queryFeed);
-
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideos();
-
- // Just for code completion
- $oVideo = new VimeoVideoEntity();
-
- $total = count($aoVideos);
- $startOffset = $start_index;
-
- $endOffset = ($startOffset-1) + $results_perpage;
- $body = '
';
- $rem = floor($total/10);
- $rem*=10;
- if($rem<$total)
- $last = $rem+1;
- $lpVid = $total - $rem;
- if($startOffset==1 && ($endOffset)==$total){}
- else if($startOffset==1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset)<$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
- $body .= '
first | ';
- $body .= '
previous | ';
- $body .= '
next | ';
- $body .= '
last ';
- }
- $body .= '
';
- $body .= '
';
- $counter = 0;$k = 0;
- foreach($aoVideos as $oVideo) {
- $k++;
- if(($counter > $startOffset) && ($counter < $endOffset))
- {
- //get all thumbnails
- $aThumbnails = array();
- foreach($oVideo->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
- //print_r($oVideo);
- $title = $oVideo->getTitle();
- $description = $oVideo->getCaption();
- $url = $oVideo->getUrl();
- $rating = $oVideo->getNumberOfLikes();
- $playedTimes = $oVideo->getNumberOfPlays();
- // Print all tags
- $aTags = array();
- foreach($oVideo->getTags() as $oTag) {
- $aTags[] = $oTag->getTag();
- }
- $play_idArray = explode("http://vimeo.com/", $url);
- $embedidArray = explode("/", $play_idArray[1]);
- $body .= '
';
- $body .= '
';
- $body .= '
';
- }
- $counter++;
- }
- $body .= '
';
- print $body;
- }
+ $body .= '
';
+ print $body;
+ }
}
-exit;
-?>
+
+exit;
\ No newline at end of file
diff --git a/browse.php b/browse.php
index b5ef13987..1ad5b3221 100644
--- a/browse.php
+++ b/browse.php
@@ -1,44 +1,41 @@
- * @copyright Prateek Choudhary
- */
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- //get videolist GUID
- $container_guid = get_input('container');
- $parent_container = "";
- if(isset($container_guid) && !empty($container_guid)){
- $container_guid = explode(":", $container_guid);
- if($container_guid[0] == "group"){
- $container = get_entity($container_guid[1]);
- set_page_owner($container->getGUID());
- $page_owner = page_owner_entity();
- set_context("groupsvideos");
- }
- else{
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
+
+//get videolist GUID
+$container_guid = get_input('container');
+$parent_container = "";
+if(isset($container_guid) && !empty($container_guid)) {
+ $container_guid = explode(":", $container_guid);
+
+ if ($container_guid[0] == "group") {
+ $container = get_entity($container_guid[1]);
+ set_page_owner($container->getGUID());
+ $page_owner = page_owner_entity();
+ set_context("groupsvideos");
+ } else {
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
}
}
- // Get the current page's owner
-
-
- $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name);
-
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view("forms/browsetube");
-
- $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
-
- page_draw($title, $body);
-?>
+}
+
+$title = sprintf(elgg_echo("videolist:browse"), $page_owner->name);
+
+$area2 = elgg_view_title($title);
+$area2 .= elgg_view("forms/browsetube");
+
+$body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
+
+page_draw($title, $body);
\ No newline at end of file
diff --git a/index.php b/index.php
index 9c2b446a4..bbeae7cf4 100644
--- a/index.php
+++ b/index.php
@@ -1,46 +1,42 @@
+ * @copyright Prateek Choudhary
+ */
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- /**
- * Elgg Video Plugin
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos
- *
- * @package Elgg
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Prateek Choudhary
- * @copyright Prateek Choudhary
- */
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- $owner = page_owner_entity();
-
- //get videolist GUID
- $container_guid = get_input('username');
- if(isset($container_guid) && !empty($container_guid)){
- $container_guid = explode(":", $container_guid);
- if($container_guid[0] == "group"){
- $container = get_entity($container_guid[1]);
- set_context("groupsvideos");
- //$page_owner = page_owner_entity();
- }
- else{
-
- }
+$owner = page_owner_entity();
+
+//get videolist GUID
+$container_guid = get_input('username');
+if(isset($container_guid) && !empty($container_guid)) {
+ $container_guid = explode(":", $container_guid);
+
+ if ($container_guid[0] == "group") {
+ $container = get_entity($container_guid[1]);
+ set_context("groupsvideos");
+ //$page_owner = page_owner_entity();
}
- //set page owner
- //set_page_owner($videolist_guid);
-
- $title = sprintf(elgg_echo("videolist:home"), "$owner->name");
-
- // Get objects
- $area2 = elgg_view_title($title);
- //set_input('search_viewtype', 'gallery');
- $area2 .= list_entities("object","videolist", page_owner(), 10);
-
- //$area2 .= elgg_view("staticvideo/index");
-
- set_context('videolist');
- $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
-
- // Finally draw the page
- page_draw($title, $body);
-?>
+}
+//set page owner
+//set_page_owner($videolist_guid);
+
+$title = sprintf(elgg_echo("videolist:home"), "$owner->name");
+
+// Get objects
+$area2 = elgg_view_title($title);
+//set_input('search_viewtype', 'gallery');
+$area2 .= list_entities("object","videolist", page_owner(), 10);
+
+//$area2 .= elgg_view("staticvideo/index");
+
+set_context('videolist');
+$body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);
+
+// Finally draw the page
+page_draw($title, $body);
\ No newline at end of file
diff --git a/languages/en.php b/languages/en.php
index 7ea20abfe..65b0d8905 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -1,57 +1,55 @@
- * @copyright Prateek Choudhary
- */
- $english = array(
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ * @file - language file 'en'
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
+$english = array(
- "videolist" => "My Videos",
-
- "videolist:home" => '%s \'s Videos',
- "videolist:new" => 'Add a Video',
- "videolist:find" => 'All Site videos',
- "videolist:search" => "All Site videos",
- "videolist:title_videourl" => 'Enter Video Url',
- "videolist:submit" => 'Submit',
- "videolist:videoTitle" => "Title",
- "videolist:error" => 'There was an error in saving the video, please try after sometime',
- "videolist:posted" => 'Your video has been saved successfully!',
- "video:more" => "View all videos",
- "video:none" => "sorry, no videos were found",
- "candidateprofile:candidatevideo" => "My videos",
- "videos:deleted" => "Your Video was removed successfully!",
- "videos:notdeleted" => "Unfortunately, this video could not be removed now. Please try again later",
- "videolist:widget" => "Videos",
- "videolist:widget:description" => "Your personal video playlist",
- "videolist:num_videos" => "Number of videos to display",
- 'videolist:widget' => "My Videos",
- "videolist:widget:description" => "Showcase your personal video gallery from youtube",
- "profile:videoheader" => "My Video Gallery",
- "videolist:title_access" => "Access",
- "item:object:videolist" => "Videos",
- "videolist:tags" => "Add Tags",
- "videolist:browse" => "Find Videos - %s",
- "videolist:browsemenu" => "Find Videos",
- "videolist:title_search_tube" => "Search Videos From",
- "videolist:searchTubeVideos" => "Search youtube.com",
- "videolist:comments" => "Comments",
- "videolist:commentspost" => "Post",
- "videolist:river:annotate" => "%s commented on",
- "videolist:river:item" => "a video",
- "videolist:river:created" => "%s added",
- "videolist:searchTubeVideos:metacafe" => "Search metacafe.com",
- "videolist:searchTubeVideos:vimeo" => "Search vimeo.com",
- "videolist:searchTubeVideos:googlevideos" => "Search video.google.com",
- "videolist:group" => "Group Videos",
- "videolist:groupall" => "All Group Videos",
- "videolist:none" => "This group does not have any videos yet",
- );
-
- add_translation("en",$english);
+ "videolist" => "My Videos",
-?>
+ "videolist:home" => '%s \'s Videos',
+ "videolist:new" => 'Add a Video',
+ "videolist:find" => 'All Site videos',
+ "videolist:search" => "All Site videos",
+ "videolist:title_videourl" => 'Enter Video Url',
+ "videolist:submit" => 'Submit',
+ "videolist:videoTitle" => "Title",
+ "videolist:error" => 'There was an error in saving the video, please try after sometime',
+ "videolist:posted" => 'Your video has been saved successfully!',
+ "video:more" => "View all videos",
+ "video:none" => "sorry, no videos were found",
+ "candidateprofile:candidatevideo" => "My videos",
+ "videos:deleted" => "Your Video was removed successfully!",
+ "videos:notdeleted" => "Unfortunately, this video could not be removed now. Please try again later",
+ "videolist:widget" => "Videos",
+ "videolist:widget:description" => "Your personal video playlist",
+ "videolist:num_videos" => "Number of videos to display",
+ 'videolist:widget' => "My Videos",
+ "videolist:widget:description" => "Showcase your personal video gallery from youtube",
+ "profile:videoheader" => "My Video Gallery",
+ "videolist:title_access" => "Access",
+ "item:object:videolist" => "Videos",
+ "videolist:tags" => "Add Tags",
+ "videolist:browse" => "Find Videos - %s",
+ "videolist:browsemenu" => "Find Videos",
+ "videolist:title_search_tube" => "Search Videos From",
+ "videolist:searchTubeVideos" => "Search youtube.com",
+ "videolist:comments" => "Comments",
+ "videolist:commentspost" => "Post",
+ "videolist:river:annotate" => "%s commented on",
+ "videolist:river:item" => "a video",
+ "videolist:river:created" => "%s added",
+ "videolist:searchTubeVideos:metacafe" => "Search metacafe.com",
+ "videolist:searchTubeVideos:vimeo" => "Search vimeo.com",
+ "videolist:searchTubeVideos:googlevideos" => "Search video.google.com",
+ "videolist:group" => "Group Videos",
+ "videolist:groupall" => "All Group Videos",
+ "videolist:none" => "This group does not have any videos yet",
+);
+
+add_translation("en",$english);
\ No newline at end of file
diff --git a/manifest.xml b/manifest.xml
index 36b3dc842..2997d4c95 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -1,9 +1,9 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/models/lib/class.vimeo.php b/models/lib/class.vimeo.php
index 03508d148..e44837fae 100644
--- a/models/lib/class.vimeo.php
+++ b/models/lib/class.vimeo.php
@@ -1,7 +1,7 @@
@@ -26,522 +26,522 @@ define('VIMEO_DEBUG_RESPONSE', true);
class VimeoBase {
- const PROJECT_NAME = 'php5-simplevimeo';
-
- /**
- * Currently logged in user object
- * @var VimeoUserEntity
- */
- private static $oUser = false;
-
- /**
- * Currently logged in user permission
- * @var string
- */
- private static $ePermission = false;
-
- /**
- * Currently logged in user token
- * @var string
- */
- private static $sToken = false;
-
- /**
- * Vimeo Application API key
- * @var string
- */
- private static $sApiKey = '7a223534b3c1d0979a954f93cb746173 ';
-
- /**
- * Vimeo Application API secret key
- * @var string
- */
- private static $sApiSecret = 'b11e83370';
-
- const VIMEO_REST_URL = 'http://vimeo.com/api/rest/';
- const VIMEO_AUTH_URL = 'http://vimeo.com/services/auth/';
- const VIMEO_UPLOAD_URL = 'http://vimeo.com/services/upload/';
- const VIMEO_LOGIN_URL = 'http://vimeo.com/log_in';
-
- /**
- * You can choose between the following engines:
- * executeRemoteCall_FSOCK = PHP5 file_get_content and stream_contexts (bad error handling)
- * executeRemoteCall_CURL = CURL is used for file transfer (better error handling)
- */
- const REQUEST_ENGINE_CURL = 'executeRemoteCall_CURL';
- const VIDEOPOST_ENGINE_FSOCK = 'executeVideopostCall_CURL';
-
- const PERMISSION_NONE = false;
- const PERMISSION_READ = 'read';
- const PERMISSION_WRITE = 'write';
- const PERMISSION_DELETE = 'delete';
-
- const COOKIE_FILE = '/tmp/simplevimeo.cookies';
-
- const DEBUG_ENABLE = false;
- const DEBUG_LOGFILE = '/tmp/simplevimeo.debug';
-
- /**
- * Debug output function
- */
- public static function debug($sTitle, $sContent) {
- if(self::DEBUG_ENABLE) {
+ const PROJECT_NAME = 'php5-simplevimeo';
+
+ /**
+ * Currently logged in user object
+ * @var VimeoUserEntity
+ */
+ private static $oUser = false;
+
+ /**
+ * Currently logged in user permission
+ * @var string
+ */
+ private static $ePermission = false;
+
+ /**
+ * Currently logged in user token
+ * @var string
+ */
+ private static $sToken = false;
+
+ /**
+ * Vimeo Application API key
+ * @var string
+ */
+ private static $sApiKey = '7a223534b3c1d0979a954f93cb746173 ';
+
+ /**
+ * Vimeo Application API secret key
+ * @var string
+ */
+ private static $sApiSecret = 'b11e83370';
+
+ const VIMEO_REST_URL = 'http://vimeo.com/api/rest/';
+ const VIMEO_AUTH_URL = 'http://vimeo.com/services/auth/';
+ const VIMEO_UPLOAD_URL = 'http://vimeo.com/services/upload/';
+ const VIMEO_LOGIN_URL = 'http://vimeo.com/log_in';
+
+ /**
+ * You can choose between the following engines:
+ * executeRemoteCall_FSOCK = PHP5 file_get_content and stream_contexts (bad error handling)
+ * executeRemoteCall_CURL = CURL is used for file transfer (better error handling)
+ */
+ const REQUEST_ENGINE_CURL = 'executeRemoteCall_CURL';
+ const VIDEOPOST_ENGINE_FSOCK = 'executeVideopostCall_CURL';
+
+ const PERMISSION_NONE = false;
+ const PERMISSION_READ = 'read';
+ const PERMISSION_WRITE = 'write';
+ const PERMISSION_DELETE = 'delete';
+
+ const COOKIE_FILE = '/tmp/simplevimeo.cookies';
+
+ const DEBUG_ENABLE = false;
+ const DEBUG_LOGFILE = '/tmp/simplevimeo.debug';
+
+ /**
+ * Debug output function
+ */
+ public static function debug($sTitle, $sContent) {
+ if(self::DEBUG_ENABLE) {
$sMessage = 'DEBUG ' . date('Y-m-d H:i:s', time()) . "\n";
$sMessage .= 'CONTENT: ' . $sContent . "\n";
$sMesasge .= $sContent . "\n\n";
-
+
$fhLog = fopen(self::DEBUG_LOGFILE, 'a+');
-
+
if(!$fhLog) {
throw new VimeoBaseException('Debug Logfile "' . self::DEBUG_LOGFILE . '" could not be found or written');
} else {
fputs($fhLog, $sMessage);
fclose($fhLog);
}
- }
- }
-
- /**
- * Update Authentication
- *
- * Initializes user and permission information if a token is present.
- * You can alter this method or skip it if you store user information
- * and permission in an external database. Then i would recommend a
- * VimeoAuthRequest::checkLoogin for confirmation.
- *
- * @access private
- * @return void
- */
- private function updateAuthentication() {
- if(self::$sToken && (!self::$ePermission || !self::$oUser)) {
- $oResponse = VimeoAuthRequest::checkToken(self::$sToken);
-
- // Parse user
- self::$oUser = $oResponse->getUser();
-
- // Parse permission
- self::$ePermission = $oResponse->getPermission();
- }
- }
-
- /**
- * Check permission
- *
- * Checks the current user permission with the given one. This will be
- * heavily used by the executeRemoteCall method to ensure the user
- * will not run into trouble.
- *
- * @access public
- * @param string Needed Permission
- * @return boolean TRUE if access can be granted, FALSE if permission denied
- */
- public function checkPermission($ePermissionNeeded) {
- // Update authentication data before permission check
- self::updateAuthentication();
-
- // Permission DELETE check
- if($ePermissionNeeded == self::PERMISSION_DELETE && self::$ePermission == self::PERMISSION_DELETE) {
- return true;
- }
-
- // Permission WRITE check
- if($ePermissionNeeded == self::PERMISSION_WRITE && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE)) {
- return true;
- }
-
- // Permission READ check
- if($ePermissionNeeded == self::PERMISSION_READ && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE || self::$ePermission == self::PERMISSION_READ)) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Proxy for API queries
- *
- * Will check permission for the requested API method as well as type
- * of the object result response or exception. Will call the given
- * API query handler method (default: executeRemoteCall_CURL) for
- * the raw connection stuff
- *
- * @access public
- * @param string API method name
- * @param array Additional arguments that need to be passed to the API
- * @return VimeoResponse Response object of API corresponding query (for vimeo.test.login you will get VimeoTestLoginResponse object)
- */
- public function executeRemoteCall($sMethod, $aArgs = array()) {
- // Get exception handler
- $sExceptionClass = VimeoMethod::getExceptionObjectForMethod($sMethod);
-
- // Check for errors in parameters
- $sTargetClass = VimeoMethod::getTargetObjectForMethod($sMethod);
-
- // Get the permission needed to run this method
- $ePermissionNeeded = VimeoMethod::getPermissionRequirementForMethod($sMethod);
-
- // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
- if($ePermissionNeeded != VimeoBase::PERMISSION_NONE && !self::checkPermission($ePermissionNeeded)) {
- throw new $sExceptionClass('Permission error: "' . VimeoMethod::getPermissionRequirementForMethod($sMethod) . '" needed, "' . self::$ePermission . '" given');
- }
-
- // Append method to request arguments
- $aArgs['method'] = $sMethod;
-
- // Check that the API query handler method exists and can be called
- if(!method_exists(__CLASS__, self::REQUEST_ENGINE_CURL)) {
- throw new VimeoBaseException('Internal error: Request engine handler method not found', 2);
- }
-
- // Build up the needed API arguments
-
- // Set API key
- $aArgs['api_key'] = self::$sApiKey;
-
- // Set request format
- $aArgs['format'] = 'php';
-
- // Set token
- if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
-
- // Generate signature
- $aArgs['api_sig'] = self::buildSignature($aArgs);
-
- // Do the request
- $aResponse = call_user_func(array(__CLASS__, self::REQUEST_ENGINE_CURL), $aArgs);
-
- // Debug request
- if(defined('VIMEO_DEBUG_REQUEST') && VIMEO_DEBUG_REQUEST) {
- self::debug('API request', print_r($aArgs, true));
- }
-
- // Debug response
- if(defined('VIMEO_DEBUG_RESPONSE') && VIMEO_DEBUG_RESPONSE) {
- self::debug('API response', print_r($aResponse, true));
- }
-
- // Transform the result into a result class
- $oResult = new $sTargetClass($aResponse);
-
- // Check if request was successfull
- if(!$oResult->getStatus()) {
- // If not, create an given exception class for the given method and pass through error code and message
- throw new $sExceptionClass($oResult->getError()->getMessage(), $oResult->getError()->getCode());
- }
-
- // Return the base class object instance for the corresponding API query
- return $oResult;
- }
-
- /**
- * Execute raw API query with CURL
- *
- * Implements CURL API queries in php format response
- *
- * @author Ted Roden
- * @access private
- * @param array Additional arguments for the API query
- * @return stdClass Simple PHP object enclosing the API result
- */
- private function executeRemoteCall_CURL($aArgs) {
- $ch = curl_init(self::VIMEO_REST_URL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
-
- $data = curl_exec($ch);
- if(curl_errno($ch))
- throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
- else {
- curl_close($ch);
-
- if(!$data || strlen(trim($data)) < 2) {
- throw new VimeoRequestException('API request error: No result returned.', 1);
- }
- return unserialize($data);
- }
- }
-
- /**
- * Execute raw API query with FSOCK
- *
- * Implements FSOCK API queries in php format response
- *
- * @access private
- * @param array Additional arguemnts for the API query
- * @return stdClass Simple PHP object enclosing the API result
- */
- private function executeRemoteCall_FSOCK($aArgs) {
- $sResponse = file_get_contents(self::VIMEO_REST_URL, NULL, stream_context_create(array('http' => array('method' => 'POST', 'header'=> 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($aArgs)))));
- if(!$sResponse || strlen(trim($sResponse)) < 2) {
- throw new VimeoRequestException('API request error: No result returned.', 1);
- } else {
- return unserialize($sResponse);
- }
- }
-
- /**
- * Proxy for video uploads
- *
- * Will call the given video upload handler method (default: executeVideopostCall_FSOCK)
- * for the raw connection and send stuff
- *
- * @access public
- * @param string Local filename to be transfered
- * @param string Ticket
- * @return string VimeoVideosCheckUploadStatusResponse
- */
- public function executeVideopostCall($sFilename, $sTicket = false) {
- // Check that the upload query handler method exists and can be called
- if(!method_exists(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK)) {
- throw new VimeoUploadException('Upload error: Videopost engine handler method not found', 1);
- }
-
- // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
- if(!self::checkPermission(VimeoBase::PERMISSION_WRITE)) {
- throw new VimeoUploadException('Upload error: Missing "write" permission for current user', 2);
- }
-
- // Check that the file exists
- if(!file_exists($sFilename)) {
- throw new VimeoUploadException('Upload error: Local file does not exists', 3);
- }
-
- // Check that the file is readable
- if(!is_readable($sFilename)) {
- throw new VimeoUploadException('Upload error: Local file is not readable', 4);
- }
-
- // Check that the file size is not larger then the allowed size you can upload
- $oResponse = VimeoPeopleRequest::getUploadStatus();
- if(filesize($sFilename) > $oResponse->getRemainingBytes()) {
- throw new VimeoUploadException('Upload error: Videosize exceeds remaining bytes', 5);
- }
-
- // Try to get a upload ticket
- if(!$sTicket) {
- $oResponse = VimeoVideosRequest::getUploadTicket();
- $sTicket = $oResponse->getTicket();
- }
-
- // Build up the needed API arguments
-
- // Set API key
- $aArgs['api_key'] = self::$sApiKey;
-
- // Set request format
- $aArgs['format'] = 'php';
-
- // Set token
- if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
-
- // Set ticket
- $aArgs['ticket_id'] = $sTicket;
-
- // Generate signature
- $aArgs['api_sig'] = self::buildSignature($aArgs);
-
- // Set file
- $aArgs['file'] = "@$sFilename";
-
- // Do the upload
- $sResponse = call_user_func(array(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK), $aArgs);
-
- // Call vimeo.videos.checkUploadStatus to prevent abandoned status
- return VimeoVideosRequest::checkUploadStatus($sTicket);
- }
-
- private function executeVideopostCall_CURL($aArgs) {
- // Disable time limit
- set_time_limit(0);
-
- $ch = curl_init(self::VIMEO_UPLOAD_URL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
-
- $data = curl_exec($ch);
- if(curl_errno($ch))
- throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
- else {
- curl_close($ch);
- return unserialize($data);
- }
- }
-
- /**
- * Build API query signature
- *
- * Composes the signature needed to verify its really us doing the query
- *
- * @author Ted Roden
- * @access private
- * @param array Additional arguments for the API query
- * @return string MD5 signature
- */
- private static function buildSignature($aArgs) {
- $s = '';
-
- // sort by name
- ksort($aArgs);
-
- foreach($aArgs as $k => $v)
- $s .= $k . $v;
-
- return(md5(self::$sApiSecret . $s));
- }
-
- /**
- * Build authentication URL
- *
- * Easy way to build a correct authentication url. You can use this
- * to link the user directly to the correct vimeo authentication page.
- *
- * @access public
- * @param string Permission level you need the user to give you (i.e. VimeoBase::PERMISSION_READ)
- * @return string URL you can use to directly link the user to the vimeo authentication page
- */
- public static function buildAuthenticationUrl($ePermission) {
-
- $aArgs = array(
- 'api_key' => self::$sApiKey,
- 'perms' => $ePermission
- );
-
- return self::VIMEO_AUTH_URL . '?api_key=' . self::$sApiKey . '&perms=' . $ePermission . '&api_sig=' . self::buildSignature($aArgs);
- }
-
- /**
- * Get current logged in user token
- *
- * @access public
- * @return string Token or FALSE if not logged in
- */
- public static function getToken() {
- return self::$sToken;
- }
-
- /**
- * Set current logged in user token
- *
- * @access public
- * @param string Authentication token
- * @return void
- */
- public static function setToken($sToken) {
- self::$sToken = $sToken;
- }
-
- /**
- * Clear current logged in user token
- *
- * Removes the current logged in user from the cache. Next API query
- * will be made as clean, not logged in, request.
- *
- * @access public
- * @return void
- */
- public static function clearToken() {
- self::$sToken = false;
- }
-
- /**
- * Execute a permit request
- *
- * ONLY USED IN SITE-MODE, see howto.autologin.php
- * Permits the current CURL cached user with your vimeo API application
- *
- * @access public
- * @param string Permission
- * @return string Vimeo Token
- */
- public function permit($ePermission) {
- // Disable time limit
- set_time_limit(0);
-
- // Construct login data
- $aArgs = array(
- 'api_key' => VimeoBase::$sApiKey,
- 'perms' => $ePermission,
- 'accept' => 'yes'
- );
- $ch = curl_init(VimeoBase::buildAuthenticationUrl($ePermission));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
- curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
-
- $sPageContent = curl_exec($ch);
- if(curl_errno($ch)) {
- throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
- return false;
- } else {
- $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
-
- }
- return $sPageContent;
- }
-
- /**
- * Ensures that the user is logged in
- *
- * ONLY USED IN SITE-MODE, see howto.autologin.php
- * Ensures the site-account is logged in
- *
- * @access public
- * @param string Username
- * @param string Password
- * @return boolean TRUE if user could be logged in, FALSE if an error occured (try manually to see error)
- */
- public function login($sUsername, $sPassword) {
- // Disable time limit
- set_time_limit(0);
-
- // Construct login data
- $aArgs = array(
- 'sign_in[email]' => $sUsername,
- 'sign_in[password]' => $sPassword,
- 'redirect' => ''
- );
-
- $ch = curl_init(VimeoBase::VIMEO_LOGIN_URL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
- curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
-
- $sPageContent = curl_exec($ch);
-
- if(curl_errno($ch)) {
- throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
- return false;
- } else {
- $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- curl_close($ch);
- }
-
- if(stristr($sResponseUrl, 'log_in') !== false) {
- // Login failed
- return false;
- } else {
- return true;
- }
- }
+ }
+ }
+
+ /**
+ * Update Authentication
+ *
+ * Initializes user and permission information if a token is present.
+ * You can alter this method or skip it if you store user information
+ * and permission in an external database. Then i would recommend a
+ * VimeoAuthRequest::checkLoogin for confirmation.
+ *
+ * @access private
+ * @return void
+ */
+ private function updateAuthentication() {
+ if(self::$sToken && (!self::$ePermission || !self::$oUser)) {
+ $oResponse = VimeoAuthRequest::checkToken(self::$sToken);
+
+ // Parse user
+ self::$oUser = $oResponse->getUser();
+
+ // Parse permission
+ self::$ePermission = $oResponse->getPermission();
+ }
+ }
+
+ /**
+ * Check permission
+ *
+ * Checks the current user permission with the given one. This will be
+ * heavily used by the executeRemoteCall method to ensure the user
+ * will not run into trouble.
+ *
+ * @access public
+ * @param string Needed Permission
+ * @return boolean TRUE if access can be granted, FALSE if permission denied
+ */
+ public function checkPermission($ePermissionNeeded) {
+ // Update authentication data before permission check
+ self::updateAuthentication();
+
+ // Permission DELETE check
+ if($ePermissionNeeded == self::PERMISSION_DELETE && self::$ePermission == self::PERMISSION_DELETE) {
+ return true;
+ }
+
+ // Permission WRITE check
+ if($ePermissionNeeded == self::PERMISSION_WRITE && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE)) {
+ return true;
+ }
+
+ // Permission READ check
+ if($ePermissionNeeded == self::PERMISSION_READ && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE || self::$ePermission == self::PERMISSION_READ)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Proxy for API queries
+ *
+ * Will check permission for the requested API method as well as type
+ * of the object result response or exception. Will call the given
+ * API query handler method (default: executeRemoteCall_CURL) for
+ * the raw connection stuff
+ *
+ * @access public
+ * @param string API method name
+ * @param array Additional arguments that need to be passed to the API
+ * @return VimeoResponse Response object of API corresponding query (for vimeo.test.login you will get VimeoTestLoginResponse object)
+ */
+ public function executeRemoteCall($sMethod, $aArgs = array()) {
+ // Get exception handler
+ $sExceptionClass = VimeoMethod::getExceptionObjectForMethod($sMethod);
+
+ // Check for errors in parameters
+ $sTargetClass = VimeoMethod::getTargetObjectForMethod($sMethod);
+
+ // Get the permission needed to run this method
+ $ePermissionNeeded = VimeoMethod::getPermissionRequirementForMethod($sMethod);
+
+ // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
+ if($ePermissionNeeded != VimeoBase::PERMISSION_NONE && !self::checkPermission($ePermissionNeeded)) {
+ throw new $sExceptionClass('Permission error: "' . VimeoMethod::getPermissionRequirementForMethod($sMethod) . '" needed, "' . self::$ePermission . '" given');
+ }
+
+ // Append method to request arguments
+ $aArgs['method'] = $sMethod;
+
+ // Check that the API query handler method exists and can be called
+ if(!method_exists(__CLASS__, self::REQUEST_ENGINE_CURL)) {
+ throw new VimeoBaseException('Internal error: Request engine handler method not found', 2);
+ }
+
+ // Build up the needed API arguments
+
+ // Set API key
+ $aArgs['api_key'] = self::$sApiKey;
+
+ // Set request format
+ $aArgs['format'] = 'php';
+
+ // Set token
+ if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
+
+ // Generate signature
+ $aArgs['api_sig'] = self::buildSignature($aArgs);
+
+ // Do the request
+ $aResponse = call_user_func(array(__CLASS__, self::REQUEST_ENGINE_CURL), $aArgs);
+
+ // Debug request
+ if(defined('VIMEO_DEBUG_REQUEST') && VIMEO_DEBUG_REQUEST) {
+ self::debug('API request', print_r($aArgs, true));
+ }
+
+ // Debug response
+ if(defined('VIMEO_DEBUG_RESPONSE') && VIMEO_DEBUG_RESPONSE) {
+ self::debug('API response', print_r($aResponse, true));
+ }
+
+ // Transform the result into a result class
+ $oResult = new $sTargetClass($aResponse);
+
+ // Check if request was successfull
+ if(!$oResult->getStatus()) {
+ // If not, create an given exception class for the given method and pass through error code and message
+ throw new $sExceptionClass($oResult->getError()->getMessage(), $oResult->getError()->getCode());
+ }
+
+ // Return the base class object instance for the corresponding API query
+ return $oResult;
+ }
+
+ /**
+ * Execute raw API query with CURL
+ *
+ * Implements CURL API queries in php format response
+ *
+ * @author Ted Roden
+ * @access private
+ * @param array Additional arguments for the API query
+ * @return stdClass Simple PHP object enclosing the API result
+ */
+ private function executeRemoteCall_CURL($aArgs) {
+ $ch = curl_init(self::VIMEO_REST_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+
+ $data = curl_exec($ch);
+ if(curl_errno($ch))
+ throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
+ else {
+ curl_close($ch);
+
+ if(!$data || strlen(trim($data)) < 2) {
+ throw new VimeoRequestException('API request error: No result returned.', 1);
+ }
+ return unserialize($data);
+ }
+ }
+
+ /**
+ * Execute raw API query with FSOCK
+ *
+ * Implements FSOCK API queries in php format response
+ *
+ * @access private
+ * @param array Additional arguemnts for the API query
+ * @return stdClass Simple PHP object enclosing the API result
+ */
+ private function executeRemoteCall_FSOCK($aArgs) {
+ $sResponse = file_get_contents(self::VIMEO_REST_URL, NULL, stream_context_create(array('http' => array('method' => 'POST', 'header'=> 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($aArgs)))));
+ if(!$sResponse || strlen(trim($sResponse)) < 2) {
+ throw new VimeoRequestException('API request error: No result returned.', 1);
+ } else {
+ return unserialize($sResponse);
+ }
+ }
+
+ /**
+ * Proxy for video uploads
+ *
+ * Will call the given video upload handler method (default: executeVideopostCall_FSOCK)
+ * for the raw connection and send stuff
+ *
+ * @access public
+ * @param string Local filename to be transfered
+ * @param string Ticket
+ * @return string VimeoVideosCheckUploadStatusResponse
+ */
+ public function executeVideopostCall($sFilename, $sTicket = false) {
+ // Check that the upload query handler method exists and can be called
+ if(!method_exists(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK)) {
+ throw new VimeoUploadException('Upload error: Videopost engine handler method not found', 1);
+ }
+
+ // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
+ if(!self::checkPermission(VimeoBase::PERMISSION_WRITE)) {
+ throw new VimeoUploadException('Upload error: Missing "write" permission for current user', 2);
+ }
+
+ // Check that the file exists
+ if(!file_exists($sFilename)) {
+ throw new VimeoUploadException('Upload error: Local file does not exists', 3);
+ }
+
+ // Check that the file is readable
+ if(!is_readable($sFilename)) {
+ throw new VimeoUploadException('Upload error: Local file is not readable', 4);
+ }
+
+ // Check that the file size is not larger then the allowed size you can upload
+ $oResponse = VimeoPeopleRequest::getUploadStatus();
+ if(filesize($sFilename) > $oResponse->getRemainingBytes()) {
+ throw new VimeoUploadException('Upload error: Videosize exceeds remaining bytes', 5);
+ }
+
+ // Try to get a upload ticket
+ if(!$sTicket) {
+ $oResponse = VimeoVideosRequest::getUploadTicket();
+ $sTicket = $oResponse->getTicket();
+ }
+
+ // Build up the needed API arguments
+
+ // Set API key
+ $aArgs['api_key'] = self::$sApiKey;
+
+ // Set request format
+ $aArgs['format'] = 'php';
+
+ // Set token
+ if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
+
+ // Set ticket
+ $aArgs['ticket_id'] = $sTicket;
+
+ // Generate signature
+ $aArgs['api_sig'] = self::buildSignature($aArgs);
+
+ // Set file
+ $aArgs['file'] = "@$sFilename";
+
+ // Do the upload
+ $sResponse = call_user_func(array(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK), $aArgs);
+
+ // Call vimeo.videos.checkUploadStatus to prevent abandoned status
+ return VimeoVideosRequest::checkUploadStatus($sTicket);
+ }
+
+ private function executeVideopostCall_CURL($aArgs) {
+ // Disable time limit
+ set_time_limit(0);
+
+ $ch = curl_init(self::VIMEO_UPLOAD_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+
+ $data = curl_exec($ch);
+ if(curl_errno($ch))
+ throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
+ else {
+ curl_close($ch);
+ return unserialize($data);
+ }
+ }
+
+ /**
+ * Build API query signature
+ *
+ * Composes the signature needed to verify its really us doing the query
+ *
+ * @author Ted Roden
+ * @access private
+ * @param array Additional arguments for the API query
+ * @return string MD5 signature
+ */
+ private static function buildSignature($aArgs) {
+ $s = '';
+
+ // sort by name
+ ksort($aArgs);
+
+ foreach($aArgs as $k => $v)
+ $s .= $k . $v;
+
+ return(md5(self::$sApiSecret . $s));
+ }
+
+ /**
+ * Build authentication URL
+ *
+ * Easy way to build a correct authentication url. You can use this
+ * to link the user directly to the correct vimeo authentication page.
+ *
+ * @access public
+ * @param string Permission level you need the user to give you (i.e. VimeoBase::PERMISSION_READ)
+ * @return string URL you can use to directly link the user to the vimeo authentication page
+ */
+ public static function buildAuthenticationUrl($ePermission) {
+
+ $aArgs = array(
+ 'api_key' => self::$sApiKey,
+ 'perms' => $ePermission
+ );
+
+ return self::VIMEO_AUTH_URL . '?api_key=' . self::$sApiKey . '&perms=' . $ePermission . '&api_sig=' . self::buildSignature($aArgs);
+ }
+
+ /**
+ * Get current logged in user token
+ *
+ * @access public
+ * @return string Token or FALSE if not logged in
+ */
+ public static function getToken() {
+ return self::$sToken;
+ }
+
+ /**
+ * Set current logged in user token
+ *
+ * @access public
+ * @param string Authentication token
+ * @return void
+ */
+ public static function setToken($sToken) {
+ self::$sToken = $sToken;
+ }
+
+ /**
+ * Clear current logged in user token
+ *
+ * Removes the current logged in user from the cache. Next API query
+ * will be made as clean, not logged in, request.
+ *
+ * @access public
+ * @return void
+ */
+ public static function clearToken() {
+ self::$sToken = false;
+ }
+
+ /**
+ * Execute a permit request
+ *
+ * ONLY USED IN SITE-MODE, see howto.autologin.php
+ * Permits the current CURL cached user with your vimeo API application
+ *
+ * @access public
+ * @param string Permission
+ * @return string Vimeo Token
+ */
+ public function permit($ePermission) {
+ // Disable time limit
+ set_time_limit(0);
+
+ // Construct login data
+ $aArgs = array(
+ 'api_key' => VimeoBase::$sApiKey,
+ 'perms' => $ePermission,
+ 'accept' => 'yes'
+ );
+ $ch = curl_init(VimeoBase::buildAuthenticationUrl($ePermission));
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
+ curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
+
+ $sPageContent = curl_exec($ch);
+ if(curl_errno($ch)) {
+ throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
+ return false;
+ } else {
+ $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+
+ }
+ return $sPageContent;
+ }
+
+ /**
+ * Ensures that the user is logged in
+ *
+ * ONLY USED IN SITE-MODE, see howto.autologin.php
+ * Ensures the site-account is logged in
+ *
+ * @access public
+ * @param string Username
+ * @param string Password
+ * @return boolean TRUE if user could be logged in, FALSE if an error occured (try manually to see error)
+ */
+ public function login($sUsername, $sPassword) {
+ // Disable time limit
+ set_time_limit(0);
+
+ // Construct login data
+ $aArgs = array(
+ 'sign_in[email]' => $sUsername,
+ 'sign_in[password]' => $sPassword,
+ 'redirect' => ''
+ );
+
+ $ch = curl_init(VimeoBase::VIMEO_LOGIN_URL);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
+ curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
+ curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
+ curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
+
+ $sPageContent = curl_exec($ch);
+
+ if(curl_errno($ch)) {
+ throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
+ return false;
+ } else {
+ $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+ curl_close($ch);
+ }
+
+ if(stristr($sResponseUrl, 'log_in') !== false) {
+ // Login failed
+ return false;
+ } else {
+ return true;
+ }
+ }
}
/**
* Vimeo base exception class
*
* Every exception caused by VimeoBase class will be of this type
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -552,7 +552,7 @@ class VimeoBaseException extends VimeoException {}
* Vimeo request exception class
*
* Exception thrown when requesting the API failed
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -563,7 +563,7 @@ class VimeoRequestException extends VimeoException {}
* Vimeo upload exception class
*
* Exception thrown when uploading a video failed
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -576,235 +576,235 @@ class VimeoUploadException extends VimeoException {}
* This class will ensure that only functions can be called if the method is implemented
* and the permission is right (p). It also states what the source (s), result (t) and
* exception (e) object will be.
-*
+*
* @package SimpleVimeo
* @subpackage Base
*/
class VimeoMethod {
-
- private static $aMethods = array(
- // Vimeo Test methods
- 'vimeo.test.login' => array( 's' => 'VimeoTestRequest',
- 't' => 'VimeoTestLoginResponse',
- 'e' => 'VimeoTestLoginException',
- 'p' => VimeoBase::PERMISSION_READ),
-
- 'vimeo.test.echo' => array( 's' => 'VimeoTestRequest',
- 't' => 'VimeoTestEchoResponse',
- 'e' => 'VimeoTestEchoException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.test.null' => array( 's' => 'VimeoTestRequest',
- 't' => 'VimeoTestNullResponse',
- 'e' => 'VimeoTestNullException',
- 'p' => VimeoBase::PERMISSION_READ),
-
- // Vimeo Auth methods
- 'vimeo.auth.getToken' => array( 's' => 'VimeoAuthRequest',
- 't' => 'VimeoAuthGetTokenResponse',
- 'e' => 'VimeoAuthGetTokenException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.auth.getFrob' => array( 's' => 'VimeoAuthRequest',
- 't' => 'VimeoAuthGetFrobResponse',
- 'e' => 'VimeoAuthGetFrobException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.auth.checkToken' => array( 's' => 'VimeoAuthRequest',
- 't' => 'VimeoAuthCheckTokenResponse',
- 'e' => 'VimeoAuthCheckTokenException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- // Vimeo Videos methods
- 'vimeo.videos.getList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetListResponse',
- 'e' => 'VimeoVideosGetListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getUploadedList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetUploadedListResponse',
- 'e' => 'VimeoVideosGetUploadedListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getAppearsInList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetAppearsInListResponse',
- 'e' => 'VimeoVideosGetAppearsInListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getSubscriptionsList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetSubscriptionsListResponse',
- 'e' => 'VimeoVideosGetSubscriptionsListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getListByTag' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetListByTagResponse',
- 'e' => 'VimeoVideosGetListByTagException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getLikeList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetLikeListResponse',
- 'e' => 'VimeoVideosGetLikeListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getContactsList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetContactsListResponse',
- 'e' => 'VimeoVideosGetContactsListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getContactsLikeList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetContactsLikeListResponse',
- 'e' => 'VimeoVideosGetContactsLikeListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.search' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSearchResponse',
- 'e' => 'VimeoVideosSearchException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getInfo' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetInfoResponse',
- 'e' => 'VimeoVideosGetInfoException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getUploadTicket' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetUploadTicketResponse',
- 'e' => 'VimeoVideosGetUploadTicketException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.checkUploadStatus' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosCheckUploadStatusResponse',
- 'e' => 'VimeoVideosCheckUploadStatusException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.delete' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosDeleteResponse',
- 'e' => 'VimeoVideosDeleteException',
- 'p' => VimeoBase::PERMISSION_DELETE),
-
- 'vimeo.videos.setTitle' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetTitleResponse',
- 'e' => 'VimeoVideosSetTitleException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.setCaption' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetCaptionResponse',
- 'e' => 'VimeoVideosSetCaptionException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.setFavorite' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetFavoriteResponse',
- 'e' => 'VimeoVideosSetFavoriteException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.addTags' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosAddTagsResponse',
- 'e' => 'VimeoVideosAddTagsException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.removeTag' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosRemoveTagResponse',
- 'e' => 'VimeoVideosRemoveTagException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.clearTags' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosClearTagsResponse',
- 'e' => 'VimeoVideosClearTagsException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.setPrivacy' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetPrivacyResponse',
- 'e' => 'VimeoVideosSetPrivacyException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- // Vimeo People methods
- 'vimeo.people.findByUserName' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleFindByUsernameResponse',
- 'e' => 'VimeoPeopleFindByUsernameException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.findByEmail' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleFindByEmailResponse',
- 'e' => 'VimeoPeopleFindByEmailException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.getInfo' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleGetInfoResponse',
- 'e' => 'VimeoPeopleGetInfoException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.getPortraitUrl' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleGetPortraitUrlResponse',
- 'e' => 'VimeoPeopleGetPortraitUrlException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.addContact' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleAddContactResponse',
- 'e' => 'VimeoPeopleAddContactException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.people.removeContact' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleRemoveContactResponse',
- 'e' => 'VimeoPeopleRemoveContactException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.people.getUploadStatus' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleGetUploadStatusResponse',
- 'e' => 'VimeoPeopleGetUploadStatusException',
- 'p' => VimeoBase::PERMISSION_READ),
-
- 'vimeo.people.addSubscription' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleAddSubscriptionResponse',
- 'e' => 'VimeoPeopleAddSubscriptionException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.people.removeSubscription' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleRemoveSubscriptionResponse',
- 'e' => 'VimeoPeopleRemoveSubscriptionException',
- 'p' => VimeoBase::PERMISSION_WRITE)
- );
-
- public static function getSourceObjectForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['s'];
- }
-
- public static function getTargetObjectForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['t'];
- }
-
- public static function getExceptionObjectForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['e'];
- }
-
- public static function getPermissionRequirementForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['p'];
- }
-
- public static function checkMethod($sMethod) {
- // Check if the method can be handled
- if(!isset(self::$aMethods[$sMethod])) {
- throw new VimeoMethodException('Unhandled vimeo method "' . $sMethod . '" given', 2);
- }
- }
+
+ private static $aMethods = array(
+ // Vimeo Test methods
+ 'vimeo.test.login' => array( 's' => 'VimeoTestRequest',
+ 't' => 'VimeoTestLoginResponse',
+ 'e' => 'VimeoTestLoginException',
+ 'p' => VimeoBase::PERMISSION_READ),
+
+ 'vimeo.test.echo' => array( 's' => 'VimeoTestRequest',
+ 't' => 'VimeoTestEchoResponse',
+ 'e' => 'VimeoTestEchoException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.test.null' => array( 's' => 'VimeoTestRequest',
+ 't' => 'VimeoTestNullResponse',
+ 'e' => 'VimeoTestNullException',
+ 'p' => VimeoBase::PERMISSION_READ),
+
+ // Vimeo Auth methods
+ 'vimeo.auth.getToken' => array( 's' => 'VimeoAuthRequest',
+ 't' => 'VimeoAuthGetTokenResponse',
+ 'e' => 'VimeoAuthGetTokenException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.auth.getFrob' => array( 's' => 'VimeoAuthRequest',
+ 't' => 'VimeoAuthGetFrobResponse',
+ 'e' => 'VimeoAuthGetFrobException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.auth.checkToken' => array( 's' => 'VimeoAuthRequest',
+ 't' => 'VimeoAuthCheckTokenResponse',
+ 'e' => 'VimeoAuthCheckTokenException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ // Vimeo Videos methods
+ 'vimeo.videos.getList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetListResponse',
+ 'e' => 'VimeoVideosGetListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getUploadedList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetUploadedListResponse',
+ 'e' => 'VimeoVideosGetUploadedListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getAppearsInList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetAppearsInListResponse',
+ 'e' => 'VimeoVideosGetAppearsInListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getSubscriptionsList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetSubscriptionsListResponse',
+ 'e' => 'VimeoVideosGetSubscriptionsListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getListByTag' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetListByTagResponse',
+ 'e' => 'VimeoVideosGetListByTagException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getLikeList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetLikeListResponse',
+ 'e' => 'VimeoVideosGetLikeListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getContactsList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetContactsListResponse',
+ 'e' => 'VimeoVideosGetContactsListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getContactsLikeList' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetContactsLikeListResponse',
+ 'e' => 'VimeoVideosGetContactsLikeListException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.search' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSearchResponse',
+ 'e' => 'VimeoVideosSearchException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getInfo' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetInfoResponse',
+ 'e' => 'VimeoVideosGetInfoException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.videos.getUploadTicket' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosGetUploadTicketResponse',
+ 'e' => 'VimeoVideosGetUploadTicketException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.checkUploadStatus' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosCheckUploadStatusResponse',
+ 'e' => 'VimeoVideosCheckUploadStatusException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.delete' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosDeleteResponse',
+ 'e' => 'VimeoVideosDeleteException',
+ 'p' => VimeoBase::PERMISSION_DELETE),
+
+ 'vimeo.videos.setTitle' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetTitleResponse',
+ 'e' => 'VimeoVideosSetTitleException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.setCaption' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetCaptionResponse',
+ 'e' => 'VimeoVideosSetCaptionException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.setFavorite' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetFavoriteResponse',
+ 'e' => 'VimeoVideosSetFavoriteException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.addTags' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosAddTagsResponse',
+ 'e' => 'VimeoVideosAddTagsException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.removeTag' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosRemoveTagResponse',
+ 'e' => 'VimeoVideosRemoveTagException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.clearTags' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosClearTagsResponse',
+ 'e' => 'VimeoVideosClearTagsException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.videos.setPrivacy' => array( 's' => 'VimeoVideosRequest',
+ 't' => 'VimeoVideosSetPrivacyResponse',
+ 'e' => 'VimeoVideosSetPrivacyException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ // Vimeo People methods
+ 'vimeo.people.findByUserName' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleFindByUsernameResponse',
+ 'e' => 'VimeoPeopleFindByUsernameException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.findByEmail' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleFindByEmailResponse',
+ 'e' => 'VimeoPeopleFindByEmailException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.getInfo' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleGetInfoResponse',
+ 'e' => 'VimeoPeopleGetInfoException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.getPortraitUrl' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleGetPortraitUrlResponse',
+ 'e' => 'VimeoPeopleGetPortraitUrlException',
+ 'p' => VimeoBase::PERMISSION_NONE),
+
+ 'vimeo.people.addContact' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleAddContactResponse',
+ 'e' => 'VimeoPeopleAddContactException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.people.removeContact' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleRemoveContactResponse',
+ 'e' => 'VimeoPeopleRemoveContactException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.people.getUploadStatus' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleGetUploadStatusResponse',
+ 'e' => 'VimeoPeopleGetUploadStatusException',
+ 'p' => VimeoBase::PERMISSION_READ),
+
+ 'vimeo.people.addSubscription' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleAddSubscriptionResponse',
+ 'e' => 'VimeoPeopleAddSubscriptionException',
+ 'p' => VimeoBase::PERMISSION_WRITE),
+
+ 'vimeo.people.removeSubscription' => array( 's' => 'VimeoPeopleRequest',
+ 't' => 'VimeoPeopleRemoveSubscriptionResponse',
+ 'e' => 'VimeoPeopleRemoveSubscriptionException',
+ 'p' => VimeoBase::PERMISSION_WRITE)
+ );
+
+ public static function getSourceObjectForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['s'];
+ }
+
+ public static function getTargetObjectForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['t'];
+ }
+
+ public static function getExceptionObjectForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['e'];
+ }
+
+ public static function getPermissionRequirementForMethod($sMethod) {
+ // Check if the method can be handled
+ self::checkMethod($sMethod);
+
+ return self::$aMethods[$sMethod]['p'];
+ }
+
+ public static function checkMethod($sMethod) {
+ // Check if the method can be handled
+ if(!isset(self::$aMethods[$sMethod])) {
+ throw new VimeoMethodException('Unhandled vimeo method "' . $sMethod . '" given', 2);
+ }
+ }
}
/**
* Vimeo method exception class
*
* Every exception caused by VimeoMethod class will be of this type
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -820,7 +820,7 @@ class VimeoMethodException extends Exception {}
*
* Every exception the whole SimpleVimeo throws will be extended of this base
* class. You can extend this one to alter all exceptions.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
* @abstract
@@ -830,125 +830,125 @@ abstract class VimeoException extends Exception {}
/**
* Vimeo array of object handler class
-*
+*
* This class is for array of object handling. i.e.: An array of video objects.
* It ensures that you can work with foreach and count without getting into a hassle.
-*
+*
* @package SimpleVimeo
* @subpackage Base
* @abstract
*/
abstract class VimeoObjectList implements Iterator, Countable {
- /**
- * Array for instanced objects
- * @var array
- */
- private $aInstances = array();
-
- /**
- * Integer how many results
- * @var integer
- */
- private $iCount = 0;
-
- /**
- * Class name
- * @var string
- */
- private $sClassName;
-
- private $aIDs = array();
-
- /**
- * Constructor
- *
- * @access public
- * @return void
- */
- public function __construct() {
- // Parse class name
- $this->sClassName = str_replace('List', '', get_class($this));
- }
-
- /**
- * Add object to array
- *
- * @access public
- * @param object Object to be added to array
- * @param integer Array index to be used for the given object
- * @return void
- */
- public function add($oObject, $iID = false) {
- if($iID !== false) {
- $this->aInstances[$iID] = $oObject;
- } else {
- $this->aInstances[] = $oObject;
- }
-
- $this->aIDs[] = $iID;
-
- $this->iCount++;
- }
-
- /**
- * Returns all array indexes for further parsing
- *
- * @access public
- * @return array Array with object array indexes
- */
- public function getAllUniqueIDs() {
- return $this->getIDs();
- }
-
- /**
- * @ignore
- */
- public function rewind() {
- reset($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function current() {
- return current($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function key() {
- return key($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function next() {
- return next($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function valid() {
- return $this->current() !== FALSE;
- }
-
- /**
- * @ignore
- */
- public function count() {
- return $this->iCount;
- }
+ /**
+ * Array for instanced objects
+ * @var array
+ */
+ private $aInstances = array();
+
+ /**
+ * Integer how many results
+ * @var integer
+ */
+ private $iCount = 0;
+
+ /**
+ * Class name
+ * @var string
+ */
+ private $sClassName;
+
+ private $aIDs = array();
+
+ /**
+ * Constructor
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct() {
+ // Parse class name
+ $this->sClassName = str_replace('List', '', get_class($this));
+ }
+
+ /**
+ * Add object to array
+ *
+ * @access public
+ * @param object Object to be added to array
+ * @param integer Array index to be used for the given object
+ * @return void
+ */
+ public function add($oObject, $iID = false) {
+ if($iID !== false) {
+ $this->aInstances[$iID] = $oObject;
+ } else {
+ $this->aInstances[] = $oObject;
+ }
+
+ $this->aIDs[] = $iID;
+
+ $this->iCount++;
+ }
+
+ /**
+ * Returns all array indexes for further parsing
+ *
+ * @access public
+ * @return array Array with object array indexes
+ */
+ public function getAllUniqueIDs() {
+ return $this->getIDs();
+ }
+
+ /**
+ * @ignore
+ */
+ public function rewind() {
+ reset($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function current() {
+ return current($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function key() {
+ return key($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function next() {
+ return next($this->aInstances);
+ }
+
+ /**
+ * @ignore
+ */
+ public function valid() {
+ return $this->current() !== FALSE;
+ }
+
+ /**
+ * @ignore
+ */
+ public function count() {
+ return $this->iCount;
+ }
}
/**
* Vimeo request class
*
* Every API query collection class will be based on this.
-*
+*
* @package SimpleVimeo
* @subpackage ApiRequest
* @abstract
@@ -962,60 +962,60 @@ abstract class VimeoRequest {}
* Every API response class will be based on this. It also handles
* everytime response variables like if the query was successfull and
* the generation time.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
* @abstract
*/
abstract class VimeoResponse {
- private $bStatus = false;
- private $fPerformance = false;
- private $iErrorCode = false;
- private $oError = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- * You dont need to pass a response if you need to give a hint your coding tool for code completion
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- if($aResponse) {
- // Parse status
- $this->setStatus($aResponse->stat);
-
- // Parse performance
- $this->fPerformance = (float) $aResponse->generated_in;
-
- // Parse error information
- if(!$this->bStatus) {
- $this->oError = new VimeoErrorEntity($aResponse->err->code, $aResponse->err->msg);
- }
- }
- }
-
- private function setStatus($sStatus) {
- if($sStatus === 'ok') {
- $this->bStatus = true;
- }
- }
-
- public function getStatus() {
- return $this->bStatus;
- }
-
- public function getPerformance() {
- return $this->fPerformance;
- }
-
- public function getError() {
- return $this->oError;
- }
+ private $bStatus = false;
+ private $fPerformance = false;
+ private $iErrorCode = false;
+ private $oError = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ * You dont need to pass a response if you need to give a hint your coding tool for code completion
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ if($aResponse) {
+ // Parse status
+ $this->setStatus($aResponse->stat);
+
+ // Parse performance
+ $this->fPerformance = (float) $aResponse->generated_in;
+
+ // Parse error information
+ if(!$this->bStatus) {
+ $this->oError = new VimeoErrorEntity($aResponse->err->code, $aResponse->err->msg);
+ }
+ }
+ }
+
+ private function setStatus($sStatus) {
+ if($sStatus === 'ok') {
+ $this->bStatus = true;
+ }
+ }
+
+ public function getStatus() {
+ return $this->bStatus;
+ }
+
+ public function getPerformance() {
+ return $this->fPerformance;
+ }
+
+ public function getError() {
+ return $this->oError;
+ }
}
/*
@@ -1027,317 +1027,317 @@ abstract class VimeoResponse {
* Vimeo API error entity class
*
* Implements API delivered error entities into an PHP 5 object with given result parameters.
-*
+*
* @package SimpleVimeo
* @subpackage Entities
*/
class VimeoErrorEntity {
- private $iErrorCode = false;
- private $sErrorMessage = false;
-
- public function __construct($iErrorCode, $sErrorMessage) {
- $this->iErrorCode = $iErrorCode;
- $this->sErrorMessage = $sErrorMessage;
- }
-
- public function getCode() {
- return $this->iErrorCode;
- }
-
- public function getMessage() {
- return $this->sErrorMessage;
- }
+ private $iErrorCode = false;
+ private $sErrorMessage = false;
+
+ public function __construct($iErrorCode, $sErrorMessage) {
+ $this->iErrorCode = $iErrorCode;
+ $this->sErrorMessage = $sErrorMessage;
+ }
+
+ public function getCode() {
+ return $this->iErrorCode;
+ }
+
+ public function getMessage() {
+ return $this->sErrorMessage;
+ }
}
/**
* Vimeo API user entity class
*
* Implements API delivered user entities into an PHP 5 object with given result parameters.
-*
+*
* @package SimpleVimeo
* @subpackage Entities
*/
class VimeoUserEntity {
- private $iUserNsId = false;
- private $iUserId = false;
- private $sUsername = false;
- private $sFullname = false;
-
- // Optional information when vimeo.person.getInfo is called
- private $sLocation = false;
- private $sUrl = false;
- private $iNumberOfContacts = false;
- private $iNumberOfUploads = false;
- private $iNumberOfLikes = false;
- private $iNumberOfVideos = false;
- private $iNumberOfVideosAppearsIn = false;
- private $sProfileUrl = false;
- private $sVideosUrl = false;
-
- public function __construct($aResponseSnippet) {
- if(isset($aResponseSnippet->id)) {
- $this->iUserId = $aResponseSnippet->id;
- }
-
- if(isset($aResponseSnippet->nsid)) {
- $this->iUserNsId = $aResponseSnippet->nsid;
- }
-
- if(isset($aResponseSnippet->username)) {
- $this->sUsername = $aResponseSnippet->username;
- }
-
- if(isset($aResponseSnippet->fullname)) {
- $this->sFullname = $aResponseSnippet->fullname;
- }
-
- if(isset($aResponseSnippet->display_name)) {
- $this->sFullname = $aResponseSnippet->display_name;
- }
-
- // Optional stuff
- if(isset($aResponseSnippet->location)) {
- $this->sLocation = $aResponseSnippet->location;
- }
-
- if(isset($aResponseSnippet->url)) {
- $this->sUrl = $aResponseSnippet->url;
- }
-
- if(isset($aResponseSnippet->number_of_contacts)) {
- $this->iNumberOfContacts = $aResponseSnippet->number_of_contacts;
- }
-
- if(isset($aResponseSnippet->number_of_uploads)) {
- $this->iNumberOfUploads = $aResponseSnippet->number_of_uploads;
- }
-
- if(isset($aResponseSnippet->number_of_likes)) {
- $this->iNumberOfLikes = $aResponseSnippet->number_of_likes;
- }
-
- if(isset($aResponseSnippet->number_of_videos)) {
- $this->iNumberOfVideos = $aResponseSnippet->number_of_videos;
- }
-
- if(isset($aResponseSnippet->number_of_videos_appears_in)) {
- $this->iNumberOfVideosAppearsIn = $aResponseSnippet->number_of_videos_appears_in;
- }
-
- if(isset($aResponseSnippet->profileurl)) {
- $this->sProfileUrl = $aResponseSnippet->profileurl;
- }
-
- if(isset($aResponseSnippet->videosurl)) {
- $this->sVideosUrl = $aResponseSnippet->videosurl;
- }
- }
-
- public function getNsID() {
- return $this->iUserNsId;
- }
-
- public function getID() {
- return $this->iUserId;
- }
-
- public function getUsername() {
- return $this->sUsername;
- }
-
- public function getFullname() {
- return $this->sFullname;
- }
-
- public function getLocation() {
- return $this->sLocation;
- }
-
- public function getUrl() {
- return $this->sUrl;
- }
-
- public function getNumberOfContacts() {
- return $this->iNumberOfContacts;
- }
-
- public function getNumberOfUploads() {
- return $this->iNumberOfUploads;
- }
-
- public function getNumberOfLikes() {
- return $this->iNumberOfLikes;
- }
-
- public function getNumberOfVideos() {
- return $this->iNumberOfVideos;
- }
-
- public function getNumberOfVideosAppearsIn() {
- return $this->iNumberOfVideosAppearsIn;
- }
-
- public function getProfileUrl() {
- return $this->sProfileUrl;
- }
-
- public function getVideosUrl() {
- return $this->sVideosUrl;
- }
+ private $iUserNsId = false;
+ private $iUserId = false;
+ private $sUsername = false;
+ private $sFullname = false;
+
+ // Optional information when vimeo.person.getInfo is called
+ private $sLocation = false;
+ private $sUrl = false;
+ private $iNumberOfContacts = false;
+ private $iNumberOfUploads = false;
+ private $iNumberOfLikes = false;
+ private $iNumberOfVideos = false;
+ private $iNumberOfVideosAppearsIn = false;
+ private $sProfileUrl = false;
+ private $sVideosUrl = false;
+
+ public function __construct($aResponseSnippet) {
+ if(isset($aResponseSnippet->id)) {
+ $this->iUserId = $aResponseSnippet->id;
+ }
+
+ if(isset($aResponseSnippet->nsid)) {
+ $this->iUserNsId = $aResponseSnippet->nsid;
+ }
+
+ if(isset($aResponseSnippet->username)) {
+ $this->sUsername = $aResponseSnippet->username;
+ }
+
+ if(isset($aResponseSnippet->fullname)) {
+ $this->sFullname = $aResponseSnippet->fullname;
+ }
+
+ if(isset($aResponseSnippet->display_name)) {
+ $this->sFullname = $aResponseSnippet->display_name;
+ }
+
+ // Optional stuff
+ if(isset($aResponseSnippet->location)) {
+ $this->sLocation = $aResponseSnippet->location;
+ }
+
+ if(isset($aResponseSnippet->url)) {
+ $this->sUrl = $aResponseSnippet->url;
+ }
+
+ if(isset($aResponseSnippet->number_of_contacts)) {
+ $this->iNumberOfContacts = $aResponseSnippet->number_of_contacts;
+ }
+
+ if(isset($aResponseSnippet->number_of_uploads)) {
+ $this->iNumberOfUploads = $aResponseSnippet->number_of_uploads;
+ }
+
+ if(isset($aResponseSnippet->number_of_likes)) {
+ $this->iNumberOfLikes = $aResponseSnippet->number_of_likes;
+ }
+
+ if(isset($aResponseSnippet->number_of_videos)) {
+ $this->iNumberOfVideos = $aResponseSnippet->number_of_videos;
+ }
+
+ if(isset($aResponseSnippet->number_of_videos_appears_in)) {
+ $this->iNumberOfVideosAppearsIn = $aResponseSnippet->number_of_videos_appears_in;
+ }
+
+ if(isset($aResponseSnippet->profileurl)) {
+ $this->sProfileUrl = $aResponseSnippet->profileurl;
+ }
+
+ if(isset($aResponseSnippet->videosurl)) {
+ $this->sVideosUrl = $aResponseSnippet->videosurl;
+ }
+ }
+
+ public function getNsID() {
+ return $this->iUserNsId;
+ }
+
+ public function getID() {
+ return $this->iUserId;
+ }
+
+ public function getUsername() {
+ return $this->sUsername;
+ }
+
+ public function getFullname() {
+ return $this->sFullname;
+ }
+
+ public function getLocation() {
+ return $this->sLocation;
+ }
+
+ public function getUrl() {
+ return $this->sUrl;
+ }
+
+ public function getNumberOfContacts() {
+ return $this->iNumberOfContacts;
+ }
+
+ public function getNumberOfUploads() {
+ return $this->iNumberOfUploads;
+ }
+
+ public function getNumberOfLikes() {
+ return $this->iNumberOfLikes;
+ }
+
+ public function getNumberOfVideos() {
+ return $this->iNumberOfVideos;
+ }
+
+ public function getNumberOfVideosAppearsIn() {
+ return $this->iNumberOfVideosAppearsIn;
+ }
+
+ public function getProfileUrl() {
+ return $this->sProfileUrl;
+ }
+
+ public function getVideosUrl() {
+ return $this->sVideosUrl;
+ }
}
/**
* Vimeo API video entity class
*
* Implements API delivered video into an PHP 5 object with given result parameters.
-*
+*
* @package SimpleVimeo
* @subpackage Entities
*/
class VimeoVideoEntity {
- private $iID = false;
- private $ePrivacy = false;
- private $bIsUploading = false;
- private $bIsTranscoding = false;
- private $bIsHD = false;
-
- private $sTitle = false;
- private $sCaption = false;
- private $iUploadTime = false;
- private $iNumberOfLikes = false;
- private $iNumberOfPlays = false;
- private $iNumberOfComments = false;
-
- private $sUrl = false;
-
- private $iWidth = false;
- private $iHeight = false;
- private $oOwner = false;
-
- private $oTagList = false;
-
- private $oThumbnailList = false;
-
- public function __construct($aResponseSnippet = false) {
- if($aResponseSnippet) {
- // Set basic information
- $this->iID = $aResponseSnippet->id;
- $this->ePrivacy = $aResponseSnippet->privacy;
- $this->bIsUploading = $aResponseSnippet->is_uploading;
- $this->bIsTranscoding = $aResponseSnippet->is_transcoding;
- $this->bIsHD = $aResponseSnippet->is_hd;
-
- $this->sTitle = $aResponseSnippet->title;
- $this->sCaption = $aResponseSnippet->caption;
- $this->iUploadTime = strtotime($aResponseSnippet->upload_date);
- $this->iNumberOfLikes = (int) $aResponseSnippet->number_of_likes;
- $this->iNumberOfPlays = (int) $aResponseSnippet->number_of_plays;
- $this->iNumberOfComments = (int) $aResponseSnippet->number_of_comments;
-
- $this->sUrl = $aResponseSnippet->urls->url->_content;
-
- $this->iWidth = (int) $aResponseSnippet->width;
- $this->iHeight = (int) $aResponseSnippet->height;
-
- $this->oOwner = new VimeoUserEntity($aResponseSnippet->owner);
-
- // Parse Tags
- $this->oTagList = new VimeoTagList();
- if(isset($aResponseSnippet->tags->tag)) {
- foreach($aResponseSnippet->tags->tag as $aTagInformation) {
- $oTag = new VimeoTagEntity($aTagInformation);
- $this->oTagList->add($oTag, $oTag->getID());
- }
- }
-
- // Parse Thumbnails
- $this->oThumbnailList = new VimeoThumbnailList();
- if(isset($aResponseSnippet->thumbnails->thumbnail)) {
- foreach($aResponseSnippet->thumbnails->thumbnail as $aThumbnailInformation) {
- $oThumbnail = new VimeoThumbnailEntity($aThumbnailInformation);
- $this->oThumbnailList->add($oThumbnail, ($oThumbnail->getWidth() * $oThumbnail->getHeight()));
- }
- }
- }
- }
-
- public function getID() {
- return $this->iID;
- }
-
- public function getPrivacy() {
- return $this->ePrivacy;
- }
-
- public function isUploading() {
- return $this->bIsUploading;
- }
-
- public function isTranscoding() {
- return $this->bIsTranscoding;
- }
-
- public function isHD() {
- return $this->bIsHD;
- }
-
- public function getTitle() {
- return $this->sTitle;
- }
-
- public function getCaption() {
- return $this->sCaption;
- }
-
- public function getUploadTimestamp() {
- return $this->iUploadTime;
- }
-
- public function getNumberOfLikes() {
- return (int) $this->iNumberOfLikes;
- }
-
- public function getNumberOfPlays() {
- return (int) $this->iNumberOfPlays;
- }
-
- public function getNumberOfComments() {
- return (int) $this->iNumberOfComments;
- }
-
- public function getWidth() {
- return (int) $this->iWidth;
- }
-
- public function getHeight() {
- return (int) $this->iHeight;
- }
-
- public function getOwner() {
- return $this->oOwner;
- }
-
- public function getTags() {
- return $this->oTagList;
- }
-
- public function getUrl() {
- return $this->sUrl;
- }
-
- public function getThumbnails() {
- return $this->oThumbnailList;
- }
+ private $iID = false;
+ private $ePrivacy = false;
+ private $bIsUploading = false;
+ private $bIsTranscoding = false;
+ private $bIsHD = false;
+
+ private $sTitle = false;
+ private $sCaption = false;
+ private $iUploadTime = false;
+ private $iNumberOfLikes = false;
+ private $iNumberOfPlays = false;
+ private $iNumberOfComments = false;
+
+ private $sUrl = false;
+
+ private $iWidth = false;
+ private $iHeight = false;
+ private $oOwner = false;
+
+ private $oTagList = false;
+
+ private $oThumbnailList = false;
+
+ public function __construct($aResponseSnippet = false) {
+ if($aResponseSnippet) {
+ // Set basic information
+ $this->iID = $aResponseSnippet->id;
+ $this->ePrivacy = $aResponseSnippet->privacy;
+ $this->bIsUploading = $aResponseSnippet->is_uploading;
+ $this->bIsTranscoding = $aResponseSnippet->is_transcoding;
+ $this->bIsHD = $aResponseSnippet->is_hd;
+
+ $this->sTitle = $aResponseSnippet->title;
+ $this->sCaption = $aResponseSnippet->caption;
+ $this->iUploadTime = strtotime($aResponseSnippet->upload_date);
+ $this->iNumberOfLikes = (int) $aResponseSnippet->number_of_likes;
+ $this->iNumberOfPlays = (int) $aResponseSnippet->number_of_plays;
+ $this->iNumberOfComments = (int) $aResponseSnippet->number_of_comments;
+
+ $this->sUrl = $aResponseSnippet->urls->url->_content;
+
+ $this->iWidth = (int) $aResponseSnippet->width;
+ $this->iHeight = (int) $aResponseSnippet->height;
+
+ $this->oOwner = new VimeoUserEntity($aResponseSnippet->owner);
+
+ // Parse Tags
+ $this->oTagList = new VimeoTagList();
+ if(isset($aResponseSnippet->tags->tag)) {
+ foreach($aResponseSnippet->tags->tag as $aTagInformation) {
+ $oTag = new VimeoTagEntity($aTagInformation);
+ $this->oTagList->add($oTag, $oTag->getID());
+ }
+ }
+
+ // Parse Thumbnails
+ $this->oThumbnailList = new VimeoThumbnailList();
+ if(isset($aResponseSnippet->thumbnails->thumbnail)) {
+ foreach($aResponseSnippet->thumbnails->thumbnail as $aThumbnailInformation) {
+ $oThumbnail = new VimeoThumbnailEntity($aThumbnailInformation);
+ $this->oThumbnailList->add($oThumbnail, ($oThumbnail->getWidth() * $oThumbnail->getHeight()));
+ }
+ }
+ }
+ }
+
+ public function getID() {
+ return $this->iID;
+ }
+
+ public function getPrivacy() {
+ return $this->ePrivacy;
+ }
+
+ public function isUploading() {
+ return $this->bIsUploading;
+ }
+
+ public function isTranscoding() {
+ return $this->bIsTranscoding;
+ }
+
+ public function isHD() {
+ return $this->bIsHD;
+ }
+
+ public function getTitle() {
+ return $this->sTitle;
+ }
+
+ public function getCaption() {
+ return $this->sCaption;
+ }
+
+ public function getUploadTimestamp() {
+ return $this->iUploadTime;
+ }
+
+ public function getNumberOfLikes() {
+ return (int) $this->iNumberOfLikes;
+ }
+
+ public function getNumberOfPlays() {
+ return (int) $this->iNumberOfPlays;
+ }
+
+ public function getNumberOfComments() {
+ return (int) $this->iNumberOfComments;
+ }
+
+ public function getWidth() {
+ return (int) $this->iWidth;
+ }
+
+ public function getHeight() {
+ return (int) $this->iHeight;
+ }
+
+ public function getOwner() {
+ return $this->oOwner;
+ }
+
+ public function getTags() {
+ return $this->oTagList;
+ }
+
+ public function getUrl() {
+ return $this->sUrl;
+ }
+
+ public function getThumbnails() {
+ return $this->oThumbnailList;
+ }
}
/**
* Vimeo API video list class
*
* Implements API delivered video list entities into an PHP 5 array of objects.
-*
+*
* @package SimpleVimeo
* @subpackage Lists
*/
@@ -1348,36 +1348,36 @@ class VimeoVideoList extends VimeoObjectList {}
* Vimeo API tag entity class
*
* Implements API delivered tag entities into an PHP 5 object with given result parameters.
-*
+*
* @package SimpleVimeo
* @subpackage Entities
*/
class VimeoTagEntity {
- private $iID = false;
- private $sContent = false;
-
- public function __construct($aResponseSnippet = false) {
- if($aResponseSnippet) {
- $this->iID = $aResponseSnippet->id;
- $this->sContent = $aResponseSnippet->_content;
- }
- }
-
- public function getID() {
- return $this->iID;
- }
-
- public function getTag() {
- return $this->sContent;
- }
+ private $iID = false;
+ private $sContent = false;
+
+ public function __construct($aResponseSnippet = false) {
+ if($aResponseSnippet) {
+ $this->iID = $aResponseSnippet->id;
+ $this->sContent = $aResponseSnippet->_content;
+ }
+ }
+
+ public function getID() {
+ return $this->iID;
+ }
+
+ public function getTag() {
+ return $this->sContent;
+ }
}
/**
* Vimeo API tag list class
*
* Implements API delivered tag list entities into an PHP 5 array of objects.
-*
+*
* @package SimpleVimeo
* @subpackage Lists
*/
@@ -1388,64 +1388,64 @@ class VimeoTagList extends VimeoObjectList {}
* Vimeo API thumbnail entity class
*
* Implements API delivered thumbnail entities into an PHP 5 object with given result parameters.
-*
+*
* @package SimpleVimeo
* @subpackage Entities
*/
class VimeoThumbnailEntity {
- private $iWidth = false;
- private $iHeight = false;
- private $sContent = false;
-
- public function __construct($aResponseSnippet = false) {
- if($aResponseSnippet) {
- $this->iWidth = (int) $aResponseSnippet->width;
- $this->iHeight = (int) $aResponseSnippet->height;
- $this->sContent = $aResponseSnippet->_content;
- }
- }
-
- public function getWidth() {
- return (int) $this->iWidth;
- }
-
- public function getHeight() {
- return (int) $this->iHeight;
- }
-
- public function getImageContent() {
- return $this->sContent;
- }
+ private $iWidth = false;
+ private $iHeight = false;
+ private $sContent = false;
+
+ public function __construct($aResponseSnippet = false) {
+ if($aResponseSnippet) {
+ $this->iWidth = (int) $aResponseSnippet->width;
+ $this->iHeight = (int) $aResponseSnippet->height;
+ $this->sContent = $aResponseSnippet->_content;
+ }
+ }
+
+ public function getWidth() {
+ return (int) $this->iWidth;
+ }
+
+ public function getHeight() {
+ return (int) $this->iHeight;
+ }
+
+ public function getImageContent() {
+ return $this->sContent;
+ }
}
/**
* Vimeo API thumbnail list class
*
* Implements API delivered thumbnail list entities into an PHP 5 array of objects.
-*
+*
* @package SimpleVimeo
* @subpackage Lists
*/
class VimeoThumbnailList extends VimeoObjectList {
- public function getByWidth($iWidth, $bAlsoLower = false) {
- /**
- * @todo
- */
- }
-
- public function getByHeight($iHeight, $bAlsoLower = false) {
- /**
- * @todo
- */
- }
-
- public function getByWidthAndHeight($iWidth, $iHeight, $bAlsoLower = false) {
- /**
- * @todo
- */
- }
+ public function getByWidth($iWidth, $bAlsoLower = false) {
+ /**
+ * @todo
+ */
+ }
+
+ public function getByHeight($iHeight, $bAlsoLower = false) {
+ /**
+ * @todo
+ */
+ }
+
+ public function getByWidthAndHeight($iWidth, $iHeight, $bAlsoLower = false) {
+ /**
+ * @todo
+ */
+ }
}
@@ -1457,53 +1457,53 @@ class VimeoThumbnailList extends VimeoObjectList {
* Vimeo Test request handler class
*
* Implements all API queries in the vimeo.test.* category
-*
+*
* @package SimpleVimeo
* @subpackage ApiRequest
*/
class VimeoTestRequest extends VimeoRequest {
-
- /**
- * Is the user logged in?
- *
- * @access public
- * @return VimeoTestLoginResponse
- */
-
- public function login() {
- return VimeoBase::executeRemoteCall('vimeo.test.login');
- }
-
- /**
- * This will just repeat back any parameters that you send.
- *
- * @access public
- * @param array Additional arguments that need to be passed to the API
- * @return VimeoTestEchoResponse
- */
-
- public function echoback($aArgs) {
- return VimeoBase::executeRemoteCall('vimeo.test.echo', $aArgs);
- }
-
- /**
- * This is just a simple null/ping test...
- *
- * @access public
- * @return VimeoTestNullResponse
- */
-
- public function ping() {
- return VimeoBase::executeRemoteCall('vimeo.test.null');
- }
+
+ /**
+ * Is the user logged in?
+ *
+ * @access public
+ * @return VimeoTestLoginResponse
+ */
+
+ public function login() {
+ return VimeoBase::executeRemoteCall('vimeo.test.login');
+ }
+
+ /**
+ * This will just repeat back any parameters that you send.
+ *
+ * @access public
+ * @param array Additional arguments that need to be passed to the API
+ * @return VimeoTestEchoResponse
+ */
+
+ public function echoback($aArgs) {
+ return VimeoBase::executeRemoteCall('vimeo.test.echo', $aArgs);
+ }
+
+ /**
+ * This is just a simple null/ping test...
+ *
+ * @access public
+ * @return VimeoTestNullResponse
+ */
+
+ public function ping() {
+ return VimeoBase::executeRemoteCall('vimeo.test.null');
+ }
}
/**
* Vimeo Test Login response handler class
*
* Handles the API response for vimeo.test.login queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -1514,7 +1514,7 @@ class VimeoTestLoginResponse extends VimeoResponse {}
* Vimeo Test Login exception handler class
*
* Handles exceptions caused by API response for vimeo.test.login queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -1525,49 +1525,49 @@ class VimeoTestLoginException extends VimeoException {}
* Vimeo Test Echo response handler class
*
* Handles the API response for vimeo.test.echo queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoTestEchoResponse extends VimeoResponse {
- private $aArgs = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->aArgs = get_object_vars($aResponse);
-
- // Unset default response stuff
- if(isset($this->aArgs['stat'])) unset($this->aArgs['stat']);
- if(isset($this->aArgs['generated_in'])) unset($this->aArgs['generated_in']);
- }
-
- /**
- * Returns an array of variables the request bounced back
- *
- * @access public
- * @return array Echoed variables
- */
- public function getResponseArray() {
- return $this->aArgs;
- }
+ private $aArgs = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->aArgs = get_object_vars($aResponse);
+
+ // Unset default response stuff
+ if(isset($this->aArgs['stat'])) unset($this->aArgs['stat']);
+ if(isset($this->aArgs['generated_in'])) unset($this->aArgs['generated_in']);
+ }
+
+ /**
+ * Returns an array of variables the request bounced back
+ *
+ * @access public
+ * @return array Echoed variables
+ */
+ public function getResponseArray() {
+ return $this->aArgs;
+ }
}
/**
* Vimeo Test Echo exception handler class
*
* Handles exceptions caused by API response for vimeo.test.echo queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -1578,7 +1578,7 @@ class VimeoTestEchoException extends VimeoException {}
* Vimeo Test Null response handler class
*
* Handles the API response for vimeo.test.null queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -1589,7 +1589,7 @@ class VimeoTestNullResponse extends VimeoResponse {}
* Vimeo Test Null exception handler class
*
* Handles exceptions caused by API response for vimeo.test.null queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -1604,134 +1604,134 @@ class VimeoTestNullException extends VimeoException {}
* Vimeo Auth request handler class
*
* Implements all API queries in the vimeo.auth.* category
-*
+*
* @package SimpleVimeo
* @subpackage ApiRequest
*/
class VimeoAuthRequest extends VimeoRequest {
-
- /**
- * Get Token
- *
- * @access public
- * @param string Frob taken from the vimeo authentication
- * @return VimeoAuthGetTokenResponse
- */
- public function getToken($sFrob) {
- $aArgs = array(
- 'frob' => $sFrob
- );
-
- return VimeoBase::executeRemoteCall('vimeo.auth.getToken', $aArgs);
- }
-
- /**
- * Check Token
- *
- * Checks the validity of the token. Returns the user associated with it.
- * Returns the same as vimeo.auth.getToken
- *
- * @access public
- * @param string Authentication token
- * @return VimeoAuthCheckTokenResponse
- */
- public function checkToken($sToken = false) {
- if(!$sToken) $sToken = VimeoBase::getToken();
-
- $aArgs = array(
- 'auth_token' => $sToken
- );
-
- return VimeoBase::executeRemoteCall('vimeo.auth.checkToken', $aArgs);
- }
-
- /**
- * Get Frob
- *
- * This is generally used by desktop applications. If the user doesn't already have
- * a token, you'll need to get the frob, send it to us at /services/auth. Then,
- * after the user, clicks continue on your app, you call vimeo.auth.getToken($frob)
- * and we give you the actual token.
- *
- * @access public
- * @return VimeoAuthGetFrobResponse
- */
- public function getFrob() {
- return VimeoBase::executeRemoteCall('vimeo.auth.getFrob');
- }
+
+ /**
+ * Get Token
+ *
+ * @access public
+ * @param string Frob taken from the vimeo authentication
+ * @return VimeoAuthGetTokenResponse
+ */
+ public function getToken($sFrob) {
+ $aArgs = array(
+ 'frob' => $sFrob
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.auth.getToken', $aArgs);
+ }
+
+ /**
+ * Check Token
+ *
+ * Checks the validity of the token. Returns the user associated with it.
+ * Returns the same as vimeo.auth.getToken
+ *
+ * @access public
+ * @param string Authentication token
+ * @return VimeoAuthCheckTokenResponse
+ */
+ public function checkToken($sToken = false) {
+ if(!$sToken) $sToken = VimeoBase::getToken();
+
+ $aArgs = array(
+ 'auth_token' => $sToken
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.auth.checkToken', $aArgs);
+ }
+
+ /**
+ * Get Frob
+ *
+ * This is generally used by desktop applications. If the user doesn't already have
+ * a token, you'll need to get the frob, send it to us at /services/auth. Then,
+ * after the user, clicks continue on your app, you call vimeo.auth.getToken($frob)
+ * and we give you the actual token.
+ *
+ * @access public
+ * @return VimeoAuthGetFrobResponse
+ */
+ public function getFrob() {
+ return VimeoBase::executeRemoteCall('vimeo.auth.getFrob');
+ }
}
/**
* Vimeo Auth GetToken response handler class
*
* Handles the API response for vimeo.auth.getToken queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoAuthGetTokenResponse extends VimeoResponse {
-
- private $sToken = false;
- private $ePermission = false;
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- $this->sToken = $aResponse->auth->token;
- $this->ePermission = $aResponse->auth->perms;
-
- $this->oUser = new VimeoUserEntity($aResponse->auth->user);
- }
-
- /**
- * Get token value
- *
- * @access public
- * @return token
- */
- public function getToken() {
- return $this->sToken;
- }
-
- /**
- * Get permission value
- *
- * @access public
- * @return permission
- */
-
- public function getPermission() {
- return $this->ePermission;
- }
-
- /**
- * Get user information object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
+
+ private $sToken = false;
+ private $ePermission = false;
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ $this->sToken = $aResponse->auth->token;
+ $this->ePermission = $aResponse->auth->perms;
+
+ $this->oUser = new VimeoUserEntity($aResponse->auth->user);
+ }
+
+ /**
+ * Get token value
+ *
+ * @access public
+ * @return token
+ */
+ public function getToken() {
+ return $this->sToken;
+ }
+
+ /**
+ * Get permission value
+ *
+ * @access public
+ * @return permission
+ */
+
+ public function getPermission() {
+ return $this->ePermission;
+ }
+
+ /**
+ * Get user information object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
}
/**
* Vimeo Auth GetToken exception handler class
*
* Handles exceptions caused by API response for vimeo.auth.getToken queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -1742,7 +1742,7 @@ class VimeoAuthGetTokenException extends Exception {}
* Vimeo Auth CheckToken response handler class
*
* Handles the API response for vimeo.auth.checkToken queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -1753,7 +1753,7 @@ class VimeoAuthCheckTokenResponse extends VimeoAuthGetTokenResponse {}
* Vimeo Auth CheckToken exception handler class
*
* Handles exceptions caused by API response for vimeo.auth.checkToken queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -1764,45 +1764,45 @@ class VimeoAuthCheckTokenException extends VimeoAuthGetTokenException {}
* Vimeo Auth GetFrob response handler class
*
* Handles the API response for vimeo.auth.getFrob queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoAuthGetFrobResponse extends VimeoResponse {
- private $sFrob = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- $this->sFrob = $aResponse->frob;
- }
-
- /**
- * Get Frob value
- *
- * @access public
- * @return frob
- */
- public function getFrob() {
- return $this->sFrob;
- }
+ private $sFrob = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ $this->sFrob = $aResponse->frob;
+ }
+
+ /**
+ * Get Frob value
+ *
+ * @access public
+ * @return frob
+ */
+ public function getFrob() {
+ return $this->sFrob;
+ }
}
/**
* Vimeo Auth GetFrob exception handler class
*
* Handles exceptions caused by API response for vimeo.auth.getFrob queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -1817,654 +1817,654 @@ class VimeoAuthGetFrobException extends VimeoException {}
* Vimeo Videos request handler class
*
* Implements all API queries in the vimeo.videos.* category
-*
+*
* @package SimpleVimeo
* @subpackage ApiRequest
*/
class VimeoVideosRequest extends VimeoRequest {
- const PRIVACY_ANYBODY = 'anybody';
- const PRIVACY_CONTACTS = 'contacts';
- const PRIVACY_NOBODY = 'nobody';
- const PRIVACY_USERS = 'users';
-
- /**
- * Search videos!
- *
- * If the calling user is logged in, this will return information that calling user
- * has access to (including private videos). If the calling user is not authenticated,
- * this will only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param string Search query
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param boolean If TRUE, we'll only search the users contacts. If this is set, you must specifiy a User ID. Otherwise it will be ignored without error.
- * @param integer ow many results per page?
- * @return VimeoVideosSearchResponse
- */
- public function search($sQuery, $iUserID = false, $bContactsOnly = false, $iItemsPerPage = false) {
-
- // Pass query (required)
- $aArgs = array(
- 'query' => $sQuery
- );
-
- // Pass user
- if($iUserID) {
- $aArgs['user_id'] = $iUserID;
- }
-
- // Pass contacts
- if($bContactsOnly) {
- $aArgs['contacts_only'] = $bContactsOnly;
- }
-
- // Pass items
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.search', $aArgs);
- }
-
- /**
- * This gets a list of videos for the specified user.
- *
- * This is the functionality of "My Videos" or "Ted's Videos." At the moment, this is the same list
- * as vimeo.videos.getAppearsInList. If you need uploaded or appears in, those are available too.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetListResponse
- */
- public function getList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getList', $aArgs);
- }
-
- /**
- * This gets a list of videos uploaded by the specified user.
- *
- * If the calling user is logged in, this will return information that calling user has access to
- * (including private videos). If the calling user is not authenticated, this will only return
- * public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetUploadedListResponse
- */
- public function getUploadedList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getUploadedList', $aArgs);
- }
-
- /**
- * This gets a list of videos that the specified user appears in.
- *
- * If the calling user is logged in, this will return information that calling user has access
- * to (including private videos). If the calling user is not authenticated, this will only return
- * public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetAppearsInListResponse
- */
- public function getAppearsInList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getAppearsInList', $aArgs);
- }
-
- /**
- * This gets a list of subscribed videos for a particular user.
- *
- * If the calling user is logged in, this will return information that calling user
- * has access to (including private videos). If the calling user is not authenticated,
- * this will only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetSubscriptionsListResponse
- */
- public function getSubscriptionsList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getSubscriptionsList', $aArgs);
- }
-
- /**
- * This gets a list of videos by tag
- *
- * If you specify a user_id, we'll only get video uploaded by that user with the specified tag.
- * If the calling user is logged in, this will return information that calling user has access
- * to (including private videos). If the calling user is not authenticated, this will only
- * return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param string A single tag: "cat" "new york" "cheese"
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetListByTagResponse
- */
- public function getListByTag($sTag, $iUserID = false, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'tag' => $sTag
- );
-
- if($iUserID) {
- $aArgs['user_id'] = $iUserID;
- }
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getListByTag', $aArgs);
- }
-
- /**
- * Get a list of videos that the specified user likes.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetLikeListResponse
- */
- public function getLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getLikeList', $aArgs);
- }
-
- /**
- * Get a list of videos made by the contacts of a specific user.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetContactsListResponse
- */
- public function getContactsList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getContactsList', $aArgs);
- }
-
- /**
- * Get a list of videos that the specified users contacts like.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetContactsLikeListResponse
- */
- public function getContactsLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getContactsLikeList', $aArgs);
- }
-
- /**
- * Get all kinds of information about a photo.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer Video ID
- * @return VimeoVideosGetInfoResponse
- */
- public function getInfo($iVideoID) {
- // Extend query
- $aArgs = array(
- 'video_id' => $iVideoID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getInfo', $aArgs);
- }
-
- /**
- * Generate a new upload Ticket.
- *
- * You'll need to pass this to the uploader. It's only good for one upload, only good for one user.
- *
- * @access public
- * @return VimeoVideosGetUploadTicketResponse
- */
- public function getUploadTicket() {
- return VimeoBase::executeRemoteCall('vimeo.videos.getUploadTicket');
- }
-
- /**
- * Check the status of an upload started via the API
- *
- * This is how you get the video_id of a clip uploaded from the API
- * If you never call this to check in, we assume it was abandoned and don't process it
- *
- * @access public
- * @param string The ticket number of the upload
- * @return VimeoVideosCheckUploadStatusResponse
- */
- public function checkUploadStatus($sTicket) {
- $aArgs = array(
- 'ticket_id' => $sTicket
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.checkUploadStatus', $aArgs);
- }
-
- /**
- * Simple video upload
- *
- * @access public
- * @param string Absolute path to file
- * @param string Existing ticket or false to generate a new one
- * @return VimeoVideosCheckUploadStatusResponse
- */
- public function doUpload($sFilename, $sTicket = false) {
- return VimeoBase::executeVideopostCall($sFilename, $sTicket);
- }
-
- /**
- * Delete a video
- *
- * The authenticated user must own the video and have granted delete permission
- *
- * @access public
- * @param integer Video ID
- * @return VimeoVideosDeleteResponse
- */
- public function delete($iVideoID) {
- $aArgs = array(
- 'video_id' => $iVideoID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.delete', $aArgs);
- }
-
- /**
- * Set the title of a video (overwrites previous title)
- *
- * @access public
- * @param integer Video ID
- * @param string Title
- * @return VimeoVideosSetTitleResponse
- */
- public function setTitle($iVideoID, $sVideoTitle) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'title' => $sVideoTitle
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setTitle', $aArgs);
- }
-
- /**
- * Set a new caption for a video (overwrites previous caption)
- *
- * @access public
- * @param integer Video ID
- * @param string Caption
- * @return VimeoVideosSetCaptionResponse
- */
- public function setCaption($iVideoID, $sVideoCaption) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'caption' => $sVideoCaption
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setCaption', $aArgs);
- }
-
- /**
- * Set a video as a favorite.
- *
- * @access public
- * @param integer Video ID
- * @param boolean TRUE to favorite, FALSE to return to normal
- * @return VimeoVideosSetFavoriteResponse
- */
- public function setFavorite($iVideoID, $bFavorite = true) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'favorite' => (int) $bFavorite
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setFavorite', $aArgs);
- }
-
- /**
- * Add specified tags to the video, this does not replace any tags.
- *
- * Tags should be comma separated lists.
- *
- * If the calling user is logged in, this will return information that calling
- * user has access to (including private videos). If the calling user is not authenticated,
- * this will only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer Video ID
- * @param mixed Array with tags or Comma separated list of tags ("lions, tigers, bears")
- * @return VimeoVideosAddTagsResponse
- */
- public function addTags($iVideoID, $mTags) {
- // Catch array of tags
- if(is_array($mTags)) {
- $mTags = implode(',', $mTags);
- }
-
- // Prepare arguments
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'tags' => $mTags
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.addTags', $aArgs);
- }
-
- /**
- * Remove specified tag from the video.
- *
- * @access public
- * @param integer Video ID
- * @param integer Tag ID, this should be a tag id returned by vimeo.videos.getInfo
- * @return VimeoVideosRemoveTagResponse
- */
- public function removeTag($iVideoID, $iTagID) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'tag_id' => $iTagID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.removeTag', $aArgs);
- }
-
- /**
- * Remove ALL of the tags from the video
- *
- * @access public
- * @param integer Video ID
- * @return VimeoVideosClearTags
- */
- public function clearTags($iVideoID) {
- $aArgs = array(
- 'video_id' => $iVideoID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.clearTags', $aArgs);
- }
-
- /**
- * Set the privacy of the video
- *
- * @access public
- * @param integer Video ID
- * @param integer Privacy enum see VimeoVideosRequest::PRIVACY_*
- * @param mixed Array or comma separated list of users who can view the video. PRIVACY_USERS must be set.
- */
- public function setPrivacy($iVideoID, $ePrivacy, $mUsers = array()) {
- // Catch array of users
- if(is_array($mUsers)) {
- $mUsers = implode(', ', $mUsers);
- }
-
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'privacy' => $ePrivacy,
- 'users' => $mUsers
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setPrivacy', $aArgs);
- }
+ const PRIVACY_ANYBODY = 'anybody';
+ const PRIVACY_CONTACTS = 'contacts';
+ const PRIVACY_NOBODY = 'nobody';
+ const PRIVACY_USERS = 'users';
+
+ /**
+ * Search videos!
+ *
+ * If the calling user is logged in, this will return information that calling user
+ * has access to (including private videos). If the calling user is not authenticated,
+ * this will only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param string Search query
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param boolean If TRUE, we'll only search the users contacts. If this is set, you must specifiy a User ID. Otherwise it will be ignored without error.
+ * @param integer ow many results per page?
+ * @return VimeoVideosSearchResponse
+ */
+ public function search($sQuery, $iUserID = false, $bContactsOnly = false, $iItemsPerPage = false) {
+
+ // Pass query (required)
+ $aArgs = array(
+ 'query' => $sQuery
+ );
+
+ // Pass user
+ if($iUserID) {
+ $aArgs['user_id'] = $iUserID;
+ }
+
+ // Pass contacts
+ if($bContactsOnly) {
+ $aArgs['contacts_only'] = $bContactsOnly;
+ }
+
+ // Pass items
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.search', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos for the specified user.
+ *
+ * This is the functionality of "My Videos" or "Ted's Videos." At the moment, this is the same list
+ * as vimeo.videos.getAppearsInList. If you need uploaded or appears in, those are available too.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetListResponse
+ */
+ public function getList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getList', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos uploaded by the specified user.
+ *
+ * If the calling user is logged in, this will return information that calling user has access to
+ * (including private videos). If the calling user is not authenticated, this will only return
+ * public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetUploadedListResponse
+ */
+ public function getUploadedList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getUploadedList', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos that the specified user appears in.
+ *
+ * If the calling user is logged in, this will return information that calling user has access
+ * to (including private videos). If the calling user is not authenticated, this will only return
+ * public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetAppearsInListResponse
+ */
+ public function getAppearsInList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getAppearsInList', $aArgs);
+ }
+
+ /**
+ * This gets a list of subscribed videos for a particular user.
+ *
+ * If the calling user is logged in, this will return information that calling user
+ * has access to (including private videos). If the calling user is not authenticated,
+ * this will only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetSubscriptionsListResponse
+ */
+ public function getSubscriptionsList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getSubscriptionsList', $aArgs);
+ }
+
+ /**
+ * This gets a list of videos by tag
+ *
+ * If you specify a user_id, we'll only get video uploaded by that user with the specified tag.
+ * If the calling user is logged in, this will return information that calling user has access
+ * to (including private videos). If the calling user is not authenticated, this will only
+ * return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param string A single tag: "cat" "new york" "cheese"
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetListByTagResponse
+ */
+ public function getListByTag($sTag, $iUserID = false, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'tag' => $sTag
+ );
+
+ if($iUserID) {
+ $aArgs['user_id'] = $iUserID;
+ }
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getListByTag', $aArgs);
+ }
+
+ /**
+ * Get a list of videos that the specified user likes.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetLikeListResponse
+ */
+ public function getLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getLikeList', $aArgs);
+ }
+
+ /**
+ * Get a list of videos made by the contacts of a specific user.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetContactsListResponse
+ */
+ public function getContactsList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getContactsList', $aArgs);
+ }
+
+ /**
+ * Get a list of videos that the specified users contacts like.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer User ID, this can be the ID number (151542) or the username (ted)
+ * @param integer Which page to show.
+ * @param integer How many results per page?
+ * @return VimeoVideosGetContactsLikeListResponse
+ */
+ public function getContactsLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
+ // Extend query
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ if($iPage) {
+ $aArgs['page'] = $iPage;
+ }
+
+ if($iItemsPerPage) {
+ $aArgs['per_page'] = $iItemsPerPage;
+ }
+
+ // Please deliver full response so we can handle videos with unified classes
+ $aArgs['fullResponse'] = 1;
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getContactsLikeList', $aArgs);
+ }
+
+ /**
+ * Get all kinds of information about a photo.
+ *
+ * If the calling user is logged in, this will return information that calling user has
+ * access to (including private videos). If the calling user is not authenticated, this will
+ * only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer Video ID
+ * @return VimeoVideosGetInfoResponse
+ */
+ public function getInfo($iVideoID) {
+ // Extend query
+ $aArgs = array(
+ 'video_id' => $iVideoID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.getInfo', $aArgs);
+ }
+
+ /**
+ * Generate a new upload Ticket.
+ *
+ * You'll need to pass this to the uploader. It's only good for one upload, only good for one user.
+ *
+ * @access public
+ * @return VimeoVideosGetUploadTicketResponse
+ */
+ public function getUploadTicket() {
+ return VimeoBase::executeRemoteCall('vimeo.videos.getUploadTicket');
+ }
+
+ /**
+ * Check the status of an upload started via the API
+ *
+ * This is how you get the video_id of a clip uploaded from the API
+ * If you never call this to check in, we assume it was abandoned and don't process it
+ *
+ * @access public
+ * @param string The ticket number of the upload
+ * @return VimeoVideosCheckUploadStatusResponse
+ */
+ public function checkUploadStatus($sTicket) {
+ $aArgs = array(
+ 'ticket_id' => $sTicket
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.checkUploadStatus', $aArgs);
+ }
+
+ /**
+ * Simple video upload
+ *
+ * @access public
+ * @param string Absolute path to file
+ * @param string Existing ticket or false to generate a new one
+ * @return VimeoVideosCheckUploadStatusResponse
+ */
+ public function doUpload($sFilename, $sTicket = false) {
+ return VimeoBase::executeVideopostCall($sFilename, $sTicket);
+ }
+
+ /**
+ * Delete a video
+ *
+ * The authenticated user must own the video and have granted delete permission
+ *
+ * @access public
+ * @param integer Video ID
+ * @return VimeoVideosDeleteResponse
+ */
+ public function delete($iVideoID) {
+ $aArgs = array(
+ 'video_id' => $iVideoID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.delete', $aArgs);
+ }
+
+ /**
+ * Set the title of a video (overwrites previous title)
+ *
+ * @access public
+ * @param integer Video ID
+ * @param string Title
+ * @return VimeoVideosSetTitleResponse
+ */
+ public function setTitle($iVideoID, $sVideoTitle) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'title' => $sVideoTitle
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setTitle', $aArgs);
+ }
+
+ /**
+ * Set a new caption for a video (overwrites previous caption)
+ *
+ * @access public
+ * @param integer Video ID
+ * @param string Caption
+ * @return VimeoVideosSetCaptionResponse
+ */
+ public function setCaption($iVideoID, $sVideoCaption) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'caption' => $sVideoCaption
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setCaption', $aArgs);
+ }
+
+ /**
+ * Set a video as a favorite.
+ *
+ * @access public
+ * @param integer Video ID
+ * @param boolean TRUE to favorite, FALSE to return to normal
+ * @return VimeoVideosSetFavoriteResponse
+ */
+ public function setFavorite($iVideoID, $bFavorite = true) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'favorite' => (int) $bFavorite
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setFavorite', $aArgs);
+ }
+
+ /**
+ * Add specified tags to the video, this does not replace any tags.
+ *
+ * Tags should be comma separated lists.
+ *
+ * If the calling user is logged in, this will return information that calling
+ * user has access to (including private videos). If the calling user is not authenticated,
+ * this will only return public information, or a permission denied error if none is available.
+ *
+ * @access public
+ * @param integer Video ID
+ * @param mixed Array with tags or Comma separated list of tags ("lions, tigers, bears")
+ * @return VimeoVideosAddTagsResponse
+ */
+ public function addTags($iVideoID, $mTags) {
+ // Catch array of tags
+ if(is_array($mTags)) {
+ $mTags = implode(',', $mTags);
+ }
+
+ // Prepare arguments
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'tags' => $mTags
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.addTags', $aArgs);
+ }
+
+ /**
+ * Remove specified tag from the video.
+ *
+ * @access public
+ * @param integer Video ID
+ * @param integer Tag ID, this should be a tag id returned by vimeo.videos.getInfo
+ * @return VimeoVideosRemoveTagResponse
+ */
+ public function removeTag($iVideoID, $iTagID) {
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'tag_id' => $iTagID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.removeTag', $aArgs);
+ }
+
+ /**
+ * Remove ALL of the tags from the video
+ *
+ * @access public
+ * @param integer Video ID
+ * @return VimeoVideosClearTags
+ */
+ public function clearTags($iVideoID) {
+ $aArgs = array(
+ 'video_id' => $iVideoID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.clearTags', $aArgs);
+ }
+
+ /**
+ * Set the privacy of the video
+ *
+ * @access public
+ * @param integer Video ID
+ * @param integer Privacy enum see VimeoVideosRequest::PRIVACY_*
+ * @param mixed Array or comma separated list of users who can view the video. PRIVACY_USERS must be set.
+ */
+ public function setPrivacy($iVideoID, $ePrivacy, $mUsers = array()) {
+ // Catch array of users
+ if(is_array($mUsers)) {
+ $mUsers = implode(', ', $mUsers);
+ }
+
+ $aArgs = array(
+ 'video_id' => $iVideoID,
+ 'privacy' => $ePrivacy,
+ 'users' => $mUsers
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.videos.setPrivacy', $aArgs);
+ }
}
/**
* Vimeo Videos Search response handler class
*
* Handles the API response for vimeo.videos.search queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
-*/
+*/
class VimeoVideosSearchResponse extends VimeoResponse {
- private $iPage = false;
- private $iItemsPerPage = false;
- private $iOnThisPage = false;
-
- private $aoVideos = array();
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- // Parse information
- if($aResponse && isset($aResponse->videos) && $this->getStatus()) {
- // Create an video list instance
- $this->aoVideos = new VimeoVideoList();
-
- // Page information
- $this->iPage = $aResponse->videos->page;
- $this->iItemsPerPage = $aResponse->videos->perpage;
- $this->iOnThisPage = $aResponse->videos->on_this_page;
-
- // Parse videos
- if(isset($aResponse->videos->video)) {
- // We should check if the subelement is an object (single hit) or an result array (multiple hits)
- if(is_array($aResponse->videos->video)) {
+ private $iPage = false;
+ private $iItemsPerPage = false;
+ private $iOnThisPage = false;
+
+ private $aoVideos = array();
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ // Parse information
+ if($aResponse && isset($aResponse->videos) && $this->getStatus()) {
+ // Create an video list instance
+ $this->aoVideos = new VimeoVideoList();
+
+ // Page information
+ $this->iPage = $aResponse->videos->page;
+ $this->iItemsPerPage = $aResponse->videos->perpage;
+ $this->iOnThisPage = $aResponse->videos->on_this_page;
+
+ // Parse videos
+ if(isset($aResponse->videos->video)) {
+ // We should check if the subelement is an object (single hit) or an result array (multiple hits)
+ if(is_array($aResponse->videos->video)) {
// We got a couple of results
$aParseableData = $aResponse->videos->video;
- } else {
- // We only got one result
+ } else {
+ // We only got one result
$aParseableData = array(
0 => $aResponse->videos->video
);
- }
-
- // Parse the results
- foreach($aParseableData as $aVideoInformation) {
- $oVideo = new VimeoVideoEntity($aVideoInformation);
-
- $this->aoVideos->add($oVideo, $oVideo->getID());
- }
- }
- }
- }
-
- /**
- * Current page
- *
- * @access public
- * @return integer Page number
- */
- public function getPage() {
- return $this->iPage;
- }
-
- /**
- * Items per page
- *
- * @access public
- * @return integer Items per page
- */
-
- public function getItemsPerPage() {
- return $this->iItemsPerPage;
- }
-
- /**
- * Items on the current page
- *
- * @access public
- * @return integer Items on the current page
- */
-
- public function getOnThisPage() {
- return $this->iOnThisPage;
- }
-
- /**
- * Get array of video objects
- *
- * @access public
- * @return array Video objects
- */
-
- public function getVideos() {
- return $this->aoVideos;
- }
+ }
+
+ // Parse the results
+ foreach($aParseableData as $aVideoInformation) {
+ $oVideo = new VimeoVideoEntity($aVideoInformation);
+
+ $this->aoVideos->add($oVideo, $oVideo->getID());
+ }
+ }
+ }
+ }
+
+ /**
+ * Current page
+ *
+ * @access public
+ * @return integer Page number
+ */
+ public function getPage() {
+ return $this->iPage;
+ }
+
+ /**
+ * Items per page
+ *
+ * @access public
+ * @return integer Items per page
+ */
+
+ public function getItemsPerPage() {
+ return $this->iItemsPerPage;
+ }
+
+ /**
+ * Items on the current page
+ *
+ * @access public
+ * @return integer Items on the current page
+ */
+
+ public function getOnThisPage() {
+ return $this->iOnThisPage;
+ }
+
+ /**
+ * Get array of video objects
+ *
+ * @access public
+ * @return array Video objects
+ */
+
+ public function getVideos() {
+ return $this->aoVideos;
+ }
}
/**
* Vimeo Videos Search exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.search queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2476,7 +2476,7 @@ class VimeoVideosSearchException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2487,7 +2487,7 @@ class VimeoVideosGetListResponse extends VimeoVideosSearchResponse {}
* Vimeo Videos Search exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.search queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2499,7 +2499,7 @@ class VimeoVideosGetListException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getUploadedList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2510,7 +2510,7 @@ class VimeoVideosGetUploadedListResponse extends VimeoVideosSearchResponse {}
* Vimeo Videos GetUploadedList exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getUploadedList queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2522,7 +2522,7 @@ class VimeoVideosGetUploadedListException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getAppearsInList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2533,7 +2533,7 @@ class VimeoVideosGetAppearsInListResponse extends VimeoVideosSearchResponse {}
* Vimeo Videos GetAppearsInList exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getAppearsInList queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2545,7 +2545,7 @@ class VimeoVideosGetAppearsInListException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getSubscriptionsList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2556,7 +2556,7 @@ class VimeoVideosGetSubscriptionsListResponse extends VimeoVideosSearchResponse
* Vimeo Videos GetSubscriptionsList exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getSubscriptionsList queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2568,7 +2568,7 @@ class VimeoVideosGetSubscriptionsListException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getListByTag queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2579,7 +2579,7 @@ class VimeoVideosGetListByTagResponse extends VimeoVideosSearchResponse {}
* Vimeo Videos GetListByTag exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getListByTag queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2591,7 +2591,7 @@ class VimeoVideosGetListByTagException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getLikeList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2602,7 +2602,7 @@ class VimeoVideosGetLikeListResponse extends VimeoVideosSearchResponse {}
* Vimeo Videos GetLikeList exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getLikeList queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2614,7 +2614,7 @@ class VimeoVideosGetLikeListException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getContactsList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2625,7 +2625,7 @@ class VimeoVideosGetContactsListResponse extends VimeoVideosSearchResponse {}
* Vimeo Videos GetContactsList exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getContactsList queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2637,7 +2637,7 @@ class VimeoVideosGetContactsListException extends VimeoException {}
*
* Handles the API response for vimeo.videos.getContactsLikeList queries.
* Currently the response is exact the same as vimeo.videos.search
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2648,7 +2648,7 @@ class VimeoVideosgetContactsLikeListResponse extends VimeoVideosSearchResponse {
* Vimeo Videos getContactsLikeList exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getContactsLikeList queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2659,45 +2659,45 @@ class VimeoVideosGetContactsLikeListException extends VimeoException {}
* Vimeo Videos GetInfo response handler class
*
* Handles the API response for vimeo.videos.getInfo queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoVideosGetInfoResponse extends VimeoResponse {
- private $oVideo = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- $this->oVideo = new VimeoVideoEntity($aResponse->video);
- }
-
- /**
- * Get video information as object
- *
- * @access public
- * @return VimeoVideoEntity
- */
- public function getVideo() {
- return $this->oVideo;
- }
+ private $oVideo = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse) {
+ parent::__construct($aResponse);
+
+ $this->oVideo = new VimeoVideoEntity($aResponse->video);
+ }
+
+ /**
+ * Get video information as object
+ *
+ * @access public
+ * @return VimeoVideoEntity
+ */
+ public function getVideo() {
+ return $this->oVideo;
+ }
}
/**
* Vimeo Videos GetInfo exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getInfo queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2708,45 +2708,45 @@ class VimeoVideosGetInfoException extends VimeoException {}
* Vimeo Videos getUploadTicket response handler class
*
* Handles the API response for vimeo.videos.getUploadTicket queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoVideosGetUploadTicketResponse extends VimeoResponse {
- private $sTicket = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->sTicket = $aResponse->ticket->id;
- }
-
- /**
- * Get generated upload ticket
- *
- * @access public
- * @return string The ticket number of the upload
- */
- public function getTicket() {
- return $this->sTicket;
- }
+ private $sTicket = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->sTicket = $aResponse->ticket->id;
+ }
+
+ /**
+ * Get generated upload ticket
+ *
+ * @access public
+ * @return string The ticket number of the upload
+ */
+ public function getTicket() {
+ return $this->sTicket;
+ }
}
/**
* Vimeo Videos getUploadTicket exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.getUploadTicket queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2757,97 +2757,97 @@ class VimeoVideosGetUploadTicketException extends VimeoException {}
* Vimeo Videos checkUploadStatus response handler class
*
* Handles the API response for vimeo.videos.checkUploadStatus queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoVideosCheckUploadStatusResponse extends VimeoResponse {
- private $sTicket = false;
- private $iVideoID = false;
- private $bIsUploading = false;
- private $bIsTranscoding = false;
- private $iTranscodingProgress = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->sTicket = $aResponse->ticket->id;
- $this->iVideoID = $aResponse->ticket->video_id;
- $this->bIsUploading = (bool) $aResponse->ticket->is_uploading;
- $this->bIsTranscoding = (bool) $aResponse->ticket->is_transcoding;
- $this->iTranscodingProgress = $aResponse->ticket->transcoding_progress;
- }
-
- /**
- * Get Ticket
- *
- * @access public
- * @return string Ticket
- */
- public function getTicket() {
- return $this->sTicket;
- }
-
- /**
- * Get Video ID
- *
- * @access public
- * @return integer Video ID
- */
- public function getVideoID() {
- return $this->iVideoID;
- }
-
- /**
- * Is the video uploading?
- *
- * @access public
- * @return boolean TRUE if uploading, FALSE if not
- */
- public function isUploading() {
- return $this->bIsUploading;
- }
-
- /**
- * Is the video transcoding?
- *
- * Also check getTranscodingProgress() for percentage in transcoding
- *
- * @access public
- * @return boolean TRUE if uploading, FALSE if not
- */
- public function isTranscoding() {
- return $this->bIsTranscoding;
- }
-
- /**
- * Get the transcoding progress
- *
- * Should only be called if isTranscoding() returns true
- *
- * @access public
- * @return integer Percentage
- */
- public function getTranscodingProgress() {
- return $this->iTranscodingProgress;
- }
+ private $sTicket = false;
+ private $iVideoID = false;
+ private $bIsUploading = false;
+ private $bIsTranscoding = false;
+ private $iTranscodingProgress = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->sTicket = $aResponse->ticket->id;
+ $this->iVideoID = $aResponse->ticket->video_id;
+ $this->bIsUploading = (bool) $aResponse->ticket->is_uploading;
+ $this->bIsTranscoding = (bool) $aResponse->ticket->is_transcoding;
+ $this->iTranscodingProgress = $aResponse->ticket->transcoding_progress;
+ }
+
+ /**
+ * Get Ticket
+ *
+ * @access public
+ * @return string Ticket
+ */
+ public function getTicket() {
+ return $this->sTicket;
+ }
+
+ /**
+ * Get Video ID
+ *
+ * @access public
+ * @return integer Video ID
+ */
+ public function getVideoID() {
+ return $this->iVideoID;
+ }
+
+ /**
+ * Is the video uploading?
+ *
+ * @access public
+ * @return boolean TRUE if uploading, FALSE if not
+ */
+ public function isUploading() {
+ return $this->bIsUploading;
+ }
+
+ /**
+ * Is the video transcoding?
+ *
+ * Also check getTranscodingProgress() for percentage in transcoding
+ *
+ * @access public
+ * @return boolean TRUE if uploading, FALSE if not
+ */
+ public function isTranscoding() {
+ return $this->bIsTranscoding;
+ }
+
+ /**
+ * Get the transcoding progress
+ *
+ * Should only be called if isTranscoding() returns true
+ *
+ * @access public
+ * @return integer Percentage
+ */
+ public function getTranscodingProgress() {
+ return $this->iTranscodingProgress;
+ }
}
/**
* Vimeo Videos checkUploadStatus exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.checkUploadStatus queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2858,7 +2858,7 @@ class VimeoVideosCheckUploadStatusException extends VimeoException {}
* Vimeo Videos delete response handler class
*
* Handles the API response for vimeo.videos.delete queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2869,7 +2869,7 @@ class VimeoVideosDeleteResponse extends VimeoResponse {}
* Vimeo Videos delete exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.delete queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2880,7 +2880,7 @@ class VimeoVideosDeleteException extends VimeoException {}
* Vimeo Videos setTitle response handler class
*
* Handles the API response for vimeo.videos.setTitle queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2891,7 +2891,7 @@ class VimeoVideosSetTitleResponse extends VimeoResponse {}
* Vimeo Videos setTitle exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.setTitle queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2902,7 +2902,7 @@ class VimeoVideosSetTitleException extends VimeoException {}
* Vimeo Videos setCaption response handler class
*
* Handles the API response for vimeo.videos.setCaption queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2913,7 +2913,7 @@ class VimeoVideosSetCaptionResponse extends VimeoResponse {}
* Vimeo Videos setCaption exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.setCaption queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2924,7 +2924,7 @@ class VimeoVideosSetCaptionException extends VimeoException {}
* Vimeo Videos setFavorite response handler class
*
* Handles the API response for vimeo.videos.setFavorite queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2935,7 +2935,7 @@ class VimeoVideosSetFavoriteResponse extends VimeoResponse {}
* Vimeo Videos setFavorite exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.setFavorite queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2946,7 +2946,7 @@ class VimeoVideosSetFavoriteException extends VimeoException {}
* Vimeo Videos addTags response handler class
*
* Handles the API response for vimeo.videos.addTags queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2957,7 +2957,7 @@ class VimeoVideosAddTagsResponse extends VimeoResponse {}
* Vimeo Videos addTags exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.addTags queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2968,7 +2968,7 @@ class VimeoVideosAddTagsException extends VimeoException {}
* Vimeo Videos removeTag response handler class
*
* Handles the API response for vimeo.videos.removeTag queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -2979,7 +2979,7 @@ class VimeoVideosRemoveTagResponse extends VimeoResponse {}
* Vimeo Videos removeTag exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.removeTag queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -2990,7 +2990,7 @@ class VimeoVideosRemoveTagException extends VimeoException {}
* Vimeo Videos clearTags response handler class
*
* Handles the API response for vimeo.videos.clearTags queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3001,7 +3001,7 @@ class VimeoVideosClearTagsResponse extends VimeoResponse {}
* Vimeo Videos clearTags exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.clearTags queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3012,7 +3012,7 @@ class VimeoVideosClearTagsException extends VimeoException {}
* Vimeo Videos setPrivacy response handler class
*
* Handles the API response for vimeo.videos.setPrivacy queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3023,7 +3023,7 @@ class VimeoVideosSetPrivacyResponse extends VimeoResponse {}
* Vimeo Videos setPrivacy exception handler class
*
* Handles exceptions caused by API response for vimeo.videos.setPrivacy queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3038,221 +3038,221 @@ class VimeoVideosSetPrivacyException extends VimeoException {}
* Vimeo People request handler class
*
* Implements all API queries in the vimeo.people.* category
-*
+*
* @package SimpleVimeo
* @subpackage ApiRequest
*/
class VimeoPeopleRequest extends VimeoRequest {
- const TYPE_LIKES = 'likes';
- const TYPE_APPEARS = 'appears';
- const TYPE_BOTH = 'likes,appears';
-
- /**
- * Get a user id and full/display name with a username.
- *
- * You shouldn't need this to get the User ID, we allow you to use the
- * username instead of User ID everywhere, it's much nicer that way.
- *
- * @access public
- * @param string The username to lookup
- * @return VimeoPeopleFindByUsernameResponse
- */
- public function findByUsername($sUsername) {
- $aArgs = array(
- 'username' => $sUsername
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.findByUserName', $aArgs);
- }
-
- /**
- * Get tons of info about a user.
- *
- * @access public
- * @param integer The id of the user we want.
- * @return VimeoPeopleGetInfoResponse
- */
- public function getInfo($iUserID) {
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.getInfo', $aArgs);
- }
-
- /**
- * Get a user id and full/display name via an Email Address.
- *
- * You shouldn't need to use this to get the User ID, we allow you
- * to use the username instead of User ID everywhere, it's much nicer that way.
- *
- * @access public
- * @param string Email
- * @return VimeoPeopleFindByEmailResponse
- */
- public function findByEmail($sEmail) {
- $aArgs = array(
- 'find_email' => $sEmail
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.findByEmail', $aArgs);
- }
-
- /**
- * Get a portrait URL for a given user/size
- *
- * Portraits are square, so you only need to pass one size parameter.
- * Possible sizes are 20, 24, 28, 30, 40, 50, 60, 75, 100, 140, 278 and 300
- *
- * @access public
- * @param string The username to lookup
- * @param integer The size of the portrait you you want. (defaults to 75)
- * @return VimeoPeopleGetPortraitUrlResponse
- *
- * @todo Check functionality. Did not work, god knows why
- */
- public function getPortraitUrl($sUser, $iSize = false) {
- $aArgs = array(
- 'user' => $sUser
- );
-
- if($iSize) {
- $aArgs['size'] = $iSize;
- }
-
- return VimeoBase::executeRemoteCall('vimeo.people.getPortraitUrl', $aArgs);
- }
-
- /**
- * Add a user as a contact for the authenticated user.
- *
- * If Jim is authenticated, and the $user is sally. Sally will be Jim's contact.
- * It won't work the other way around. Depending on Sally's settings, this may
- * send her an email notifying her that Jim Added her as a contact.
- *
- * @access public
- * @param string The user to add. User ID, this can be the ID number (151542) or the username (ted)
- * @return VimeoPeopleAddContactResponse
- */
- public function addContact($sUser) {
- $aArgs = array(
- 'user' => $sUser
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.addContact', $aArgs);
- }
-
- /**
- * Remove a user as a contact for the authenticated user.
- *
- * @access public
- * @param string The user to remove. User ID, this can be the ID number (151542) or the username (ted)
- * @return VimeoPeopleRemoveContactResponse
- */
- public function removeContact($sUser) {
- $aArgs = array(
- 'user' => $sUser
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.removeContact', $aArgs);
- }
-
- /**
- * This tells you how much space the user has remaining for uploads.
- *
- * We provide info in bytes and kilobytes. It probably makes sense for you to use kilobytes.
- *
- * @access public
- * @return VimeoPeopleGetUploadStatusResponse
- */
- public function getUploadStatus() {
- return VimeoBase::executeRemoteCall('vimeo.people.getUploadStatus');
- }
-
- /**
- * Subscribe to a user's videos.
- *
- * Just like on the site, you can subscribe to videos a user "appears" in or "likes." Or both!
- * This will not remove any subscriptions. So if the user is subscribed to a user for both "likes"
- * and "appears," this will not change anything if you only specify one of them. If you want to
- * remove one, you must call vimeo.people.removeSubscription().
- *
- * @access public
- * @param string User ID, this can be the ID number (151542) or the username (ted)
- * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
- * @return VimeoPeopleAddSubscriptionResponse
- */
- public function addSubscription($sUser, $eType = self::TYPE_BOTH) {
- $aArgs = array(
- 'user' => $sUser,
- 'type' => $eType
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.addSubscription', $aArgs);
- }
-
- /**
- * Unsubscribe to a user's videos.
- *
- * @access public
- * @param string User ID, this can be the ID number (151542) or the username (ted)
- * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
- * @return VimeoPeopleRemoveSubscriptionResponse
- */
- public function removeSubscription($sUser, $eType = self::TYPE_BOTH) {
- $aArgs = array(
- 'user' => $sUser,
- 'type' => $eType
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.removeSubscription', $aArgs);
- }
+ const TYPE_LIKES = 'likes';
+ const TYPE_APPEARS = 'appears';
+ const TYPE_BOTH = 'likes,appears';
+
+ /**
+ * Get a user id and full/display name with a username.
+ *
+ * You shouldn't need this to get the User ID, we allow you to use the
+ * username instead of User ID everywhere, it's much nicer that way.
+ *
+ * @access public
+ * @param string The username to lookup
+ * @return VimeoPeopleFindByUsernameResponse
+ */
+ public function findByUsername($sUsername) {
+ $aArgs = array(
+ 'username' => $sUsername
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.findByUserName', $aArgs);
+ }
+
+ /**
+ * Get tons of info about a user.
+ *
+ * @access public
+ * @param integer The id of the user we want.
+ * @return VimeoPeopleGetInfoResponse
+ */
+ public function getInfo($iUserID) {
+ $aArgs = array(
+ 'user_id' => $iUserID
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.getInfo', $aArgs);
+ }
+
+ /**
+ * Get a user id and full/display name via an Email Address.
+ *
+ * You shouldn't need to use this to get the User ID, we allow you
+ * to use the username instead of User ID everywhere, it's much nicer that way.
+ *
+ * @access public
+ * @param string Email
+ * @return VimeoPeopleFindByEmailResponse
+ */
+ public function findByEmail($sEmail) {
+ $aArgs = array(
+ 'find_email' => $sEmail
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.findByEmail', $aArgs);
+ }
+
+ /**
+ * Get a portrait URL for a given user/size
+ *
+ * Portraits are square, so you only need to pass one size parameter.
+ * Possible sizes are 20, 24, 28, 30, 40, 50, 60, 75, 100, 140, 278 and 300
+ *
+ * @access public
+ * @param string The username to lookup
+ * @param integer The size of the portrait you you want. (defaults to 75)
+ * @return VimeoPeopleGetPortraitUrlResponse
+ *
+ * @todo Check functionality. Did not work, god knows why
+ */
+ public function getPortraitUrl($sUser, $iSize = false) {
+ $aArgs = array(
+ 'user' => $sUser
+ );
+
+ if($iSize) {
+ $aArgs['size'] = $iSize;
+ }
+
+ return VimeoBase::executeRemoteCall('vimeo.people.getPortraitUrl', $aArgs);
+ }
+
+ /**
+ * Add a user as a contact for the authenticated user.
+ *
+ * If Jim is authenticated, and the $user is sally. Sally will be Jim's contact.
+ * It won't work the other way around. Depending on Sally's settings, this may
+ * send her an email notifying her that Jim Added her as a contact.
+ *
+ * @access public
+ * @param string The user to add. User ID, this can be the ID number (151542) or the username (ted)
+ * @return VimeoPeopleAddContactResponse
+ */
+ public function addContact($sUser) {
+ $aArgs = array(
+ 'user' => $sUser
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.addContact', $aArgs);
+ }
+
+ /**
+ * Remove a user as a contact for the authenticated user.
+ *
+ * @access public
+ * @param string The user to remove. User ID, this can be the ID number (151542) or the username (ted)
+ * @return VimeoPeopleRemoveContactResponse
+ */
+ public function removeContact($sUser) {
+ $aArgs = array(
+ 'user' => $sUser
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.removeContact', $aArgs);
+ }
+
+ /**
+ * This tells you how much space the user has remaining for uploads.
+ *
+ * We provide info in bytes and kilobytes. It probably makes sense for you to use kilobytes.
+ *
+ * @access public
+ * @return VimeoPeopleGetUploadStatusResponse
+ */
+ public function getUploadStatus() {
+ return VimeoBase::executeRemoteCall('vimeo.people.getUploadStatus');
+ }
+
+ /**
+ * Subscribe to a user's videos.
+ *
+ * Just like on the site, you can subscribe to videos a user "appears" in or "likes." Or both!
+ * This will not remove any subscriptions. So if the user is subscribed to a user for both "likes"
+ * and "appears," this will not change anything if you only specify one of them. If you want to
+ * remove one, you must call vimeo.people.removeSubscription().
+ *
+ * @access public
+ * @param string User ID, this can be the ID number (151542) or the username (ted)
+ * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
+ * @return VimeoPeopleAddSubscriptionResponse
+ */
+ public function addSubscription($sUser, $eType = self::TYPE_BOTH) {
+ $aArgs = array(
+ 'user' => $sUser,
+ 'type' => $eType
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.addSubscription', $aArgs);
+ }
+
+ /**
+ * Unsubscribe to a user's videos.
+ *
+ * @access public
+ * @param string User ID, this can be the ID number (151542) or the username (ted)
+ * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
+ * @return VimeoPeopleRemoveSubscriptionResponse
+ */
+ public function removeSubscription($sUser, $eType = self::TYPE_BOTH) {
+ $aArgs = array(
+ 'user' => $sUser,
+ 'type' => $eType
+ );
+
+ return VimeoBase::executeRemoteCall('vimeo.people.removeSubscription', $aArgs);
+ }
}
/**
* Vimeo People FindByUserName response handler class
*
* Handles the API response for vimeo.people.findByUserName queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoPeopleFindByUserNameResponse extends VimeoResponse {
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->oUser = new VimeoUserEntity($aResponse->user);
- }
-
- /**
- * Get user entity object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->oUser = new VimeoUserEntity($aResponse->user);
+ }
+
+ /**
+ * Get user entity object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
}
/**
* Vimeo People FindByUserName exception handler class
*
* Handles exceptions caused by API response for vimeo.people.findByUserName queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3263,45 +3263,45 @@ class VimeoPeopleFindByUserNameException extends VimeoException {}
* Vimeo People FindByEmail response handler class
*
* Handles the API response for vimeo.people.findByEmail queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoPeopleFindByEmailResponse extends VimeoResponse {
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->oUser = new VimeoUserEntity($aResponse->user);
- }
-
- /**
- * Get user entity object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->oUser = new VimeoUserEntity($aResponse->user);
+ }
+
+ /**
+ * Get user entity object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
}
/**
* Vimeo People FindByEmail exception handler class
*
* Handles exceptions caused by API response for vimeo.people.findByEmail queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3312,45 +3312,45 @@ class VimeoPeopleFindByEmailException extends VimeoException {}
* Vimeo People GetInfo response handler class
*
* Handles the API response for vimeo.people.getInfo queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoPeopleGetInfoResponse extends VimeoResponse {
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->oUser = new VimeoUserEntity($aResponse->person);
- }
-
- /**
- * Get user entity object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
+ private $oUser = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->oUser = new VimeoUserEntity($aResponse->person);
+ }
+
+ /**
+ * Get user entity object
+ *
+ * @access public
+ * @return VimeoUserEntity
+ */
+ public function getUser() {
+ return $this->oUser;
+ }
}
/**
* Vimeo People GetInfo exception handler class
*
* Handles exceptions caused by API response for vimeo.people.getInfo queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3361,7 +3361,7 @@ class VimeoPeopleGetInfoException extends VimeoException {}
* Vimeo People getPortraitUrl response handler class
*
* Handles the API response for vimeo.people.getPortraitUrl queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3372,7 +3372,7 @@ class VimeoPeopleGetPortraitUrlResponse extends VimeoResponse {}
* Vimeo People getPortraitUrl exception handler class
*
* Handles exceptions caused by API response for vimeo.people.getPortraitUrl queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3383,7 +3383,7 @@ class VimeoPeopleGetPortraitUrlException extends VimeoException {}
* Vimeo People addContact response handler class
*
* Handles the API response for vimeo.people.addContact queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3394,7 +3394,7 @@ class VimeoPeopleAddContactResponse extends VimeoResponse {}
* Vimeo People addContact exception handler class
*
* Handles exceptions caused by API response for vimeo.people.addContact queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3405,7 +3405,7 @@ class VimeoPeopleAddContactException extends VimeoException {}
* Vimeo People removeContact response handler class
*
* Handles the API response for vimeo.people.removeContact queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3416,7 +3416,7 @@ class VimeoPeopleRemoveContactResponse extends VimeoResponse {}
* Vimeo People removeContact exception handler class
*
* Handles exceptions caused by API response for vimeo.people.removeContact queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3427,109 +3427,109 @@ class VimeoPeopleRemoveContactException extends VimeoException {}
* Vimeo People getUploadStatus response handler class
*
* Handles the API response for vimeo.people.getUploadStatus queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
class VimeoPeopleGetUploadStatusResponse extends VimeoResponse {
- private $iMaxBytes = false;
- private $iMaxKBytes = false;
-
- private $iUsedBytes = false;
- private $iUsedKBytes = false;
-
- private $iRemainingBytes = false;
- private $iRemainingKBytes = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->iMaxBytes = $aResponse->user->bandwidth->maxbytes;
- $this->iMaxKBytes = $aResponse->user->bandwidth->maxkb;
-
- $this->iUsedBytes = $aResponse->user->bandwidth->usedbytes;
- $this->iUsedKBytes = $aResponse->user->bandwidth->usedkb;
-
- $this->iRemainingBytes = $aResponse->user->bandwidth->remainingbytes;
- $this->iRemainingKBytes = $aResponse->user->bandwidth->remainingkb;
- }
-
- /**
- * Get maximum upload for this week in BYTES
- *
- * @access public
- * @return integer Maximum bytes this week
- */
- public function getMaxBytes() {
- return $this->iMaxBytes;
- }
-
- /**
- * Get maximum upload for this week in KILOBYTES
- *
- * @access public
- * @return integer Maximum kbytes this week
- */
- public function getMaxKiloBytes() {
- return $this->iMaxKBytes;
- }
-
- /**
- * Get used upload for this week in BYTES
- *
- * @access public
- * @return integer Used bytes this week
- */
- public function getUsedBytes() {
- return $this->iUsedBytes;
- }
-
- /**
- * Get used upload for this week in KILOBYTES
- *
- * @access public
- * @return integer Used kbytes this week
- */
- public function getUsedKiloBytes() {
- return $this->iUsedKBytes;
- }
-
- /**
- * Get remaining upload for this week in BYTES
- *
- * @access public
- * @return integer Remaining bytes this week
- */
- public function getRemainingBytes() {
- return $this->iRemainingBytes;
- }
-
- /**
- * Get remaining upload for this week in KILOBYTES
- *
- * @access public
- * @return integer Remaining kbytes this week
- */
- public function getRemainingKiloBytes() {
- return $this->iRemainingKBytes;
- }
+ private $iMaxBytes = false;
+ private $iMaxKBytes = false;
+
+ private $iUsedBytes = false;
+ private $iUsedKBytes = false;
+
+ private $iRemainingBytes = false;
+ private $iRemainingKBytes = false;
+
+ /**
+ * Constructor
+ *
+ * Parses the API response
+ *
+ * @access public
+ * @param stdClass API response
+ * @return void
+ */
+ public function __construct($aResponse = false) {
+ parent::__construct($aResponse);
+
+ $this->iMaxBytes = $aResponse->user->bandwidth->maxbytes;
+ $this->iMaxKBytes = $aResponse->user->bandwidth->maxkb;
+
+ $this->iUsedBytes = $aResponse->user->bandwidth->usedbytes;
+ $this->iUsedKBytes = $aResponse->user->bandwidth->usedkb;
+
+ $this->iRemainingBytes = $aResponse->user->bandwidth->remainingbytes;
+ $this->iRemainingKBytes = $aResponse->user->bandwidth->remainingkb;
+ }
+
+ /**
+ * Get maximum upload for this week in BYTES
+ *
+ * @access public
+ * @return integer Maximum bytes this week
+ */
+ public function getMaxBytes() {
+ return $this->iMaxBytes;
+ }
+
+ /**
+ * Get maximum upload for this week in KILOBYTES
+ *
+ * @access public
+ * @return integer Maximum kbytes this week
+ */
+ public function getMaxKiloBytes() {
+ return $this->iMaxKBytes;
+ }
+
+ /**
+ * Get used upload for this week in BYTES
+ *
+ * @access public
+ * @return integer Used bytes this week
+ */
+ public function getUsedBytes() {
+ return $this->iUsedBytes;
+ }
+
+ /**
+ * Get used upload for this week in KILOBYTES
+ *
+ * @access public
+ * @return integer Used kbytes this week
+ */
+ public function getUsedKiloBytes() {
+ return $this->iUsedKBytes;
+ }
+
+ /**
+ * Get remaining upload for this week in BYTES
+ *
+ * @access public
+ * @return integer Remaining bytes this week
+ */
+ public function getRemainingBytes() {
+ return $this->iRemainingBytes;
+ }
+
+ /**
+ * Get remaining upload for this week in KILOBYTES
+ *
+ * @access public
+ * @return integer Remaining kbytes this week
+ */
+ public function getRemainingKiloBytes() {
+ return $this->iRemainingKBytes;
+ }
}
/**
* Vimeo People getUploadStatus exception handler class
*
* Handles exceptions caused by API response for vimeo.people.getUploadStatus queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3540,7 +3540,7 @@ class VimeoPeopleGetUploadStatusException extends VimeoException {}
* Vimeo People addSubscription response handler class
*
* Handles the API response for vimeo.people.addSubscription queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3551,7 +3551,7 @@ class VimeoPeopleAddSubscriptionResponse extends VimeoResponse {}
* Vimeo People addSubscription exception handler class
*
* Handles exceptions caused by API response for vimeo.people.addSubscription queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
@@ -3562,7 +3562,7 @@ class VimeoPeopleAddSubscriptionException extends VimeoException {}
* Vimeo People removeSubscription response handler class
*
* Handles the API response for vimeo.people.removeSubscription queries.
-*
+*
* @package SimpleVimeo
* @subpackage ApiResponse
*/
@@ -3573,7 +3573,7 @@ class VimeoPeopleRemoveSubscriptionResponse extends VimeoResponse {}
* Vimeo People removeSubscription exception handler class
*
* Handles exceptions caused by API response for vimeo.people.removeSubscription queries.
-*
+*
* @package SimpleVimeo
* @subpackage Exceptions
*/
diff --git a/new.php b/new.php
index aa092284f..583e6bc25 100644
--- a/new.php
+++ b/new.php
@@ -1,47 +1,45 @@
- * @copyright Prateek Choudhary
- */
-
-
- // Render the video upload page
- // Load Elgg engine
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
-
- //get videolist GUID
- $container_guid = get_input('container');
- if(isset($container_guid) && !empty($container_guid)){
- $container_guid = explode(":", $container_guid);
- if($container_guid[0] == "group"){
- $container = get_entity($container_guid[1]);
- set_page_owner($container->getGUID());
- $page_owner = page_owner_entity();
- set_context("groupsvideos");
- set_input("container_guid", $container->getGUID());
- }
- else{
- // Get the current page's owner
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- set_input("container_guid", $_SESSION['guid']);
- }
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
+
+
+// Render the video upload page
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+gatekeeper();
+
+//get videolist GUID
+$container_guid = get_input('container');
+if(isset($container_guid) && !empty($container_guid)){
+ $container_guid = explode(":", $container_guid);
+ if ($container_guid[0] == "group") {
+ $container = get_entity($container_guid[1]);
+ set_page_owner($container->getGUID());
+ $page_owner = page_owner_entity();
+ set_context("groupsvideos");
+ set_input("container_guid", $container->getGUID());
+ } else {
+ // Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ set_input("container_guid", $_SESSION['guid']);
}
}
+}
+
+$title = sprintf(elgg_echo("videolist:new"), $page_owner->name);
+
+$area2 = elgg_view_title($title);
+$area2 .= elgg_view("forms/add");
+$body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
- $title = sprintf(elgg_echo("videolist:new"), $page_owner->name);
-
- $area2 = elgg_view_title($title);
- $area2 .= elgg_view("forms/add");
- $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);
-
- page_draw($title, $body);
-?>
+page_draw($title, $body);
\ No newline at end of file
diff --git a/start.php b/start.php
index e7f6d6085..0b15243d1 100644
--- a/start.php
+++ b/start.php
@@ -1,165 +1,158 @@
- * @copyright Prateek Choudhary
- */
- function videolist_init() {
-
- // Load system configuration
- global $CONFIG;
- if (isloggedin())
- {
- add_menu(elgg_echo('videolist'), $CONFIG->wwwroot . "pg/videolist/owned/" . $_SESSION['user']->username);
- }
-
- // Extend system CSS with our own styles
- extend_view('css','videolist/css');
-
- // Load the language file - default is english
- register_translations($CONFIG->pluginspath . "videolist/languages/");
-
- // Register a page handler, so we can have nice URLs
- register_page_handler('videolist','videolist_page_handler');
-
- //extend this plugin for groups
- extend_view('groups/left_column','videolist/groupprofile_videolist');
-
- // Add a new videolist widget
- add_widget_type('videolist_view',elgg_echo("videolist:widget"),elgg_echo("videolist:widget:description"), 'profile');
-
- if (is_callable('register_notification_object'))
- register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
- register_plugin_hook('object:notifications','object','videolist_object_notifications_intercept');
-
- // Register URL handler
- register_entity_url_handler('video_url','object', 'videolist');
- register_entity_url_handler('video_url','object', 'watch');
-
- //register entity url handler
- register_entity_url_handler('videolist_url','object','videolist');
- // Register entity type
- register_entity_type('object','videolist');
-
-
-
-
- }
-
- /**
- * videolist page handler; allows the use of fancy URLs
- *
- * @param array $page From the page_handler function
- * @return true|false Depending on success
- */
- function videolist_page_handler($page) {
-
- if (isset($page[0])) {
- switch($page[0]) {
- case "owned": if (isset($page[1])) set_input('username',$page[1]);
- @include(dirname(__FILE__) . "/index.php");
- break;
- case "search": @include(dirname(__FILE__) . "/world.php");
- break;
- case "video": @include(dirname(__FILE__) . "/video.php");
- break;
- case "new": if (isset($page[3])) set_input('add_videourl',$page[3]);
- if (isset($page[5])) set_input('page',$page[5]);
- if (isset($page[1])) set_input('container',$page[1]);
- @include(dirname(__FILE__) . "/new.php");
- break;
- case "watch": set_input('video_id',$page[1]);
- @include(dirname(__FILE__) . "/watch.php");
- break;
- case "browse": if (isset($page[1])) set_input('container',$page[1]);
- @include(dirname(__FILE__) . "/browse.php");
- break;
- default : if (isset($page[1])) set_input('username',$page[1]);
- @include(dirname(__FILE__) . "/index.php");
- break;
- }
- // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file
- } else {
- if (isset($page[1])) set_input('username',$page[1]);
- @include(dirname(__FILE__) . "/index.php");
- return true;
- }
-
- return false;
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
+function videolist_init() {
+ global $CONFIG;
- }
+ if (isloggedin()) {
+ add_menu(elgg_echo('videolist'), $CONFIG->wwwroot . "pg/videolist/owned/" . $_SESSION['user']->username);
+ }
+ // Extend system CSS with our own styles
+ extend_view('css','videolist/css');
- function videolist_pagesetup() {
-
- global $CONFIG;
- $page_owner = page_owner_entity();
-
- if ($page_owner instanceof ElggGroup && get_context() == "groups") {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
- }
- //add submenu options
- else if (get_context() == "videolist") {
- /**********************************************************************************************
- ****if user is OR is not registered user then show him following page menus to choose from
- ***********************************************************************************************/
- /*
- add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username);
-
- add_submenu_item(elgg_echo('videolist:new'),$CONFIG->wwwroot."pg/videolist/new");
-
- add_submenu_item(elgg_echo('videolist:find'),$CONFIG->wwwroot."pg/videolist/search/");
- */
- if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
- add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
- add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
- add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/");
- } else if (page_owner() && $page_owner instanceof ElggUser) {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username);
- }
- }
- else if (get_context() == "groupsvideos") {
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
- if ($page_owner->canEdit()) {
- add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
- add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
- }
- }
+ // Load the language file - default is english
+ register_translations($CONFIG->pluginspath . "videolist/languages/");
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('videolist','videolist_page_handler');
+
+ //extend this plugin for groups
+ extend_view('groups/left_column','videolist/groupprofile_videolist');
+
+ // Add a new videolist widget
+ add_widget_type('videolist_view',elgg_echo("videolist:widget"),elgg_echo("videolist:widget:description"), 'profile');
+
+ if (is_callable('register_notification_object')) {
+ register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
+ }
+
+ register_plugin_hook('object:notifications','object','videolist_object_notifications_intercept');
+
+ // Register URL handler
+ register_entity_url_handler('video_url','object', 'videolist');
+ register_entity_url_handler('video_url','object', 'watch');
+
+ //register entity url handler
+ register_entity_url_handler('videolist_url','object','videolist');
+
+ // Register entity type
+ register_entity_type('object','videolist');
+}
+
+/**
+ * videolist page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
+function videolist_page_handler($page) {
+ if (isset($page[0])) {
+ switch($page[0]) {
+ case "owned": if (isset($page[1])) set_input('username',$page[1]);
+ @include(dirname(__FILE__) . "/index.php");
+ break;
+ case "search": @include(dirname(__FILE__) . "/world.php");
+ break;
+ case "video": @include(dirname(__FILE__) . "/video.php");
+ break;
+ case "new": if (isset($page[3])) set_input('add_videourl',$page[3]);
+ if (isset($page[5])) set_input('page',$page[5]);
+ if (isset($page[1])) set_input('container',$page[1]);
+ @include(dirname(__FILE__) . "/new.php");
+ break;
+ case "watch": set_input('video_id',$page[1]);
+ @include(dirname(__FILE__) . "/watch.php");
+ break;
+ case "browse": if (isset($page[1])) set_input('container',$page[1]);
+ @include(dirname(__FILE__) . "/browse.php");
+ break;
+ default : if (isset($page[1])) set_input('username',$page[1]);
+ @include(dirname(__FILE__) . "/index.php");
+ break;
}
-
-
- function video_url($entity) {
- global $CONFIG;
- $video_id = $entity->video_id;
- return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;
-
+ // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file
+ } else {
+ if (isset($page[1])) {
+ set_input('username',$page[1]);
}
-
- function videolist_url($videolistpage) {
-
- global $CONFIG;
- $owner = $videolistpage->container_guid;
- $userdata = get_entity($owner);
- $title = $videolistpage->title;
- $title = friendly_title($title);
- return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();
+
+ include(dirname(__FILE__) . "/index.php");
+ return true;
+ }
+
+ return false;
+}
+
+
+function videolist_pagesetup() {
+ global $CONFIG;
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup && get_context() == "groups") {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"), page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ } else if (get_context() == "videolist") {
+ /**********************************************************************************************
+ ****if user is OR is not registered user then show him following page menus to choose from
+ ***********************************************************************************************/
+ /*
+ add_submenu_item(elgg_echo('videolist:home'),$CONFIG->wwwroot."pg/videolist/". $page_owner->username);
+
+ add_submenu_item(elgg_echo('videolist:new'),$CONFIG->wwwroot."pg/videolist/new");
+
+ add_submenu_item(elgg_echo('videolist:find'),$CONFIG->wwwroot."pg/videolist/search/");
+ */
+ if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/");
+ } else if (page_owner() && $page_owner instanceof ElggUser) {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username);
+ }
+ } else if (get_context() == "groupsvideos") {
+ add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);
+ if ($page_owner->canEdit()) {
+ add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/browse/". page_owner_entity()->username);
+ add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/new/". page_owner_entity()->username);
}
-
- /**
- * Event handler for videolist
- *
- */
- function videolist_object_notifications($event, $object_type, $object) {
-
- static $flag;
- if (!isset($flag)) $flag = 0;
-
- if (is_callable('object_notifications'))
+ }
+}
+
+function video_url($entity) {
+ global $CONFIG;
+ $video_id = $entity->video_id;
+ return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;
+}
+
+function videolist_url($videolistpage) {
+ global $CONFIG;
+
+ $owner = $videolistpage->container_guid;
+ $userdata = get_entity($owner);
+ $title = $videolistpage->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();
+}
+
+/**
+ * Event handler for videolist
+ *
+ */
+function videolist_object_notifications($event, $object_type, $object) {
+ static $flag;
+ if (!isset($flag)) {
+ $flag = 0;
+ }
+
+ if (is_callable('object_notifications')) {
if ($object instanceof ElggObject) {
if ($object->getSubtype() == 'videolist') {
if ($flag == 0) {
@@ -167,49 +160,47 @@
object_notifications($event, $object_type, $object);
}
}
- }
+ }
}
-
- /**
- * Intercepts the notification on an event of new video being created and prevents a notification from going out
- * (because one will be sent on the annotation)
- *
- * @param unknown_type $hook
- * @param unknown_type $entity_type
- * @param unknown_type $returnvalue
- * @param unknown_type $params
- * @return unknown
- */
- function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
- if (isset($params)) {
- if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
- if ($params['object']->getSubtype() == 'videolist') {
- return true;
- }
- }
+}
+
+/**
+ * Intercepts the notification on an event of new video being created and prevents a notification from going out
+ * (because one will be sent on the annotation)
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
+ if (isset($params)) {
+ if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
+ if ($params['object']->getSubtype() == 'videolist') {
+ return true;
}
- return null;
}
-
- // Register a handler for adding videos
- register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');
-
- // Register a handler for delete videos
- register_elgg_event_handler('delete', 'videolist', 'videolist_delete_event_listener');
-
- // Make sure the status initialisation function is called on initialisation
- register_elgg_event_handler('init','system','videolist_init');
-
- register_elgg_event_handler('pagesetup','system','videolist_pagesetup');
- register_elgg_event_handler('annotate','all','videolist_object_notifications');
-
- // Register actions
- global $CONFIG;
-
- register_action("videolist/addvideo", false, $CONFIG->pluginspath . "videolist/actions/addvideo.php");
- register_action("videolist/tubesearch", false, $CONFIG->pluginspath . "videolist/actions/tubesearch.php");
- //register_action("videolist/addcomment", false, $CONFIG->pluginspath . "videolist/actions/comments/add.php");
- register_action("videolist/remove", false, $CONFIG->pluginspath . "videolist/actions/delete.php");
-
-
-?>
+ }
+ return null;
+}
+
+// Register a handler for adding videos
+register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');
+
+// Register a handler for delete videos
+register_elgg_event_handler('delete', 'videolist', 'videolist_delete_event_listener');
+
+// Make sure the status initialisation function is called on initialisation
+register_elgg_event_handler('init','system','videolist_init');
+
+register_elgg_event_handler('pagesetup','system','videolist_pagesetup');
+register_elgg_event_handler('annotate','all','videolist_object_notifications');
+
+// Register actions
+global $CONFIG;
+
+register_action("videolist/addvideo", false, $CONFIG->pluginspath . "videolist/actions/addvideo.php");
+register_action("videolist/tubesearch", false, $CONFIG->pluginspath . "videolist/actions/tubesearch.php");
+//register_action("videolist/addcomment", false, $CONFIG->pluginspath . "videolist/actions/comments/add.php");
+register_action("videolist/remove", false, $CONFIG->pluginspath . "videolist/actions/delete.php");
\ No newline at end of file
diff --git a/views/default/forms/add.php b/views/default/forms/add.php
index b387731f8..f6d5ed4c2 100644
--- a/views/default/forms/add.php
+++ b/views/default/forms/add.php
@@ -1,176 +1,156 @@
- * @copyright Prateek Choudhary
- */
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ * @file - the add user interface
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
// Make sure we're logged in (send us to the front page if not)
- gatekeeper();
- $page_owner = page_owner_entity();
- $error = array(
- 'no-video' => 1
- );
- $error_msg = array(
- 'no-video' => "Please enter a valid video url"
- );
-
- $container_guid = get_input("container_guid");
- set_page_owner($container_guid);
-
- $confirm_action = get_input('video_action');
- $guid = get_input('guid');
- $access_id = get_input('access_id');
- $title_videourl = get_input('title_videourl');
- $Pagecontainer = get_input('page');
- $get_addvideourl = get_input('add_videourl');
- $timestamp = time();
- $token = generate_action_token(time());
- if(!empty($get_addvideourl) && ($Pagecontainer == "youtube"))
- $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
- else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe"))
- $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
- else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo"))
- $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
- else
- $title_add_videourl = "";
-
-
- $tags = get_input('videolisttags');
-
- function video_youtube_parse_url($url)
- {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches))
- {
- return false;
- }
-
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches))
- {
- return false;
- }
-
- $hash = $matches[2];
-
-
- return $domain . 'v/' . $hash;
- }
-
- function video_vimeo_parse_url($url)
- {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches))
- {
- return false;
- }
-
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- $hash = $matches[2];
-
-
- return $domain . '/' . $hash;
- }
-
- function video_metacafe_parse_url($url)
- {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches))
- {
- return false;
- }
-
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- $hash = $matches[2];
-
-
- return $domain . '/' . $hash;
- }
-
- if(isset($confirm_action) && ($confirm_action == 'add_video'))
- {
- if(isset($title_videourl) && ($title_videourl != ''))
- {
- if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
- if(preg_match("/youtube/i", $title_videourl))
- $Pagecontainer = "youtube";
- if(preg_match("/vimeo/i", $title_videourl))
- $Pagecontainer = "vimeo";
- if(preg_match("/metacafe/i", $title_videourl))
- $Pagecontainer = "metacafe";
- }
- if($Pagecontainer == "youtube")
- $is_valid_video = video_youtube_parse_url($title_videourl);
- else if($Pagecontainer == "vimeo"){
- $is_valid_video = video_vimeo_parse_url($title_videourl);
- $is_valid_video = $get_addvideourl;
- }
- else if($Pagecontainer == "metacafe"){
- $is_valid_video = video_metacafe_parse_url($title_videourl);
- $is_valid_video = $get_addvideourl;
- }
- if($is_valid_video)
- {
- $error['no-video'] = 1;
- $_SESSION['candidate_profile_video'] = $is_valid_video;
- $_SESSION['candidate_profile_video_access_id'] = $access_id;
- $_SESSION['videolisttags'] = $tags;
- $_SESSION['Pagecontainer'] = $Pagecontainer;
- $_SESSION['container_guid'] = $container_guid;
- //echo $_SESSION['candidate_profile_video'];
- $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}";
- forward($url);
- }
- else
- $error['no-video'] = 0;
- }
- else
- {
- $error['no-video'] = 0;
+gatekeeper();
+$page_owner = page_owner_entity();
+$error = array(
+ 'no-video' => 1
+ );
+$error_msg = array(
+ 'no-video' => "Please enter a valid video url"
+ );
+
+$container_guid = get_input("container_guid");
+set_page_owner($container_guid);
+
+$confirm_action = get_input('video_action');
+$guid = get_input('guid');
+$access_id = get_input('access_id');
+$title_videourl = get_input('title_videourl');
+$Pagecontainer = get_input('page');
+$get_addvideourl = get_input('add_videourl');
+$timestamp = time();
+$token = generate_action_token(time());
+if (!empty($get_addvideourl) && ($Pagecontainer == "youtube")) {
+ $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
+} else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) {
+ $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
+} else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) {
+ $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
+} else {
+ $title_add_videourl = "";
+}
+
+$tags = get_input('videolisttags');
+
+function video_youtube_parse_url($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches)) {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches)) {
+ return false;
+ }
+
+ $hash = $matches[2];
+ return $domain . 'v/' . $hash;
+}
+
+function video_vimeo_parse_url($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+ return $domain . '/' . $hash;
+}
+
+function video_metacafe_parse_url($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+ return $domain . '/' . $hash;
+}
+
+if(isset($confirm_action) && ($confirm_action == 'add_video')) {
+ if(isset($title_videourl) && ($title_videourl != '')) {
+ if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
+ if(preg_match("/youtube/i", $title_videourl)) {
+ $Pagecontainer = "youtube";
+ }
+
+ if(preg_match("/vimeo/i", $title_videourl)) {
+ $Pagecontainer = "vimeo";
+ }
+
+ if(preg_match("/metacafe/i", $title_videourl)) {
+ $Pagecontainer = "metacafe";
}
- }
-
-
-
- $body = '';
-
- $body .= '
';
- $body .= '
';
-
- print $body." ";
-
-
-?>
-
-
+ if($Pagecontainer == "youtube") {
+ $is_valid_video = video_youtube_parse_url($title_videourl);
+ } else if($Pagecontainer == "vimeo") {
+ $is_valid_video = video_vimeo_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ } else if($Pagecontainer == "metacafe"){
+ $is_valid_video = video_metacafe_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ }
+
+ if($is_valid_video) {
+ $error['no-video'] = 1;
+ $_SESSION['candidate_profile_video'] = $is_valid_video;
+ $_SESSION['candidate_profile_video_access_id'] = $access_id;
+ $_SESSION['videolisttags'] = $tags;
+ $_SESSION['Pagecontainer'] = $Pagecontainer;
+ $_SESSION['container_guid'] = $container_guid;
+ //echo $_SESSION['candidate_profile_video'];
+ $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}";
+ forward($url);
+ }
+ else
+ $error['no-video'] = 0;
+ }
+ else {
+ $error['no-video'] = 0;
+ }
+}
+
+$body = '';
+
+$body .= '
';
+$body .= '
';
+
+print $body." ";
diff --git a/views/default/forms/browsetube.php b/views/default/forms/browsetube.php
index 601fb4e6a..0a54f0d10 100644
--- a/views/default/forms/browsetube.php
+++ b/views/default/forms/browsetube.php
@@ -1,106 +1,105 @@
- * @copyright Prateek Choudhary
- */
+/**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ * @file - load the browse view
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary
+ * @copyright Prateek Choudhary
+ */
$getcontainer_guid = get_input("container");
$container_guid = explode(":", $getcontainer_guid);
if($container_guid[0] == "group"){
$container = $container_guid[1];
-}
-else{
+} else{
$container = $getcontainer_guid;
}
- $error = array(
- 'no-search' => 1
- );
- $error_msg = array(
- 'no-search' => "Please enter a valid search term"
- );
- $browseCat = get_input('q');
- if(empty($browseCat) || !isset($browseCat))
- $browseCat = "youtube";
- $confirm_action = get_input('video_action');
-
- if(isset($confirm_action) && ($confirm_action == 'search_video'))
- {
- if(isset($title_search) && ($title_search != ''))
- $error['no-search'] = 0;
- else
- $error['no-search'] = 1;
- }
+$error = array(
+ 'no-search' => 1
+ );
+$error_msg = array(
+ 'no-search' => "Please enter a valid search term"
+ );
+$browseCat = get_input('q');
+if(empty($browseCat) || !isset($browseCat)) {
+ $browseCat = "youtube";
+}
+
+$confirm_action = get_input('video_action');
+
+if(isset($confirm_action) && ($confirm_action == 'search_video')) {
+ if(isset($title_search) && ($title_search != '')) {
+ $error['no-search'] = 0;
+ } else {
+ $error['no-search'] = 1;
+ }
+}
+
+//$body = '';
+//Load youtube menu
+$body .= "
";
+$body .= "
";
+$body .= "";
+$body .= "YouTube ";
+$body .= " ";
+$body .= "";
+$body .= "Metacafe ";
+$body .= " ";
+$body .= "";
+$body .= "Vimeo ";
+$body .= " ";
+/*
+$body .= "";
+$body .= "Google Videos ";
+$body .= " ";
+*/
+$body .= " ";
+$body .= "
";
+
+$body .= "
";
+
+//$body .= "
";
+$body .= '';
+//$body .= '
';
+//$body .= '
';
+
+$body .= '';
+$body .= '
';
+$body .= '
';
+$body .= '
';
+$body .= '
';
+$body .= '
';
+
+print $body." ";
+
-
- //$body = '';
- //Load youtube menu
- $body .= "
";
- $body .= "
";
- $body .= "";
- $body .= "YouTube ";
- $body .= " ";
- $body .= "";
- $body .= "Metacafe ";
- $body .= " ";
- $body .= "";
- $body .= "Vimeo ";
- $body .= " ";
- /*
- $body .= "";
- $body .= "Google Videos ";
- $body .= " ";
- */
- $body .= " ";
- $body .= "
";
-
- $body .= "
";
-
- //$body .= "
";
- $body .= '';
- //$body .= '
';
- //$body .= '
';
-
- $body .= '';
- $body .= '
';
- $body .= '
';
- $body .= '
';
- $body .= '
';
- $body .= '
';
-
- print $body." ";
-
-
?>
diff --git a/views/default/forms/edit.php b/views/default/forms/edit.php
deleted file mode 100644
index 7d7901bcd..000000000
--- a/views/default/forms/edit.php
+++ /dev/null
@@ -1,43 +0,0 @@
- Edit view
-*/
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-$page_owner = page_owner_entity();
-$container_guid = $vars['entity']->container_guid;
-$owner = get_entity($container_guid);
-if($owner instanceof ElggGroup){
- $options = group_access_options($owner);
-}else{
- $options = '';
-}
-?>
-
-
\ No newline at end of file
diff --git a/views/default/forms/labels/googlevideos.php b/views/default/forms/labels/googlevideos.php
deleted file mode 100644
index 9ce2d607c..000000000
--- a/views/default/forms/labels/googlevideos.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
-$body .= "
";
-$body .= 'Loading...
';
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/labels/metacafe.php b/views/default/forms/labels/metacafe.php
deleted file mode 100644
index 0642153f4..000000000
--- a/views/default/forms/labels/metacafe.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:metacafe')));
-$body .= "
";
-
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/labels/vimeo.php b/views/default/forms/labels/vimeo.php
deleted file mode 100644
index 24a49a1ee..000000000
--- a/views/default/forms/labels/vimeo.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if ($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
-$body .= "
";
-
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/labels/youtube.php b/views/default/forms/labels/youtube.php
deleted file mode 100644
index 4c824f6f3..000000000
--- a/views/default/forms/labels/youtube.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos')));
-$body .= "
";
-
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/add.php b/views/default/forms/videolist/add.php
new file mode 100644
index 000000000..2ee5d9c2e
--- /dev/null
+++ b/views/default/forms/videolist/add.php
@@ -0,0 +1,163 @@
+
+ * @copyright Prateek Choudhary
+ */
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+$page_owner = page_owner_entity();
+$error = array(
+ 'no-video' => 1
+ );
+$error_msg = array(
+ 'no-video' => "Please enter a valid video url"
+ );
+
+$container_guid = get_input("container_guid");
+set_page_owner($container_guid);
+
+$confirm_action = get_input('video_action');
+$guid = get_input('guid');
+if(page_owner_entity() instanceof ElggGroup){
+ //if in a group, set the access level to default to the group
+ $access_id = page_owner_entity()->group_acl;
+}else{
+ $access_id = get_default_access(get_loggedin_user());
+}
+//if it is a group, pull out the group access view
+if(page_owner_entity() instanceof ElggGroup){
+ $options = group_access_options(page_owner_entity());
+}else{
+ $options = '';
+}
+$title_videourl = get_input('title_videourl');
+$Pagecontainer = get_input('page');
+$get_addvideourl = get_input('add_videourl');
+$timestamp = time();
+$token = generate_action_token(time());
+if (!empty($get_addvideourl) && ($Pagecontainer == "youtube")) {
+ $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
+} else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) {
+ $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
+} else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) {
+ $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
+} else {
+ $title_add_videourl = "";
+}
+
+$tags = get_input('videolisttags');
+
+function video_youtube_parse_url($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches)) {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches)) {
+ return false;
+ }
+
+ $hash = $matches[2];
+ return $domain . 'v/' . $hash;
+}
+
+function video_vimeo_parse_url($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+ return $domain . '/' . $hash;
+}
+
+function video_metacafe_parse_url($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) {
+ return false;
+ }
+
+ $domain = $matches[2] . $matches[3];
+ $path = $matches[4];
+
+ $hash = $matches[2];
+
+ return $domain . '/' . $hash;
+}
+
+if(isset($confirm_action) && ($confirm_action == 'add_video')) {
+ if(isset($title_videourl) && ($title_videourl != '')) {
+ if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
+ if(preg_match("/youtube/i", $title_videourl)) {
+ $Pagecontainer = "youtube";
+ }
+
+ if(preg_match("/vimeo/i", $title_videourl)) {
+ $Pagecontainer = "vimeo";
+ }
+
+ if(preg_match("/metacafe/i", $title_videourl)) {
+ $Pagecontainer = "metacafe";
+ }
+ }
+ if($Pagecontainer == "youtube") {
+ $is_valid_video = video_youtube_parse_url($title_videourl);
+ } else if($Pagecontainer == "vimeo") {
+ $is_valid_video = video_vimeo_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ } else if($Pagecontainer == "metacafe"){
+ $is_valid_video = video_metacafe_parse_url($title_videourl);
+ $is_valid_video = $get_addvideourl;
+ }
+
+ if($is_valid_video) {
+ $error['no-video'] = 1;
+ $_SESSION['candidate_profile_video'] = $is_valid_video;
+ $_SESSION['candidate_profile_video_access_id'] = $access_id;
+ $_SESSION['videolisttags'] = $tags;
+ $_SESSION['Pagecontainer'] = $Pagecontainer;
+ $_SESSION['container_guid'] = $container_guid;
+ $url = "action/videolist/add?__elgg_ts={$timestamp}&__elgg_token={$token}";
+ forward($url);
+ }
+ else
+ $error['no-video'] = 0;
+ }
+ else {
+ $error['no-video'] = 0;
+ }
+}
+
+$body = '';
+
+print $body;
diff --git a/views/default/forms/videolist/browsetube.php b/views/default/forms/videolist/browsetube.php
new file mode 100644
index 000000000..bbe2b8935
--- /dev/null
+++ b/views/default/forms/videolist/browsetube.php
@@ -0,0 +1,251 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+$getcontainer_guid = get_input("container");
+$container_guid = explode(":", $getcontainer_guid);
+if($container_guid[0] == "group"){
+ $container = $container_guid[1];
+} else{
+ $container = $getcontainer_guid;
+}
+$error = array(
+ 'no-search' => 1
+ );
+$error_msg = array(
+ 'no-search' => "Please enter a valid search term"
+ );
+$browseCat = get_input('q');
+if(empty($browseCat) || !isset($browseCat)) {
+ $browseCat = "youtube";
+}
+
+$confirm_action = get_input('video_action');
+
+if(isset($confirm_action) && ($confirm_action == 'search_video')) {
+ if(isset($title_search) && ($title_search != '')) {
+ $error['no-search'] = 0;
+ } else {
+ $error['no-search'] = 1;
+ }
+}
+
+//Load youtube menu
+$body .= "";
+$body .= "
";
+$body .= "";
+$body .= "YouTube ";
+$body .= " ";
+$body .= "";
+$body .= "Metacafe ";
+$body .= " ";
+$body .= "";
+$body .= "Vimeo ";
+$body .= " ";
+$body .= " ";
+$body .= "
";
+
+$body .= '';
+
+$body .= '
';
+$body .= '
';
+
+print $body;
+
+
+?>
+
+
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
new file mode 100644
index 000000000..7d7901bcd
--- /dev/null
+++ b/views/default/forms/videolist/edit.php
@@ -0,0 +1,43 @@
+ Edit view
+*/
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+$page_owner = page_owner_entity();
+$container_guid = $vars['entity']->container_guid;
+$owner = get_entity($container_guid);
+if($owner instanceof ElggGroup){
+ $options = group_access_options($owner);
+}else{
+ $options = '';
+}
+?>
+
+
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/googlevideos.php b/views/default/forms/videolist/labels/googlevideos.php
new file mode 100644
index 000000000..9ce2d607c
--- /dev/null
+++ b/views/default/forms/videolist/labels/googlevideos.php
@@ -0,0 +1,27 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+$body = ''.elgg_echo("videolist:title_search_tube").'
';
+$body .= "";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+if($error['no-search'] == 0) {
+ $body .= '
'.$error_msg['no-search'].'
';
+}
+$body .= "
";
+$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
+$body .= "
";
+$body .= 'Loading...
';
+print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/metacafe.php b/views/default/forms/videolist/labels/metacafe.php
new file mode 100644
index 000000000..0642153f4
--- /dev/null
+++ b/views/default/forms/videolist/labels/metacafe.php
@@ -0,0 +1,27 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+$body = ''.elgg_echo("videolist:title_search_tube").'
';
+$body .= "";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+if($error['no-search'] == 0) {
+ $body .= '
'.$error_msg['no-search'].'
';
+}
+$body .= "
";
+$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:metacafe')));
+$body .= "
";
+
+print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/vimeo.php b/views/default/forms/videolist/labels/vimeo.php
new file mode 100644
index 000000000..24a49a1ee
--- /dev/null
+++ b/views/default/forms/videolist/labels/vimeo.php
@@ -0,0 +1,27 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+$body = ''.elgg_echo("videolist:title_search_tube").'
';
+$body .= "";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+if ($error['no-search'] == 0) {
+ $body .= '
'.$error_msg['no-search'].'
';
+}
+$body .= "
";
+$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
+$body .= "
";
+
+print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/youtube.php b/views/default/forms/videolist/labels/youtube.php
new file mode 100644
index 000000000..4c824f6f3
--- /dev/null
+++ b/views/default/forms/videolist/labels/youtube.php
@@ -0,0 +1,27 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+$body = ''.elgg_echo("videolist:title_search_tube").'
';
+$body .= "";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+$body .= "
";
+if($error['no-search'] == 0) {
+ $body .= '
'.$error_msg['no-search'].'
';
+}
+$body .= "
";
+$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos')));
+$body .= "
";
+
+print $body;
\ No newline at end of file
--
cgit v1.2.3
From ecf03771557e24e86a982e5f79ebcb84d8d54883 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 3 Nov 2011 22:23:57 +0100
Subject: Moved url parse functions to a library.
---
lib/videolist.php | 86 ++++++++++++++++++++++++++++++++++
start.php | 2 +
views/default/forms/videolist/add.php | 84 ---------------------------------
views/default/forms/videolist/edit.php | 5 +-
4 files changed, 92 insertions(+), 85 deletions(-)
create mode 100644 lib/videolist.php
diff --git a/lib/videolist.php b/lib/videolist.php
new file mode 100644
index 000000000..50f83c923
--- /dev/null
+++ b/lib/videolist.php
@@ -0,0 +1,86 @@
+';
$body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video'));
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
index 7d7901bcd..9bcc64a7a 100644
--- a/views/default/forms/videolist/edit.php
+++ b/views/default/forms/videolist/edit.php
@@ -2,6 +2,9 @@
/**
* Elgg Video Plugin > Edit view
*/
+
+elgg_load_library('elgg:videolist');
+
// Make sure we're logged in (send us to the front page if not)
gatekeeper();
$page_owner = page_owner_entity();
@@ -40,4 +43,4 @@ if($owner instanceof ElggGroup){
" />
-
\ No newline at end of file
+
--
cgit v1.2.3
From d7ac68a7db932618c051442210614b9b6484c702 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 6 Nov 2011 01:11:57 +0100
Subject: Add/edit video form.
---
languages/en.php | 6 +--
pages/videolist/add.php | 14 +++---
start.php | 9 ++++
views/default/forms/videolist/add.php | 79 --------------------------------
views/default/forms/videolist/edit.php | 82 ++++++++++++++++++----------------
5 files changed, 65 insertions(+), 125 deletions(-)
delete mode 100644 views/default/forms/videolist/add.php
diff --git a/languages/en.php b/languages/en.php
index d8c076556..747bf725c 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -24,7 +24,7 @@ $english = array(
'videolist:friends' => "Friends' videos",
'videolist:edit' => "Edit video",
'videolist:ingroup' => "in the group",
- "videolist:title_videourl" => 'Enter Video Url',
+ "videolist:video_url" => 'Enter Video Url',
"videolist:submit" => 'Submit',
"videolist:videoTitle" => "Title",
"videolist:error" => 'There was an error in saving the video, please try after sometime',
@@ -40,7 +40,7 @@ $english = array(
'videolist:widget' => "My Videos",
"videolist:widget:description" => "Showcase your personal video gallery from youtube",
"profile:videoheader" => "My Video Gallery",
- "videolist:title_access" => "Access",
+ "videolist:access_id" => "Who can see you posted this video?",
"item:object:videolist" => "Videos",
"videolist:tags" => "Add Tags",
"videolist:browse" => "Find Videos - %s",
@@ -62,4 +62,4 @@ $english = array(
"videolist:none:found" => "No videos were found."
);
-add_translation("en",$english);
\ No newline at end of file
+add_translation("en",$english);
diff --git a/pages/videolist/add.php b/pages/videolist/add.php
index 0ae067391..6dd6a2f1f 100644
--- a/pages/videolist/add.php
+++ b/pages/videolist/add.php
@@ -14,17 +14,21 @@ $title = elgg_echo('videolist:add');
// set up breadcrumbs
elgg_push_breadcrumb(elgg_echo('videolist'), "file/all");
-if (elgg_instanceof($owner, 'user')) {
- elgg_push_breadcrumb($owner->name, "videolist/owner/$owner->username");
+if (elgg_instanceof($page_owner, 'user')) {
+ elgg_push_breadcrumb($page_owner->name, "videolist/owner/$page_owner->username");
} else {
- elgg_push_breadcrumb($owner->name, "videolist/group/$owner->guid/all");
+ elgg_push_breadcrumb($page_owner->name, "videolist/group/$page_owner->guid/all");
}
elgg_push_breadcrumb($title);
// create form
$form_vars = array();
-$body_vars = array();
-$content = elgg_view_form('videolist/add', $form_vars, $body_vars);
+$body_vars = array(
+ 'container_guid' => $page_owner->guid,
+ 'access_id' => elgg_instanceof($page_owner, 'user') ? ACCESS_DEFAULT : $page_owner->group_acl,
+);
+
+$content = elgg_view_form('videolist/edit', $form_vars, $body_vars);
$body = elgg_view_layout('content', array(
'content' => $content,
diff --git a/start.php b/start.php
index ff0182c3b..94a07a35c 100644
--- a/start.php
+++ b/start.php
@@ -27,6 +27,15 @@ function videolist_init() {
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('videolist', 'videolist_page_handler');
+
+ // Language short codes must be of the form "videolist:key"
+ // where key is the array key below
+ elgg_set_config('videolist', array(
+ 'video_url' => 'url',
+ 'title' => 'text',
+ 'tags' => 'tags',
+ 'access_id' => 'access',
+ ));
//extend this plugin for groups
elgg_extend_view('groups/tool_latest','videolist/groupprofile_videolist');
diff --git a/views/default/forms/videolist/add.php b/views/default/forms/videolist/add.php
deleted file mode 100644
index b03c18341..000000000
--- a/views/default/forms/videolist/add.php
+++ /dev/null
@@ -1,79 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-$page_owner = page_owner_entity();
-$error = array(
- 'no-video' => 1
- );
-$error_msg = array(
- 'no-video' => "Please enter a valid video url"
- );
-
-$container_guid = get_input("container_guid");
-set_page_owner($container_guid);
-
-$confirm_action = get_input('video_action');
-$guid = get_input('guid');
-if(page_owner_entity() instanceof ElggGroup){
- //if in a group, set the access level to default to the group
- $access_id = page_owner_entity()->group_acl;
-}else{
- $access_id = get_default_access(get_loggedin_user());
-}
-//if it is a group, pull out the group access view
-if(page_owner_entity() instanceof ElggGroup){
- $options = group_access_options(page_owner_entity());
-}else{
- $options = '';
-}
-$title_videourl = get_input('title_videourl');
-$Pagecontainer = get_input('page');
-$get_addvideourl = get_input('add_videourl');
-$timestamp = time();
-$token = generate_action_token(time());
-if (!empty($get_addvideourl) && ($Pagecontainer == "youtube")) {
- $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;
-} else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe")) {
- $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;
-} else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo")) {
- $title_add_videourl = "http://vimeo.com/".$get_addvideourl;
-} else {
- $title_add_videourl = "";
-}
-
-$tags = get_input('videolisttags');
-
-
-$body = '';
-
-print $body;
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
index 9bcc64a7a..ba6141263 100644
--- a/views/default/forms/videolist/edit.php
+++ b/views/default/forms/videolist/edit.php
@@ -1,46 +1,52 @@
Edit view
-*/
-
-elgg_load_library('elgg:videolist');
-
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-$page_owner = page_owner_entity();
-$container_guid = $vars['entity']->container_guid;
-$owner = get_entity($container_guid);
-if($owner instanceof ElggGroup){
- $options = group_access_options($owner);
-}else{
- $options = '';
+ * Videolist edit form body
+ *
+ * @package ElggVideolist
+ */
+
+$variables = elgg_get_config('videolist');
+
+if(empty($vars['guid'])){
+ unset($variables['title']);
}
-?>
-
+echo ' ';
--
cgit v1.2.3
From c2a680f932b589ada25a5c4c95523ffe07976b79 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 6 Nov 2011 01:30:19 +0100
Subject: Reordered actions (deleted some).
---
actions/add.php | 215 --------------------------
actions/comments_delete/add.php | 51 -------
actions/delete.php | 33 ----
actions/edit.php | 40 -----
actions/save.php | 11 --
actions/tubesearch.php | 316 ---------------------------------------
actions/videolist/delete.php | 33 ++++
actions/videolist/edit.php | 40 +++++
actions/videolist/tubesearch.php | 316 +++++++++++++++++++++++++++++++++++++++
9 files changed, 389 insertions(+), 666 deletions(-)
delete mode 100644 actions/add.php
delete mode 100644 actions/comments_delete/add.php
delete mode 100644 actions/delete.php
delete mode 100644 actions/edit.php
delete mode 100644 actions/save.php
delete mode 100644 actions/tubesearch.php
create mode 100644 actions/videolist/delete.php
create mode 100644 actions/videolist/edit.php
create mode 100644 actions/videolist/tubesearch.php
diff --git a/actions/add.php b/actions/add.php
deleted file mode 100644
index 4fd6481ae..000000000
--- a/actions/add.php
+++ /dev/null
@@ -1,215 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-
-// Get the current page's owner
-set_page_owner($_SESSION['container_guid']);
-
-$page_owner = page_owner_entity();
-
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
-}
-
-if($page_owner instanceof ElggGroup) {
- $entity_referer = $page_owner->type.":".$page_owner->getGUID();
-} else {
- $entity_referer = $page_owner->username;
-}
-
-require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
-
-function fetchyoutubeDatatitle($videoid){
- $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$videoid);
- /**
- ** generate XML View
- **/
- $xml_buffer = new SimpleXMLElement($buffer);
- $vidDataTitle = $xml_buffer->title;
- return $vidDataTitle;
- //return "";
-}
-
-function fetchyoutubeDatadesc($videoid){
- $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$videoid);
- /**
- ** generate XML View
- **/
- $xml_buffer = new SimpleXMLElement($buffer);
- $vidDataDesc = $xml_buffer->content;
- return $vidDataDesc;
- //return "";
-}
-
-function getVimeoInfoDataTitle($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- $title = $aoVideos->getTitle();
- return $title;
-}
-
-function getVimeoInfoDataDesc($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- $description = $aoVideos->getCaption();
- return $description;
-}
-
-function getVimeoInfoImage($iGetVideoId){
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideo();
- //get all thumbnails
-
- $aThumbnails = array();
- foreach($aoVideos->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
-
- return $thumbnail;
-}
-
-function fetchyoutubeDatathumbnail($videoId){
- $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";
- return $thumbnail;
-}
-
-function metacafeFetchData($getVideoId){
- $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $myitem = $sxml->getElementsByTagName('item');
- return $myitem;
-}
-
-function fetchmetacafeTitle($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
- }
- return $valueTitle;
-}
-
-function fetchmetacafeDesc($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
- }
- return $desc_src;
-}
-
-function fetchmetacafeImg($getVideoId){
- $myitem = metacafeFetchData($getVideoId);
- foreach($myitem as $searchNode){
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
- $pattern = '/ ]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
- }
- }
- return $thumbnail;
-}
-
-$pageContainer = $_SESSION['Pagecontainer'];
-
-
-// Initialise a new ElggObject
-$videolist = new ElggObject();
-// Tell the system it's a blog post
-$videolist->subtype = "videolist";
-// Set its owner to the current user
-$videolist->owner_guid = $_SESSION['user']->getGUID();
-
-// Set container of the video whether it was uploaded to groups or profile
-$videolist->container_guid = $_SESSION['container_guid'];
-// For now, set its access to public (we'll add an access dropdown shortly)
-$videolist->access_id = $_SESSION['candidate_profile_video_access_id'];
-
-// In order to Set its title and description appropriately WE need the video ID
-$videolist->url = $_SESSION['candidate_profile_video'];
-
-if($pageContainer == "youtube"){
- $videoIDArray = split("/v/", $videolist->url);
- $videolist->video_id = $videoIDArray[1];
- // Now set the video title and description appropriately
- $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);
- $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);
- $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);
- $videolist->videotype = "youtube";
-}
-else if($pageContainer == "metacafe"){
- $videolist->video_id = $_SESSION['candidate_profile_video'];
- // Now set the video title and description appropriately
- $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);
- $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);
- $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);
- $videolist->videotype = "metacafe";
-}
-else if($pageContainer == "vimeo"){
- $videolist->video_id = $_SESSION['candidate_profile_video'];
-
- // Now set the video title and description appropriately
- $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);
- $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);
- $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);
- $videolist->videotype = "vimeo";
-}
-
-// Before we can set metadata, we need to save the video
-if (!$videolist->save()) {
- register_error(elgg_echo("videolist:error"));
- forward("videolist/new");
-}
-//add video tags
-$videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);
-if (is_array($videolist_tags_array)) {
- $videolist->tags = $videolist_tags_array;
-}
-
-// add to river
-add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);
-
-// add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
-// Success message
-system_message(elgg_echo("videolist:posted"));
-// Remove the videolist cache
-unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
-unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);
-// Forward to the main videolist page
-
-forward("videolist/owned/".page_owner_entity()->username);
-
-// Remove the videolist cache
-unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']);
-unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);
diff --git a/actions/comments_delete/add.php b/actions/comments_delete/add.php
deleted file mode 100644
index 209561e04..000000000
--- a/actions/comments_delete/add.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
- * @copyright Curverider Ltd 2008-2009
- * @link http://elgg.org/
- */
-
-// Make sure we're logged in; forward to the front page if not
-gatekeeper();
-action_gatekeeper();
-
-// Get input
-$entity_guid = (int) get_input('entity_guid');
-$comment_text = get_input('generic_comment');
-
-// Let's see if we can get an entity with the specified GUID
-if ($entity = get_entity($entity_guid)) {
- // If posting the comment was successful, say so
- if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {
-
- if ($entity->owner_guid != $_SESSION['user']->getGUID()) {
- notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'),
- sprintf(
- elgg_echo('generic_comment:email:body'),
- $entity->title,
- $_SESSION['user']->name,
- $comment_text,
- $entity->getURL(),
- $_SESSION['user']->name,
- $_SESSION['user']->getURL()
- )
- );
- }
-
- system_message(elgg_echo("generic_comment:posted"));
- //add to river
- add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);
- } else {
- register_error(elgg_echo("generic_comment:failure"));
- }
-} else {
- register_error(elgg_echo("generic_comment:notfound"));
-}
-
-// Forward to the
-forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file
diff --git a/actions/delete.php b/actions/delete.php
deleted file mode 100644
index 221109ec4..000000000
--- a/actions/delete.php
+++ /dev/null
@@ -1,33 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
-
-// Get input data
-$guid = (int) get_input('video');
-
-// Make sure we actually have permission to edit
-$video = get_entity($guid);
-if ($video->getSubtype() == "videolist" && $video->canEdit()) {
- // Get owning user
- $owner = get_entity($video->getOwner());
-
- // Delete it!
- $rowsaffected = $video->delete();
- if ($rowsaffected > 0) {
- // Success message
- system_message(elgg_echo("videos:deleted"));
- } else {
- register_error(elgg_echo("videos:notdeleted"));
- }
- // Forward to the main video list page
- forward($_SERVER['HTTP_REFERER']);
-}
\ No newline at end of file
diff --git a/actions/edit.php b/actions/edit.php
deleted file mode 100644
index 3aa536e4c..000000000
--- a/actions/edit.php
+++ /dev/null
@@ -1,40 +0,0 @@
-username);
- exit;
-}
-
-$result = false;
-
-$container_guid = $video->container_guid;
-$container = get_entity($container_guid);
-
-if ($video->canEdit()) {
-
- $video->access_id = $access_id;
- $video->title = $title;
-
- // Save tags
- $tags = explode(",", $tags);
- $video->tags = $tags;
- $result = $video->save();
-}
-
-if ($result)
- system_message(elgg_echo("videolist:editsaved"));
-else
- register_error(elgg_echo("videolist:editfailed"));
-
-forward($_SERVER['HTTP_REFERER']);
diff --git a/actions/save.php b/actions/save.php
deleted file mode 100644
index 3f7391fbf..000000000
--- a/actions/save.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
diff --git a/actions/tubesearch.php b/actions/tubesearch.php
deleted file mode 100644
index 761bbb41e..000000000
--- a/actions/tubesearch.php
+++ /dev/null
@@ -1,316 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-// Get the current page's owner
-//set_page_owner($_SESSION['container_guid']);
-
-$page_ownerx = get_entity(get_input('container'));
-if(!$page_ownerx) {
- $page_ownerx = get_user_by_username(get_input('container'));
-}
-set_page_owner($page_ownerx->getGUID());
-$page_owner = page_owner_entity();
-
-if($page_owner->type == "group") {
- $container = "group:".$page_ownerx->getGUID();
-} else {
- $container = $page_ownerx->username;
-}
-
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
-}
-
-$queryFeed = get_input('q');
-$start_index = get_input('start_index');
-$results_perpage = 10;
-$queryCatgory = get_input('page');
-if (!isset($queryFeed) || empty($queryFeed)) {
-
-} else {
- $q = $queryFeed;
- if($queryCatgory == "youtube") {
- $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
- $sxml = simplexml_load_file($feedURL);
-
- $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
- $total = $counts->totalResults;
- $startOffset = $counts->startIndex;
- $endOffset = ($startOffset-1) + $counts->itemsPerPage;
-
- $body = '';
- $body .= '';
- $k = 0;$counter = 0;
- foreach ($sxml->entry as $entry) {
- $k++;
- $media = $entry->children('http://search.yahoo.com/mrss/');
- $attrs = $media->group->player->attributes();
- $watch = $attrs['url'];
- $vid_array = explode("?v=", $watch);
- if(preg_match("/&/", $vid_array[1])){
- $vid_array = explode("&", $vid_array[1]);
- $vid_array[1] = $vid_array[0];
- }
-
- $attrs = $media->group->thumbnail[0]->attributes();
- $thumbnail = $attrs['url'];
- $yt = $media->children('http://gdata.youtube.com/schemas/2007');
- $attrs = $yt->duration->attributes();
- $length = $attrs['seconds'];
- $gd = $entry->children('http://schemas.google.com/g/2005');
- if ($gd->rating) {
- $attrs = $gd->rating->attributes();
- $rating = $attrs['average'];
- } else {
- $rating = 0;
- }
- $tags = array();
- $tags[] = $media->group->keywords;
-
- $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
- $body .= '
';
- }
- $body .= '
';
- print $body;
- } else if($queryCatgory == "metacafe") {
- $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
-
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $total = 999;
- $startOffset = $start_index;
- $endOffset = ($startOffset-1) + $results_perpage;
-
- $body = '';
- $k = 0;
- $body .= '';
- $myitem = $sxml->getElementsByTagName('item');
- foreach($myitem as $searchNode) {
- $k++;
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
-
- $xmlLink = $searchNode->getElementsByTagName("link");
- $valueLink = $xmlLink->item(0)->nodeValue;
-
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
-
- $pattern = '/
]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
- }
-
- $pattern = '/
]+href[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $anchor_src = $match[1];
- }
-
- $encodedVideoUrlArray = explode("/watch/", $valueLink);
- $showEncodedVideo = $encodedVideoUrlArray[1];
- $metacafevideoIdArray = explode("/", $showEncodedVideo);
-
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
-
- $body .= '';
- $body .= '
';
- $body .= '
';
- }
- $body .= ' ';
- print $body;
- } else if($queryCatgory == "vimeo") {
- require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::search($queryFeed);
-
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideos();
-
- // Just for code completion
- $oVideo = new VimeoVideoEntity();
-
- $total = count($aoVideos);
- $startOffset = $start_index;
-
- $endOffset = ($startOffset-1) + $results_perpage;
- $body = '';
- $body .= '';
- $counter = 0;$k = 0;
- foreach($aoVideos as $oVideo) {
- $k++;
- if(($counter > $startOffset) && ($counter < $endOffset)) {
- //get all thumbnails
- $aThumbnails = array();
- foreach($oVideo->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
- //print_r($oVideo);
- $title = $oVideo->getTitle();
- $description = $oVideo->getCaption();
- $url = $oVideo->getUrl();
- $rating = $oVideo->getNumberOfLikes();
- $playedTimes = $oVideo->getNumberOfPlays();
- // Print all tags
- $aTags = array();
- foreach($oVideo->getTags() as $oTag) {
- $aTags[] = $oTag->getTag();
- }
- $play_idArray = explode("http://vimeo.com/", $url);
- $embedidArray = explode("/", $play_idArray[1]);
- $body .= '
';
- $body .= '
';
- $body .= '';
-
- $body .= '';
- $body .= " ";
- $body .= ' ';
-
- $body .= '';
- $body .= "".$title."
";
- $body .= "User Likes : ".$rating." ";
- $body .= "Played : ".$playedTimes." times ";
- $body .= "Description : ".$description." ... ";
- $body .= "Tags : ".implode(', ', $aTags)."
";
- $body .= ' ';
-
- $body .= "".elgg_echo('videolist:play:video')." ".elgg_echo('videolist:add:video')." ";
-
- $body .= ' ';
- $body .= '
';
- $body .= '
';
- }
- $counter++;
- }
- $body .= '
';
- print $body;
- }
-}
-
-exit;
diff --git a/actions/videolist/delete.php b/actions/videolist/delete.php
new file mode 100644
index 000000000..221109ec4
--- /dev/null
+++ b/actions/videolist/delete.php
@@ -0,0 +1,33 @@
+
+ * @copyright Prateek Choudhary
+ */
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+
+// Get input data
+$guid = (int) get_input('video');
+
+// Make sure we actually have permission to edit
+$video = get_entity($guid);
+if ($video->getSubtype() == "videolist" && $video->canEdit()) {
+ // Get owning user
+ $owner = get_entity($video->getOwner());
+
+ // Delete it!
+ $rowsaffected = $video->delete();
+ if ($rowsaffected > 0) {
+ // Success message
+ system_message(elgg_echo("videos:deleted"));
+ } else {
+ register_error(elgg_echo("videos:notdeleted"));
+ }
+ // Forward to the main video list page
+ forward($_SERVER['HTTP_REFERER']);
+}
\ No newline at end of file
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
new file mode 100644
index 000000000..3aa536e4c
--- /dev/null
+++ b/actions/videolist/edit.php
@@ -0,0 +1,40 @@
+username);
+ exit;
+}
+
+$result = false;
+
+$container_guid = $video->container_guid;
+$container = get_entity($container_guid);
+
+if ($video->canEdit()) {
+
+ $video->access_id = $access_id;
+ $video->title = $title;
+
+ // Save tags
+ $tags = explode(",", $tags);
+ $video->tags = $tags;
+ $result = $video->save();
+}
+
+if ($result)
+ system_message(elgg_echo("videolist:editsaved"));
+else
+ register_error(elgg_echo("videolist:editfailed"));
+
+forward($_SERVER['HTTP_REFERER']);
diff --git a/actions/videolist/tubesearch.php b/actions/videolist/tubesearch.php
new file mode 100644
index 000000000..761bbb41e
--- /dev/null
+++ b/actions/videolist/tubesearch.php
@@ -0,0 +1,316 @@
+
+ * @copyright Prateek Choudhary
+ */
+
+// Get the current page's owner
+//set_page_owner($_SESSION['container_guid']);
+
+$page_ownerx = get_entity(get_input('container'));
+if(!$page_ownerx) {
+ $page_ownerx = get_user_by_username(get_input('container'));
+}
+set_page_owner($page_ownerx->getGUID());
+$page_owner = page_owner_entity();
+
+if($page_owner->type == "group") {
+ $container = "group:".$page_ownerx->getGUID();
+} else {
+ $container = $page_ownerx->username;
+}
+
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
+
+$queryFeed = get_input('q');
+$start_index = get_input('start_index');
+$results_perpage = 10;
+$queryCatgory = get_input('page');
+if (!isset($queryFeed) || empty($queryFeed)) {
+
+} else {
+ $q = $queryFeed;
+ if($queryCatgory == "youtube") {
+ $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
+ $sxml = simplexml_load_file($feedURL);
+
+ $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
+ $total = $counts->totalResults;
+ $startOffset = $counts->startIndex;
+ $endOffset = ($startOffset-1) + $counts->itemsPerPage;
+
+ $body = '';
+ $body .= '';
+ $k = 0;$counter = 0;
+ foreach ($sxml->entry as $entry) {
+ $k++;
+ $media = $entry->children('http://search.yahoo.com/mrss/');
+ $attrs = $media->group->player->attributes();
+ $watch = $attrs['url'];
+ $vid_array = explode("?v=", $watch);
+ if(preg_match("/&/", $vid_array[1])){
+ $vid_array = explode("&", $vid_array[1]);
+ $vid_array[1] = $vid_array[0];
+ }
+
+ $attrs = $media->group->thumbnail[0]->attributes();
+ $thumbnail = $attrs['url'];
+ $yt = $media->children('http://gdata.youtube.com/schemas/2007');
+ $attrs = $yt->duration->attributes();
+ $length = $attrs['seconds'];
+ $gd = $entry->children('http://schemas.google.com/g/2005');
+ if ($gd->rating) {
+ $attrs = $gd->rating->attributes();
+ $rating = $attrs['average'];
+ } else {
+ $rating = 0;
+ }
+ $tags = array();
+ $tags[] = $media->group->keywords;
+
+ $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
+ $body .= '
';
+ }
+ $body .= '
';
+ print $body;
+ } else if($queryCatgory == "metacafe") {
+ $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
+
+ $sxml = new DomDocument;
+ $sxml->load($feedURL);
+ $total = 999;
+ $startOffset = $start_index;
+ $endOffset = ($startOffset-1) + $results_perpage;
+
+ $body = '';
+ $k = 0;
+ $body .= '';
+ $myitem = $sxml->getElementsByTagName('item');
+ foreach($myitem as $searchNode) {
+ $k++;
+ $xmlTitle = $searchNode->getElementsByTagName("title");
+ $valueTitle = $xmlTitle->item(0)->nodeValue;
+
+ $xmlLink = $searchNode->getElementsByTagName("link");
+ $valueLink = $xmlLink->item(0)->nodeValue;
+
+ $xmlDesc = $searchNode->getElementsByTagName("description");
+ $valueDesc = $xmlDesc->item(0)->nodeValue;
+
+ $pattern = '/
]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+
+ $pattern = '/
]+href[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $anchor_src = $match[1];
+ }
+
+ $encodedVideoUrlArray = explode("/watch/", $valueLink);
+ $showEncodedVideo = $encodedVideoUrlArray[1];
+ $metacafevideoIdArray = explode("/", $showEncodedVideo);
+
+ $ot = "";
+ $ct = "
";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+
+ $body .= '';
+ $body .= '
';
+ $body .= '
';
+ }
+ $body .= ' ';
+ print $body;
+ } else if($queryCatgory == "vimeo") {
+ require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
+ // Now lets do the search query. We will get an response object containing everything we need
+ $oResponse = VimeoVideosRequest::search($queryFeed);
+
+ // We want the result videos as an array of objects
+ $aoVideos = $oResponse->getVideos();
+
+ // Just for code completion
+ $oVideo = new VimeoVideoEntity();
+
+ $total = count($aoVideos);
+ $startOffset = $start_index;
+
+ $endOffset = ($startOffset-1) + $results_perpage;
+ $body = '';
+ $body .= '';
+ $counter = 0;$k = 0;
+ foreach($aoVideos as $oVideo) {
+ $k++;
+ if(($counter > $startOffset) && ($counter < $endOffset)) {
+ //get all thumbnails
+ $aThumbnails = array();
+ foreach($oVideo->getThumbnails() as $oThumbs) {
+ $aThumbnails[] = $oThumbs->getImageContent();
+ }
+
+ foreach($aThumbnails as $thumbnailArray){
+ $thumbnail = $thumbnailArray;
+ break;
+ }
+ //print_r($oVideo);
+ $title = $oVideo->getTitle();
+ $description = $oVideo->getCaption();
+ $url = $oVideo->getUrl();
+ $rating = $oVideo->getNumberOfLikes();
+ $playedTimes = $oVideo->getNumberOfPlays();
+ // Print all tags
+ $aTags = array();
+ foreach($oVideo->getTags() as $oTag) {
+ $aTags[] = $oTag->getTag();
+ }
+ $play_idArray = explode("http://vimeo.com/", $url);
+ $embedidArray = explode("/", $play_idArray[1]);
+ $body .= '
';
+ $body .= '
';
+ $body .= '';
+
+ $body .= '';
+ $body .= " ";
+ $body .= ' ';
+
+ $body .= '';
+ $body .= "".$title."
";
+ $body .= "User Likes : ".$rating." ";
+ $body .= "Played : ".$playedTimes." times ";
+ $body .= "Description : ".$description." ... ";
+ $body .= "Tags : ".implode(', ', $aTags)."
";
+ $body .= ' ';
+
+ $body .= "".elgg_echo('videolist:play:video')." ".elgg_echo('videolist:add:video')." ";
+
+ $body .= ' ';
+ $body .= '
';
+ $body .= '
';
+ }
+ $counter++;
+ }
+ $body .= '
';
+ print $body;
+ }
+}
+
+exit;
--
cgit v1.2.3
From bd59fd55caede2a13ec00662152e044d2746522c Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 6 Nov 2011 20:06:26 +0100
Subject: Add/edit accion.
---
actions/videolist/edit.php | 106 +++++++++++++++++++++++------------
lib/videolist.php | 135 +++++++++++++++++++++++++++++----------------
start.php | 9 +--
3 files changed, 162 insertions(+), 88 deletions(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 3aa536e4c..2ca99c1c4 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -1,40 +1,76 @@
username);
- exit;
+
+$variables = elgg_get_config('videolist');
+$input = array();
+foreach ($variables as $name => $type) {
+ $input[$name] = get_input($name);
+ if ($name == 'title') {
+ $input[$name] = strip_tags($input[$name]);
+ }
+ if ($type == 'tags') {
+ $input[$name] = string_to_tag_array($input[$name]);
+ }
+}
+
+// Get guids
+$videolist_guid = (int)get_input('videolist_guid');
+$container_guid = (int)get_input('container_guid');
+
+elgg_make_sticky_form('videolist');
+
+elgg_load_library('elgg:videolist');
+
+if (!$input['video_url']) {
+ register_error(elgg_echo('videolist:error:no_url'));
+ forward(REFERER);
+}
+
+$parsed_url = videolist_parseurl($input['video_url']);
+
+if(!$parsed) {
+ register_error(elgg_echo('videolist:error:invalid_url'));
+}
+
+if ($video_guid) {
+ $video = get_entity($video_guid);
+ if (!$video || !$video->canEdit()) {
+ register_error(elgg_echo('videolist:error:no_save'));
+ forward(REFERER);
+ }
+ $new_video = false;
+} else {
+ $video = new ElggObject();
+ $video->subtype = 'videolist_item';
+ $new_video = true;
}
-
-$result = false;
-
-$container_guid = $video->container_guid;
-$container = get_entity($container_guid);
-
-if ($video->canEdit()) {
-
- $video->access_id = $access_id;
- $video->title = $title;
-
- // Save tags
- $tags = explode(",", $tags);
- $video->tags = $tags;
- $result = $video->save();
+
+$input = array_merge($input, videolist_get_data($parsed_url));
+
+if (sizeof($input) > 0) {
+ foreach ($input as $name => $value) {
+ $video->$name = $value;
+ }
+}
+
+$video->container_guid = $container_guid;
+
+if ($video->save()) {
+
+ elgg_clear_sticky_form('videolist');
+
+ system_message(elgg_echo('videolist:saved'));
+
+ if ($new_video) {
+ add_to_river('river/object/videolist_item/create', 'create', elgg_get_logged_in_user_guid(), $video->guid);
+ }
+
+ forward($video->getURL());
+} else {
+ register_error(elgg_echo('videolist:error:no_save'));
+ forward(REFERER);
}
-
-if ($result)
- system_message(elgg_echo("videolist:editsaved"));
-else
- register_error(elgg_echo("videolist:editfailed"));
-
-forward($_SERVER['HTTP_REFERER']);
diff --git a/lib/videolist.php b/lib/videolist.php
index 50f83c923..a71315027 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,6 +1,10 @@
$domain,
+ 'videoid' => $hash,
+ );
}
-function video_vimeo_parse_url($url) {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches)) {
+function videolist_parseurl_vimeo($url) {
+ if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)*(vimeo\.com\/)(.*)/', $url, $matches)) {
return false;
}
$domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- $hash = $matches[2];
+ $hash = $matches[4];
- return $domain . '/' . $hash;
+ return array(
+ 'domain' => $domain,
+ 'videoid' => $hash,
+ );
}
-function video_metacafe_parse_url($url) {
+function videolist_parseurl_metacafe($url) {
if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) {
return false;
}
@@ -39,48 +48,76 @@ function video_metacafe_parse_url($url) {
$hash = $matches[2];
- return $domain . '/' . $hash;
+ return array(
+ 'domain' => $domain,
+ 'videoid' => $hash,
+ );
}
-if(isset($confirm_action) && ($confirm_action == 'add_video')) {
- if(isset($title_videourl) && ($title_videourl != '')) {
- if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){
- if(preg_match("/youtube/i", $title_videourl)) {
- $Pagecontainer = "youtube";
- }
-
- if(preg_match("/vimeo/i", $title_videourl)) {
- $Pagecontainer = "vimeo";
- }
-
- if(preg_match("/metacafe/i", $title_videourl)) {
- $Pagecontainer = "metacafe";
- }
- }
- if($Pagecontainer == "youtube") {
- $is_valid_video = video_youtube_parse_url($title_videourl);
- } else if($Pagecontainer == "vimeo") {
- $is_valid_video = video_vimeo_parse_url($title_videourl);
- $is_valid_video = $get_addvideourl;
- } else if($Pagecontainer == "metacafe"){
- $is_valid_video = video_metacafe_parse_url($title_videourl);
- $is_valid_video = $get_addvideourl;
- }
-
- if($is_valid_video) {
- $error['no-video'] = 1;
- $_SESSION['candidate_profile_video'] = $is_valid_video;
- $_SESSION['candidate_profile_video_access_id'] = $access_id;
- $_SESSION['videolisttags'] = $tags;
- $_SESSION['Pagecontainer'] = $Pagecontainer;
- $_SESSION['container_guid'] = $container_guid;
- $url = "action/videolist/add?__elgg_ts={$timestamp}&__elgg_token={$token}";
- forward($url);
- }
- else
- $error['no-video'] = 0;
+function videolist_parseurl($url){
+ if ($parsed = videolist_parseurl_youtube($url)){
+ $parsed['site'] = YOUTUBE;
+ return $parsed;
+ } elseif ($parsed = videolist_parseurl_vimeo($url)) {
+ $parsed['site'] = VIMEO;
+ return $parsed;
+ } elseif ($parsed = videolist_parseurl_metacafe($url)) {
+ $parsed['site'] = METACAFE;
+ return $parsed;
+ } else {
+ return array();
}
- else {
- $error['no-video'] = 0;
+}
+
+function videolist_get_data($video_parsed_url) {
+ $site = $video_parsed_url['site'];
+ $videoid = $video_parsed_url['videoid'];
+ switch($site){
+ case YOUTUBE: return videolist_get_data_youtube($videoid);
+ case VIMEO: return videolist_get_data_vimeo($videoid);
+ case METACAFE: return videolist_get_data_metacafe($videoid);
+ default: return array();
}
}
+
+
+function videolist_get_data_youtube($videoid){
+ $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$videoid);
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => sanitize_string($xml->title),
+ 'description' => sanitize_string($xml->content),
+ 'icon' => "http://img.youtube.com/vi/$videoid/default.jpg",
+ );
+}
+
+function videolist_get_data_vimeo($videoid){
+ $buffer = file_get_contents("http://vimeo.com/api/v2/video/$videoid.xml");
+ $xml = new SimpleXMLElement($buffer);
+
+ $videos = $xml->children();
+ $video = $videos[0];
+
+ return array(
+ 'title' => sanitize_string($video->title),
+ 'description' => sanitize_string($video->description),
+ 'icon' => sanitize_string($video->thumbnail_medium),
+ );
+}
+
+function videolist_get_data_metacafe($videoid){ //FIXME
+ $buffer = file_get_contents("http://www.metacafe.com/api/item/$videoid");
+ $xml = new SimpleXMLElement($buffer);
+
+ $children = $xml->children();
+ $channel = $children[1];
+
+ preg_match('/ ]+src[\\s=\'"]+([^"\'>\\s]+)/is', $channel->description, $matches);
+
+ return array(
+ 'title' => $channel->title,
+ 'description' => $channel->description,
+ 'icon' => $matches[1],
+ );
+}
diff --git a/start.php b/start.php
index 94a07a35c..c0ed1a0bf 100644
--- a/start.php
+++ b/start.php
@@ -75,10 +75,11 @@ function videolist_init() {
elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'profile_usericon_hook');
// Register actions
- elgg_register_action("videolist/add", elgg_get_plugins_path() . "videolist/actions/add.php");
- elgg_register_action("videolist/edit", elgg_get_plugins_path() . "videolist/actions/edit.php");
- elgg_register_action("videolist/tubesearch", elgg_get_plugins_path() . "videolist/actions/tubesearch.php");
- elgg_register_action("videolist/delete", elgg_get_plugins_path() . "videolist/actions/delete.php");
+ $actions_path = elgg_get_plugins_path() . "videolist/actions/videolist";
+ elgg_register_action("videolist/add", "$actions_path/add.php");
+ elgg_register_action("videolist/edit", "$actions_path/edit.php");
+ elgg_register_action("videolist/tubesearch", "$actions_path/tubesearch.php");
+ elgg_register_action("videolist/delete", "$actions_path/delete.php");
}
/**
--
cgit v1.2.3
From 84de3a9ab57277bbaedb30c5e24070f8a5ad4431 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 6 Nov 2011 22:42:30 +0100
Subject: Videolist objects all in one view.
---
lib/videolist.php | 3 ++
views/default/object/videolist.php | 54 --------------------
views/default/object/videolist_item.php | 90 +++++++++++++++++++++++++++++++++
views/default/object/watch.php | 52 -------------------
4 files changed, 93 insertions(+), 106 deletions(-)
delete mode 100644 views/default/object/videolist.php
create mode 100644 views/default/object/videolist_item.php
delete mode 100644 views/default/object/watch.php
diff --git a/lib/videolist.php b/lib/videolist.php
index a71315027..18745dfd1 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -89,6 +89,7 @@ function videolist_get_data_youtube($videoid){
'title' => sanitize_string($xml->title),
'description' => sanitize_string($xml->content),
'icon' => "http://img.youtube.com/vi/$videoid/default.jpg",
+ 'videotype' => 'youtube',
);
}
@@ -103,6 +104,7 @@ function videolist_get_data_vimeo($videoid){
'title' => sanitize_string($video->title),
'description' => sanitize_string($video->description),
'icon' => sanitize_string($video->thumbnail_medium),
+ 'videotype' => 'vimeo',
);
}
@@ -119,5 +121,6 @@ function videolist_get_data_metacafe($videoid){ //FIXME
'title' => $channel->title,
'description' => $channel->description,
'icon' => $matches[1],
+ 'videotype' => 'metacafe',
);
}
diff --git a/views/default/object/videolist.php b/views/default/object/videolist.php
deleted file mode 100644
index d67d35b23..000000000
--- a/views/default/object/videolist.php
+++ /dev/null
@@ -1,54 +0,0 @@
-
-/* YouTube/vimeo/metacafe video Object file
-/* @copyright Prateek.Choudhary
-/*****************************************************************************************/
-
-$video_file = $vars['entity'];
-
-if(!empty($video_file)) {
- $url = $video_file->url;
- $title = $video_file->title;
- $video_guid = $video_file->guid;
- $video_id = $video_file->video_id;
- $videotype = $video_file->videotype;
- $videothumbnail = $video_file->thumbnail;
- $owner = $vars['entity']->getOwnerEntity();
- $friendlytime = friendly_time($vars['entity']->time_created);
-
- $mime = "image/html";
- $thumbnail = $videothumbnail;
- $watch_URL = $vars['url']."videolist/watch/".$video_guid;
-
- $object_acl = get_readable_access_level($video_file->access_id);
- // metadata block, - access level, edit, delete, + options view extender
- $info = "";
-
- if(get_input('show_viewtype') == "all") {
- $info .= ''.$title.'
';
- $info .= "username}\">{$owner->name} {$friendlytime}";
- $info .= "
";
- $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
- echo "".elgg_view_listing($icon, $info)."
";
- } else {
- $info .= ''.$title.'
';
- $info .= "username}\">{$owner->name} {$friendlytime}";
- $info .= "
";
- $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
- echo "".elgg_view_listing($icon, $info)."
";
- }
-} else {
- echo "".elgg_echo('videolist:none:found')."
";
-}
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
new file mode 100644
index 000000000..35946579b
--- /dev/null
+++ b/views/default/object/videolist_item.php
@@ -0,0 +1,90 @@
+
+/* YouTube/vimeo/metacafe video Object file
+/* @copyright Prateek.Choudhary
+/*****************************************************************************************/
+
+$video_file = $vars['entity'];
+$full_view = $vars['full_view'];
+
+if(!$full_view) {
+ $url = $video_file->url;
+ $title = $video_file->title;
+ $video_guid = $video_file->guid;
+ $video_id = $video_file->video_id;
+ $videotype = $video_file->videotype;
+ $videothumbnail = $video_file->thumbnail;
+ $owner = $vars['entity']->getOwnerEntity();
+ $friendlytime = friendly_time($vars['entity']->time_created);
+
+ $mime = "image/html";
+ $thumbnail = $videothumbnail;
+ $watch_URL = $vars['url']."videolist/watch/".$video_guid;
+
+ $object_acl = get_readable_access_level($video_file->access_id);
+ // metadata block, - access level, edit, delete, + options view extender
+ $info = "";
+
+ if(get_input('show_viewtype') == "all") {
+ $info .= ''.$title.'
';
+ $info .= "username}\">{$owner->name} {$friendlytime}";
+ $info .= "
";
+ $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
+ echo "".elgg_view_listing($icon, $info)."
";
+ } else {
+ $info .= ''.$title.'
';
+ $info .= "username}\">{$owner->name} {$friendlytime}";
+ $info .= "
";
+ $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
+ echo "".elgg_view_listing($icon, $info)."
";
+ }
+} else {
+ $videodiv = '';
+ $width = "600";
+ $height = "400";
+ $file = $vars['entity'];
+
+ $videos = get_entity($vars['entity']);
+ $title = $videos->title;
+ $url = $videos->url;
+ $videoid = $videos->video_id;
+ $tags = $videos->tags;
+
+ $videodiv .= "";
+ $videodiv .= elgg_view_comments($videos);
+ print $videodiv;
+}
diff --git a/views/default/object/watch.php b/views/default/object/watch.php
deleted file mode 100644
index 5a35bd0ac..000000000
--- a/views/default/object/watch.php
+++ /dev/null
@@ -1,52 +0,0 @@
-
-* @copyright Prateek Choudhary
-*/
-
-$videodiv = '';
-$width = "600";
-$height = "400";
-$file = $vars['entity'];
-if(isset($vars['entity'])) {
- $videos = get_entity($vars['entity']);
- $title = $videos->title;
- $url = $videos->url;
- $videoid = $videos->video_id;
- $tags = $videos->tags;
-
- $videodiv .= "";
- $videodiv .= elgg_view_comments($videos);
- print $videodiv;
-}
\ No newline at end of file
--
cgit v1.2.3
From 0adeee109cf8d8517f3a890105f5b46459495204 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 6 Nov 2011 23:28:09 +0100
Subject: Watch working for Vimeo and Youtube.
---
lib/videolist.php | 31 ++++++++++--------
views/default/object/videolist_item.php | 51 ++++++++++++------------------
views/default/videolist/watch/metacafe.php | 15 +++++++++
views/default/videolist/watch/vimeo.php | 7 ++++
views/default/videolist/watch/youtube.php | 7 ++++
5 files changed, 67 insertions(+), 44 deletions(-)
create mode 100644 views/default/videolist/watch/metacafe.php
create mode 100644 views/default/videolist/watch/vimeo.php
create mode 100644 views/default/videolist/watch/youtube.php
diff --git a/lib/videolist.php b/lib/videolist.php
index 18745dfd1..03b6e2760 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -20,7 +20,7 @@ function videolist_parseurl_youtube($url) {
return array(
'domain' => $domain,
- 'videoid' => $hash,
+ 'video_id' => $hash,
);
}
@@ -34,7 +34,7 @@ function videolist_parseurl_vimeo($url) {
return array(
'domain' => $domain,
- 'videoid' => $hash,
+ 'video_id' => $hash,
);
}
@@ -50,7 +50,7 @@ function videolist_parseurl_metacafe($url) {
return array(
'domain' => $domain,
- 'videoid' => $hash,
+ 'video_id' => $hash,
);
}
@@ -71,30 +71,31 @@ function videolist_parseurl($url){
function videolist_get_data($video_parsed_url) {
$site = $video_parsed_url['site'];
- $videoid = $video_parsed_url['videoid'];
+ $video_id = $video_parsed_url['video_id'];
switch($site){
- case YOUTUBE: return videolist_get_data_youtube($videoid);
- case VIMEO: return videolist_get_data_vimeo($videoid);
- case METACAFE: return videolist_get_data_metacafe($videoid);
+ case YOUTUBE: return videolist_get_data_youtube($video_id);
+ case VIMEO: return videolist_get_data_vimeo($video_id);
+ case METACAFE: return videolist_get_data_metacafe($video_id);
default: return array();
}
}
-function videolist_get_data_youtube($videoid){
- $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$videoid);
+function videolist_get_data_youtube($video_id){
+ $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id);
$xml = new SimpleXMLElement($buffer);
return array(
'title' => sanitize_string($xml->title),
'description' => sanitize_string($xml->content),
- 'icon' => "http://img.youtube.com/vi/$videoid/default.jpg",
+ 'icon' => "http://img.youtube.com/vi/$video_id/default.jpg",
+ 'video_id' => $video_id,
'videotype' => 'youtube',
);
}
-function videolist_get_data_vimeo($videoid){
- $buffer = file_get_contents("http://vimeo.com/api/v2/video/$videoid.xml");
+function videolist_get_data_vimeo($video_id){
+ $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml");
$xml = new SimpleXMLElement($buffer);
$videos = $xml->children();
@@ -104,12 +105,13 @@ function videolist_get_data_vimeo($videoid){
'title' => sanitize_string($video->title),
'description' => sanitize_string($video->description),
'icon' => sanitize_string($video->thumbnail_medium),
+ 'video_id' => $video_id,
'videotype' => 'vimeo',
);
}
-function videolist_get_data_metacafe($videoid){ //FIXME
- $buffer = file_get_contents("http://www.metacafe.com/api/item/$videoid");
+function videolist_get_data_metacafe($video_id){ //FIXME
+ $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
$xml = new SimpleXMLElement($buffer);
$children = $xml->children();
@@ -121,6 +123,7 @@ function videolist_get_data_metacafe($videoid){ //FIXME
'title' => $channel->title,
'description' => $channel->description,
'icon' => $matches[1],
+ 'video_id' => $video_id,
'videotype' => 'metacafe',
);
}
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 35946579b..827efb48f 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -51,40 +51,31 @@ if(!$full_view) {
echo "".elgg_view_listing($icon, $info)."
";
}
} else {
- $videodiv = '';
+ $html = '';
$width = "600";
$height = "400";
- $file = $vars['entity'];
+ $entity = $vars['entity'];
- $videos = get_entity($vars['entity']);
- $title = $videos->title;
- $url = $videos->url;
- $videoid = $videos->video_id;
- $tags = $videos->tags;
+ $title = $entity->title;
+ $url = $entity->video_url;
+ $video_id = $entity->video_id;
- $videodiv .= "";
+ $html .= elgg_view_comments($videos);
+ echo $html;
}
diff --git a/views/default/videolist/watch/metacafe.php b/views/default/videolist/watch/metacafe.php
new file mode 100644
index 000000000..cfa5e02a4
--- /dev/null
+++ b/views/default/videolist/watch/metacafe.php
@@ -0,0 +1,15 @@
+thumbnail);
+$path = array_reverse($path);
+$thumbnailArray = explode(".", $path[0]);
+$video_id = $video_id."/".$thumbnailArray[0].".swf";
+
+echo "
+ ";
+*/
diff --git a/views/default/videolist/watch/vimeo.php b/views/default/videolist/watch/vimeo.php
new file mode 100644
index 000000000..caf34c1f4
--- /dev/null
+++ b/views/default/videolist/watch/vimeo.php
@@ -0,0 +1,7 @@
+";
diff --git a/views/default/videolist/watch/youtube.php b/views/default/videolist/watch/youtube.php
new file mode 100644
index 000000000..4b62aabbc
--- /dev/null
+++ b/views/default/videolist/watch/youtube.php
@@ -0,0 +1,7 @@
+";
--
cgit v1.2.3
From c07236c9235ddf86830a780465e9c0bf57cc2b9f Mon Sep 17 00:00:00 2001
From: Sem
Date: Tue, 8 Nov 2011 18:50:48 +0100
Subject: Refactored videolist item view.
---
pages/videolist/all.php | 2 +-
views/default/object/videolist_item.php | 171 +++++++++++++++++++-------------
2 files changed, 104 insertions(+), 69 deletions(-)
diff --git a/pages/videolist/all.php b/pages/videolist/all.php
index cd7500898..db0b0ee9d 100644
--- a/pages/videolist/all.php
+++ b/pages/videolist/all.php
@@ -15,7 +15,7 @@ $title = elgg_echo('videolist:all');
$content = elgg_list_entities(array(
'types' => 'object',
- 'subtypes' => 'videolist',
+ 'subtypes' => 'videolist_item',
'limit' => $limit,
'full_view' => FALSE
));
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 827efb48f..2a08508bb 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -1,81 +1,116 @@
-/* YouTube/vimeo/metacafe video Object file
-/* @copyright Prateek.Choudhary
-/*****************************************************************************************/
-
-$video_file = $vars['entity'];
-$full_view = $vars['full_view'];
-
-if(!$full_view) {
- $url = $video_file->url;
- $title = $video_file->title;
- $video_guid = $video_file->guid;
- $video_id = $video_file->video_id;
- $videotype = $video_file->videotype;
- $videothumbnail = $video_file->thumbnail;
- $owner = $vars['entity']->getOwnerEntity();
- $friendlytime = friendly_time($vars['entity']->time_created);
-
- $mime = "image/html";
- $thumbnail = $videothumbnail;
- $watch_URL = $vars['url']."videolist/watch/".$video_guid;
-
- $object_acl = get_readable_access_level($video_file->access_id);
- // metadata block, - access level, edit, delete, + options view extender
- $info = "";
-
- if(get_input('show_viewtype') == "all") {
- $info .= ''.$title.'
';
- $info .= "username}\">{$owner->name} {$friendlytime}";
- $info .= "
";
- $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
- echo "".elgg_view_listing($icon, $info)."
";
- } else {
- $info .= ''.$title.'
';
- $info .= "username}\">{$owner->name} {$friendlytime}";
- $info .= "
";
- $icon = "" . elgg_view("videolist/icon", array("mimetype" => $mime, 'thumbnail' => $thumbnail, 'video_guid' => $video_guid, 'size' => 'small')) . " ";
- echo "".elgg_view_listing($icon, $info)."
";
- }
+/**
+ * Videolist item renderer.
+ *
+ * @package ElggVideolist
+ */
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$entity = elgg_extract('entity', $vars, FALSE);
+
+if (!$entity) {
+ return TRUE;
+}
+
+$owner = $entity->getOwnerEntity();
+$container = $entity->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
+$excerpt = elgg_get_excerpt($entity->description);
+$mime = $entity->mimetype;
+$base_type = substr($mime, 0, strpos($mime,'/'));
+
+$body = elgg_view('output/longtext', array('value' => $entity->description));
+
+$owner_link = elgg_view('output/url', array(
+ 'href' => "file/owner/$owner->username",
+ 'text' => $owner->name,
+));
+$author_text = elgg_echo('byline', array($owner_link));
+
+$entity_icon = elgg_view_entity_icon($entity, 'small');
+
+$owner_icon = elgg_view_entity_icon($owner, 'small');
+
+$tags = elgg_view('output/tags', array('tags' => $entity->tags));
+$date = elgg_view_friendly_time($entity->time_created);
+
+$comments_count = $entity->countComments();
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $entity->getURL() . '#file-comments',
+ 'text' => $text,
+ ));
} else {
- $html = '';
- $width = "600";
- $height = "400";
- $entity = $vars['entity'];
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'file',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$author_text $date $categories $comments_link";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full && !elgg_in_context('gallery')) {
$title = $entity->title;
$url = $entity->video_url;
$video_id = $entity->video_id;
- $html .= "";
+ $header = elgg_view_title($entity->title);
- if (!empty($entity->tags)) {
- $html .= "
";
- $html .= elgg_view('output/tags',array('value' => $entity->tags));
- $html .= "
";
- }
-
- $html .= elgg_view("videolist/watch/{$entity->videotype}", array(
+ $content= elgg_view("videolist/watch/{$entity->videotype}", array(
'video_id' => $entity->video_id,
- 'width' => $width,
- 'height' => $height,
+ 'width' => 600,
+ 'height' => 400,
));
+ $params = array(
+ 'entity' => $entity,
+ 'title' => false,
+ 'content' => $content,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ $entity_info = elgg_view_image_block($owner_icon, $list_body);
+
+ echo <<';
+ echo "
" . $entity->title . " ";
+ echo elgg_view_entity_icon($entity, 'medium');
+ echo "
$owner_link $date
";
+ echo '
';
+} else {
+ // brief view
+
+ $params = array(
+ 'entity' => $entity,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
- $html .= " ";
- $html .= elgg_view_comments($videos);
- echo $html;
+ echo elgg_view_image_block($entity_icon, $list_body);
}
--
cgit v1.2.3
From 2d806df7a3ffe4ec57781ada8829b3b86bd91632 Mon Sep 17 00:00:00 2001
From: Sem
Date: Tue, 8 Nov 2011 21:44:25 +0100
Subject: Video icons.
---
graphics/Video_Icon.jpg | Bin 64088 -> 0 bytes
graphics/_videolist_icon_medium.png | Bin 0 -> 4391 bytes
graphics/badge3.gif | Bin 16801 -> 0 bytes
graphics/logo_videos.png | Bin 6333 -> 0 bytes
graphics/metacafe.jpg | Bin 5523 -> 0 bytes
graphics/pic_youtubelogo_123x63.gif | Bin 3457 -> 0 bytes
graphics/play.jpg | Bin 15987 -> 0 bytes
graphics/video_icon_tiny.png | Bin 655 -> 0 bytes
graphics/videolist_icon_medium.png | Bin 0 -> 3840 bytes
graphics/videolist_icon_small.png | Bin 0 -> 1960 bytes
graphics/videolist_icon_tiny.png | Bin 0 -> 1295 bytes
graphics/vimeo_logo.gif | Bin 3811 -> 0 bytes
graphics/youtube.jpg | Bin 6877 -> 0 bytes
graphics/youtube_logo.jpg | Bin 16791 -> 0 bytes
lib/videolist.php | 6 ++--
start.php | 41 ++++++++++++----------
views/default/icon/object/videolist/large.php | 11 ------
views/default/icon/object/videolist/master.php | 11 ------
views/default/icon/object/videolist/medium.php | 11 ------
views/default/icon/object/videolist/small.php | 11 ------
views/default/icon/object/videolist/tiny.php | 11 ------
views/default/icon/object/videolist/topbar.php | 11 ------
views/default/icon/object/videolist_item.php | 46 +++++++++++++++++++++++++
views/default/object/videolist_item.php | 3 +-
24 files changed, 72 insertions(+), 90 deletions(-)
delete mode 100644 graphics/Video_Icon.jpg
create mode 100644 graphics/_videolist_icon_medium.png
delete mode 100644 graphics/badge3.gif
delete mode 100644 graphics/logo_videos.png
delete mode 100644 graphics/metacafe.jpg
delete mode 100644 graphics/pic_youtubelogo_123x63.gif
delete mode 100644 graphics/play.jpg
delete mode 100644 graphics/video_icon_tiny.png
create mode 100644 graphics/videolist_icon_medium.png
create mode 100644 graphics/videolist_icon_small.png
create mode 100644 graphics/videolist_icon_tiny.png
delete mode 100644 graphics/vimeo_logo.gif
delete mode 100644 graphics/youtube.jpg
delete mode 100644 graphics/youtube_logo.jpg
delete mode 100644 views/default/icon/object/videolist/large.php
delete mode 100644 views/default/icon/object/videolist/master.php
delete mode 100644 views/default/icon/object/videolist/medium.php
delete mode 100644 views/default/icon/object/videolist/small.php
delete mode 100644 views/default/icon/object/videolist/tiny.php
delete mode 100644 views/default/icon/object/videolist/topbar.php
create mode 100644 views/default/icon/object/videolist_item.php
diff --git a/graphics/Video_Icon.jpg b/graphics/Video_Icon.jpg
deleted file mode 100644
index 6a22c3e88..000000000
Binary files a/graphics/Video_Icon.jpg and /dev/null differ
diff --git a/graphics/_videolist_icon_medium.png b/graphics/_videolist_icon_medium.png
new file mode 100644
index 000000000..9cfc50fd8
Binary files /dev/null and b/graphics/_videolist_icon_medium.png differ
diff --git a/graphics/badge3.gif b/graphics/badge3.gif
deleted file mode 100644
index 6dc0c1007..000000000
Binary files a/graphics/badge3.gif and /dev/null differ
diff --git a/graphics/logo_videos.png b/graphics/logo_videos.png
deleted file mode 100644
index 3a626d314..000000000
Binary files a/graphics/logo_videos.png and /dev/null differ
diff --git a/graphics/metacafe.jpg b/graphics/metacafe.jpg
deleted file mode 100644
index a74ab75f9..000000000
Binary files a/graphics/metacafe.jpg and /dev/null differ
diff --git a/graphics/pic_youtubelogo_123x63.gif b/graphics/pic_youtubelogo_123x63.gif
deleted file mode 100644
index f66c93730..000000000
Binary files a/graphics/pic_youtubelogo_123x63.gif and /dev/null differ
diff --git a/graphics/play.jpg b/graphics/play.jpg
deleted file mode 100644
index 1e701c853..000000000
Binary files a/graphics/play.jpg and /dev/null differ
diff --git a/graphics/video_icon_tiny.png b/graphics/video_icon_tiny.png
deleted file mode 100644
index 5a7204d3b..000000000
Binary files a/graphics/video_icon_tiny.png and /dev/null differ
diff --git a/graphics/videolist_icon_medium.png b/graphics/videolist_icon_medium.png
new file mode 100644
index 000000000..e567c70ed
Binary files /dev/null and b/graphics/videolist_icon_medium.png differ
diff --git a/graphics/videolist_icon_small.png b/graphics/videolist_icon_small.png
new file mode 100644
index 000000000..507260f28
Binary files /dev/null and b/graphics/videolist_icon_small.png differ
diff --git a/graphics/videolist_icon_tiny.png b/graphics/videolist_icon_tiny.png
new file mode 100644
index 000000000..2ea6e05f4
Binary files /dev/null and b/graphics/videolist_icon_tiny.png differ
diff --git a/graphics/vimeo_logo.gif b/graphics/vimeo_logo.gif
deleted file mode 100644
index 2c3c65b5c..000000000
Binary files a/graphics/vimeo_logo.gif and /dev/null differ
diff --git a/graphics/youtube.jpg b/graphics/youtube.jpg
deleted file mode 100644
index 19a0d1673..000000000
Binary files a/graphics/youtube.jpg and /dev/null differ
diff --git a/graphics/youtube_logo.jpg b/graphics/youtube_logo.jpg
deleted file mode 100644
index 59d8e0d36..000000000
Binary files a/graphics/youtube_logo.jpg and /dev/null differ
diff --git a/lib/videolist.php b/lib/videolist.php
index 03b6e2760..9e29f3061 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -88,7 +88,7 @@ function videolist_get_data_youtube($video_id){
return array(
'title' => sanitize_string($xml->title),
'description' => sanitize_string($xml->content),
- 'icon' => "http://img.youtube.com/vi/$video_id/default.jpg",
+ 'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
'video_id' => $video_id,
'videotype' => 'youtube',
);
@@ -104,7 +104,7 @@ function videolist_get_data_vimeo($video_id){
return array(
'title' => sanitize_string($video->title),
'description' => sanitize_string($video->description),
- 'icon' => sanitize_string($video->thumbnail_medium),
+ 'thumbnail' => sanitize_string($video->thumbnail_medium),
'video_id' => $video_id,
'videotype' => 'vimeo',
);
@@ -122,7 +122,7 @@ function videolist_get_data_metacafe($video_id){ //FIXME
return array(
'title' => $channel->title,
'description' => $channel->description,
- 'icon' => $matches[1],
+ 'thumbnail' => $matches[1],
'video_id' => $video_id,
'videotype' => 'metacafe',
);
diff --git a/start.php b/start.php
index c0ed1a0bf..b8bf49d83 100644
--- a/start.php
+++ b/start.php
@@ -60,7 +60,8 @@ function videolist_init() {
elgg_register_entity_url_handler('object', 'watch', 'video_url');
//register entity url handler
- elgg_register_entity_url_handler('object', 'videolist', 'videolist_url');
+ elgg_register_entity_url_handler('object', 'videolist_item', 'videolist_url');
+ elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'videolist_icon_url_override');
// Register entity type
elgg_register_entity_type('object','videolist');
@@ -70,9 +71,6 @@ function videolist_init() {
// register for embed
elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'videolist_embed_get_sections');
elgg_register_plugin_hook_handler('embed_get_items', 'videolist', 'videolist_embed_get_items');
-
- // override icons for ElggEntity::getIcon()
- elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'profile_usericon_hook');
// Register actions
$actions_path = elgg_get_plugins_path() . "videolist/actions/videolist";
@@ -91,7 +89,7 @@ function videolist_init() {
* Video watch: videolist/watch//
* Video browse: videolist/browse
* New video: videolist/add/
- * Edit video: videolist/edit//
+ * Edit video: videolist/edit/
* Group videos: videolist/group//all
*
* Title is ignored
@@ -170,12 +168,10 @@ function video_url($entity) {
return elgg_get_site_url() . "videolist/watch/" . $entity->getGUID() . "/" . $video_id;
}
-function videolist_url($videolistpage) {
- $owner = $videolistpage->container_guid;
- $userdata = get_entity($owner);
- $title = $videolistpage->title;
- $title = friendly_title($title);
- return elgg_get_site_url() . "videolist/watch/" . $videolistpage->getGUID();
+function videolist_url($videolist_item) {
+ $guid = $videolist_item->guid;
+ $title = elgg_get_friendly_title($videolist_item->title);
+ return elgg_get_site_url() . "videolist/watch/$guid/$title";
}
/**
@@ -279,17 +275,24 @@ function videolist_embed_get_items($hook, $type, $value, $params) {
}
/**
- * Returns the URL of the icon for $entity at $size.
+ * Override the default entity icon for videoslist items
*
- * @param ElggEntity $entity
- * @param string $size Not used yet. Not sure if possible.
+ * @return string Relative URL
*/
-function videolist_get_entity_icon_url(ElggEntity $entity, $size = 'medium') {
-
+function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
+ $videolist_item = $params['entity'];
+ $size = $params['size'];
+
+ if($videolist_item->getSubtype() != 'videolist_item'){
+ return $returnvalue;
+ }
+
// tiny thumbnails are too small to be useful, so give a generic video icon
- if ($size == 'tiny') {
- return elgg_get_site_url() . "mod/videolist/graphics/video_icon_tiny.png";
+ if ($size != 'tiny' && isset($videolist_item->thumbnail)) {
+ return $videolist_item->thumbnail;
}
- return $entity->thumbnail;
+ if (in_array($size, array('tiny', 'small', 'medium'))){
+ return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ }
}
diff --git a/views/default/icon/object/videolist/large.php b/views/default/icon/object/videolist/large.php
deleted file mode 100644
index 62815f7c4..000000000
--- a/views/default/icon/object/videolist/large.php
+++ /dev/null
@@ -1,11 +0,0 @@
- 25, 'small' => 40, 'medium' => 100, 'large' => 200);
+
+// Get size
+if (!in_array($vars['size'], $sizes)) {
+ $size = "medium";
+} else {
+ $size = $vars['size'];
+}
+
+if (isset($entity->name)) {
+ $title = $entity->name;
+} else {
+ $title = $entity->title;
+}
+
+$url = $entity->getURL();
+if (isset($vars['href'])) {
+ $url = $vars['href'];
+}
+
+$img_src = $entity->getIconURL($vars['size']);
+$img = " ";
+
+if ($url) {
+ echo elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => $img,
+ ));
+} else {
+ echo $img;
+}
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 2a08508bb..2be1f2a9a 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -27,8 +27,7 @@ $owner_link = elgg_view('output/url', array(
));
$author_text = elgg_echo('byline', array($owner_link));
-$entity_icon = elgg_view_entity_icon($entity, 'small');
-
+$entity_icon = elgg_view_entity_icon($entity, 'medium');
$owner_icon = elgg_view_entity_icon($owner, 'small');
$tags = elgg_view('output/tags', array('tags' => $entity->tags));
--
cgit v1.2.3
From 78e11786257411c9b823d5c6ac0f4a1ae411a6fd Mon Sep 17 00:00:00 2001
From: Sem
Date: Tue, 8 Nov 2011 23:36:51 +0100
Subject: Changes on pagesetup and watch page.
---
pages/videolist/watch.php | 91 +++++++++------------------------
start.php | 58 ++++++++-------------
views/default/object/videolist_item.php | 7 ---
3 files changed, 44 insertions(+), 112 deletions(-)
diff --git a/pages/videolist/watch.php b/pages/videolist/watch.php
index 4c92cc63b..fc9bd1a68 100644
--- a/pages/videolist/watch.php
+++ b/pages/videolist/watch.php
@@ -1,79 +1,36 @@
- * @copyright Prateek Choudhary
+ * @package ElggFile
*/
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+$videolist_item = get_entity(get_input('guid'));
-// Get objects
-$video_id = (int) get_input('video_id');
-$video = get_entity($video_id);
+elgg_set_page_owner_guid($videolist_item->container_guid);
-// If we can get out the video corresponding to video_id object ...
-if ($videos = get_entity($video_id)) {
- set_page_owner($videos->container_guid);
- $videos_container = get_entity($videos->container_guid);
- // set up breadcrumbs
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
- }
- elgg_push_breadcrumb(elgg_echo('videolist:all'), elgg_get_site_url()."videolist/all.php");
- elgg_push_breadcrumb(sprintf(elgg_echo("videolist:user"),$page_owner->name), elgg_get_site_url()."videolist/".$page_owner->username);
- elgg_push_breadcrumb(sprintf($video->title));
- $area1 = elgg_view('navigation/breadcrumbs');
+$page_owner = elgg_get_page_owner_entity();
- if($videos_container->type == "group") {
- set_context("groupsvideos");
- }
- $page_owner = page_owner_entity();
- $pagetitle = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name);
- $title = $videos->title;
-
- $area1 .= "";
-
- // Display it
- $area2 .= elgg_view("object/watch",array(
- 'entity' => $video_id,
- 'entity_owner' => $page_owner,
- 'full' => true
- ));
-
- // include a view for plugins to extend
- $area3 .= elgg_view("videolist/sidebar", array("object_type" => 'videolist'));
-
- // get the latest comments on all videos
- $comments = get_annotations(0, "object", "videolist", "generic_comment", "", 0, 4, 0, "desc");
- $area3 .= elgg_view('annotation/latest_comments', array('comments' => $comments));
-
- // tag-cloud display
- $area3 .= display_tagcloud(0, 50, 'tags', 'object', 'videolist');
-
- $body = elgg_view_layout("one_column_with_sidebar", $area1.$area2, $area3);
+$crumbs_title = $page_owner->name;
+if (elgg_instanceof($page_owner, 'group')) {
+ elgg_push_breadcrumb($crumbs_title, "videolist/group/$page_owner->guid/all");
} else {
- // video not found
- $body = "".elgg_echo('videolist:none:found')."
";
- $pagetitle = elgg_echo("video:none");
+ elgg_push_breadcrumb($crumbs_title, "videolist/owner/$page_owner->username");
}
-// Finally draw the page
-page_draw($pagetitle, $body);
+$title = $videolist_item->title;
+
+elgg_push_breadcrumb($title);
+
+$content = elgg_view_entity($videolist_item, array('full_view' => true));
+$content .= elgg_view_comments($videolist_item);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/start.php b/start.php
index b8bf49d83..2c21bec83 100644
--- a/start.php
+++ b/start.php
@@ -50,15 +50,15 @@ function videolist_init() {
// Register a handler for delete videos
elgg_register_event_handler('delete', 'videolist', 'videolist_delete_event_listener');
- elgg_register_event_handler('pagesetup','system','videolist_pagesetup');
+ // Register entity type for search
+ elgg_register_entity_type('object', 'videolist_item');
+
+ // add a file link to owner blocks
+ elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'videolist_owner_block_menu');
elgg_register_event_handler('annotate','all','videolist_object_notifications');
elgg_register_plugin_hook_handler('object:notifications','object','videolist_object_notifications_intercept');
- // Register URL handler
- elgg_register_entity_url_handler('object', 'videolist', 'video_url');
- elgg_register_entity_url_handler('object', 'watch', 'video_url');
-
//register entity url handler
elgg_register_entity_url_handler('object', 'videolist_item', 'videolist_url');
elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'videolist_icon_url_override');
@@ -66,8 +66,6 @@ function videolist_init() {
// Register entity type
elgg_register_entity_type('object','videolist');
- elgg_register_plugin_hook_handler('profile_menu', 'profile', 'videolist_profile_menu');
-
// register for embed
elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'videolist_embed_get_sections');
elgg_register_plugin_hook_handler('embed_get_items', 'videolist', 'videolist_embed_get_items');
@@ -137,30 +135,23 @@ function videolist_page_handler($page) {
}
}
-
-function videolist_pagesetup() {
- $page_owner = elgg_get_page_owner_entity();
-
- if ($page_owner instanceof ElggGroup && elgg_in_context("groups")) {
- //add_submenu_item(sprintf(elgg_echo("videolist:group"), page_owner_entity()->name), elgg_get_site_url() . "videolist/owned/" . page_owner_entity()->username);
- } else if (elgg_in_context("videolist")) {
- /**********************************************************************************************
- ****if user is OR is not registered user then show him following page menus to choose from
- ***********************************************************************************************/
- /*
- add_submenu_item(elgg_echo('videolist:home'),elgg_get_site_url()."videolist/". $page_owner->username);
-
- add_submenu_item(elgg_echo('videolist:new'),elgg_get_site_url()."videolist/new");
-
- add_submenu_item(elgg_echo('videolist:find'),elgg_get_site_url()."videolist/search/");
- */
- } else if (elgg_get_context("group")) {
- //add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), elgg_get_site_url() . "videolist/owned/" . page_owner_entity()->username);
- if ($page_owner && $page_owner->canEdit()) {
- //add_submenu_item(sprintf(elgg_echo('videolist:browsemenu'),page_owner_entity()->name), elgg_get_site_url() . "videolist/browse/". page_owner_entity()->username);
- //add_submenu_item(sprintf(elgg_echo('videolist:new'),page_owner_entity()->name), elgg_get_site_url() . "videolist/new/". page_owner_entity()->username);
+/**
+ * Add a menu item to the user ownerblock
+ */
+function videolist_owner_block_menu($hook, $type, $return, $params) {
+ if (elgg_instanceof($params['entity'], 'user')) {
+ $url = "videolist/owner/{$params['entity']->username}";
+ $item = new ElggMenuItem('videolist', elgg_echo('videolist'), $url);
+ $return[] = $item;
+ } else {
+ if ($params['entity']->videolist_enable != "no") {
+ $url = "videolist/group/{$params['entity']->guid}/all";
+ $item = new ElggMenuItem('videolist', elgg_echo('videolist:group'), $url);
+ $return[] = $item;
}
}
+
+ return $return;
}
function video_url($entity) {
@@ -217,15 +208,6 @@ function videolist_object_notifications_intercept($hook, $entity_type, $returnva
return null;
}
-function videolist_profile_menu($hook, $entity_type, $return_value, $params) {
- $return_value[] = array(
- 'text' => elgg_echo('videolist'),
- 'href' => elgg_get_site_url() . "videolist/owned/{$params['owner']->username}",
- );
-
- return $return_value;
-}
-
/**
* Register videolist as an embed type.
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 2be1f2a9a..f2543dd19 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -61,12 +61,6 @@ if (elgg_in_context('widgets')) {
if ($full && !elgg_in_context('gallery')) {
- $title = $entity->title;
- $url = $entity->video_url;
- $video_id = $entity->video_id;
-
- $header = elgg_view_title($entity->title);
-
$content= elgg_view("videolist/watch/{$entity->videotype}", array(
'video_id' => $entity->video_id,
'width' => 600,
@@ -87,7 +81,6 @@ if ($full && !elgg_in_context('gallery')) {
$entity_info = elgg_view_image_block($owner_icon, $list_body);
echo <<
Date: Tue, 8 Nov 2011 23:58:43 +0100
Subject: Mine and friends pages.
---
pages/videolist/friends.php | 64 ++++++++++++++-------------------
pages/videolist/owner.php | 88 +++++++++++++++++++--------------------------
2 files changed, 63 insertions(+), 89 deletions(-)
diff --git a/pages/videolist/friends.php b/pages/videolist/friends.php
index 8d90ae1a3..c505464cb 100644
--- a/pages/videolist/friends.php
+++ b/pages/videolist/friends.php
@@ -1,45 +1,33 @@
- * @copyright Prateek Choudhary
+ * @package ElggVideolist
*/
-// Start engine
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-$page_owner = page_owner_entity();
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
+$page_owner = elgg_get_page_owner_entity();
+
+elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all");
+elgg_push_breadcrumb($page_owner->name, "videolist/owner/$page_owner->username");
+elgg_push_breadcrumb(elgg_echo('friends'));
+
+elgg_register_title_button();
+
+$title = elgg_echo("videolist:friends");
+
+// offset is grabbed in list_user_friends_objects
+$content = list_user_friends_objects($page_owner->guid, 'videolist_items', 10, false);
+if (!$content) {
+ $content = elgg_echo("videolist:none");
}
-// get the filter menu
-$friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username;
-// get the filter menu
-$area1 = elgg_view("page_elements/content_header", array('context' => "friends", 'type' => 'videolist', 'friend_link' => $friend_link));
-
-// List videos
-set_context('search');
-$area2 .= list_user_friends_objects($page_owner->getGUID(), 'videolist', 10, false, false);
-set_context('videolist');
-
-// include a view for plugins to extend
-$area3 = elgg_view("videolist/sidebar", array("object_type" => 'videolist'));
-
-// fetch & display latest comments on friends videos
-$comments = get_annotations(0, "object", "videolist", "generic_comment", "", 0, 4, 0, "desc");
-$area3 .= elgg_view('annotation/latest_comments', array('comments' => $comments));
-
-// tag-cloud display
-$area3 .= display_tagcloud(0, 50, 'tags', 'object', 'videolist');
-
-// Format page
-$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3);
-
-// Draw it
-echo page_draw(elgg_echo('videolist:friends'),$body);
+//$sidebar = elgg_view('videolist/sidebar', array());
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'friends',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => $sidebar,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/pages/videolist/owner.php b/pages/videolist/owner.php
index 4ca5495e1..720281ee7 100644
--- a/pages/videolist/owner.php
+++ b/pages/videolist/owner.php
@@ -1,68 +1,54 @@
- * @copyright Prateek Choudhary
+ * @package ElggVideolist
*/
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+// access check for closed groups
+group_gatekeeper();
-if (is_callable('group_gatekeeper')) group_gatekeeper();
+$page_owner = elgg_get_page_owner_entity();
-$page_owner = page_owner_entity();
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($page_owner->getGUID());
-}
-
-//get videolist GUID
-$container_guid = get_input('username');
-if(isset($container_guid) && !empty($container_guid)) {
- $container_guid = explode(":", $container_guid);
+elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all");
+elgg_push_breadcrumb($page_owner->name);
- if ($container_guid[0] == "group") {
- $container = get_entity($container_guid[1]);
- set_context("groupsvideos");
- }
-}
+elgg_register_title_button();
-elgg_push_breadcrumb(elgg_echo('videolist:find'), elgg_get_site_url()."videolist/all");
-elgg_push_breadcrumb(sprintf(elgg_echo("videolist:home"),$page_owner->name));
-$title = sprintf(elgg_echo("videolist:home"), "$owner->name");
+$params = array();
-//set videolist header
-if(page_owner() == get_loggedin_userid()) {
- // get the filter menu
- $friend_link = elgg_get_site_url() . "videolist/friends/" . $page_owner->username;
- $area1 .= elgg_view('page_elements/content_header', array('context' => "mine", 'type' => 'videolist', 'friend_link' => $friend_link));
-}elseif(page_owner_entity() instanceof ElggGroup){
- $area1 .= elgg_view('navigation/breadcrumbs');
- $area1 .= elgg_view('videolist/group_video_header');
+if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
+ // user looking at own videolist
+ $params['filter_context'] = 'mine';
+} else if (elgg_instanceof($page_owner, 'user')) {
+ // someone else's videolist
+ // do not show select a tab when viewing someone else's posts
+ $params['filter_context'] = 'none';
} else {
- $area1 .= elgg_view('navigation/breadcrumbs');
- $area1 .= elgg_view('page_elements/content_header_member', array('type' => 'videolist'));
+ // group videolist
+ $params['filter'] = '';
}
+$title = elgg_echo("videolist:user", array($page_owner->name));
+
+// List videolist
+$content = elgg_list_entities(array(
+ 'types' => 'object',
+ 'subtypes' => 'videolist_item',
+ 'container_guid' => $page_owner->guid,
+ 'limit' => 10,
+ 'full_view' => FALSE,
+));
+if (!$content) {
+ $content = elgg_echo("videolist:none");
+}
-// include a view for plugins to extend
-$area3 = elgg_view("videolist/sidebar", array("object_type" => 'videolist'));
-
-// get the latest comments on all videos
-$comments = get_annotations(0, "object", "videolist", "generic_comment", "", 0, 4, 0, "desc");
-$area3 .= elgg_view('annotation/latest_comments', array('comments' => $comments));
-
-// tag-cloud display
-$area3 .= display_tagcloud(0, 50, 'tags', 'object', 'videolist');
+$sidebar = elgg_view('videolist/sidebar');
-// Get objects
-$area2 = elgg_list_entities(array('types' => 'object', 'subtypes' => 'videolist', 'container_guids' => page_owner(), 'limit' => 10));
+$params['content'] = $content;
+$params['title'] = $title;
+$params['sidebar'] = $sidebar;
-set_context('videolist');
-$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3);
+$body = elgg_view_layout('content', $params);
-// Finally draw the page
-page_draw($title, $body);
+echo elgg_view_page($title, $body);
--
cgit v1.2.3
From 6b16fa9b322ae12a54c66ba5160cc7547d6e7667 Mon Sep 17 00:00:00 2001
From: Sem
Date: Wed, 9 Nov 2011 01:35:57 +0100
Subject: Videolist on groups and edit/delete functionalities.
---
actions/videolist/delete.php | 62 ++++++++++--------
pages/videolist/edit.php | 75 ++++++++++++----------
start.php | 4 +-
views/default/object/videolist_item.php | 7 +-
views/default/videolist/group_module.php | 43 +++++++++++++
views/default/videolist/groupprofile_videolist.php | 47 --------------
6 files changed, 123 insertions(+), 115 deletions(-)
create mode 100644 views/default/videolist/group_module.php
delete mode 100644 views/default/videolist/groupprofile_videolist.php
diff --git a/actions/videolist/delete.php b/actions/videolist/delete.php
index 221109ec4..191d7546c 100644
--- a/actions/videolist/delete.php
+++ b/actions/videolist/delete.php
@@ -1,33 +1,39 @@
- * @copyright Prateek Choudhary
- */
-// Make sure we're logged in (send us to the front page if not)
-gatekeeper();
+* Elgg videolist item delete
+*
+* @package ElggVideolist
+*/
-// Get input data
-$guid = (int) get_input('video');
+$guid = (int) get_input('guid');
-// Make sure we actually have permission to edit
-$video = get_entity($guid);
-if ($video->getSubtype() == "videolist" && $video->canEdit()) {
- // Get owning user
- $owner = get_entity($video->getOwner());
+$videolist_item = get_entity($guid);
+if (!$videolist_item->guid) {
+ register_error(elgg_echo("videolist:deletefailed"));
+ forward('videolist/all');
+}
- // Delete it!
- $rowsaffected = $video->delete();
- if ($rowsaffected > 0) {
- // Success message
- system_message(elgg_echo("videos:deleted"));
- } else {
- register_error(elgg_echo("videos:notdeleted"));
- }
- // Forward to the main video list page
- forward($_SERVER['HTTP_REFERER']);
-}
\ No newline at end of file
+if (!$videolist_item->canEdit()) {
+ register_error(elgg_echo("videolist:deletefailed"));
+ forward($videolist_item->getURL());
+}
+
+$container = $videolist_item->getContainerEntity();
+$url = $videolist_item->getURL();
+
+if (!$videolist_item->delete()) {
+ register_error(elgg_echo("videolist:deletefailed"));
+} else {
+ system_message(elgg_echo("videolist:deleted"));
+}
+
+// we can't come back to video url because it's deleted
+if($url != REFERER) {
+ forward(REFERER);
+}
+
+if (elgg_instanceof($container, 'group')) {
+ forward("videolist/group/$container->guid/all");
+} else {
+ forward("videolist/owner/$container->username");
+}
diff --git a/pages/videolist/edit.php b/pages/videolist/edit.php
index cc06dd9c4..5ca1e4b64 100644
--- a/pages/videolist/edit.php
+++ b/pages/videolist/edit.php
@@ -1,43 +1,48 @@
container_guid;
- if (!empty($container_guid))
- if ($page_owner = get_entity($container_guid)) {
- set_page_owner($container_guid->guid);
- }
- if (empty($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
- }
-
- if ($video_file->canEdit()) {
- // set up breadcrumbs
- elgg_push_breadcrumb(elgg_echo('videolist:all'), elgg_get_site_url()."videolist/all.php");
- elgg_push_breadcrumb(sprintf(elgg_echo("videolist:user"),$page_owner->name), elgg_get_site_url()."videolist/".$page_owner->username);
- elgg_push_breadcrumb(sprintf(elgg_echo("videolist:edit")));
-
- $area1 = elgg_view('navigation/breadcrumbs');
- $area1 .= elgg_view_title($title = elgg_echo('videolist:edit'));
- $area2 = elgg_view("forms/edit",array('entity' => $video_file));
- $body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3);
- page_draw(elgg_echo("videolist:edit"), $body);
- }
-} else {
+$guid = (int) get_input('guid');
+$videolist_item = get_entity($guid);
+if (!$videolist_item) {
+ forward();
+}
+if (!$videolist_item->canEdit()) {
forward();
}
-?>
+$title = elgg_echo('videolist:edit');
+$container = get_entity($videolist_item->getContainerGUID());
+
+elgg_push_breadcrumb(elgg_echo('videolist'), "videolist/all");
+if(elgg_instanceof($container, 'user')){
+ elgg_push_breadcrumb($container->name, "videolist/owner/$container->username/");
+} else {
+ elgg_push_breadcrumb($container->name, "videolist/group/$container->guid/");
+}
+elgg_push_breadcrumb($videolist_item->title, $videolist_item->getURL());
+elgg_push_breadcrumb($title);
+
+elgg_set_page_owner_guid($container->guid);
+
+$form_vars = array();
+$body_vars = array('guid' => $guid);
+
+foreach(array_keys(elgg_get_config('videolist')) as $variable) {
+ $body_vars[$variable] = $videolist_item->$variable;
+}
+
+$content = elgg_view_form('videolist/edit', $form_vars, $body_vars);
+
+$body = elgg_view_layout('content', array(
+ 'content' => $content,
+ 'title' => $title,
+ 'filter' => '',
+));
+
+echo elgg_view_page($title, $body);
diff --git a/start.php b/start.php
index 2c21bec83..f0fe8253c 100644
--- a/start.php
+++ b/start.php
@@ -37,8 +37,8 @@ function videolist_init() {
'access_id' => 'access',
));
- //extend this plugin for groups
- elgg_extend_view('groups/tool_latest','videolist/groupprofile_videolist');
+ // extend group main page
+ elgg_extend_view('groups/tool_latest', 'videolist/group_module');
if (is_callable('register_notification_object')) {
register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index f2543dd19..63f3e6334 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -22,7 +22,7 @@ $base_type = substr($mime, 0, strpos($mime,'/'));
$body = elgg_view('output/longtext', array('value' => $entity->description));
$owner_link = elgg_view('output/url', array(
- 'href' => "file/owner/$owner->username",
+ 'href' => "videolist/owner/$owner->username",
'text' => $owner->name,
));
$author_text = elgg_echo('byline', array($owner_link));
@@ -38,7 +38,7 @@ $comments_count = $entity->countComments();
if ($comments_count != 0) {
$text = elgg_echo("comments") . " ($comments_count)";
$comments_link = elgg_view('output/url', array(
- 'href' => $entity->getURL() . '#file-comments',
+ 'href' => $entity->getURL() . '#videolist-item-comments',
'text' => $text,
));
} else {
@@ -47,7 +47,7 @@ if ($comments_count != 0) {
$metadata = elgg_view_menu('entity', array(
'entity' => $vars['entity'],
- 'handler' => 'file',
+ 'handler' => 'videolist',
'sort_by' => 'priority',
'class' => 'elgg-menu-hz',
));
@@ -57,6 +57,7 @@ $subtitle = "$author_text $date $categories $comments_link";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
+ $excerpt = '';
}
if ($full && !elgg_in_context('gallery')) {
diff --git a/views/default/videolist/group_module.php b/views/default/videolist/group_module.php
new file mode 100644
index 000000000..0e0a1ab63
--- /dev/null
+++ b/views/default/videolist/group_module.php
@@ -0,0 +1,43 @@
+videolist_enable == "no") {
+ return true;
+}
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "videolist/group/$group->guid/all",
+ 'text' => elgg_echo('link:view:all'),
+));
+
+elgg_push_context('widgets');
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'videolist_item',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => 6,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+$content = elgg_list_entities($options);
+elgg_pop_context();
+
+if (!$content) {
+ $content = '' . elgg_echo('videolist:none') . '
';
+}
+
+$new_link = elgg_view('output/url', array(
+ 'href' => "videolist/add/$group->guid",
+ 'text' => elgg_echo('videolist:add'),
+));
+
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('videolist:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+));
diff --git a/views/default/videolist/groupprofile_videolist.php b/views/default/videolist/groupprofile_videolist.php
deleted file mode 100644
index 33a22ab68..000000000
--- a/views/default/videolist/groupprofile_videolist.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-?>
-";
-?>
--
cgit v1.2.3
From b0f15fbebe3781626ba6b086d63ed364f6822209 Mon Sep 17 00:00:00 2001
From: Sem
Date: Wed, 9 Nov 2011 03:10:35 +0100
Subject: Sidebar.
---
pages/videolist/all.php | 17 +------------
pages/videolist/friends.php | 2 +-
pages/videolist/watch.php | 6 +++++
views/default/object/videolist_item.php | 11 +++++----
views/default/page/elements/videolist_block.php | 33 +++++++++++++++++++++++++
views/default/videolist/sidebar.php | 28 +++++++++++++++++++++
6 files changed, 75 insertions(+), 22 deletions(-)
create mode 100644 views/default/page/elements/videolist_block.php
create mode 100644 views/default/videolist/sidebar.php
diff --git a/pages/videolist/all.php b/pages/videolist/all.php
index db0b0ee9d..6fe68f3eb 100644
--- a/pages/videolist/all.php
+++ b/pages/videolist/all.php
@@ -20,22 +20,7 @@ $content = elgg_list_entities(array(
'full_view' => FALSE
));
-// get the latest comments on all videos
-$comments = elgg_get_annotations(array(
- 'type' => 'object',
- 'subype' => 'videolist',
- 'annotation_names' => array('generic_comment'),
- 'limit' => 4,
- 'order_by' => 'time_created desc',
-));
-$sidebar = elgg_view('annotation/latest_comments', array('comments' => $comments));
-
-// tag-cloud display
-$sidebar .= elgg_view_tagcloud(array(
- 'type' => 'object',
- 'subtype' => 'videolist',
- 'limit' => 50,
-));
+$sidebar = elgg_view('videolist/sidebar');
elgg_set_context('videolist');
$body = elgg_view_layout('content', array(
diff --git a/pages/videolist/friends.php b/pages/videolist/friends.php
index c505464cb..8bbb34698 100644
--- a/pages/videolist/friends.php
+++ b/pages/videolist/friends.php
@@ -21,7 +21,7 @@ if (!$content) {
$content = elgg_echo("videolist:none");
}
-//$sidebar = elgg_view('videolist/sidebar', array());
+$sidebar = elgg_view('videolist/sidebar', array());
$body = elgg_view_layout('content', array(
'filter_context' => 'friends',
diff --git a/pages/videolist/watch.php b/pages/videolist/watch.php
index fc9bd1a68..3a740f396 100644
--- a/pages/videolist/watch.php
+++ b/pages/videolist/watch.php
@@ -27,10 +27,16 @@ elgg_push_breadcrumb($title);
$content = elgg_view_entity($videolist_item, array('full_view' => true));
$content .= elgg_view_comments($videolist_item);
+$sidebar = elgg_view('videolist/sidebar', array(
+ 'show_comments' => false,
+ 'show_videolist' => true,
+));
+
$body = elgg_view_layout('content', array(
'content' => $content,
'title' => $title,
'filter' => '',
+ 'sidebar' => $sidebar,
));
echo elgg_view_page($title, $body);
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 63f3e6334..bda333a2d 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -16,8 +16,6 @@ $owner = $entity->getOwnerEntity();
$container = $entity->getContainerEntity();
$categories = elgg_view('output/categories', $vars);
$excerpt = elgg_get_excerpt($entity->description);
-$mime = $entity->mimetype;
-$base_type = substr($mime, 0, strpos($mime,'/'));
$body = elgg_view('output/longtext', array('value' => $entity->description));
@@ -88,9 +86,12 @@ HTML;
} elseif (elgg_in_context('gallery')) {
echo '';
- echo "
" . $entity->title . " ";
- echo elgg_view_entity_icon($entity, 'medium');
- echo "
$owner_link $date
";
+ $content = elgg_view('output/url', array(
+ 'text' => elgg_get_excerpt($entity->title, 25),
+ 'href' => $entity->getURL(),
+ ));
+ $content .= "
$owner_link $date
";
+ echo elgg_view_image_block($entity_icon, $content);
echo '
';
} else {
// brief view
diff --git a/views/default/page/elements/videolist_block.php b/views/default/page/elements/videolist_block.php
new file mode 100644
index 000000000..264862ccf
--- /dev/null
+++ b/views/default/page/elements/videolist_block.php
@@ -0,0 +1,33 @@
+ $container_guid,
+ 'limit' => elgg_extract('limit', $vars, 4),
+ 'type' => 'object',
+ 'subtypes' => 'videolist_item',
+ 'full_view' => false,
+);
+
+if($container) {
+ $title = elgg_echo('videolist:user', array($container->name));
+} else {
+ $title = elgg_echo('videolist');
+}
+
+elgg_push_context('gallery');
+$content = elgg_list_entities($options);
+elgg_pop_context('gallery');
+
+echo elgg_view_module('aside', $title, $content);
diff --git a/views/default/videolist/sidebar.php b/views/default/videolist/sidebar.php
new file mode 100644
index 000000000..4a9e1cdda
--- /dev/null
+++ b/views/default/videolist/sidebar.php
@@ -0,0 +1,28 @@
+ elgg_get_page_owner_guid(),
+ ));
+}
+
+if($show_comments) {
+ echo elgg_view('page/elements/comments_block', array(
+ 'subtypes' => 'videolist_item',
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ ));
+}
+
+if($show_tags) {
+ echo elgg_view('page/elements/tagcloud_block', array(
+ 'subtypes' => 'videolist_item',
+ 'owner_guid' => elgg_get_page_owner_guid(),
+ ));
+}
--
cgit v1.2.3
From f2280654f8aaa33964e62c27a9cab6c96372ba57 Mon Sep 17 00:00:00 2001
From: Sem
Date: Wed, 9 Nov 2011 20:24:56 +0100
Subject: No regexp when parsing urls. Blip.tv support added. Style added.
Fixed edit action.
---
actions/videolist/edit.php | 3 +-
lib/videolist.php | 104 ++++++++++++++++--------------
views/default/object/videolist_item.php | 5 +-
views/default/videolist/css.php | 5 ++
views/default/videolist/watch/bliptv.php | 7 ++
views/default/videolist/watch/vimeo.php | 4 +-
views/default/videolist/watch/youtube.php | 2 +-
7 files changed, 77 insertions(+), 53 deletions(-)
create mode 100644 views/default/videolist/watch/bliptv.php
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 2ca99c1c4..f9db7b6a2 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -32,8 +32,9 @@ if (!$input['video_url']) {
$parsed_url = videolist_parseurl($input['video_url']);
-if(!$parsed) {
+if(!$parsed_url) {
register_error(elgg_echo('videolist:error:invalid_url'));
+ forward(REFERER);
}
if ($video_guid) {
diff --git a/lib/videolist.php b/lib/videolist.php
index 9e29f3061..c62109b77 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,81 +1,77 @@
$domain,
- 'video_id' => $hash,
+ 'videotype' => 'youtube',
+ 'video_id' => $query['v'],
);
}
function videolist_parseurl_vimeo($url) {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)*(vimeo\.com\/)(.*)/', $url, $matches)) {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'vimeo.com' || !(int) $path[1]) {
return false;
}
- $domain = $matches[2] . $matches[3];
- $hash = $matches[4];
-
return array(
- 'domain' => $domain,
- 'video_id' => $hash,
+ 'videotype' => 'vimeo',
+ 'video_id' => $path[1],
);
}
function videolist_parseurl_metacafe($url) {
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches)) {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'www.metacafe.com' || $path[1] != 'watch' || !(int) $path[2]) {
return false;
}
+
+ return array(
+ 'videotype' => 'metacafe',
+ 'video_id' => $path[2],
+ );
+}
- $domain = $matches[2] . $matches[3];
- $path = $matches[4];
-
- $hash = $matches[2];
+function videolist_parseurl_bliptv($url) {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+ if ($parsed['host'] != 'blip.tv' || count($path) < 3) {
+ return false;
+ }
+
return array(
- 'domain' => $domain,
- 'video_id' => $hash,
+ 'videotype' => 'bliptv',
+ 'video_id' => $parsed['path'],
);
}
function videolist_parseurl($url){
- if ($parsed = videolist_parseurl_youtube($url)){
- $parsed['site'] = YOUTUBE;
- return $parsed;
- } elseif ($parsed = videolist_parseurl_vimeo($url)) {
- $parsed['site'] = VIMEO;
- return $parsed;
- } elseif ($parsed = videolist_parseurl_metacafe($url)) {
- $parsed['site'] = METACAFE;
- return $parsed;
- } else {
- return array();
- }
+ if ($parsed = videolist_parseurl_youtube($url)) return $parsed;
+ elseif ($parsed = videolist_parseurl_vimeo($url)) return $parsed;
+ elseif ($parsed = videolist_parseurl_metacafe($url)) return $parsed;
+ elseif ($parsed = videolist_parseurl_bliptv($url)) return $parsed;
+ else return array();
}
function videolist_get_data($video_parsed_url) {
- $site = $video_parsed_url['site'];
+ $videotype = $video_parsed_url['videotype'];
$video_id = $video_parsed_url['video_id'];
- switch($site){
- case YOUTUBE: return videolist_get_data_youtube($video_id);
- case VIMEO: return videolist_get_data_vimeo($video_id);
- case METACAFE: return videolist_get_data_metacafe($video_id);
+ switch($videotype){
+ case 'youtube': return videolist_get_data_youtube($video_id);
+ case 'vimeo': return videolist_get_data_vimeo($video_id);
+ case 'metacafe': return videolist_get_data_metacafe($video_id);
+ case 'bliptv': return videolist_get_data_bliptv($video_id);
default: return array();
}
}
@@ -127,3 +123,17 @@ function videolist_get_data_metacafe($video_id){ //FIXME
'videotype' => 'metacafe',
);
}
+
+function videolist_get_data_bliptv($video_id){
+ $buffer = file_get_contents('http://blip.tv'.$video_id.'?skin=rss');
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => current($xml->xpath('/rss/channel/item/title')),
+ 'description' => current($xml->xpath('/rss/channel/item/description')),
+ 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
+ 'embedurl' => current($xml->xpath('/rss/channel/item/blip:embedUrl')),
+ 'video_id' => $video_id,
+ 'videotype' => 'bliptv',
+ );
+}
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index bda333a2d..6ed284a43 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -60,11 +60,12 @@ if (elgg_in_context('widgets')) {
if ($full && !elgg_in_context('gallery')) {
- $content= elgg_view("videolist/watch/{$entity->videotype}", array(
- 'video_id' => $entity->video_id,
+ $content = elgg_view("videolist/watch/{$entity->videotype}", array(
+ 'entity' => $entity,
'width' => 600,
'height' => 400,
));
+ $content = "$content
";
$params = array(
'entity' => $entity,
diff --git a/views/default/videolist/css.php b/views/default/videolist/css.php
index 93069181a..6f2bf397d 100644
--- a/views/default/videolist/css.php
+++ b/views/default/videolist/css.php
@@ -10,6 +10,11 @@
*/
?>
+.videolist-watch {
+ margin-top: 40px;
+ margin-left: 20px;
+}
+
.videolist_error{
color:red;
font-weight:bold;
diff --git a/views/default/videolist/watch/bliptv.php b/views/default/videolist/watch/bliptv.php
new file mode 100644
index 000000000..b7f72dea6
--- /dev/null
+++ b/views/default/videolist/watch/bliptv.php
@@ -0,0 +1,7 @@
+embedurl;
+$width = $vars['width'];
+$height = $vars['height'];
+
+echo "";
diff --git a/views/default/videolist/watch/vimeo.php b/views/default/videolist/watch/vimeo.php
index caf34c1f4..97b5e8d88 100644
--- a/views/default/videolist/watch/vimeo.php
+++ b/views/default/videolist/watch/vimeo.php
@@ -1,7 +1,7 @@
video_id;
$width = $vars['width'];
$height = $vars['height'];
-echo "";
+echo "";
diff --git a/views/default/videolist/watch/youtube.php b/views/default/videolist/watch/youtube.php
index 4b62aabbc..e0b2ece06 100644
--- a/views/default/videolist/watch/youtube.php
+++ b/views/default/videolist/watch/youtube.php
@@ -1,6 +1,6 @@
video_id;
$width = $vars['width'];
$height = $vars['height'];
--
cgit v1.2.3
From 838229d4ef15607ae60c8fd3e3c37cd4849b376f Mon Sep 17 00:00:00 2001
From: Sem
Date: Wed, 9 Nov 2011 23:26:27 +0100
Subject: Metacafe and Giss.tv support.
---
lib/videolist.php | 55 +++++++++++++++++++++++++-----
views/default/videolist/watch/gisstv.php | 9 +++++
views/default/videolist/watch/metacafe.php | 12 ++-----
3 files changed, 58 insertions(+), 18 deletions(-)
create mode 100644 views/default/videolist/watch/gisstv.php
diff --git a/lib/videolist.php b/lib/videolist.php
index c62109b77..bb114b298 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -56,11 +56,34 @@ function videolist_parseurl_bliptv($url) {
);
}
+function videolist_parseurl_gisstv($url) {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'giss.tv' || $path[1] != 'dmmdb') {
+ return false;
+ }
+
+ if($path[2] == 'contents' && isset($path[3])) {
+ $video_id = $path[3];
+ } elseif($path[3] == 'contents' && isset($path[4])) {
+ $video_id = $path[4];
+ } else {
+ return false;
+ }
+
+ return array(
+ 'videotype' => 'gisstv',
+ 'video_id' => $video_id,
+ );
+}
+
function videolist_parseurl($url){
if ($parsed = videolist_parseurl_youtube($url)) return $parsed;
elseif ($parsed = videolist_parseurl_vimeo($url)) return $parsed;
elseif ($parsed = videolist_parseurl_metacafe($url)) return $parsed;
elseif ($parsed = videolist_parseurl_bliptv($url)) return $parsed;
+ elseif ($parsed = videolist_parseurl_gisstv($url)) return $parsed;
else return array();
}
@@ -72,6 +95,7 @@ function videolist_get_data($video_parsed_url) {
case 'vimeo': return videolist_get_data_vimeo($video_id);
case 'metacafe': return videolist_get_data_metacafe($video_id);
case 'bliptv': return videolist_get_data_bliptv($video_id);
+ case 'gisstv': return videolist_get_data_gisstv($video_id);
default: return array();
}
}
@@ -110,15 +134,11 @@ function videolist_get_data_metacafe($video_id){ //FIXME
$buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
$xml = new SimpleXMLElement($buffer);
- $children = $xml->children();
- $channel = $children[1];
-
- preg_match('/ ]+src[\\s=\'"]+([^"\'>\\s]+)/is', $channel->description, $matches);
-
return array(
- 'title' => $channel->title,
- 'description' => $channel->description,
- 'thumbnail' => $matches[1],
+ 'title' => current($xml->xpath('/rss/channel/item/title')),
+ 'description' => current($xml->xpath('/rss/channel/item/description')),
+ 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
+ 'embedurl' => current($xml->xpath('/rss/channel/item/media:content/@url')),
'video_id' => $video_id,
'videotype' => 'metacafe',
);
@@ -137,3 +157,22 @@ function videolist_get_data_bliptv($video_id){
'videotype' => 'bliptv',
);
}
+
+function videolist_get_data_gisstv($video_id){
+ $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
+ $xml = new SimpleXMLElement($buffer);
+
+ $data = array();
+ foreach($xml->xpath('/rss/channel/item') as $item){
+ if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
+ $data['title'] = sanitize_string($item->title);
+ $data['description'] = sanitize_string($item->description);
+ $data['thumbnail'] = sanitize_string($item->thumbnail);
+ break;
+ }
+ }
+ return array_merge($data, array(
+ 'video_id' => $video_id,
+ 'videotype' => 'gisstv',
+ ));
+}
diff --git a/views/default/videolist/watch/gisstv.php b/views/default/videolist/watch/gisstv.php
new file mode 100644
index 000000000..6fdecd1ce
--- /dev/null
+++ b/views/default/videolist/watch/gisstv.php
@@ -0,0 +1,9 @@
+video_id;
+$width = $vars['width'];
+$height = $vars['height'];
+
+echo "
+
+ ";
diff --git a/views/default/videolist/watch/metacafe.php b/views/default/videolist/watch/metacafe.php
index cfa5e02a4..ddf2b155e 100644
--- a/views/default/videolist/watch/metacafe.php
+++ b/views/default/videolist/watch/metacafe.php
@@ -1,15 +1,7 @@
embedurl;
$width = $vars['width'];
$height = $vars['height'];
-$path = explode("/", $videos->thumbnail);
-$path = array_reverse($path);
-$thumbnailArray = explode(".", $path[0]);
-$video_id = $video_id."/".$thumbnailArray[0].".swf";
-
-echo "
- ";
-*/
+echo " ";
--
cgit v1.2.3
From c2dd51263f83815092bdcf29588afd4b84b31e1f Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 00:11:53 +0100
Subject: Solved some issues.
---
actions/videolist/delete.php | 2 +-
lib/videolist.php | 24 ++++++++++++------------
views/default/page/elements/videolist_block.php | 3 ++-
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/actions/videolist/delete.php b/actions/videolist/delete.php
index 191d7546c..0b9724c52 100644
--- a/actions/videolist/delete.php
+++ b/actions/videolist/delete.php
@@ -28,7 +28,7 @@ if (!$videolist_item->delete()) {
}
// we can't come back to video url because it's deleted
-if($url != REFERER) {
+if($url != $_SERVER['HTTP_REFERER']) {
forward(REFERER);
}
diff --git a/lib/videolist.php b/lib/videolist.php
index bb114b298..c30916773 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -107,7 +107,7 @@ function videolist_get_data_youtube($video_id){
return array(
'title' => sanitize_string($xml->title),
- 'description' => sanitize_string($xml->content),
+ 'description' => strip_tags($xml->content),
'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
'video_id' => $video_id,
'videotype' => 'youtube',
@@ -123,22 +123,22 @@ function videolist_get_data_vimeo($video_id){
return array(
'title' => sanitize_string($video->title),
- 'description' => sanitize_string($video->description),
+ 'description' => strip_tags($video->description),
'thumbnail' => sanitize_string($video->thumbnail_medium),
'video_id' => $video_id,
'videotype' => 'vimeo',
);
}
-function videolist_get_data_metacafe($video_id){ //FIXME
+function videolist_get_data_metacafe($video_id){
$buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
$xml = new SimpleXMLElement($buffer);
return array(
- 'title' => current($xml->xpath('/rss/channel/item/title')),
- 'description' => current($xml->xpath('/rss/channel/item/description')),
- 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
- 'embedurl' => current($xml->xpath('/rss/channel/item/media:content/@url')),
+ 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
+ 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/media:content/@url'))),
'video_id' => $video_id,
'videotype' => 'metacafe',
);
@@ -149,10 +149,10 @@ function videolist_get_data_bliptv($video_id){
$xml = new SimpleXMLElement($buffer);
return array(
- 'title' => current($xml->xpath('/rss/channel/item/title')),
- 'description' => current($xml->xpath('/rss/channel/item/description')),
- 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
- 'embedurl' => current($xml->xpath('/rss/channel/item/blip:embedUrl')),
+ 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
+ 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/blip:embedUrl'))),
'video_id' => $video_id,
'videotype' => 'bliptv',
);
@@ -166,7 +166,7 @@ function videolist_get_data_gisstv($video_id){
foreach($xml->xpath('/rss/channel/item') as $item){
if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
$data['title'] = sanitize_string($item->title);
- $data['description'] = sanitize_string($item->description);
+ $data['description'] = strip_tags($item->description);
$data['thumbnail'] = sanitize_string($item->thumbnail);
break;
}
diff --git a/views/default/page/elements/videolist_block.php b/views/default/page/elements/videolist_block.php
index 264862ccf..77ad75ab8 100644
--- a/views/default/page/elements/videolist_block.php
+++ b/views/default/page/elements/videolist_block.php
@@ -14,10 +14,11 @@ $container = get_entity($container_guid);
$options = array(
'container_guid' => $container_guid,
- 'limit' => elgg_extract('limit', $vars, 4),
+ 'limit' => elgg_extract('limit', $vars, 6),
'type' => 'object',
'subtypes' => 'videolist_item',
'full_view' => false,
+ 'pagination' => false,
);
if($container) {
--
cgit v1.2.3
From 4f4c5fbbf888495ca734231459b9496abd5d1539 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 20:08:08 +0100
Subject: Added description field and arranged english language file.
---
languages/en.php | 41 ++++++++++++++--------------------
start.php | 1 +
views/default/forms/videolist/edit.php | 1 +
3 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/languages/en.php b/languages/en.php
index 747bf725c..db181aa37 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -1,13 +1,10 @@
- * @copyright Prateek Choudhary
+ * Elgg videolist english language pack.
+ *
+ * @package ElggVideolist
*/
+
$english = array(
"videolist" => "Videos",
@@ -24,16 +21,16 @@ $english = array(
'videolist:friends' => "Friends' videos",
'videolist:edit' => "Edit video",
'videolist:ingroup' => "in the group",
- "videolist:video_url" => 'Enter Video Url',
"videolist:submit" => 'Submit',
- "videolist:videoTitle" => "Title",
- "videolist:error" => 'There was an error in saving the video, please try after sometime',
- "videolist:posted" => 'Your video has been saved successfully!',
- "video:more" => "View all videos",
- "video:none" => "sorry, no videos were found",
- "candidateprofile:candidatevideo" => "My videos",
- "videos:deleted" => "Your Video was removed successfully!",
- "videos:notdeleted" => "Unfortunately, this video could not be removed now. Please try again later",
+ "videolist:title" => "Title",
+ "videolist:description" => "Description",
+ "videolist:video_url" => "Enter video URL",
+ "videolist:error:no_save" => 'There was an error in saving the video, please try after sometime',
+ "videolist:saved" => 'Your video has been saved successfully!',
+ "videolist_item:more" => "View all videos",
+ "videolist_item:none" => "sorry, no videos were found",
+ "videolist:deleted" => "Your video was removed successfully!",
+ "videolist:deletefailed" => "Unfortunately, this video could not be removed now. Please try again later",
"videolist:widget" => "Videos",
"videolist:widget:description" => "Your personal video playlist",
"videolist:num_videos" => "Number of videos to display",
@@ -41,7 +38,7 @@ $english = array(
"videolist:widget:description" => "Showcase your personal video gallery from youtube",
"profile:videoheader" => "My Video Gallery",
"videolist:access_id" => "Who can see you posted this video?",
- "item:object:videolist" => "Videos",
+ "item:object:videolist_item" => "Videos",
"videolist:tags" => "Add Tags",
"videolist:browse" => "Find Videos - %s",
"videolist:browsemenu" => "Find Videos",
@@ -49,17 +46,13 @@ $english = array(
"videolist:searchTubeVideos" => "Search youtube.com",
"videolist:comments" => "Comments",
"videolist:commentspost" => "Post",
- "videolist:river:annotate" => "%s commented on",
+ "river:comment:object:videolist_item" => "%s commented on %s",
"videolist:river:item" => "a video",
"videolist:river:created" => "%s added",
- "videolist:searchTubeVideos:metacafe" => "Search metacafe.com",
- "videolist:searchTubeVideos:vimeo" => "Search vimeo.com",
- "videolist:searchTubeVideos:googlevideos" => "Search video.google.com",
- "videolist:group" => "Videos",
+ "videolist:group" => "Group Videos",
"videolist:groupall" => "All Group Videos",
"videolist:delete:confirm" => "Are you sure you want to delete this video?",
- "videolist:none" => "This group does not have any videos yet",
- "videolist:none:found" => "No videos were found."
+ "videolist:none" => "No videos were found.",
);
add_translation("en",$english);
diff --git a/start.php b/start.php
index f0fe8253c..ad6998382 100644
--- a/start.php
+++ b/start.php
@@ -33,6 +33,7 @@ function videolist_init() {
elgg_set_config('videolist', array(
'video_url' => 'url',
'title' => 'text',
+ 'description' => 'longtext',
'tags' => 'tags',
'access_id' => 'access',
));
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
index ba6141263..8bbbcffb7 100644
--- a/views/default/forms/videolist/edit.php
+++ b/views/default/forms/videolist/edit.php
@@ -9,6 +9,7 @@ $variables = elgg_get_config('videolist');
if(empty($vars['guid'])){
unset($variables['title']);
+ unset($variables['description']);
}
foreach ($variables as $name => $type) {
--
cgit v1.2.3
From 201f1ffc0737ed3794b038c4cce0dfa1a4073c99 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 20:38:37 +0100
Subject: Cleaned some start funcitons.
---
start.php | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff --git a/start.php b/start.php
index ad6998382..d06268fd8 100644
--- a/start.php
+++ b/start.php
@@ -20,10 +20,7 @@ function videolist_init() {
elgg_register_menu_item('site', $item);
// Extend system CSS with our own styles
- elgg_extend_view('css','videolist/css');
-
- // Load the language file - default is english
- register_translations(elgg_get_plugins_path() . "videolist/languages/");
+ elgg_extend_view('css/elgg','videolist/css');
// Register a page handler, so we can have nice URLs
elgg_register_page_handler('videolist', 'videolist_page_handler');
@@ -42,15 +39,9 @@ function videolist_init() {
elgg_extend_view('groups/tool_latest', 'videolist/group_module');
if (is_callable('register_notification_object')) {
- register_notification_object('object', 'videolist', elgg_echo('videolist:new'));
+ register_notification_object('object', 'videolist_item', elgg_echo('videolist:new'));
}
- // Register a handler for adding videos
- elgg_register_event_handler('create', 'videolist', 'videolist_create_event_listener');
-
- // Register a handler for delete videos
- elgg_register_event_handler('delete', 'videolist', 'videolist_delete_event_listener');
-
// Register entity type for search
elgg_register_entity_type('object', 'videolist_item');
@@ -64,9 +55,6 @@ function videolist_init() {
elgg_register_entity_url_handler('object', 'videolist_item', 'videolist_url');
elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'videolist_icon_url_override');
- // Register entity type
- elgg_register_entity_type('object','videolist');
-
// register for embed
elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'videolist_embed_get_sections');
elgg_register_plugin_hook_handler('embed_get_items', 'videolist', 'videolist_embed_get_items');
@@ -75,7 +63,6 @@ function videolist_init() {
$actions_path = elgg_get_plugins_path() . "videolist/actions/videolist";
elgg_register_action("videolist/add", "$actions_path/add.php");
elgg_register_action("videolist/edit", "$actions_path/edit.php");
- elgg_register_action("videolist/tubesearch", "$actions_path/tubesearch.php");
elgg_register_action("videolist/delete", "$actions_path/delete.php");
}
@@ -123,9 +110,6 @@ function videolist_page_handler($page) {
set_input('guid', $page[1]);
include "$videolist_dir/edit.php";
break;
- case 'browse':
- include "$videolist_dir/browse.php";
- break;
case 'group':
include "$videolist_dir/owner.php";
break;
@@ -155,11 +139,6 @@ function videolist_owner_block_menu($hook, $type, $return, $params) {
return $return;
}
-function video_url($entity) {
- $video_id = $entity->video_id;
- return elgg_get_site_url() . "videolist/watch/" . $entity->getGUID() . "/" . $video_id;
-}
-
function videolist_url($videolist_item) {
$guid = $videolist_item->guid;
$title = elgg_get_friendly_title($videolist_item->title);
@@ -178,7 +157,7 @@ function videolist_object_notifications($event, $object_type, $object) {
if (is_callable('object_notifications')) {
if ($object instanceof ElggObject) {
- if ($object->getSubtype() == 'videolist') {
+ if ($object->getSubtype() == 'videolist_item') {
if ($flag == 0) {
$flag = 1;
object_notifications($event, $object_type, $object);
@@ -201,7 +180,7 @@ function videolist_object_notifications($event, $object_type, $object) {
function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
if (isset($params)) {
if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {
- if ($params['object']->getSubtype() == 'videolist') {
+ if ($params['object']->getSubtype() == 'videolist_item') {
return true;
}
}
@@ -239,7 +218,7 @@ function videolist_embed_get_sections($hook, $type, $value, $params) {
function videolist_embed_get_items($hook, $type, $value, $params) {
$options = array(
'owner_guid' => get_loggedin_userid(),
- 'type_subtype_pair' => array('object' => 'videolist'),
+ 'type_subtype_pair' => array('object' => 'videolist_item'),
'count' => TRUE
);
--
cgit v1.2.3
From 643951237699a76a6af0f3058c81905e38aa6194 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 20:42:29 +0100
Subject: Removed unused files.
---
actions/videolist/tubesearch.php | 316 --
models/lib/class.vimeo.php | 3583 --------------------
pages/videolist/browse.php | 49 -
views/default/forms/videolist/browsetube.php | 251 --
.../forms/videolist/labels/googlevideos.php | 27 -
views/default/forms/videolist/labels/metacafe.php | 27 -
views/default/forms/videolist/labels/vimeo.php | 27 -
views/default/forms/videolist/labels/youtube.php | 27 -
views/default/river/object/videolist/annotate.php | 11 -
views/default/river/object/videolist/create.php | 32 -
views/default/staticvideo/index.php | 53 -
views/default/videolist/group_video_header.php | 22 -
views/default/videolist/icon.php | 36 -
13 files changed, 4461 deletions(-)
delete mode 100644 actions/videolist/tubesearch.php
delete mode 100644 models/lib/class.vimeo.php
delete mode 100644 pages/videolist/browse.php
delete mode 100644 views/default/forms/videolist/browsetube.php
delete mode 100644 views/default/forms/videolist/labels/googlevideos.php
delete mode 100644 views/default/forms/videolist/labels/metacafe.php
delete mode 100644 views/default/forms/videolist/labels/vimeo.php
delete mode 100644 views/default/forms/videolist/labels/youtube.php
delete mode 100644 views/default/river/object/videolist/annotate.php
delete mode 100644 views/default/river/object/videolist/create.php
delete mode 100644 views/default/staticvideo/index.php
delete mode 100644 views/default/videolist/group_video_header.php
delete mode 100644 views/default/videolist/icon.php
diff --git a/actions/videolist/tubesearch.php b/actions/videolist/tubesearch.php
deleted file mode 100644
index 761bbb41e..000000000
--- a/actions/videolist/tubesearch.php
+++ /dev/null
@@ -1,316 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-// Get the current page's owner
-//set_page_owner($_SESSION['container_guid']);
-
-$page_ownerx = get_entity(get_input('container'));
-if(!$page_ownerx) {
- $page_ownerx = get_user_by_username(get_input('container'));
-}
-set_page_owner($page_ownerx->getGUID());
-$page_owner = page_owner_entity();
-
-if($page_owner->type == "group") {
- $container = "group:".$page_ownerx->getGUID();
-} else {
- $container = $page_ownerx->username;
-}
-
-if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
-}
-
-$queryFeed = get_input('q');
-$start_index = get_input('start_index');
-$results_perpage = 10;
-$queryCatgory = get_input('page');
-if (!isset($queryFeed) || empty($queryFeed)) {
-
-} else {
- $q = $queryFeed;
- if($queryCatgory == "youtube") {
- $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";
- $sxml = simplexml_load_file($feedURL);
-
- $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');
- $total = $counts->totalResults;
- $startOffset = $counts->startIndex;
- $endOffset = ($startOffset-1) + $counts->itemsPerPage;
-
- $body = '';
- $body .= '';
- $k = 0;$counter = 0;
- foreach ($sxml->entry as $entry) {
- $k++;
- $media = $entry->children('http://search.yahoo.com/mrss/');
- $attrs = $media->group->player->attributes();
- $watch = $attrs['url'];
- $vid_array = explode("?v=", $watch);
- if(preg_match("/&/", $vid_array[1])){
- $vid_array = explode("&", $vid_array[1]);
- $vid_array[1] = $vid_array[0];
- }
-
- $attrs = $media->group->thumbnail[0]->attributes();
- $thumbnail = $attrs['url'];
- $yt = $media->children('http://gdata.youtube.com/schemas/2007');
- $attrs = $yt->duration->attributes();
- $length = $attrs['seconds'];
- $gd = $entry->children('http://schemas.google.com/g/2005');
- if ($gd->rating) {
- $attrs = $gd->rating->attributes();
- $rating = $attrs['average'];
- } else {
- $rating = 0;
- }
- $tags = array();
- $tags[] = $media->group->keywords;
-
- $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);
- $body .= '
';
- }
- $body .= '
';
- print $body;
- } else if($queryCatgory == "metacafe") {
- $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";
-
- $sxml = new DomDocument;
- $sxml->load($feedURL);
- $total = 999;
- $startOffset = $start_index;
- $endOffset = ($startOffset-1) + $results_perpage;
-
- $body = '';
- $k = 0;
- $body .= '';
- $myitem = $sxml->getElementsByTagName('item');
- foreach($myitem as $searchNode) {
- $k++;
- $xmlTitle = $searchNode->getElementsByTagName("title");
- $valueTitle = $xmlTitle->item(0)->nodeValue;
-
- $xmlLink = $searchNode->getElementsByTagName("link");
- $valueLink = $xmlLink->item(0)->nodeValue;
-
- $xmlDesc = $searchNode->getElementsByTagName("description");
- $valueDesc = $xmlDesc->item(0)->nodeValue;
-
- $pattern = '/
]+src[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $thumbnail = $match[1];
- }
-
- $pattern = '/
]+href[\\s=\'"]';
- $pattern .= '+([^"\'>\\s]+)/is';
- if(preg_match($pattern,$valueDesc,$match)){
- $anchor_src = $match[1];
- }
-
- $encodedVideoUrlArray = explode("/watch/", $valueLink);
- $showEncodedVideo = $encodedVideoUrlArray[1];
- $metacafevideoIdArray = explode("/", $showEncodedVideo);
-
- $ot = "";
- $ct = "
";
- $string = trim($valueDesc);
- $start = intval(strpos($string, $ot) + strlen($ot));
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
-
- $body .= '';
- $body .= '
';
- $body .= '
';
- }
- $body .= ' ';
- print $body;
- } else if($queryCatgory == "vimeo") {
- require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");
- // Now lets do the search query. We will get an response object containing everything we need
- $oResponse = VimeoVideosRequest::search($queryFeed);
-
- // We want the result videos as an array of objects
- $aoVideos = $oResponse->getVideos();
-
- // Just for code completion
- $oVideo = new VimeoVideoEntity();
-
- $total = count($aoVideos);
- $startOffset = $start_index;
-
- $endOffset = ($startOffset-1) + $results_perpage;
- $body = '';
- $body .= '';
- $counter = 0;$k = 0;
- foreach($aoVideos as $oVideo) {
- $k++;
- if(($counter > $startOffset) && ($counter < $endOffset)) {
- //get all thumbnails
- $aThumbnails = array();
- foreach($oVideo->getThumbnails() as $oThumbs) {
- $aThumbnails[] = $oThumbs->getImageContent();
- }
-
- foreach($aThumbnails as $thumbnailArray){
- $thumbnail = $thumbnailArray;
- break;
- }
- //print_r($oVideo);
- $title = $oVideo->getTitle();
- $description = $oVideo->getCaption();
- $url = $oVideo->getUrl();
- $rating = $oVideo->getNumberOfLikes();
- $playedTimes = $oVideo->getNumberOfPlays();
- // Print all tags
- $aTags = array();
- foreach($oVideo->getTags() as $oTag) {
- $aTags[] = $oTag->getTag();
- }
- $play_idArray = explode("http://vimeo.com/", $url);
- $embedidArray = explode("/", $play_idArray[1]);
- $body .= '
';
- $body .= '
';
- $body .= '';
-
- $body .= '';
- $body .= " ";
- $body .= ' ';
-
- $body .= '';
- $body .= "".$title."
";
- $body .= "User Likes : ".$rating." ";
- $body .= "Played : ".$playedTimes." times ";
- $body .= "Description : ".$description." ... ";
- $body .= "Tags : ".implode(', ', $aTags)."
";
- $body .= ' ';
-
- $body .= "".elgg_echo('videolist:play:video')." ".elgg_echo('videolist:add:video')." ";
-
- $body .= ' ';
- $body .= '
';
- $body .= '
';
- }
- $counter++;
- }
- $body .= '
';
- print $body;
- }
-}
-
-exit;
diff --git a/models/lib/class.vimeo.php b/models/lib/class.vimeo.php
deleted file mode 100644
index e44837fae..000000000
--- a/models/lib/class.vimeo.php
+++ /dev/null
@@ -1,3583 +0,0 @@
-
-* @link http://code.google.com/p/php5-simplevimeo/
-*/
-
-/**
-* Enable debug to output raw request and response information
-*/
-
-define('VIMEO_DEBUG_REQUEST', true);
-define('VIMEO_DEBUG_RESPONSE', true);
-
-/**
-* Vimeo base class
-*
-* Provides vital functions to API (access, permission and object handling)
-*
-* @package SimpleVimeo
-* @subpackage Base
-*/
-
-class VimeoBase {
-
- const PROJECT_NAME = 'php5-simplevimeo';
-
- /**
- * Currently logged in user object
- * @var VimeoUserEntity
- */
- private static $oUser = false;
-
- /**
- * Currently logged in user permission
- * @var string
- */
- private static $ePermission = false;
-
- /**
- * Currently logged in user token
- * @var string
- */
- private static $sToken = false;
-
- /**
- * Vimeo Application API key
- * @var string
- */
- private static $sApiKey = '7a223534b3c1d0979a954f93cb746173 ';
-
- /**
- * Vimeo Application API secret key
- * @var string
- */
- private static $sApiSecret = 'b11e83370';
-
- const VIMEO_REST_URL = 'http://vimeo.com/api/rest/';
- const VIMEO_AUTH_URL = 'http://vimeo.com/services/auth/';
- const VIMEO_UPLOAD_URL = 'http://vimeo.com/services/upload/';
- const VIMEO_LOGIN_URL = 'http://vimeo.com/log_in';
-
- /**
- * You can choose between the following engines:
- * executeRemoteCall_FSOCK = PHP5 file_get_content and stream_contexts (bad error handling)
- * executeRemoteCall_CURL = CURL is used for file transfer (better error handling)
- */
- const REQUEST_ENGINE_CURL = 'executeRemoteCall_CURL';
- const VIDEOPOST_ENGINE_FSOCK = 'executeVideopostCall_CURL';
-
- const PERMISSION_NONE = false;
- const PERMISSION_READ = 'read';
- const PERMISSION_WRITE = 'write';
- const PERMISSION_DELETE = 'delete';
-
- const COOKIE_FILE = '/tmp/simplevimeo.cookies';
-
- const DEBUG_ENABLE = false;
- const DEBUG_LOGFILE = '/tmp/simplevimeo.debug';
-
- /**
- * Debug output function
- */
- public static function debug($sTitle, $sContent) {
- if(self::DEBUG_ENABLE) {
- $sMessage = 'DEBUG ' . date('Y-m-d H:i:s', time()) . "\n";
- $sMessage .= 'CONTENT: ' . $sContent . "\n";
- $sMesasge .= $sContent . "\n\n";
-
- $fhLog = fopen(self::DEBUG_LOGFILE, 'a+');
-
- if(!$fhLog) {
- throw new VimeoBaseException('Debug Logfile "' . self::DEBUG_LOGFILE . '" could not be found or written');
- } else {
- fputs($fhLog, $sMessage);
- fclose($fhLog);
- }
- }
- }
-
- /**
- * Update Authentication
- *
- * Initializes user and permission information if a token is present.
- * You can alter this method or skip it if you store user information
- * and permission in an external database. Then i would recommend a
- * VimeoAuthRequest::checkLoogin for confirmation.
- *
- * @access private
- * @return void
- */
- private function updateAuthentication() {
- if(self::$sToken && (!self::$ePermission || !self::$oUser)) {
- $oResponse = VimeoAuthRequest::checkToken(self::$sToken);
-
- // Parse user
- self::$oUser = $oResponse->getUser();
-
- // Parse permission
- self::$ePermission = $oResponse->getPermission();
- }
- }
-
- /**
- * Check permission
- *
- * Checks the current user permission with the given one. This will be
- * heavily used by the executeRemoteCall method to ensure the user
- * will not run into trouble.
- *
- * @access public
- * @param string Needed Permission
- * @return boolean TRUE if access can be granted, FALSE if permission denied
- */
- public function checkPermission($ePermissionNeeded) {
- // Update authentication data before permission check
- self::updateAuthentication();
-
- // Permission DELETE check
- if($ePermissionNeeded == self::PERMISSION_DELETE && self::$ePermission == self::PERMISSION_DELETE) {
- return true;
- }
-
- // Permission WRITE check
- if($ePermissionNeeded == self::PERMISSION_WRITE && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE)) {
- return true;
- }
-
- // Permission READ check
- if($ePermissionNeeded == self::PERMISSION_READ && (self::$ePermission == self::PERMISSION_DELETE || self::$ePermission == self::PERMISSION_WRITE || self::$ePermission == self::PERMISSION_READ)) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Proxy for API queries
- *
- * Will check permission for the requested API method as well as type
- * of the object result response or exception. Will call the given
- * API query handler method (default: executeRemoteCall_CURL) for
- * the raw connection stuff
- *
- * @access public
- * @param string API method name
- * @param array Additional arguments that need to be passed to the API
- * @return VimeoResponse Response object of API corresponding query (for vimeo.test.login you will get VimeoTestLoginResponse object)
- */
- public function executeRemoteCall($sMethod, $aArgs = array()) {
- // Get exception handler
- $sExceptionClass = VimeoMethod::getExceptionObjectForMethod($sMethod);
-
- // Check for errors in parameters
- $sTargetClass = VimeoMethod::getTargetObjectForMethod($sMethod);
-
- // Get the permission needed to run this method
- $ePermissionNeeded = VimeoMethod::getPermissionRequirementForMethod($sMethod);
-
- // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
- if($ePermissionNeeded != VimeoBase::PERMISSION_NONE && !self::checkPermission($ePermissionNeeded)) {
- throw new $sExceptionClass('Permission error: "' . VimeoMethod::getPermissionRequirementForMethod($sMethod) . '" needed, "' . self::$ePermission . '" given');
- }
-
- // Append method to request arguments
- $aArgs['method'] = $sMethod;
-
- // Check that the API query handler method exists and can be called
- if(!method_exists(__CLASS__, self::REQUEST_ENGINE_CURL)) {
- throw new VimeoBaseException('Internal error: Request engine handler method not found', 2);
- }
-
- // Build up the needed API arguments
-
- // Set API key
- $aArgs['api_key'] = self::$sApiKey;
-
- // Set request format
- $aArgs['format'] = 'php';
-
- // Set token
- if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
-
- // Generate signature
- $aArgs['api_sig'] = self::buildSignature($aArgs);
-
- // Do the request
- $aResponse = call_user_func(array(__CLASS__, self::REQUEST_ENGINE_CURL), $aArgs);
-
- // Debug request
- if(defined('VIMEO_DEBUG_REQUEST') && VIMEO_DEBUG_REQUEST) {
- self::debug('API request', print_r($aArgs, true));
- }
-
- // Debug response
- if(defined('VIMEO_DEBUG_RESPONSE') && VIMEO_DEBUG_RESPONSE) {
- self::debug('API response', print_r($aResponse, true));
- }
-
- // Transform the result into a result class
- $oResult = new $sTargetClass($aResponse);
-
- // Check if request was successfull
- if(!$oResult->getStatus()) {
- // If not, create an given exception class for the given method and pass through error code and message
- throw new $sExceptionClass($oResult->getError()->getMessage(), $oResult->getError()->getCode());
- }
-
- // Return the base class object instance for the corresponding API query
- return $oResult;
- }
-
- /**
- * Execute raw API query with CURL
- *
- * Implements CURL API queries in php format response
- *
- * @author Ted Roden
- * @access private
- * @param array Additional arguments for the API query
- * @return stdClass Simple PHP object enclosing the API result
- */
- private function executeRemoteCall_CURL($aArgs) {
- $ch = curl_init(self::VIMEO_REST_URL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
-
- $data = curl_exec($ch);
- if(curl_errno($ch))
- throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
- else {
- curl_close($ch);
-
- if(!$data || strlen(trim($data)) < 2) {
- throw new VimeoRequestException('API request error: No result returned.', 1);
- }
- return unserialize($data);
- }
- }
-
- /**
- * Execute raw API query with FSOCK
- *
- * Implements FSOCK API queries in php format response
- *
- * @access private
- * @param array Additional arguemnts for the API query
- * @return stdClass Simple PHP object enclosing the API result
- */
- private function executeRemoteCall_FSOCK($aArgs) {
- $sResponse = file_get_contents(self::VIMEO_REST_URL, NULL, stream_context_create(array('http' => array('method' => 'POST', 'header'=> 'Content-type: application/x-www-form-urlencoded', 'content' => http_build_query($aArgs)))));
- if(!$sResponse || strlen(trim($sResponse)) < 2) {
- throw new VimeoRequestException('API request error: No result returned.', 1);
- } else {
- return unserialize($sResponse);
- }
- }
-
- /**
- * Proxy for video uploads
- *
- * Will call the given video upload handler method (default: executeVideopostCall_FSOCK)
- * for the raw connection and send stuff
- *
- * @access public
- * @param string Local filename to be transfered
- * @param string Ticket
- * @return string VimeoVideosCheckUploadStatusResponse
- */
- public function executeVideopostCall($sFilename, $sTicket = false) {
- // Check that the upload query handler method exists and can be called
- if(!method_exists(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK)) {
- throw new VimeoUploadException('Upload error: Videopost engine handler method not found', 1);
- }
-
- // If permission requirement is not met refuse to even call the API, safes bandwith for both ends
- if(!self::checkPermission(VimeoBase::PERMISSION_WRITE)) {
- throw new VimeoUploadException('Upload error: Missing "write" permission for current user', 2);
- }
-
- // Check that the file exists
- if(!file_exists($sFilename)) {
- throw new VimeoUploadException('Upload error: Local file does not exists', 3);
- }
-
- // Check that the file is readable
- if(!is_readable($sFilename)) {
- throw new VimeoUploadException('Upload error: Local file is not readable', 4);
- }
-
- // Check that the file size is not larger then the allowed size you can upload
- $oResponse = VimeoPeopleRequest::getUploadStatus();
- if(filesize($sFilename) > $oResponse->getRemainingBytes()) {
- throw new VimeoUploadException('Upload error: Videosize exceeds remaining bytes', 5);
- }
-
- // Try to get a upload ticket
- if(!$sTicket) {
- $oResponse = VimeoVideosRequest::getUploadTicket();
- $sTicket = $oResponse->getTicket();
- }
-
- // Build up the needed API arguments
-
- // Set API key
- $aArgs['api_key'] = self::$sApiKey;
-
- // Set request format
- $aArgs['format'] = 'php';
-
- // Set token
- if(self::$sToken) $aArgs['auth_token'] = self::$sToken;
-
- // Set ticket
- $aArgs['ticket_id'] = $sTicket;
-
- // Generate signature
- $aArgs['api_sig'] = self::buildSignature($aArgs);
-
- // Set file
- $aArgs['file'] = "@$sFilename";
-
- // Do the upload
- $sResponse = call_user_func(array(__CLASS__, self::VIDEOPOST_ENGINE_FSOCK), $aArgs);
-
- // Call vimeo.videos.checkUploadStatus to prevent abandoned status
- return VimeoVideosRequest::checkUploadStatus($sTicket);
- }
-
- private function executeVideopostCall_CURL($aArgs) {
- // Disable time limit
- set_time_limit(0);
-
- $ch = curl_init(self::VIMEO_UPLOAD_URL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
-
- $data = curl_exec($ch);
- if(curl_errno($ch))
- throw new VimeoRequestException('executeRemoteCall_CURL error: ' . curl_error($ch), curl_errno($ch));
- else {
- curl_close($ch);
- return unserialize($data);
- }
- }
-
- /**
- * Build API query signature
- *
- * Composes the signature needed to verify its really us doing the query
- *
- * @author Ted Roden
- * @access private
- * @param array Additional arguments for the API query
- * @return string MD5 signature
- */
- private static function buildSignature($aArgs) {
- $s = '';
-
- // sort by name
- ksort($aArgs);
-
- foreach($aArgs as $k => $v)
- $s .= $k . $v;
-
- return(md5(self::$sApiSecret . $s));
- }
-
- /**
- * Build authentication URL
- *
- * Easy way to build a correct authentication url. You can use this
- * to link the user directly to the correct vimeo authentication page.
- *
- * @access public
- * @param string Permission level you need the user to give you (i.e. VimeoBase::PERMISSION_READ)
- * @return string URL you can use to directly link the user to the vimeo authentication page
- */
- public static function buildAuthenticationUrl($ePermission) {
-
- $aArgs = array(
- 'api_key' => self::$sApiKey,
- 'perms' => $ePermission
- );
-
- return self::VIMEO_AUTH_URL . '?api_key=' . self::$sApiKey . '&perms=' . $ePermission . '&api_sig=' . self::buildSignature($aArgs);
- }
-
- /**
- * Get current logged in user token
- *
- * @access public
- * @return string Token or FALSE if not logged in
- */
- public static function getToken() {
- return self::$sToken;
- }
-
- /**
- * Set current logged in user token
- *
- * @access public
- * @param string Authentication token
- * @return void
- */
- public static function setToken($sToken) {
- self::$sToken = $sToken;
- }
-
- /**
- * Clear current logged in user token
- *
- * Removes the current logged in user from the cache. Next API query
- * will be made as clean, not logged in, request.
- *
- * @access public
- * @return void
- */
- public static function clearToken() {
- self::$sToken = false;
- }
-
- /**
- * Execute a permit request
- *
- * ONLY USED IN SITE-MODE, see howto.autologin.php
- * Permits the current CURL cached user with your vimeo API application
- *
- * @access public
- * @param string Permission
- * @return string Vimeo Token
- */
- public function permit($ePermission) {
- // Disable time limit
- set_time_limit(0);
-
- // Construct login data
- $aArgs = array(
- 'api_key' => VimeoBase::$sApiKey,
- 'perms' => $ePermission,
- 'accept' => 'yes'
- );
- $ch = curl_init(VimeoBase::buildAuthenticationUrl($ePermission));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
- curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
-
- $sPageContent = curl_exec($ch);
- if(curl_errno($ch)) {
- throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
- return false;
- } else {
- $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
-
- }
- return $sPageContent;
- }
-
- /**
- * Ensures that the user is logged in
- *
- * ONLY USED IN SITE-MODE, see howto.autologin.php
- * Ensures the site-account is logged in
- *
- * @access public
- * @param string Username
- * @param string Password
- * @return boolean TRUE if user could be logged in, FALSE if an error occured (try manually to see error)
- */
- public function login($sUsername, $sPassword) {
- // Disable time limit
- set_time_limit(0);
-
- // Construct login data
- $aArgs = array(
- 'sign_in[email]' => $sUsername,
- 'sign_in[password]' => $sPassword,
- 'redirect' => ''
- );
-
- $ch = curl_init(VimeoBase::VIMEO_LOGIN_URL);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $aArgs);
- curl_setopt($ch, CURLOPT_USERAGENT, self::PROJECT_NAME);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
- curl_setopt($ch, CURLOPT_COOKIEFILE, VimeoBase::COOKIE_FILE);
- curl_setopt($ch, CURLOPT_COOKIEJAR, VimeoBase::COOKIE_FILE);
-
- $sPageContent = curl_exec($ch);
-
- if(curl_errno($ch)) {
- throw new VimeoRequestException('Error: Tried to login failed ' . curl_error($ch), curl_errno($ch));
- return false;
- } else {
- $sResponseUrl = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
- curl_close($ch);
- }
-
- if(stristr($sResponseUrl, 'log_in') !== false) {
- // Login failed
- return false;
- } else {
- return true;
- }
- }
-}
-
-/**
-* Vimeo base exception class
-*
-* Every exception caused by VimeoBase class will be of this type
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoBaseException extends VimeoException {}
-
-/**
-* Vimeo request exception class
-*
-* Exception thrown when requesting the API failed
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoRequestException extends VimeoException {}
-
-/**
-* Vimeo upload exception class
-*
-* Exception thrown when uploading a video failed
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoUploadException extends VimeoException {}
-
-/**
-* Vimeo API method handler class
-*
-* This class will ensure that only functions can be called if the method is implemented
-* and the permission is right (p). It also states what the source (s), result (t) and
-* exception (e) object will be.
-*
-* @package SimpleVimeo
-* @subpackage Base
-*/
-
-class VimeoMethod {
-
- private static $aMethods = array(
- // Vimeo Test methods
- 'vimeo.test.login' => array( 's' => 'VimeoTestRequest',
- 't' => 'VimeoTestLoginResponse',
- 'e' => 'VimeoTestLoginException',
- 'p' => VimeoBase::PERMISSION_READ),
-
- 'vimeo.test.echo' => array( 's' => 'VimeoTestRequest',
- 't' => 'VimeoTestEchoResponse',
- 'e' => 'VimeoTestEchoException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.test.null' => array( 's' => 'VimeoTestRequest',
- 't' => 'VimeoTestNullResponse',
- 'e' => 'VimeoTestNullException',
- 'p' => VimeoBase::PERMISSION_READ),
-
- // Vimeo Auth methods
- 'vimeo.auth.getToken' => array( 's' => 'VimeoAuthRequest',
- 't' => 'VimeoAuthGetTokenResponse',
- 'e' => 'VimeoAuthGetTokenException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.auth.getFrob' => array( 's' => 'VimeoAuthRequest',
- 't' => 'VimeoAuthGetFrobResponse',
- 'e' => 'VimeoAuthGetFrobException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.auth.checkToken' => array( 's' => 'VimeoAuthRequest',
- 't' => 'VimeoAuthCheckTokenResponse',
- 'e' => 'VimeoAuthCheckTokenException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- // Vimeo Videos methods
- 'vimeo.videos.getList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetListResponse',
- 'e' => 'VimeoVideosGetListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getUploadedList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetUploadedListResponse',
- 'e' => 'VimeoVideosGetUploadedListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getAppearsInList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetAppearsInListResponse',
- 'e' => 'VimeoVideosGetAppearsInListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getSubscriptionsList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetSubscriptionsListResponse',
- 'e' => 'VimeoVideosGetSubscriptionsListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getListByTag' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetListByTagResponse',
- 'e' => 'VimeoVideosGetListByTagException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getLikeList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetLikeListResponse',
- 'e' => 'VimeoVideosGetLikeListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getContactsList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetContactsListResponse',
- 'e' => 'VimeoVideosGetContactsListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getContactsLikeList' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetContactsLikeListResponse',
- 'e' => 'VimeoVideosGetContactsLikeListException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.search' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSearchResponse',
- 'e' => 'VimeoVideosSearchException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getInfo' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetInfoResponse',
- 'e' => 'VimeoVideosGetInfoException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.videos.getUploadTicket' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosGetUploadTicketResponse',
- 'e' => 'VimeoVideosGetUploadTicketException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.checkUploadStatus' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosCheckUploadStatusResponse',
- 'e' => 'VimeoVideosCheckUploadStatusException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.delete' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosDeleteResponse',
- 'e' => 'VimeoVideosDeleteException',
- 'p' => VimeoBase::PERMISSION_DELETE),
-
- 'vimeo.videos.setTitle' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetTitleResponse',
- 'e' => 'VimeoVideosSetTitleException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.setCaption' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetCaptionResponse',
- 'e' => 'VimeoVideosSetCaptionException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.setFavorite' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetFavoriteResponse',
- 'e' => 'VimeoVideosSetFavoriteException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.addTags' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosAddTagsResponse',
- 'e' => 'VimeoVideosAddTagsException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.removeTag' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosRemoveTagResponse',
- 'e' => 'VimeoVideosRemoveTagException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.clearTags' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosClearTagsResponse',
- 'e' => 'VimeoVideosClearTagsException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.videos.setPrivacy' => array( 's' => 'VimeoVideosRequest',
- 't' => 'VimeoVideosSetPrivacyResponse',
- 'e' => 'VimeoVideosSetPrivacyException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- // Vimeo People methods
- 'vimeo.people.findByUserName' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleFindByUsernameResponse',
- 'e' => 'VimeoPeopleFindByUsernameException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.findByEmail' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleFindByEmailResponse',
- 'e' => 'VimeoPeopleFindByEmailException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.getInfo' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleGetInfoResponse',
- 'e' => 'VimeoPeopleGetInfoException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.getPortraitUrl' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleGetPortraitUrlResponse',
- 'e' => 'VimeoPeopleGetPortraitUrlException',
- 'p' => VimeoBase::PERMISSION_NONE),
-
- 'vimeo.people.addContact' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleAddContactResponse',
- 'e' => 'VimeoPeopleAddContactException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.people.removeContact' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleRemoveContactResponse',
- 'e' => 'VimeoPeopleRemoveContactException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.people.getUploadStatus' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleGetUploadStatusResponse',
- 'e' => 'VimeoPeopleGetUploadStatusException',
- 'p' => VimeoBase::PERMISSION_READ),
-
- 'vimeo.people.addSubscription' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleAddSubscriptionResponse',
- 'e' => 'VimeoPeopleAddSubscriptionException',
- 'p' => VimeoBase::PERMISSION_WRITE),
-
- 'vimeo.people.removeSubscription' => array( 's' => 'VimeoPeopleRequest',
- 't' => 'VimeoPeopleRemoveSubscriptionResponse',
- 'e' => 'VimeoPeopleRemoveSubscriptionException',
- 'p' => VimeoBase::PERMISSION_WRITE)
- );
-
- public static function getSourceObjectForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['s'];
- }
-
- public static function getTargetObjectForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['t'];
- }
-
- public static function getExceptionObjectForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['e'];
- }
-
- public static function getPermissionRequirementForMethod($sMethod) {
- // Check if the method can be handled
- self::checkMethod($sMethod);
-
- return self::$aMethods[$sMethod]['p'];
- }
-
- public static function checkMethod($sMethod) {
- // Check if the method can be handled
- if(!isset(self::$aMethods[$sMethod])) {
- throw new VimeoMethodException('Unhandled vimeo method "' . $sMethod . '" given', 2);
- }
- }
-}
-
-/**
-* Vimeo method exception class
-*
-* Every exception caused by VimeoMethod class will be of this type
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoMethodException extends Exception {}
-
-/*
-* Abstract class constructs that the whole api stuff will be based on
-*/
-
-/**
-* Vimeo exception class
-*
-* Every exception the whole SimpleVimeo throws will be extended of this base
-* class. You can extend this one to alter all exceptions.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-* @abstract
-*/
-
-abstract class VimeoException extends Exception {}
-
-/**
-* Vimeo array of object handler class
-*
-* This class is for array of object handling. i.e.: An array of video objects.
-* It ensures that you can work with foreach and count without getting into a hassle.
-*
-* @package SimpleVimeo
-* @subpackage Base
-* @abstract
-*/
-
-abstract class VimeoObjectList implements Iterator, Countable {
- /**
- * Array for instanced objects
- * @var array
- */
- private $aInstances = array();
-
- /**
- * Integer how many results
- * @var integer
- */
- private $iCount = 0;
-
- /**
- * Class name
- * @var string
- */
- private $sClassName;
-
- private $aIDs = array();
-
- /**
- * Constructor
- *
- * @access public
- * @return void
- */
- public function __construct() {
- // Parse class name
- $this->sClassName = str_replace('List', '', get_class($this));
- }
-
- /**
- * Add object to array
- *
- * @access public
- * @param object Object to be added to array
- * @param integer Array index to be used for the given object
- * @return void
- */
- public function add($oObject, $iID = false) {
- if($iID !== false) {
- $this->aInstances[$iID] = $oObject;
- } else {
- $this->aInstances[] = $oObject;
- }
-
- $this->aIDs[] = $iID;
-
- $this->iCount++;
- }
-
- /**
- * Returns all array indexes for further parsing
- *
- * @access public
- * @return array Array with object array indexes
- */
- public function getAllUniqueIDs() {
- return $this->getIDs();
- }
-
- /**
- * @ignore
- */
- public function rewind() {
- reset($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function current() {
- return current($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function key() {
- return key($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function next() {
- return next($this->aInstances);
- }
-
- /**
- * @ignore
- */
- public function valid() {
- return $this->current() !== FALSE;
- }
-
- /**
- * @ignore
- */
- public function count() {
- return $this->iCount;
- }
-}
-
-/**
-* Vimeo request class
-*
-* Every API query collection class will be based on this.
-*
-* @package SimpleVimeo
-* @subpackage ApiRequest
-* @abstract
-*/
-
-abstract class VimeoRequest {}
-
-/**
-* Vimeo response class
-*
-* Every API response class will be based on this. It also handles
-* everytime response variables like if the query was successfull and
-* the generation time.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-* @abstract
-*/
-
-abstract class VimeoResponse {
- private $bStatus = false;
- private $fPerformance = false;
- private $iErrorCode = false;
- private $oError = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- * You dont need to pass a response if you need to give a hint your coding tool for code completion
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- if($aResponse) {
- // Parse status
- $this->setStatus($aResponse->stat);
-
- // Parse performance
- $this->fPerformance = (float) $aResponse->generated_in;
-
- // Parse error information
- if(!$this->bStatus) {
- $this->oError = new VimeoErrorEntity($aResponse->err->code, $aResponse->err->msg);
- }
- }
- }
-
- private function setStatus($sStatus) {
- if($sStatus === 'ok') {
- $this->bStatus = true;
- }
- }
-
- public function getStatus() {
- return $this->bStatus;
- }
-
- public function getPerformance() {
- return $this->fPerformance;
- }
-
- public function getError() {
- return $this->oError;
- }
-}
-
-/*
-* Entity classes for default instances of users etc. they are always the same
-* and their array of object handlers
-*/
-
-/**
-* Vimeo API error entity class
-*
-* Implements API delivered error entities into an PHP 5 object with given result parameters.
-*
-* @package SimpleVimeo
-* @subpackage Entities
-*/
-
-class VimeoErrorEntity {
- private $iErrorCode = false;
- private $sErrorMessage = false;
-
- public function __construct($iErrorCode, $sErrorMessage) {
- $this->iErrorCode = $iErrorCode;
- $this->sErrorMessage = $sErrorMessage;
- }
-
- public function getCode() {
- return $this->iErrorCode;
- }
-
- public function getMessage() {
- return $this->sErrorMessage;
- }
-}
-
-/**
-* Vimeo API user entity class
-*
-* Implements API delivered user entities into an PHP 5 object with given result parameters.
-*
-* @package SimpleVimeo
-* @subpackage Entities
-*/
-
-class VimeoUserEntity {
- private $iUserNsId = false;
- private $iUserId = false;
- private $sUsername = false;
- private $sFullname = false;
-
- // Optional information when vimeo.person.getInfo is called
- private $sLocation = false;
- private $sUrl = false;
- private $iNumberOfContacts = false;
- private $iNumberOfUploads = false;
- private $iNumberOfLikes = false;
- private $iNumberOfVideos = false;
- private $iNumberOfVideosAppearsIn = false;
- private $sProfileUrl = false;
- private $sVideosUrl = false;
-
- public function __construct($aResponseSnippet) {
- if(isset($aResponseSnippet->id)) {
- $this->iUserId = $aResponseSnippet->id;
- }
-
- if(isset($aResponseSnippet->nsid)) {
- $this->iUserNsId = $aResponseSnippet->nsid;
- }
-
- if(isset($aResponseSnippet->username)) {
- $this->sUsername = $aResponseSnippet->username;
- }
-
- if(isset($aResponseSnippet->fullname)) {
- $this->sFullname = $aResponseSnippet->fullname;
- }
-
- if(isset($aResponseSnippet->display_name)) {
- $this->sFullname = $aResponseSnippet->display_name;
- }
-
- // Optional stuff
- if(isset($aResponseSnippet->location)) {
- $this->sLocation = $aResponseSnippet->location;
- }
-
- if(isset($aResponseSnippet->url)) {
- $this->sUrl = $aResponseSnippet->url;
- }
-
- if(isset($aResponseSnippet->number_of_contacts)) {
- $this->iNumberOfContacts = $aResponseSnippet->number_of_contacts;
- }
-
- if(isset($aResponseSnippet->number_of_uploads)) {
- $this->iNumberOfUploads = $aResponseSnippet->number_of_uploads;
- }
-
- if(isset($aResponseSnippet->number_of_likes)) {
- $this->iNumberOfLikes = $aResponseSnippet->number_of_likes;
- }
-
- if(isset($aResponseSnippet->number_of_videos)) {
- $this->iNumberOfVideos = $aResponseSnippet->number_of_videos;
- }
-
- if(isset($aResponseSnippet->number_of_videos_appears_in)) {
- $this->iNumberOfVideosAppearsIn = $aResponseSnippet->number_of_videos_appears_in;
- }
-
- if(isset($aResponseSnippet->profileurl)) {
- $this->sProfileUrl = $aResponseSnippet->profileurl;
- }
-
- if(isset($aResponseSnippet->videosurl)) {
- $this->sVideosUrl = $aResponseSnippet->videosurl;
- }
- }
-
- public function getNsID() {
- return $this->iUserNsId;
- }
-
- public function getID() {
- return $this->iUserId;
- }
-
- public function getUsername() {
- return $this->sUsername;
- }
-
- public function getFullname() {
- return $this->sFullname;
- }
-
- public function getLocation() {
- return $this->sLocation;
- }
-
- public function getUrl() {
- return $this->sUrl;
- }
-
- public function getNumberOfContacts() {
- return $this->iNumberOfContacts;
- }
-
- public function getNumberOfUploads() {
- return $this->iNumberOfUploads;
- }
-
- public function getNumberOfLikes() {
- return $this->iNumberOfLikes;
- }
-
- public function getNumberOfVideos() {
- return $this->iNumberOfVideos;
- }
-
- public function getNumberOfVideosAppearsIn() {
- return $this->iNumberOfVideosAppearsIn;
- }
-
- public function getProfileUrl() {
- return $this->sProfileUrl;
- }
-
- public function getVideosUrl() {
- return $this->sVideosUrl;
- }
-}
-
-/**
-* Vimeo API video entity class
-*
-* Implements API delivered video into an PHP 5 object with given result parameters.
-*
-* @package SimpleVimeo
-* @subpackage Entities
-*/
-
-class VimeoVideoEntity {
- private $iID = false;
- private $ePrivacy = false;
- private $bIsUploading = false;
- private $bIsTranscoding = false;
- private $bIsHD = false;
-
- private $sTitle = false;
- private $sCaption = false;
- private $iUploadTime = false;
- private $iNumberOfLikes = false;
- private $iNumberOfPlays = false;
- private $iNumberOfComments = false;
-
- private $sUrl = false;
-
- private $iWidth = false;
- private $iHeight = false;
- private $oOwner = false;
-
- private $oTagList = false;
-
- private $oThumbnailList = false;
-
- public function __construct($aResponseSnippet = false) {
- if($aResponseSnippet) {
- // Set basic information
- $this->iID = $aResponseSnippet->id;
- $this->ePrivacy = $aResponseSnippet->privacy;
- $this->bIsUploading = $aResponseSnippet->is_uploading;
- $this->bIsTranscoding = $aResponseSnippet->is_transcoding;
- $this->bIsHD = $aResponseSnippet->is_hd;
-
- $this->sTitle = $aResponseSnippet->title;
- $this->sCaption = $aResponseSnippet->caption;
- $this->iUploadTime = strtotime($aResponseSnippet->upload_date);
- $this->iNumberOfLikes = (int) $aResponseSnippet->number_of_likes;
- $this->iNumberOfPlays = (int) $aResponseSnippet->number_of_plays;
- $this->iNumberOfComments = (int) $aResponseSnippet->number_of_comments;
-
- $this->sUrl = $aResponseSnippet->urls->url->_content;
-
- $this->iWidth = (int) $aResponseSnippet->width;
- $this->iHeight = (int) $aResponseSnippet->height;
-
- $this->oOwner = new VimeoUserEntity($aResponseSnippet->owner);
-
- // Parse Tags
- $this->oTagList = new VimeoTagList();
- if(isset($aResponseSnippet->tags->tag)) {
- foreach($aResponseSnippet->tags->tag as $aTagInformation) {
- $oTag = new VimeoTagEntity($aTagInformation);
- $this->oTagList->add($oTag, $oTag->getID());
- }
- }
-
- // Parse Thumbnails
- $this->oThumbnailList = new VimeoThumbnailList();
- if(isset($aResponseSnippet->thumbnails->thumbnail)) {
- foreach($aResponseSnippet->thumbnails->thumbnail as $aThumbnailInformation) {
- $oThumbnail = new VimeoThumbnailEntity($aThumbnailInformation);
- $this->oThumbnailList->add($oThumbnail, ($oThumbnail->getWidth() * $oThumbnail->getHeight()));
- }
- }
- }
- }
-
- public function getID() {
- return $this->iID;
- }
-
- public function getPrivacy() {
- return $this->ePrivacy;
- }
-
- public function isUploading() {
- return $this->bIsUploading;
- }
-
- public function isTranscoding() {
- return $this->bIsTranscoding;
- }
-
- public function isHD() {
- return $this->bIsHD;
- }
-
- public function getTitle() {
- return $this->sTitle;
- }
-
- public function getCaption() {
- return $this->sCaption;
- }
-
- public function getUploadTimestamp() {
- return $this->iUploadTime;
- }
-
- public function getNumberOfLikes() {
- return (int) $this->iNumberOfLikes;
- }
-
- public function getNumberOfPlays() {
- return (int) $this->iNumberOfPlays;
- }
-
- public function getNumberOfComments() {
- return (int) $this->iNumberOfComments;
- }
-
- public function getWidth() {
- return (int) $this->iWidth;
- }
-
- public function getHeight() {
- return (int) $this->iHeight;
- }
-
- public function getOwner() {
- return $this->oOwner;
- }
-
- public function getTags() {
- return $this->oTagList;
- }
-
- public function getUrl() {
- return $this->sUrl;
- }
-
- public function getThumbnails() {
- return $this->oThumbnailList;
- }
-}
-
-/**
-* Vimeo API video list class
-*
-* Implements API delivered video list entities into an PHP 5 array of objects.
-*
-* @package SimpleVimeo
-* @subpackage Lists
-*/
-
-class VimeoVideoList extends VimeoObjectList {}
-
-/**
-* Vimeo API tag entity class
-*
-* Implements API delivered tag entities into an PHP 5 object with given result parameters.
-*
-* @package SimpleVimeo
-* @subpackage Entities
-*/
-
-class VimeoTagEntity {
- private $iID = false;
- private $sContent = false;
-
- public function __construct($aResponseSnippet = false) {
- if($aResponseSnippet) {
- $this->iID = $aResponseSnippet->id;
- $this->sContent = $aResponseSnippet->_content;
- }
- }
-
- public function getID() {
- return $this->iID;
- }
-
- public function getTag() {
- return $this->sContent;
- }
-}
-
-/**
-* Vimeo API tag list class
-*
-* Implements API delivered tag list entities into an PHP 5 array of objects.
-*
-* @package SimpleVimeo
-* @subpackage Lists
-*/
-
-class VimeoTagList extends VimeoObjectList {}
-
-/**
-* Vimeo API thumbnail entity class
-*
-* Implements API delivered thumbnail entities into an PHP 5 object with given result parameters.
-*
-* @package SimpleVimeo
-* @subpackage Entities
-*/
-
-class VimeoThumbnailEntity {
- private $iWidth = false;
- private $iHeight = false;
- private $sContent = false;
-
- public function __construct($aResponseSnippet = false) {
- if($aResponseSnippet) {
- $this->iWidth = (int) $aResponseSnippet->width;
- $this->iHeight = (int) $aResponseSnippet->height;
- $this->sContent = $aResponseSnippet->_content;
- }
- }
-
- public function getWidth() {
- return (int) $this->iWidth;
- }
-
- public function getHeight() {
- return (int) $this->iHeight;
- }
-
- public function getImageContent() {
- return $this->sContent;
- }
-}
-
-/**
-* Vimeo API thumbnail list class
-*
-* Implements API delivered thumbnail list entities into an PHP 5 array of objects.
-*
-* @package SimpleVimeo
-* @subpackage Lists
-*/
-
-class VimeoThumbnailList extends VimeoObjectList {
- public function getByWidth($iWidth, $bAlsoLower = false) {
- /**
- * @todo
- */
- }
-
- public function getByHeight($iHeight, $bAlsoLower = false) {
- /**
- * @todo
- */
- }
-
- public function getByWidthAndHeight($iWidth, $iHeight, $bAlsoLower = false) {
- /**
- * @todo
- */
- }
-}
-
-
-/*
-* vimeo.test.* methods
-*/
-
-/**
-* Vimeo Test request handler class
-*
-* Implements all API queries in the vimeo.test.* category
-*
-* @package SimpleVimeo
-* @subpackage ApiRequest
-*/
-
-class VimeoTestRequest extends VimeoRequest {
-
- /**
- * Is the user logged in?
- *
- * @access public
- * @return VimeoTestLoginResponse
- */
-
- public function login() {
- return VimeoBase::executeRemoteCall('vimeo.test.login');
- }
-
- /**
- * This will just repeat back any parameters that you send.
- *
- * @access public
- * @param array Additional arguments that need to be passed to the API
- * @return VimeoTestEchoResponse
- */
-
- public function echoback($aArgs) {
- return VimeoBase::executeRemoteCall('vimeo.test.echo', $aArgs);
- }
-
- /**
- * This is just a simple null/ping test...
- *
- * @access public
- * @return VimeoTestNullResponse
- */
-
- public function ping() {
- return VimeoBase::executeRemoteCall('vimeo.test.null');
- }
-}
-
-/**
-* Vimeo Test Login response handler class
-*
-* Handles the API response for vimeo.test.login queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoTestLoginResponse extends VimeoResponse {}
-
-/**
-* Vimeo Test Login exception handler class
-*
-* Handles exceptions caused by API response for vimeo.test.login queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoTestLoginException extends VimeoException {}
-
-/**
-* Vimeo Test Echo response handler class
-*
-* Handles the API response for vimeo.test.echo queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoTestEchoResponse extends VimeoResponse {
- private $aArgs = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->aArgs = get_object_vars($aResponse);
-
- // Unset default response stuff
- if(isset($this->aArgs['stat'])) unset($this->aArgs['stat']);
- if(isset($this->aArgs['generated_in'])) unset($this->aArgs['generated_in']);
- }
-
- /**
- * Returns an array of variables the request bounced back
- *
- * @access public
- * @return array Echoed variables
- */
- public function getResponseArray() {
- return $this->aArgs;
- }
-}
-
-/**
-* Vimeo Test Echo exception handler class
-*
-* Handles exceptions caused by API response for vimeo.test.echo queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoTestEchoException extends VimeoException {}
-
-/**
-* Vimeo Test Null response handler class
-*
-* Handles the API response for vimeo.test.null queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoTestNullResponse extends VimeoResponse {}
-
-/**
-* Vimeo Test Null exception handler class
-*
-* Handles exceptions caused by API response for vimeo.test.null queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoTestNullException extends VimeoException {}
-
-/*
-* vimeo.auth.* methods
-*/
-
-/**
-* Vimeo Auth request handler class
-*
-* Implements all API queries in the vimeo.auth.* category
-*
-* @package SimpleVimeo
-* @subpackage ApiRequest
-*/
-
-class VimeoAuthRequest extends VimeoRequest {
-
- /**
- * Get Token
- *
- * @access public
- * @param string Frob taken from the vimeo authentication
- * @return VimeoAuthGetTokenResponse
- */
- public function getToken($sFrob) {
- $aArgs = array(
- 'frob' => $sFrob
- );
-
- return VimeoBase::executeRemoteCall('vimeo.auth.getToken', $aArgs);
- }
-
- /**
- * Check Token
- *
- * Checks the validity of the token. Returns the user associated with it.
- * Returns the same as vimeo.auth.getToken
- *
- * @access public
- * @param string Authentication token
- * @return VimeoAuthCheckTokenResponse
- */
- public function checkToken($sToken = false) {
- if(!$sToken) $sToken = VimeoBase::getToken();
-
- $aArgs = array(
- 'auth_token' => $sToken
- );
-
- return VimeoBase::executeRemoteCall('vimeo.auth.checkToken', $aArgs);
- }
-
- /**
- * Get Frob
- *
- * This is generally used by desktop applications. If the user doesn't already have
- * a token, you'll need to get the frob, send it to us at /services/auth. Then,
- * after the user, clicks continue on your app, you call vimeo.auth.getToken($frob)
- * and we give you the actual token.
- *
- * @access public
- * @return VimeoAuthGetFrobResponse
- */
- public function getFrob() {
- return VimeoBase::executeRemoteCall('vimeo.auth.getFrob');
- }
-}
-
-/**
-* Vimeo Auth GetToken response handler class
-*
-* Handles the API response for vimeo.auth.getToken queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoAuthGetTokenResponse extends VimeoResponse {
-
- private $sToken = false;
- private $ePermission = false;
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- $this->sToken = $aResponse->auth->token;
- $this->ePermission = $aResponse->auth->perms;
-
- $this->oUser = new VimeoUserEntity($aResponse->auth->user);
- }
-
- /**
- * Get token value
- *
- * @access public
- * @return token
- */
- public function getToken() {
- return $this->sToken;
- }
-
- /**
- * Get permission value
- *
- * @access public
- * @return permission
- */
-
- public function getPermission() {
- return $this->ePermission;
- }
-
- /**
- * Get user information object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
-}
-
-/**
-* Vimeo Auth GetToken exception handler class
-*
-* Handles exceptions caused by API response for vimeo.auth.getToken queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoAuthGetTokenException extends Exception {}
-
-/**
-* Vimeo Auth CheckToken response handler class
-*
-* Handles the API response for vimeo.auth.checkToken queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoAuthCheckTokenResponse extends VimeoAuthGetTokenResponse {}
-
-/**
-* Vimeo Auth CheckToken exception handler class
-*
-* Handles exceptions caused by API response for vimeo.auth.checkToken queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoAuthCheckTokenException extends VimeoAuthGetTokenException {}
-
-/**
-* Vimeo Auth GetFrob response handler class
-*
-* Handles the API response for vimeo.auth.getFrob queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoAuthGetFrobResponse extends VimeoResponse {
- private $sFrob = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- $this->sFrob = $aResponse->frob;
- }
-
- /**
- * Get Frob value
- *
- * @access public
- * @return frob
- */
- public function getFrob() {
- return $this->sFrob;
- }
-}
-
-/**
-* Vimeo Auth GetFrob exception handler class
-*
-* Handles exceptions caused by API response for vimeo.auth.getFrob queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoAuthGetFrobException extends VimeoException {}
-
-/**
-* vimeo.videos.* methods
-*/
-
-/**
-* Vimeo Videos request handler class
-*
-* Implements all API queries in the vimeo.videos.* category
-*
-* @package SimpleVimeo
-* @subpackage ApiRequest
-*/
-
-class VimeoVideosRequest extends VimeoRequest {
-
- const PRIVACY_ANYBODY = 'anybody';
- const PRIVACY_CONTACTS = 'contacts';
- const PRIVACY_NOBODY = 'nobody';
- const PRIVACY_USERS = 'users';
-
- /**
- * Search videos!
- *
- * If the calling user is logged in, this will return information that calling user
- * has access to (including private videos). If the calling user is not authenticated,
- * this will only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param string Search query
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param boolean If TRUE, we'll only search the users contacts. If this is set, you must specifiy a User ID. Otherwise it will be ignored without error.
- * @param integer ow many results per page?
- * @return VimeoVideosSearchResponse
- */
- public function search($sQuery, $iUserID = false, $bContactsOnly = false, $iItemsPerPage = false) {
-
- // Pass query (required)
- $aArgs = array(
- 'query' => $sQuery
- );
-
- // Pass user
- if($iUserID) {
- $aArgs['user_id'] = $iUserID;
- }
-
- // Pass contacts
- if($bContactsOnly) {
- $aArgs['contacts_only'] = $bContactsOnly;
- }
-
- // Pass items
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.search', $aArgs);
- }
-
- /**
- * This gets a list of videos for the specified user.
- *
- * This is the functionality of "My Videos" or "Ted's Videos." At the moment, this is the same list
- * as vimeo.videos.getAppearsInList. If you need uploaded or appears in, those are available too.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetListResponse
- */
- public function getList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getList', $aArgs);
- }
-
- /**
- * This gets a list of videos uploaded by the specified user.
- *
- * If the calling user is logged in, this will return information that calling user has access to
- * (including private videos). If the calling user is not authenticated, this will only return
- * public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetUploadedListResponse
- */
- public function getUploadedList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getUploadedList', $aArgs);
- }
-
- /**
- * This gets a list of videos that the specified user appears in.
- *
- * If the calling user is logged in, this will return information that calling user has access
- * to (including private videos). If the calling user is not authenticated, this will only return
- * public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetAppearsInListResponse
- */
- public function getAppearsInList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getAppearsInList', $aArgs);
- }
-
- /**
- * This gets a list of subscribed videos for a particular user.
- *
- * If the calling user is logged in, this will return information that calling user
- * has access to (including private videos). If the calling user is not authenticated,
- * this will only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetSubscriptionsListResponse
- */
- public function getSubscriptionsList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getSubscriptionsList', $aArgs);
- }
-
- /**
- * This gets a list of videos by tag
- *
- * If you specify a user_id, we'll only get video uploaded by that user with the specified tag.
- * If the calling user is logged in, this will return information that calling user has access
- * to (including private videos). If the calling user is not authenticated, this will only
- * return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param string A single tag: "cat" "new york" "cheese"
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetListByTagResponse
- */
- public function getListByTag($sTag, $iUserID = false, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'tag' => $sTag
- );
-
- if($iUserID) {
- $aArgs['user_id'] = $iUserID;
- }
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getListByTag', $aArgs);
- }
-
- /**
- * Get a list of videos that the specified user likes.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetLikeListResponse
- */
- public function getLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getLikeList', $aArgs);
- }
-
- /**
- * Get a list of videos made by the contacts of a specific user.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetContactsListResponse
- */
- public function getContactsList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getContactsList', $aArgs);
- }
-
- /**
- * Get a list of videos that the specified users contacts like.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer User ID, this can be the ID number (151542) or the username (ted)
- * @param integer Which page to show.
- * @param integer How many results per page?
- * @return VimeoVideosGetContactsLikeListResponse
- */
- public function getContactsLikeList($iUserID, $iPage = false, $iItemsPerPage = false) {
- // Extend query
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- if($iPage) {
- $aArgs['page'] = $iPage;
- }
-
- if($iItemsPerPage) {
- $aArgs['per_page'] = $iItemsPerPage;
- }
-
- // Please deliver full response so we can handle videos with unified classes
- $aArgs['fullResponse'] = 1;
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getContactsLikeList', $aArgs);
- }
-
- /**
- * Get all kinds of information about a photo.
- *
- * If the calling user is logged in, this will return information that calling user has
- * access to (including private videos). If the calling user is not authenticated, this will
- * only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer Video ID
- * @return VimeoVideosGetInfoResponse
- */
- public function getInfo($iVideoID) {
- // Extend query
- $aArgs = array(
- 'video_id' => $iVideoID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.getInfo', $aArgs);
- }
-
- /**
- * Generate a new upload Ticket.
- *
- * You'll need to pass this to the uploader. It's only good for one upload, only good for one user.
- *
- * @access public
- * @return VimeoVideosGetUploadTicketResponse
- */
- public function getUploadTicket() {
- return VimeoBase::executeRemoteCall('vimeo.videos.getUploadTicket');
- }
-
- /**
- * Check the status of an upload started via the API
- *
- * This is how you get the video_id of a clip uploaded from the API
- * If you never call this to check in, we assume it was abandoned and don't process it
- *
- * @access public
- * @param string The ticket number of the upload
- * @return VimeoVideosCheckUploadStatusResponse
- */
- public function checkUploadStatus($sTicket) {
- $aArgs = array(
- 'ticket_id' => $sTicket
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.checkUploadStatus', $aArgs);
- }
-
- /**
- * Simple video upload
- *
- * @access public
- * @param string Absolute path to file
- * @param string Existing ticket or false to generate a new one
- * @return VimeoVideosCheckUploadStatusResponse
- */
- public function doUpload($sFilename, $sTicket = false) {
- return VimeoBase::executeVideopostCall($sFilename, $sTicket);
- }
-
- /**
- * Delete a video
- *
- * The authenticated user must own the video and have granted delete permission
- *
- * @access public
- * @param integer Video ID
- * @return VimeoVideosDeleteResponse
- */
- public function delete($iVideoID) {
- $aArgs = array(
- 'video_id' => $iVideoID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.delete', $aArgs);
- }
-
- /**
- * Set the title of a video (overwrites previous title)
- *
- * @access public
- * @param integer Video ID
- * @param string Title
- * @return VimeoVideosSetTitleResponse
- */
- public function setTitle($iVideoID, $sVideoTitle) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'title' => $sVideoTitle
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setTitle', $aArgs);
- }
-
- /**
- * Set a new caption for a video (overwrites previous caption)
- *
- * @access public
- * @param integer Video ID
- * @param string Caption
- * @return VimeoVideosSetCaptionResponse
- */
- public function setCaption($iVideoID, $sVideoCaption) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'caption' => $sVideoCaption
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setCaption', $aArgs);
- }
-
- /**
- * Set a video as a favorite.
- *
- * @access public
- * @param integer Video ID
- * @param boolean TRUE to favorite, FALSE to return to normal
- * @return VimeoVideosSetFavoriteResponse
- */
- public function setFavorite($iVideoID, $bFavorite = true) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'favorite' => (int) $bFavorite
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setFavorite', $aArgs);
- }
-
- /**
- * Add specified tags to the video, this does not replace any tags.
- *
- * Tags should be comma separated lists.
- *
- * If the calling user is logged in, this will return information that calling
- * user has access to (including private videos). If the calling user is not authenticated,
- * this will only return public information, or a permission denied error if none is available.
- *
- * @access public
- * @param integer Video ID
- * @param mixed Array with tags or Comma separated list of tags ("lions, tigers, bears")
- * @return VimeoVideosAddTagsResponse
- */
- public function addTags($iVideoID, $mTags) {
- // Catch array of tags
- if(is_array($mTags)) {
- $mTags = implode(',', $mTags);
- }
-
- // Prepare arguments
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'tags' => $mTags
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.addTags', $aArgs);
- }
-
- /**
- * Remove specified tag from the video.
- *
- * @access public
- * @param integer Video ID
- * @param integer Tag ID, this should be a tag id returned by vimeo.videos.getInfo
- * @return VimeoVideosRemoveTagResponse
- */
- public function removeTag($iVideoID, $iTagID) {
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'tag_id' => $iTagID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.removeTag', $aArgs);
- }
-
- /**
- * Remove ALL of the tags from the video
- *
- * @access public
- * @param integer Video ID
- * @return VimeoVideosClearTags
- */
- public function clearTags($iVideoID) {
- $aArgs = array(
- 'video_id' => $iVideoID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.clearTags', $aArgs);
- }
-
- /**
- * Set the privacy of the video
- *
- * @access public
- * @param integer Video ID
- * @param integer Privacy enum see VimeoVideosRequest::PRIVACY_*
- * @param mixed Array or comma separated list of users who can view the video. PRIVACY_USERS must be set.
- */
- public function setPrivacy($iVideoID, $ePrivacy, $mUsers = array()) {
- // Catch array of users
- if(is_array($mUsers)) {
- $mUsers = implode(', ', $mUsers);
- }
-
- $aArgs = array(
- 'video_id' => $iVideoID,
- 'privacy' => $ePrivacy,
- 'users' => $mUsers
- );
-
- return VimeoBase::executeRemoteCall('vimeo.videos.setPrivacy', $aArgs);
- }
-}
-
-/**
-* Vimeo Videos Search response handler class
-*
-* Handles the API response for vimeo.videos.search queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosSearchResponse extends VimeoResponse {
- private $iPage = false;
- private $iItemsPerPage = false;
- private $iOnThisPage = false;
-
- private $aoVideos = array();
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- // Parse information
- if($aResponse && isset($aResponse->videos) && $this->getStatus()) {
- // Create an video list instance
- $this->aoVideos = new VimeoVideoList();
-
- // Page information
- $this->iPage = $aResponse->videos->page;
- $this->iItemsPerPage = $aResponse->videos->perpage;
- $this->iOnThisPage = $aResponse->videos->on_this_page;
-
- // Parse videos
- if(isset($aResponse->videos->video)) {
- // We should check if the subelement is an object (single hit) or an result array (multiple hits)
- if(is_array($aResponse->videos->video)) {
- // We got a couple of results
- $aParseableData = $aResponse->videos->video;
- } else {
- // We only got one result
- $aParseableData = array(
- 0 => $aResponse->videos->video
- );
- }
-
- // Parse the results
- foreach($aParseableData as $aVideoInformation) {
- $oVideo = new VimeoVideoEntity($aVideoInformation);
-
- $this->aoVideos->add($oVideo, $oVideo->getID());
- }
- }
- }
- }
-
- /**
- * Current page
- *
- * @access public
- * @return integer Page number
- */
- public function getPage() {
- return $this->iPage;
- }
-
- /**
- * Items per page
- *
- * @access public
- * @return integer Items per page
- */
-
- public function getItemsPerPage() {
- return $this->iItemsPerPage;
- }
-
- /**
- * Items on the current page
- *
- * @access public
- * @return integer Items on the current page
- */
-
- public function getOnThisPage() {
- return $this->iOnThisPage;
- }
-
- /**
- * Get array of video objects
- *
- * @access public
- * @return array Video objects
- */
-
- public function getVideos() {
- return $this->aoVideos;
- }
-}
-
-/**
-* Vimeo Videos Search exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.search queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosSearchException extends VimeoException {}
-
-/**
-* Vimeo Videos GetList response handler class
-*
-* Handles the API response for vimeo.videos.getList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos Search exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.search queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetListException extends VimeoException {}
-
-/**
-* Vimeo Videos GetUploadedList response handler class
-*
-* Handles the API response for vimeo.videos.getUploadedList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetUploadedListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos GetUploadedList exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getUploadedList queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetUploadedListException extends VimeoException {}
-
-/**
-* Vimeo Videos GetAppearsInList response handler class
-*
-* Handles the API response for vimeo.videos.getAppearsInList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetAppearsInListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos GetAppearsInList exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getAppearsInList queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetAppearsInListException extends VimeoException {}
-
-/**
-* Vimeo Videos GetSubscriptionsList response handler class
-*
-* Handles the API response for vimeo.videos.getSubscriptionsList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetSubscriptionsListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos GetSubscriptionsList exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getSubscriptionsList queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetSubscriptionsListException extends VimeoException {}
-
-/**
-* Vimeo Videos GetListByTag response handler class
-*
-* Handles the API response for vimeo.videos.getListByTag queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetListByTagResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos GetListByTag exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getListByTag queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetListByTagException extends VimeoException {}
-
-/**
-* Vimeo Videos GetLikeList response handler class
-*
-* Handles the API response for vimeo.videos.getLikeList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetLikeListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos GetLikeList exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getLikeList queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetLikeListException extends VimeoException {}
-
-/**
-* Vimeo Videos GetContactsList response handler class
-*
-* Handles the API response for vimeo.videos.getContactsList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetContactsListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos GetContactsList exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getContactsList queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetContactsListException extends VimeoException {}
-
-/**
-* Vimeo Videos getContactsLikeList response handler class
-*
-* Handles the API response for vimeo.videos.getContactsLikeList queries.
-* Currently the response is exact the same as vimeo.videos.search
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosgetContactsLikeListResponse extends VimeoVideosSearchResponse {}
-
-/**
-* Vimeo Videos getContactsLikeList exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getContactsLikeList queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetContactsLikeListException extends VimeoException {}
-
-/**
-* Vimeo Videos GetInfo response handler class
-*
-* Handles the API response for vimeo.videos.getInfo queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetInfoResponse extends VimeoResponse {
- private $oVideo = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse) {
- parent::__construct($aResponse);
-
- $this->oVideo = new VimeoVideoEntity($aResponse->video);
- }
-
- /**
- * Get video information as object
- *
- * @access public
- * @return VimeoVideoEntity
- */
- public function getVideo() {
- return $this->oVideo;
- }
-}
-
-/**
-* Vimeo Videos GetInfo exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getInfo queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetInfoException extends VimeoException {}
-
-/**
-* Vimeo Videos getUploadTicket response handler class
-*
-* Handles the API response for vimeo.videos.getUploadTicket queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosGetUploadTicketResponse extends VimeoResponse {
- private $sTicket = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->sTicket = $aResponse->ticket->id;
- }
-
- /**
- * Get generated upload ticket
- *
- * @access public
- * @return string The ticket number of the upload
- */
- public function getTicket() {
- return $this->sTicket;
- }
-}
-
-/**
-* Vimeo Videos getUploadTicket exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.getUploadTicket queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosGetUploadTicketException extends VimeoException {}
-
-/**
-* Vimeo Videos checkUploadStatus response handler class
-*
-* Handles the API response for vimeo.videos.checkUploadStatus queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosCheckUploadStatusResponse extends VimeoResponse {
- private $sTicket = false;
- private $iVideoID = false;
- private $bIsUploading = false;
- private $bIsTranscoding = false;
- private $iTranscodingProgress = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->sTicket = $aResponse->ticket->id;
- $this->iVideoID = $aResponse->ticket->video_id;
- $this->bIsUploading = (bool) $aResponse->ticket->is_uploading;
- $this->bIsTranscoding = (bool) $aResponse->ticket->is_transcoding;
- $this->iTranscodingProgress = $aResponse->ticket->transcoding_progress;
- }
-
- /**
- * Get Ticket
- *
- * @access public
- * @return string Ticket
- */
- public function getTicket() {
- return $this->sTicket;
- }
-
- /**
- * Get Video ID
- *
- * @access public
- * @return integer Video ID
- */
- public function getVideoID() {
- return $this->iVideoID;
- }
-
- /**
- * Is the video uploading?
- *
- * @access public
- * @return boolean TRUE if uploading, FALSE if not
- */
- public function isUploading() {
- return $this->bIsUploading;
- }
-
- /**
- * Is the video transcoding?
- *
- * Also check getTranscodingProgress() for percentage in transcoding
- *
- * @access public
- * @return boolean TRUE if uploading, FALSE if not
- */
- public function isTranscoding() {
- return $this->bIsTranscoding;
- }
-
- /**
- * Get the transcoding progress
- *
- * Should only be called if isTranscoding() returns true
- *
- * @access public
- * @return integer Percentage
- */
- public function getTranscodingProgress() {
- return $this->iTranscodingProgress;
- }
-}
-
-/**
-* Vimeo Videos checkUploadStatus exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.checkUploadStatus queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosCheckUploadStatusException extends VimeoException {}
-
-/**
-* Vimeo Videos delete response handler class
-*
-* Handles the API response for vimeo.videos.delete queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosDeleteResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos delete exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.delete queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosDeleteException extends VimeoException {}
-
-/**
-* Vimeo Videos setTitle response handler class
-*
-* Handles the API response for vimeo.videos.setTitle queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosSetTitleResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos setTitle exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.setTitle queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosSetTitleException extends VimeoException {}
-
-/**
-* Vimeo Videos setCaption response handler class
-*
-* Handles the API response for vimeo.videos.setCaption queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosSetCaptionResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos setCaption exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.setCaption queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosSetCaptionException extends VimeoException {}
-
-/**
-* Vimeo Videos setFavorite response handler class
-*
-* Handles the API response for vimeo.videos.setFavorite queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosSetFavoriteResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos setFavorite exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.setFavorite queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosSetFavoriteException extends VimeoException {}
-
-/**
-* Vimeo Videos addTags response handler class
-*
-* Handles the API response for vimeo.videos.addTags queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosAddTagsResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos addTags exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.addTags queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosAddTagsException extends VimeoException {}
-
-/**
-* Vimeo Videos removeTag response handler class
-*
-* Handles the API response for vimeo.videos.removeTag queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosRemoveTagResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos removeTag exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.removeTag queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosRemoveTagException extends VimeoException {}
-
-/**
-* Vimeo Videos clearTags response handler class
-*
-* Handles the API response for vimeo.videos.clearTags queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosClearTagsResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos clearTags exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.clearTags queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosClearTagsException extends VimeoException {}
-
-/**
-* Vimeo Videos setPrivacy response handler class
-*
-* Handles the API response for vimeo.videos.setPrivacy queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoVideosSetPrivacyResponse extends VimeoResponse {}
-
-/**
-* Vimeo Videos setPrivacy exception handler class
-*
-* Handles exceptions caused by API response for vimeo.videos.setPrivacy queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoVideosSetPrivacyException extends VimeoException {}
-
-/**
-* vimeo.people.* methods
-*/
-
-/**
-* Vimeo People request handler class
-*
-* Implements all API queries in the vimeo.people.* category
-*
-* @package SimpleVimeo
-* @subpackage ApiRequest
-*/
-
-class VimeoPeopleRequest extends VimeoRequest {
- const TYPE_LIKES = 'likes';
- const TYPE_APPEARS = 'appears';
- const TYPE_BOTH = 'likes,appears';
-
- /**
- * Get a user id and full/display name with a username.
- *
- * You shouldn't need this to get the User ID, we allow you to use the
- * username instead of User ID everywhere, it's much nicer that way.
- *
- * @access public
- * @param string The username to lookup
- * @return VimeoPeopleFindByUsernameResponse
- */
- public function findByUsername($sUsername) {
- $aArgs = array(
- 'username' => $sUsername
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.findByUserName', $aArgs);
- }
-
- /**
- * Get tons of info about a user.
- *
- * @access public
- * @param integer The id of the user we want.
- * @return VimeoPeopleGetInfoResponse
- */
- public function getInfo($iUserID) {
- $aArgs = array(
- 'user_id' => $iUserID
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.getInfo', $aArgs);
- }
-
- /**
- * Get a user id and full/display name via an Email Address.
- *
- * You shouldn't need to use this to get the User ID, we allow you
- * to use the username instead of User ID everywhere, it's much nicer that way.
- *
- * @access public
- * @param string Email
- * @return VimeoPeopleFindByEmailResponse
- */
- public function findByEmail($sEmail) {
- $aArgs = array(
- 'find_email' => $sEmail
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.findByEmail', $aArgs);
- }
-
- /**
- * Get a portrait URL for a given user/size
- *
- * Portraits are square, so you only need to pass one size parameter.
- * Possible sizes are 20, 24, 28, 30, 40, 50, 60, 75, 100, 140, 278 and 300
- *
- * @access public
- * @param string The username to lookup
- * @param integer The size of the portrait you you want. (defaults to 75)
- * @return VimeoPeopleGetPortraitUrlResponse
- *
- * @todo Check functionality. Did not work, god knows why
- */
- public function getPortraitUrl($sUser, $iSize = false) {
- $aArgs = array(
- 'user' => $sUser
- );
-
- if($iSize) {
- $aArgs['size'] = $iSize;
- }
-
- return VimeoBase::executeRemoteCall('vimeo.people.getPortraitUrl', $aArgs);
- }
-
- /**
- * Add a user as a contact for the authenticated user.
- *
- * If Jim is authenticated, and the $user is sally. Sally will be Jim's contact.
- * It won't work the other way around. Depending on Sally's settings, this may
- * send her an email notifying her that Jim Added her as a contact.
- *
- * @access public
- * @param string The user to add. User ID, this can be the ID number (151542) or the username (ted)
- * @return VimeoPeopleAddContactResponse
- */
- public function addContact($sUser) {
- $aArgs = array(
- 'user' => $sUser
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.addContact', $aArgs);
- }
-
- /**
- * Remove a user as a contact for the authenticated user.
- *
- * @access public
- * @param string The user to remove. User ID, this can be the ID number (151542) or the username (ted)
- * @return VimeoPeopleRemoveContactResponse
- */
- public function removeContact($sUser) {
- $aArgs = array(
- 'user' => $sUser
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.removeContact', $aArgs);
- }
-
- /**
- * This tells you how much space the user has remaining for uploads.
- *
- * We provide info in bytes and kilobytes. It probably makes sense for you to use kilobytes.
- *
- * @access public
- * @return VimeoPeopleGetUploadStatusResponse
- */
- public function getUploadStatus() {
- return VimeoBase::executeRemoteCall('vimeo.people.getUploadStatus');
- }
-
- /**
- * Subscribe to a user's videos.
- *
- * Just like on the site, you can subscribe to videos a user "appears" in or "likes." Or both!
- * This will not remove any subscriptions. So if the user is subscribed to a user for both "likes"
- * and "appears," this will not change anything if you only specify one of them. If you want to
- * remove one, you must call vimeo.people.removeSubscription().
- *
- * @access public
- * @param string User ID, this can be the ID number (151542) or the username (ted)
- * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
- * @return VimeoPeopleAddSubscriptionResponse
- */
- public function addSubscription($sUser, $eType = self::TYPE_BOTH) {
- $aArgs = array(
- 'user' => $sUser,
- 'type' => $eType
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.addSubscription', $aArgs);
- }
-
- /**
- * Unsubscribe to a user's videos.
- *
- * @access public
- * @param string User ID, this can be the ID number (151542) or the username (ted)
- * @param string with self::TYPE_LIKES or self::TYPE_APPEARS or self::TYPE_BOTH
- * @return VimeoPeopleRemoveSubscriptionResponse
- */
- public function removeSubscription($sUser, $eType = self::TYPE_BOTH) {
- $aArgs = array(
- 'user' => $sUser,
- 'type' => $eType
- );
-
- return VimeoBase::executeRemoteCall('vimeo.people.removeSubscription', $aArgs);
- }
-}
-
-/**
-* Vimeo People FindByUserName response handler class
-*
-* Handles the API response for vimeo.people.findByUserName queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleFindByUserNameResponse extends VimeoResponse {
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->oUser = new VimeoUserEntity($aResponse->user);
- }
-
- /**
- * Get user entity object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
-}
-
-/**
-* Vimeo People FindByUserName exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.findByUserName queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleFindByUserNameException extends VimeoException {}
-
-/**
-* Vimeo People FindByEmail response handler class
-*
-* Handles the API response for vimeo.people.findByEmail queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleFindByEmailResponse extends VimeoResponse {
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->oUser = new VimeoUserEntity($aResponse->user);
- }
-
- /**
- * Get user entity object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
-}
-
-/**
-* Vimeo People FindByEmail exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.findByEmail queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleFindByEmailException extends VimeoException {}
-
-/**
-* Vimeo People GetInfo response handler class
-*
-* Handles the API response for vimeo.people.getInfo queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleGetInfoResponse extends VimeoResponse {
- private $oUser = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->oUser = new VimeoUserEntity($aResponse->person);
- }
-
- /**
- * Get user entity object
- *
- * @access public
- * @return VimeoUserEntity
- */
- public function getUser() {
- return $this->oUser;
- }
-}
-
-/**
-* Vimeo People GetInfo exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.getInfo queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleGetInfoException extends VimeoException {}
-
-/**
-* Vimeo People getPortraitUrl response handler class
-*
-* Handles the API response for vimeo.people.getPortraitUrl queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleGetPortraitUrlResponse extends VimeoResponse {}
-
-/**
-* Vimeo People getPortraitUrl exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.getPortraitUrl queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleGetPortraitUrlException extends VimeoException {}
-
-/**
-* Vimeo People addContact response handler class
-*
-* Handles the API response for vimeo.people.addContact queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleAddContactResponse extends VimeoResponse {}
-
-/**
-* Vimeo People addContact exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.addContact queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleAddContactException extends VimeoException {}
-
-/**
-* Vimeo People removeContact response handler class
-*
-* Handles the API response for vimeo.people.removeContact queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleRemoveContactResponse extends VimeoResponse {}
-
-/**
-* Vimeo People removeContact exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.removeContact queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleRemoveContactException extends VimeoException {}
-
-/**
-* Vimeo People getUploadStatus response handler class
-*
-* Handles the API response for vimeo.people.getUploadStatus queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleGetUploadStatusResponse extends VimeoResponse {
- private $iMaxBytes = false;
- private $iMaxKBytes = false;
-
- private $iUsedBytes = false;
- private $iUsedKBytes = false;
-
- private $iRemainingBytes = false;
- private $iRemainingKBytes = false;
-
- /**
- * Constructor
- *
- * Parses the API response
- *
- * @access public
- * @param stdClass API response
- * @return void
- */
- public function __construct($aResponse = false) {
- parent::__construct($aResponse);
-
- $this->iMaxBytes = $aResponse->user->bandwidth->maxbytes;
- $this->iMaxKBytes = $aResponse->user->bandwidth->maxkb;
-
- $this->iUsedBytes = $aResponse->user->bandwidth->usedbytes;
- $this->iUsedKBytes = $aResponse->user->bandwidth->usedkb;
-
- $this->iRemainingBytes = $aResponse->user->bandwidth->remainingbytes;
- $this->iRemainingKBytes = $aResponse->user->bandwidth->remainingkb;
- }
-
- /**
- * Get maximum upload for this week in BYTES
- *
- * @access public
- * @return integer Maximum bytes this week
- */
- public function getMaxBytes() {
- return $this->iMaxBytes;
- }
-
- /**
- * Get maximum upload for this week in KILOBYTES
- *
- * @access public
- * @return integer Maximum kbytes this week
- */
- public function getMaxKiloBytes() {
- return $this->iMaxKBytes;
- }
-
- /**
- * Get used upload for this week in BYTES
- *
- * @access public
- * @return integer Used bytes this week
- */
- public function getUsedBytes() {
- return $this->iUsedBytes;
- }
-
- /**
- * Get used upload for this week in KILOBYTES
- *
- * @access public
- * @return integer Used kbytes this week
- */
- public function getUsedKiloBytes() {
- return $this->iUsedKBytes;
- }
-
- /**
- * Get remaining upload for this week in BYTES
- *
- * @access public
- * @return integer Remaining bytes this week
- */
- public function getRemainingBytes() {
- return $this->iRemainingBytes;
- }
-
- /**
- * Get remaining upload for this week in KILOBYTES
- *
- * @access public
- * @return integer Remaining kbytes this week
- */
- public function getRemainingKiloBytes() {
- return $this->iRemainingKBytes;
- }
-}
-
-/**
-* Vimeo People getUploadStatus exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.getUploadStatus queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleGetUploadStatusException extends VimeoException {}
-
-/**
-* Vimeo People addSubscription response handler class
-*
-* Handles the API response for vimeo.people.addSubscription queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleAddSubscriptionResponse extends VimeoResponse {}
-
-/**
-* Vimeo People addSubscription exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.addSubscription queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleAddSubscriptionException extends VimeoException {}
-
-/**
-* Vimeo People removeSubscription response handler class
-*
-* Handles the API response for vimeo.people.removeSubscription queries.
-*
-* @package SimpleVimeo
-* @subpackage ApiResponse
-*/
-
-class VimeoPeopleRemoveSubscriptionResponse extends VimeoResponse {}
-
-/**
-* Vimeo People removeSubscription exception handler class
-*
-* Handles exceptions caused by API response for vimeo.people.removeSubscription queries.
-*
-* @package SimpleVimeo
-* @subpackage Exceptions
-*/
-
-class VimeoPeopleRemoveSubscriptionException extends VimeoException {}
-
-?>
diff --git a/pages/videolist/browse.php b/pages/videolist/browse.php
deleted file mode 100644
index 2392ef19a..000000000
--- a/pages/videolist/browse.php
+++ /dev/null
@@ -1,49 +0,0 @@
-
-* @copyright Prateek Choudhary
-*/
-
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-//get videolist GUID
-$container_guid = get_input('container');
-$parent_container = "";
-if(isset($container_guid) && !empty($container_guid)) {
- $container_guid = explode(":", $container_guid);
-
- if ($container_guid[0] == "group") {
- $container = get_entity($container_guid[1]);
- set_page_owner($container->getGUID());
- $page_owner = page_owner_entity();
- set_context("groupsvideos");
- } else {
- $page_owner = page_owner_entity();
- if ($page_owner === false || is_null($page_owner)) {
- $page_owner = $_SESSION['user'];
- set_page_owner($_SESSION['guid']);
- }
- }
-}
-
-elgg_push_breadcrumb(elgg_echo('videolist:find'), elgg_get_site_url()."videolist/all/");
-elgg_push_breadcrumb(elgg_echo("videolist:browsemenu"));
-
-$title = elgg_echo("videolist:browsemenu");
-
-$area1 = elgg_view('navigation/breadcrumbs');
-$area1 .= elgg_view_title($title);
-$area2 .= elgg_view("forms/browsetube");
-
-// get the latest comments on all videos
-$comments = get_annotations(0, "object", "videolist", "generic_comment", "", 0, 4, 0, "desc");
-$area3 = elgg_view('annotation/latest_comments', array('comments' => $comments));
-
-$body = elgg_view_layout('one_column_with_sidebar', $area1.$area2, $area3);
-
-page_draw($title, $body);
diff --git a/views/default/forms/videolist/browsetube.php b/views/default/forms/videolist/browsetube.php
deleted file mode 100644
index bbe2b8935..000000000
--- a/views/default/forms/videolist/browsetube.php
+++ /dev/null
@@ -1,251 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$getcontainer_guid = get_input("container");
-$container_guid = explode(":", $getcontainer_guid);
-if($container_guid[0] == "group"){
- $container = $container_guid[1];
-} else{
- $container = $getcontainer_guid;
-}
-$error = array(
- 'no-search' => 1
- );
-$error_msg = array(
- 'no-search' => "Please enter a valid search term"
- );
-$browseCat = get_input('q');
-if(empty($browseCat) || !isset($browseCat)) {
- $browseCat = "youtube";
-}
-
-$confirm_action = get_input('video_action');
-
-if(isset($confirm_action) && ($confirm_action == 'search_video')) {
- if(isset($title_search) && ($title_search != '')) {
- $error['no-search'] = 0;
- } else {
- $error['no-search'] = 1;
- }
-}
-
-//Load youtube menu
-$body .= "";
-$body .= "
";
-$body .= "";
-$body .= "YouTube ";
-$body .= " ";
-$body .= "";
-$body .= "Metacafe ";
-$body .= " ";
-$body .= "";
-$body .= "Vimeo ";
-$body .= " ";
-$body .= " ";
-$body .= "
";
-
-$body .= '';
-
-$body .= '
';
-$body .= '
';
-
-print $body;
-
-
-?>
-
-
diff --git a/views/default/forms/videolist/labels/googlevideos.php b/views/default/forms/videolist/labels/googlevideos.php
deleted file mode 100644
index 9ce2d607c..000000000
--- a/views/default/forms/videolist/labels/googlevideos.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
-$body .= "
";
-$body .= 'Loading...
';
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/metacafe.php b/views/default/forms/videolist/labels/metacafe.php
deleted file mode 100644
index 0642153f4..000000000
--- a/views/default/forms/videolist/labels/metacafe.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:metacafe')));
-$body .= "
";
-
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/vimeo.php b/views/default/forms/videolist/labels/vimeo.php
deleted file mode 100644
index 24a49a1ee..000000000
--- a/views/default/forms/videolist/labels/vimeo.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if ($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
-$body .= "
";
-
-print $body;
\ No newline at end of file
diff --git a/views/default/forms/videolist/labels/youtube.php b/views/default/forms/videolist/labels/youtube.php
deleted file mode 100644
index 4c824f6f3..000000000
--- a/views/default/forms/videolist/labels/youtube.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-$body = ''.elgg_echo("videolist:title_search_tube").'
';
-$body .= "";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-$body .= "
";
-if($error['no-search'] == 0) {
- $body .= '
'.$error_msg['no-search'].'
';
-}
-$body .= "
";
-$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos')));
-$body .= "
";
-
-print $body;
\ No newline at end of file
diff --git a/views/default/river/object/videolist/annotate.php b/views/default/river/object/videolist/annotate.php
deleted file mode 100644
index 50a4a8397..000000000
--- a/views/default/river/object/videolist/annotate.php
+++ /dev/null
@@ -1,11 +0,0 @@
-getSubject();
-$object = $statement->getObject();
-
-$url = "getURL()}\">{$performed_by->name} ";
-$string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " ";
-$string .= "getURL() . "\">" . elgg_echo("videolist:river:item") . " ";
-
-echo $string;
diff --git a/views/default/river/object/videolist/create.php b/views/default/river/object/videolist/create.php
deleted file mode 100644
index 4206d0083..000000000
--- a/views/default/river/object/videolist/create.php
+++ /dev/null
@@ -1,32 +0,0 @@
-subject_guid); // $statement->getSubject();
-$object = get_entity($vars['item']->object_guid);
-$thumbnail = $object->thumbnail;
-$is_group = get_entity($object->container_guid);
-
-$url = "getURL()}\">{$performed_by->name} ";
-$title = $object->title;
-
-if(!$title) {
- $title = "untitled";
-}
-
-$string = sprintf(elgg_echo("videolist:river:created"),$url) . " ";
-$string .= elgg_echo("videolist:river:item") . " titled getURL() . "\">" . $title . " ";
-//if the video was added to a group, show that unless displayed on the group profile
-if(($is_group instanceof ElggGroup) && (get_context() != 'groups')){
- $string .= " " . elgg_echo('videolist:ingroup') . " " . $is_group->name;
-}
-$string .= "" . friendly_time($object->time_created);
-if (isloggedin()){
- $string .= "";
- $string .= elgg_view('likes/forms/link', array('entity' => $object));
-}
-$string .= " ";
-
-$string .= "";
-$string .= "
getURL() . "\"> ";
-$string .= "
";
-
-echo $string;
\ No newline at end of file
diff --git a/views/default/staticvideo/index.php b/views/default/staticvideo/index.php
deleted file mode 100644
index 8d265fd50..000000000
--- a/views/default/staticvideo/index.php
+++ /dev/null
@@ -1,53 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-
-$owner = $_SESSION['guid'];
-$number = 10;
-$owner_videos = elgg_get_entities(array('types' => 'object', 'subtypes' => 'videolist', 'owner_guids' => $_SESSION['guid']));
-//get_entities("object", "videolist", $_SESSION['guid'], $number);
-$videodiv = '';
-$width = "390";
-$height = "275";
-?>
-
-url;
- $title = $node->title;
- $video_guid = $node->guid;
- $video_id = $node->video_id;
- $videodiv .= "
";
- $videodiv .= "
";
- $videodiv .= "Title : ".$title." ";
- $videodiv .= "
";
-
- $videodiv .= "
";
- $videodiv .= elgg_view("output/confirmlink", array(
- 'href' => $vars['url'] . "action/videolist/remove?video_id=" . $video_guid,
- 'text' => elgg_echo('delete'),
- 'confirm' => elgg_echo('deleteconfirm'),
- ));
- $videodiv .= "
";
- }
-
- print $videodiv;
-} else {
- echo "
".elgg_echo('videolist:none:found')."
";
-}
-?>
-
diff --git a/views/default/videolist/group_video_header.php b/views/default/videolist/group_video_header.php
deleted file mode 100644
index e6d13bca3..000000000
--- a/views/default/videolist/group_video_header.php
+++ /dev/null
@@ -1,22 +0,0 @@
-name . "'s " . elgg_echo('videos'));
-$url = elgg_get_site_url() . "videolist/browse/". $user->username . "/";
-//if the user is a memebr of the group, show find button
-if($user->isMember(get_loggedin_user()))
- $upload_link = "" . elgg_echo('videolist:browsemenu') . ' ';
-else
- $upload_link = '';
-?>
-
diff --git a/views/default/videolist/icon.php b/views/default/videolist/icon.php
deleted file mode 100644
index 36b30e5ca..000000000
--- a/views/default/videolist/icon.php
+++ /dev/null
@@ -1,36 +0,0 @@
-";
-} else {
- $mime = $vars['mimetype'];
- if (isset($vars['thumbnail'])) {
- $thumbnail = $vars['thumbnail'];
- } else {
- $thumbnail = false;
- }
-
- $size = $vars['size'];
- if ($size != 'large') {
- $size = 'small';
- }
-
- if ($thumbnail && strpos($mime, "image/")!==false) {
- echo " ";
- } else {
- if ($size == 'large') {
- echo " ";
- } else {
- echo " ";
- }
- }
-}
--
cgit v1.2.3
From 614c1203c7ddd6108c24b6114d3278089fa70633 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 21:51:56 +0100
Subject: Video embedded on RSS.
---
views/rss/object/videolist_item.php | 47 ++++++++++++++++++++++++++++++++++
views/rss/videolist/contentwrapper.php | 15 -----------
views/rss/videolist/videolist.php | 17 ------------
3 files changed, 47 insertions(+), 32 deletions(-)
create mode 100644 views/rss/object/videolist_item.php
delete mode 100644 views/rss/videolist/contentwrapper.php
delete mode 100644 views/rss/videolist/videolist.php
diff --git a/views/rss/object/videolist_item.php b/views/rss/object/videolist_item.php
new file mode 100644
index 000000000..41d89fadf
--- /dev/null
+++ b/views/rss/object/videolist_item.php
@@ -0,0 +1,47 @@
+title;
+if (empty($title)) {
+ $subtitle = strip_tags($vars['entity']->description);
+ $title = substr($subtitle, 0, 32);
+ if (strlen($subtitle) > 32) {
+ $title .= ' ...';
+ }
+}
+
+set_input('view', 'default');
+
+$description = elgg_view("videolist/watch/".$vars['entity']->videotype, array(
+ 'entity' => $vars['entity'],
+));
+
+set_input('view', 'rss');
+
+$description .= $vars['entity']->description;
+
+$permalink = htmlspecialchars($vars['entity']->getURL());
+$pubdate = date('r', $vars['entity']->time_created);
+
+$creator = elgg_view('object/creator', $vars);
+$georss = elgg_view('object/georss', $vars);
+$extension = elgg_view('extensions/item', $vars);
+
+$item = <<<__HTML
+-
+
$permalink
+ $pubdate
+ $permalink
+
+
+ $creator$georss$extension
+
+
+__HTML;
+
+echo $item;
diff --git a/views/rss/videolist/contentwrapper.php b/views/rss/videolist/contentwrapper.php
deleted file mode 100644
index c8e2438d5..000000000
--- a/views/rss/videolist/contentwrapper.php
+++ /dev/null
@@ -1,15 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
-
- echo $vars['body'];
-
-?>
diff --git a/views/rss/videolist/videolist.php b/views/rss/videolist/videolist.php
deleted file mode 100644
index 7745b070b..000000000
--- a/views/rss/videolist/videolist.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
- * @copyright Prateek Choudhary
- */
-
- if ($foreach = elgg_get_entities(array('types' => 'object', 'subtypes' => 'videolist'))) {
- foreach($foreach as $videos)
- echo elgg_view_entity($videos);
- }
-
-?>
--
cgit v1.2.3
From 34e4ad8ba5e0a77b797f24ed9af1cee6dce82c36 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 23:03:58 +0100
Subject: Refactored library. One file per videotype.
---
lib/bliptv.php | 29 +++++++++
lib/gisstv.php | 41 ++++++++++++
lib/metacafe.php | 29 +++++++++
lib/videolist.php | 183 +++++-------------------------------------------------
lib/vimeo.php | 31 +++++++++
lib/youtube.php | 28 +++++++++
6 files changed, 175 insertions(+), 166 deletions(-)
create mode 100644 lib/bliptv.php
create mode 100644 lib/gisstv.php
create mode 100644 lib/metacafe.php
create mode 100644 lib/vimeo.php
create mode 100644 lib/youtube.php
diff --git a/lib/bliptv.php b/lib/bliptv.php
new file mode 100644
index 000000000..f4c0f772c
--- /dev/null
+++ b/lib/bliptv.php
@@ -0,0 +1,29 @@
+ 'bliptv',
+ 'video_id' => $parsed['path'],
+ );
+}
+
+function videolist_get_data_bliptv($parsed){
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://blip.tv'.$video_id.'?skin=rss');
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
+ 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/blip:embedUrl'))),
+ );
+}
diff --git a/lib/gisstv.php b/lib/gisstv.php
new file mode 100644
index 000000000..24e11340a
--- /dev/null
+++ b/lib/gisstv.php
@@ -0,0 +1,41 @@
+ 'gisstv',
+ 'video_id' => $video_id,
+ );
+}
+
+function videolist_get_data_gisstv($parsed){
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
+ $xml = new SimpleXMLElement($buffer);
+
+ $data = array();
+ foreach($xml->xpath('/rss/channel/item') as $item){
+ if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
+ $data['title'] = sanitize_string($item->title);
+ $data['description'] = strip_tags($item->description);
+ $data['thumbnail'] = sanitize_string($item->thumbnail);
+ break;
+ }
+ }
+ return $data;
+}
diff --git a/lib/metacafe.php b/lib/metacafe.php
new file mode 100644
index 000000000..34b006a32
--- /dev/null
+++ b/lib/metacafe.php
@@ -0,0 +1,29 @@
+ 'metacafe',
+ 'video_id' => $path[2],
+ );
+}
+
+function videolist_get_data_metacafe($parsed){
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
+ 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/media:content/@url'))),
+ );
+}
diff --git a/lib/videolist.php b/lib/videolist.php
index c30916773..2dfc7d8fc 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,178 +1,29 @@
'youtube',
- 'video_id' => $query['v'],
- );
-}
-
-function videolist_parseurl_vimeo($url) {
- $parsed = parse_url($url);
- $path = explode('/', $parsed['path']);
-
- if ($parsed['host'] != 'vimeo.com' || !(int) $path[1]) {
- return false;
- }
-
- return array(
- 'videotype' => 'vimeo',
- 'video_id' => $path[1],
- );
-}
-
-function videolist_parseurl_metacafe($url) {
- $parsed = parse_url($url);
- $path = explode('/', $parsed['path']);
-
- if ($parsed['host'] != 'www.metacafe.com' || $path[1] != 'watch' || !(int) $path[2]) {
- return false;
- }
-
- return array(
- 'videotype' => 'metacafe',
- 'video_id' => $path[2],
- );
-}
+define('VIDEOLIST_SUPPORTED_PLATFORMS', 'youtube, vimeo, metacafe, bliptv, gisstv');
-function videolist_parseurl_bliptv($url) {
- $parsed = parse_url($url);
- $path = explode('/', $parsed['path']);
-
- if ($parsed['host'] != 'blip.tv' || count($path) < 3) {
- return false;
- }
-
- return array(
- 'videotype' => 'bliptv',
- 'video_id' => $parsed['path'],
- );
-}
-
-function videolist_parseurl_gisstv($url) {
- $parsed = parse_url($url);
- $path = explode('/', $parsed['path']);
-
- if ($parsed['host'] != 'giss.tv' || $path[1] != 'dmmdb') {
- return false;
- }
-
- if($path[2] == 'contents' && isset($path[3])) {
- $video_id = $path[3];
- } elseif($path[3] == 'contents' && isset($path[4])) {
- $video_id = $path[4];
- } else {
- return false;
- }
-
- return array(
- 'videotype' => 'gisstv',
- 'video_id' => $video_id,
- );
+foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){
+ include(elgg_get_plugins_path()."videolist/lib/$videotype.php");
}
function videolist_parseurl($url){
- if ($parsed = videolist_parseurl_youtube($url)) return $parsed;
- elseif ($parsed = videolist_parseurl_vimeo($url)) return $parsed;
- elseif ($parsed = videolist_parseurl_metacafe($url)) return $parsed;
- elseif ($parsed = videolist_parseurl_bliptv($url)) return $parsed;
- elseif ($parsed = videolist_parseurl_gisstv($url)) return $parsed;
- else return array();
-}
-
-function videolist_get_data($video_parsed_url) {
- $videotype = $video_parsed_url['videotype'];
- $video_id = $video_parsed_url['video_id'];
- switch($videotype){
- case 'youtube': return videolist_get_data_youtube($video_id);
- case 'vimeo': return videolist_get_data_vimeo($video_id);
- case 'metacafe': return videolist_get_data_metacafe($video_id);
- case 'bliptv': return videolist_get_data_bliptv($video_id);
- case 'gisstv': return videolist_get_data_gisstv($video_id);
- default: return array();
+ foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){
+ if (is_callable("videolist_parseurl_$videotype")){
+ if ($parsed = call_user_func("videolist_parseurl_$videotype", $url)) {
+ return $parsed;
+ }
+ }
}
+ return array();
}
-
-function videolist_get_data_youtube($video_id){
- $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id);
- $xml = new SimpleXMLElement($buffer);
-
- return array(
- 'title' => sanitize_string($xml->title),
- 'description' => strip_tags($xml->content),
- 'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
- 'video_id' => $video_id,
- 'videotype' => 'youtube',
- );
-}
-
-function videolist_get_data_vimeo($video_id){
- $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml");
- $xml = new SimpleXMLElement($buffer);
-
- $videos = $xml->children();
- $video = $videos[0];
-
- return array(
- 'title' => sanitize_string($video->title),
- 'description' => strip_tags($video->description),
- 'thumbnail' => sanitize_string($video->thumbnail_medium),
- 'video_id' => $video_id,
- 'videotype' => 'vimeo',
- );
-}
-
-function videolist_get_data_metacafe($video_id){
- $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
- $xml = new SimpleXMLElement($buffer);
-
- return array(
- 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
- 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
- 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
- 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/media:content/@url'))),
- 'video_id' => $video_id,
- 'videotype' => 'metacafe',
- );
-}
-
-function videolist_get_data_bliptv($video_id){
- $buffer = file_get_contents('http://blip.tv'.$video_id.'?skin=rss');
- $xml = new SimpleXMLElement($buffer);
+function videolist_get_data($parsed) {
+ $videotype = $parsed['videotype'];
+ $video_id = $parsed['video_id'];
- return array(
- 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
- 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
- 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
- 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/blip:embedUrl'))),
- 'video_id' => $video_id,
- 'videotype' => 'bliptv',
- );
-}
-
-function videolist_get_data_gisstv($video_id){
- $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
- $xml = new SimpleXMLElement($buffer);
-
- $data = array();
- foreach($xml->xpath('/rss/channel/item') as $item){
- if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
- $data['title'] = sanitize_string($item->title);
- $data['description'] = strip_tags($item->description);
- $data['thumbnail'] = sanitize_string($item->thumbnail);
- break;
- }
+ if(is_callable("videolist_get_data_$videotype")){
+ return array_merge($parsed, call_user_func("videolist_get_data_$videotype", $parsed));
+ } else {
+ return $parsed;
}
- return array_merge($data, array(
- 'video_id' => $video_id,
- 'videotype' => 'gisstv',
- ));
}
diff --git a/lib/vimeo.php b/lib/vimeo.php
new file mode 100644
index 000000000..0433c5a94
--- /dev/null
+++ b/lib/vimeo.php
@@ -0,0 +1,31 @@
+ 'vimeo',
+ 'video_id' => $path[1],
+ );
+}
+
+function videolist_get_data_vimeo($parsed){
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml");
+ $xml = new SimpleXMLElement($buffer);
+
+ $videos = $xml->children();
+ $video = $videos[0];
+
+ return array(
+ 'title' => sanitize_string($video->title),
+ 'description' => strip_tags($video->description),
+ 'thumbnail' => sanitize_string($video->thumbnail_medium),
+ );
+}
diff --git a/lib/youtube.php b/lib/youtube.php
new file mode 100644
index 000000000..6ed9344b0
--- /dev/null
+++ b/lib/youtube.php
@@ -0,0 +1,28 @@
+ 'youtube',
+ 'video_id' => $query['v'],
+ );
+}
+
+function videolist_get_data_youtube($parsed){
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id);
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => sanitize_string($xml->title),
+ 'description' => strip_tags($xml->content),
+ 'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
+ );
+}
--
cgit v1.2.3
From 2649953a338c84608d586d1d6ff18e5a137c1ddd Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 23:12:15 +0100
Subject: Suppressed non-used CSS code.
---
views/default/videolist/css.php | 115 +---------------------------------------
1 file changed, 1 insertion(+), 114 deletions(-)
diff --git a/views/default/videolist/css.php b/views/default/videolist/css.php
index 6f2bf397d..931d80567 100644
--- a/views/default/videolist/css.php
+++ b/views/default/videolist/css.php
@@ -1,12 +1,6 @@
- * @copyright Prateek Choudhary
+ * Elgg Videolist CSS
*/
?>
@@ -14,110 +8,3 @@
margin-top: 40px;
margin-left: 20px;
}
-
-.videolist_error{
- color:red;
- font-weight:bold;
-}
-
-/* video listing */
-.video_entity .entity_listing:first-child {
- border-top:0;
-}
-.entity_listing_icon .video_icon {
- width:150px;
- height:95px;
- display:table-cell;
- text-align:center;
- vertical-align: middle;
- background-color: black;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
-}
-.video_entity .entity_listing_info {
- width:560px;
- margin-left:15px;
-}
-
-/* single video view page */
-.video_view {
- text-align: center;
- margin-top:5px;
- padding-bottom:20px;
- border-bottom:1px solid #CCCCCC;
-}
-.video_view embed {
- margin-top:20px;
-}
-.video_view .tags {
- text-align:left;
-}
-
-/* search for videos */
-#loading_search_results .ajax_loader {
- margin:10px 0;
-}
-.search_videos {
- width:100%;
- margin-top:4px;
-}
-.search_videos .submit_button {
- margin:0;
-}
-.search_videos #title_search {
- margin-left:14px;
- margin-right:14px;
-}
-
-/* find videos search results list */
-#videosearch_results .video_entity {
- padding:10px 0;
- border-top:1px dotted #CCCCCC;
-}
-#videosearch_results .video_entity table {
- width:100%;
-}
-#videosearch_results .video_actions {
- text-align: right;
- width:15%;
-}
-#videosearch_results .video_entity .entity_title {
- margin:0;
-}
-
-/* pop-up video player */
-#page_overlay {
- position: fixed;
- top: 0px;
- left: 0px;
- height:100%;
- width:100%;
- z-index:299999;
-}
-.video_popup{
- position:absolute;
- display:none;
- padding:5px 10px 10px 10px;
- background:black;
- z-index:300000;
- -webkit-border-radius: 6px;
- -moz-border-radius: 6px;
-}
-.close_video {
- margin-bottom:5px;
- text-align: right;
-}
-.close_video a {
- color:white;
-}
-
-/* videos group widget */
-.group_tool_widget.video .entity_listing_icon img {
- margin:0;
- width:auto;
- max-width:80px;
- height:60px;
-}
-.group_tool_widget.video .entity_listing_info {
- width:260px;
-}
--
cgit v1.2.3
From 7d56efa97981052c08683b13c372c465db0b3e1b Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 23:15:02 +0100
Subject: No autoplay in giss.tv videos.
---
views/default/videolist/watch/gisstv.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/views/default/videolist/watch/gisstv.php b/views/default/videolist/watch/gisstv.php
index 6fdecd1ce..15a903ab1 100644
--- a/views/default/videolist/watch/gisstv.php
+++ b/views/default/videolist/watch/gisstv.php
@@ -4,6 +4,6 @@ $video_id = $vars['entity']->video_id;
$width = $vars['width'];
$height = $vars['height'];
-echo "
+echo "
";
--
cgit v1.2.3
From 6bf0fd153040b94751cc8fffde9f1b1f56524a06 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 23:31:44 +0100
Subject: River.
---
languages/en.php | 1 +
views/default/river/object/videolist_item/create.php | 15 +++++++++++++++
2 files changed, 16 insertions(+)
create mode 100644 views/default/river/object/videolist_item/create.php
diff --git a/languages/en.php b/languages/en.php
index db181aa37..ce8a24a3d 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -46,6 +46,7 @@ $english = array(
"videolist:searchTubeVideos" => "Search youtube.com",
"videolist:comments" => "Comments",
"videolist:commentspost" => "Post",
+ "river:create:object:videolist_item" => "%s added the video %s",
"river:comment:object:videolist_item" => "%s commented on %s",
"videolist:river:item" => "a video",
"videolist:river:created" => "%s added",
diff --git a/views/default/river/object/videolist_item/create.php b/views/default/river/object/videolist_item/create.php
new file mode 100644
index 000000000..ea9f8394b
--- /dev/null
+++ b/views/default/river/object/videolist_item/create.php
@@ -0,0 +1,15 @@
+getObjectEntity();
+$thumbnail = elgg_view('icon/object/videolist_item', array(
+ 'entity' => $object,
+ 'size' => 'medium',
+));
+
+echo elgg_view('river/item', array(
+ 'item' => $vars['item'],
+ 'message' => $thumbnail,
+));
--
cgit v1.2.3
From 72be71dcf9187fe98d55aab28b31e3c61707f141 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 23:38:18 +0100
Subject: Updated version.
---
manifest.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/manifest.xml b/manifest.xml
index e4cdbcc4e..d288e875c 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -2,12 +2,12 @@
Video List
Prateek Choudhary, Core developers, Lorea
- 1.8
+ 1.8-beta
bundled
content
multimedia
This plugin allows users to create a library of videos.
- https://lorea.cc/
+ http://elgg.org/
(C) prateek.choudhary 2008-09, Elgg 2010, Lorea 2011
GNU Public License version 2
--
cgit v1.2.3
From 89c298b5359333d048fc96bed8e33040fa243a51 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 10 Nov 2011 23:40:03 +0100
Subject: Not giss.tv support for general release.
---
lib/gisstv.php | 41 --------------------------------
lib/videolist.php | 2 +-
views/default/videolist/watch/gisstv.php | 9 -------
3 files changed, 1 insertion(+), 51 deletions(-)
delete mode 100644 lib/gisstv.php
delete mode 100644 views/default/videolist/watch/gisstv.php
diff --git a/lib/gisstv.php b/lib/gisstv.php
deleted file mode 100644
index 24e11340a..000000000
--- a/lib/gisstv.php
+++ /dev/null
@@ -1,41 +0,0 @@
- 'gisstv',
- 'video_id' => $video_id,
- );
-}
-
-function videolist_get_data_gisstv($parsed){
- $video_id = $parsed['video_id'];
-
- $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
- $xml = new SimpleXMLElement($buffer);
-
- $data = array();
- foreach($xml->xpath('/rss/channel/item') as $item){
- if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
- $data['title'] = sanitize_string($item->title);
- $data['description'] = strip_tags($item->description);
- $data['thumbnail'] = sanitize_string($item->thumbnail);
- break;
- }
- }
- return $data;
-}
diff --git a/lib/videolist.php b/lib/videolist.php
index 2dfc7d8fc..4e12c5361 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,6 +1,6 @@
video_id;
-$width = $vars['width'];
-$height = $vars['height'];
-
-echo "
-
- ";
--
cgit v1.2.3
From 9b176145bc10850e02b8602bb670d6832945ea83 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 12 Nov 2011 00:27:48 +0100
Subject: Fixes two bugs when editing a video.
---
actions/videolist/edit.php | 2 +-
pages/videolist/edit.php | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index f9db7b6a2..72e1d2427 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -18,7 +18,7 @@ foreach ($variables as $name => $type) {
}
// Get guids
-$videolist_guid = (int)get_input('videolist_guid');
+$video_guid = (int)get_input('video_guid');
$container_guid = (int)get_input('container_guid');
elgg_make_sticky_form('videolist');
diff --git a/pages/videolist/edit.php b/pages/videolist/edit.php
index 5ca1e4b64..916d9d280 100644
--- a/pages/videolist/edit.php
+++ b/pages/videolist/edit.php
@@ -36,6 +36,7 @@ $body_vars = array('guid' => $guid);
foreach(array_keys(elgg_get_config('videolist')) as $variable) {
$body_vars[$variable] = $videolist_item->$variable;
}
+$body_vars['container_guid'] = $videolist_item->container_guid;
$content = elgg_view_form('videolist/edit', $form_vars, $body_vars);
--
cgit v1.2.3
From 4585e371857636c1dece9978fba65d978a3afc78 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 12 Nov 2011 01:25:31 +0100
Subject: Refactored video savings to permit change title and description when
editing and avoid to change url.
---
actions/videolist/edit.php | 28 ++++++++++++++++++----------
views/default/forms/videolist/edit.php | 2 ++
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 72e1d2427..6670ceadb 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -25,16 +25,26 @@ elgg_make_sticky_form('videolist');
elgg_load_library('elgg:videolist');
-if (!$input['video_url']) {
- register_error(elgg_echo('videolist:error:no_url'));
- forward(REFERER);
-}
+// If new video, get data from video providers
+if(!$video_guid) {
+ if (!$input['video_url']) {
+ register_error(elgg_echo('videolist:error:no_url'));
+ forward(REFERER);
+ }
-$parsed_url = videolist_parseurl($input['video_url']);
+ $parsed_url = videolist_parseurl($input['video_url']);
-if(!$parsed_url) {
- register_error(elgg_echo('videolist:error:invalid_url'));
- forward(REFERER);
+ if(!$parsed_url) {
+ register_error(elgg_echo('videolist:error:invalid_url'));
+ forward(REFERER);
+ }
+
+ unset($input['title']);
+ unset($input['description']);
+ $input = array_merge(videolist_get_data($parsed_url), $input);
+
+} else {
+ unset($input['video_url']);
}
if ($video_guid) {
@@ -50,8 +60,6 @@ if ($video_guid) {
$new_video = true;
}
-$input = array_merge($input, videolist_get_data($parsed_url));
-
if (sizeof($input) > 0) {
foreach ($input as $name => $value) {
$video->$name = $value;
diff --git a/views/default/forms/videolist/edit.php b/views/default/forms/videolist/edit.php
index 8bbbcffb7..18fb6ded4 100644
--- a/views/default/forms/videolist/edit.php
+++ b/views/default/forms/videolist/edit.php
@@ -10,6 +10,8 @@ $variables = elgg_get_config('videolist');
if(empty($vars['guid'])){
unset($variables['title']);
unset($variables['description']);
+} else {
+ unset($variables['video_url']);
}
foreach ($variables as $name => $type) {
--
cgit v1.2.3
From e7d8b73c0e65f188b835bbb0a7e98eb2fa0f3478 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 19 Nov 2011 22:37:34 +0100
Subject: Added videos widget.
---
start.php | 3 +++
views/default/widgets/videolist/content.php | 32 +++++++++++++++++++++++++++++
views/default/widgets/videolist/edit.php | 24 ++++++++++++++++++++++
3 files changed, 59 insertions(+)
create mode 100644 views/default/widgets/videolist/content.php
create mode 100644 views/default/widgets/videolist/edit.php
diff --git a/start.php b/start.php
index d06268fd8..cdbce6270 100644
--- a/start.php
+++ b/start.php
@@ -37,6 +37,9 @@ function videolist_init() {
// extend group main page
elgg_extend_view('groups/tool_latest', 'videolist/group_module');
+
+ //add a widget
+ elgg_register_widget_type('videolist', elgg_echo('videolist'), elgg_echo('videolist:widget:description'));
if (is_callable('register_notification_object')) {
register_notification_object('object', 'videolist_item', elgg_echo('videolist:new'));
diff --git a/views/default/widgets/videolist/content.php b/views/default/widgets/videolist/content.php
new file mode 100644
index 000000000..2b8de92bf
--- /dev/null
+++ b/views/default/widgets/videolist/content.php
@@ -0,0 +1,32 @@
+videos_num;
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'videolist_item',
+ 'container_guid' => $vars['entity']->owner_guid,
+ 'limit' => $num,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_list_entities($options);
+
+echo $content;
+
+if ($content) {
+ $url = "pages/owner/" . elgg_get_page_owner_entity()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('videolist_item:more'),
+ 'is_trusted' => true,
+ ));
+ echo "$more_link ";
+} else {
+ echo elgg_echo('videolist_item:none');
+}
diff --git a/views/default/widgets/videolist/edit.php b/views/default/widgets/videolist/edit.php
new file mode 100644
index 000000000..a2865848e
--- /dev/null
+++ b/views/default/widgets/videolist/edit.php
@@ -0,0 +1,24 @@
+videos_num)) {
+ $vars['entity']->videos_num = 4;
+}
+
+$params = array(
+ 'name' => 'params[videos_num]',
+ 'value' => $vars['entity']->videos_num,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
+?>
+
+ :
+
+
--
cgit v1.2.3
From 789c5d12f23d3158c65c8654c9dcf7bd0a67b9a4 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 31 Dec 2011 21:04:45 +0100
Subject: Readded giss.tv support.
---
lib/gisstv.php | 41 ++++++++++++++++++++++++++++++++
lib/videolist.php | 2 +-
views/default/videolist/watch/gisstv.php | 9 +++++++
3 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 lib/gisstv.php
create mode 100644 views/default/videolist/watch/gisstv.php
diff --git a/lib/gisstv.php b/lib/gisstv.php
new file mode 100644
index 000000000..24e11340a
--- /dev/null
+++ b/lib/gisstv.php
@@ -0,0 +1,41 @@
+ 'gisstv',
+ 'video_id' => $video_id,
+ );
+}
+
+function videolist_get_data_gisstv($parsed){
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
+ $xml = new SimpleXMLElement($buffer);
+
+ $data = array();
+ foreach($xml->xpath('/rss/channel/item') as $item){
+ if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
+ $data['title'] = sanitize_string($item->title);
+ $data['description'] = strip_tags($item->description);
+ $data['thumbnail'] = sanitize_string($item->thumbnail);
+ break;
+ }
+ }
+ return $data;
+}
diff --git a/lib/videolist.php b/lib/videolist.php
index 4e12c5361..45253a9e3 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,6 +1,6 @@
video_id;
+$width = $vars['width'];
+$height = $vars['height'];
+
+echo "
+
+ ";
--
cgit v1.2.3
From 77883a67f5a44483314ba63624cf0bf779533247 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 31 Dec 2011 21:08:44 +0100
Subject: Upgraded for Elgg 1.8.1.
---
manifest.xml | 13 ++++++-------
start.php | 1 +
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/manifest.xml b/manifest.xml
index d288e875c..2d5627dae 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -1,19 +1,18 @@
- Video List
- Prateek Choudhary, Core developers, Lorea
- 1.8-beta
+ Videolist
+ Prateek Choudhary, Core developers, Lorea developers
+ 1.8-beta2
bundled
content
multimedia
This plugin allows users to create a library of videos.
- http://elgg.org/
+ http://lorea.cc/
(C) prateek.choudhary 2008-09, Elgg 2010, Lorea 2011
GNU Public License version 2
- elgg_version
- 2010111501
+ elgg_release
+ 1.8
true
- simple
diff --git a/start.php b/start.php
index cdbce6270..4c29549eb 100644
--- a/start.php
+++ b/start.php
@@ -121,6 +121,7 @@ function videolist_page_handler($page) {
include "$videolist_dir/all.php";
break;
}
+ return true;
}
/**
--
cgit v1.2.3
From 3a948fa46583e2419388d0c04e910f5d69721d3e Mon Sep 17 00:00:00 2001
From: Sem
Date: Fri, 24 Feb 2012 00:32:56 +0100
Subject: Fixed gisstv.
---
lib/videolist.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/videolist.php b/lib/videolist.php
index 45253a9e3..2dfc7d8fc 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,6 +1,6 @@
Date: Sat, 25 Feb 2012 01:38:29 +0100
Subject: Saving thumbnails in server and serving them secure.
---
actions/videolist/edit.php | 12 ++++++++++++
start.php | 2 +-
thumbnail.php | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
create mode 100644 thumbnail.php
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 6670ceadb..be566de7e 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -71,6 +71,18 @@ $video->container_guid = $container_guid;
if ($video->save()) {
elgg_clear_sticky_form('videolist');
+
+ // Let's save the thumbnail in the data folder
+ $thumbnail = file_get_contents($video->thumbnail);
+ if ($thumbnail) {
+ $prefix = "videolist/" . $video->guid;
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $video->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write($thumbnail);
+ $filehandler->close();
+ }
system_message(elgg_echo('videolist:saved'));
diff --git a/start.php b/start.php
index 4c29549eb..ff668f00c 100644
--- a/start.php
+++ b/start.php
@@ -255,7 +255,7 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
// tiny thumbnails are too small to be useful, so give a generic video icon
if ($size != 'tiny' && isset($videolist_item->thumbnail)) {
- return $videolist_item->thumbnail;
+ return elgg_get_site_url() . "mod/videolist/thumbnail.php?guid=" . $videolist_item->guid;
}
if (in_array($size, array('tiny', 'small', 'medium'))){
diff --git a/thumbnail.php b/thumbnail.php
new file mode 100644
index 000000000..bd93f8e63
--- /dev/null
+++ b/thumbnail.php
@@ -0,0 +1,35 @@
+getSubtype() != "videolist_item") {
+ exit;
+}
+
+$readfile = new ElggFile();
+$readfile->owner_guid = $item->owner_guid;
+$readfile->setFilename("videolist/{$item->guid}.jpg");
+$contents = $readfile->grabFile();
+
+// caching images for 10 days
+header("Content-type: image/jpeg");
+header('Expires: ' . date('r',time() + 864000));
+header("Pragma: public", true);
+header("Cache-Control: public", true);
+header("Content-Length: " . strlen($contents));
+
+echo $contents;
+exit;
--
cgit v1.2.3
From f1a0a4d5aa28753620552df9d5e88bd983d0aca4 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 25 Feb 2012 02:18:00 +0100
Subject: Added upgrade script to fetch thumbnails.
---
start.php | 13 +++++++++
upgrades/2012022501.php | 70 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 upgrades/2012022501.php
diff --git a/start.php b/start.php
index ff668f00c..07ec618a0 100644
--- a/start.php
+++ b/start.php
@@ -67,6 +67,8 @@ function videolist_init() {
elgg_register_action("videolist/add", "$actions_path/add.php");
elgg_register_action("videolist/edit", "$actions_path/edit.php");
elgg_register_action("videolist/delete", "$actions_path/delete.php");
+
+ elgg_register_event_handler('upgrade', 'system', 'videolist_run_upgrades');
}
/**
@@ -262,3 +264,14 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
return "mod/videolist/graphics/videolist_icon_{$size}.png";
}
}
+
+/**
+ * Process upgrades for the videolist plugin
+ */
+function videolist_run_upgrades() {
+ $path = elgg_get_plugins_path() . 'videolist/upgrades/';
+ $files = elgg_get_upgrade_files($path);
+ foreach ($files as $file) {
+ include "$path{$file}";
+ }
+}
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
new file mode 100644
index 000000000..815e10b62
--- /dev/null
+++ b/upgrades/2012022501.php
@@ -0,0 +1,70 @@
+ 'object',
+ 'subtype' => 'videolist_item',
+ 'limit' => 5,
+ 'order_by' => 'e.time_created asc',
+));
+
+// if not items, no upgrade required
+if (!$items) {
+ return;
+}
+
+// if all five of the items have empty thumbnails, we need to upgrade
+foreach ($items as $item) {
+ if ($item->thumbnail === true) {
+ return;
+ }
+}
+
+
+/**
+ * Downloads the thumbnail and saves into data folder
+ *
+ * @param ElggObject $item
+ */
+function videolist_2012022501($item) {
+
+ // do not upgrade videos that have already been upgraded
+ if ($item->thumbnail === true) {
+ return true;
+ }
+
+ $thumbnail = file_get_contents($item->thumbnail);
+ if (!$thumbnail) {
+ return false;
+ }
+
+ $prefix = "videolist/" . $item->guid;
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $item->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write($thumbnail);
+ $filehandler->close();
+
+ $item->thumbnail = true;
+ return true;
+}
+
+$previous_access = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'videolist_item',
+ 'limit' => 0,
+);
+$batch = new ElggBatch('elgg_get_entities', $options, 'videolist_2012022501', 100);
+elgg_set_ignore_access($previous_access);
+
+if ($batch->callbackResult) {
+ error_log("Elgg videolist upgrade (2012022501) succeeded");
+} else {
+ error_log("Elgg videolist upgrade (2012022501) failed");
+}
--
cgit v1.2.3
From 01c44e9002d03f58c9a5271c6256096de3273eb5 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Mon, 9 Apr 2012 15:06:33 -0400
Subject: More PHPDoc comments and @var declarations to help IDE comprehension
---
lib/videolist.php | 8 +++++
start.php | 52 +++++++++++++++++++---------
upgrades/2012022501.php | 1 +
views/default/icon/object/videolist_item.php | 1 +
views/default/object/videolist_item.php | 1 +
5 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/lib/videolist.php b/lib/videolist.php
index 2dfc7d8fc..96a2c6335 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -6,6 +6,10 @@ foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){
include(elgg_get_plugins_path()."videolist/lib/$videotype.php");
}
+/**
+ * @param string $url
+ * @return array
+ */
function videolist_parseurl($url){
foreach(explode(', ', VIDEOLIST_SUPPORTED_PLATFORMS) as $videotype){
if (is_callable("videolist_parseurl_$videotype")){
@@ -17,6 +21,10 @@ function videolist_parseurl($url){
return array();
}
+/**
+ * @param array $parsed
+ * @return array
+ */
function videolist_get_data($parsed) {
$videotype = $parsed['videotype'];
$video_id = $parsed['video_id'];
diff --git a/start.php b/start.php
index 07ec618a0..d764a78c9 100644
--- a/start.php
+++ b/start.php
@@ -128,6 +128,12 @@ function videolist_page_handler($page) {
/**
* Add a menu item to the user ownerblock
+ *
+ * @param string $hook
+ * @param string $type
+ * @param array $return
+ * @param array $params
+ * @return array
*/
function videolist_owner_block_menu($hook, $type, $return, $params) {
if (elgg_instanceof($params['entity'], 'user')) {
@@ -145,6 +151,10 @@ function videolist_owner_block_menu($hook, $type, $return, $params) {
return $return;
}
+/**
+ * @param ElggObject $videolist_item
+ * @return string
+ */
function videolist_url($videolist_item) {
$guid = $videolist_item->guid;
$title = elgg_get_friendly_title($videolist_item->title);
@@ -154,6 +164,9 @@ function videolist_url($videolist_item) {
/**
* Event handler for videolist
*
+ * @param string $event
+ * @param string $object_type
+ * @param ElggObject $object
*/
function videolist_object_notifications($event, $object_type, $object) {
static $flag;
@@ -177,11 +190,11 @@ function videolist_object_notifications($event, $object_type, $object) {
* Intercepts the notification on an event of new video being created and prevents a notification from going out
* (because one will be sent on the annotation)
*
- * @param unknown_type $hook
- * @param unknown_type $entity_type
- * @param unknown_type $returnvalue
- * @param unknown_type $params
- * @return unknown
+ * @param string $hook
+ * @param string $entity_type
+ * @param array $returnvalue
+ * @param array $params
+ * @return bool
*/
function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {
if (isset($params)) {
@@ -198,10 +211,11 @@ function videolist_object_notifications_intercept($hook, $entity_type, $returnva
/**
* Register videolist as an embed type.
*
- * @param unknown_type $hook
- * @param unknown_type $type
- * @param unknown_type $value
- * @param unknown_type $params
+ * @param string $hook
+ * @param string $type
+ * @param array $value
+ * @param array $params
+ * @return array
*/
function videolist_embed_get_sections($hook, $type, $value, $params) {
$value['videolist'] = array(
@@ -216,10 +230,11 @@ function videolist_embed_get_sections($hook, $type, $value, $params) {
/**
* Return a list of videos for embedding
*
- * @param unknown_type $hook
- * @param unknown_type $type
- * @param unknown_type $value
- * @param unknown_type $params
+ * @param string $hook
+ * @param string $type
+ * @param array $value
+ * @param array $params
+ * @return array
*/
function videolist_embed_get_items($hook, $type, $value, $params) {
$options = array(
@@ -245,13 +260,18 @@ function videolist_embed_get_items($hook, $type, $value, $params) {
/**
* Override the default entity icon for videoslist items
*
+ * @param string $hook
+ * @param string $type
+ * @param string $returnvalue
+ * @param array $params
* @return string Relative URL
*/
function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
$videolist_item = $params['entity'];
- $size = $params['size'];
-
- if($videolist_item->getSubtype() != 'videolist_item'){
+ /* @var ElggObject $videolist_item */
+ $size = $params['size'];
+
+ if($videolist_item->getSubtype() != 'videolist_item'){
return $returnvalue;
}
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
index 815e10b62..50102e875 100644
--- a/upgrades/2012022501.php
+++ b/upgrades/2012022501.php
@@ -29,6 +29,7 @@ foreach ($items as $item) {
* Downloads the thumbnail and saves into data folder
*
* @param ElggObject $item
+ * @return bool
*/
function videolist_2012022501($item) {
diff --git a/views/default/icon/object/videolist_item.php b/views/default/icon/object/videolist_item.php
index 38b805021..24a5b5fe8 100644
--- a/views/default/icon/object/videolist_item.php
+++ b/views/default/icon/object/videolist_item.php
@@ -11,6 +11,7 @@
*/
$entity = $vars['entity'];
+/* @var ElggObject $entity */
$sizes = array('small', 'medium', 'large', 'tiny', 'master', 'topbar');
$img_width = array('tiny' => 25, 'small' => 40, 'medium' => 100, 'large' => 200);
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 6ed284a43..e30d9d95b 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -7,6 +7,7 @@
$full = elgg_extract('full_view', $vars, FALSE);
$entity = elgg_extract('entity', $vars, FALSE);
+/* @var ElggObject $entity */
if (!$entity) {
return TRUE;
--
cgit v1.2.3
From e80bb29671b7887d5749a9eb147be38e6f0401f4 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Mon, 9 Apr 2012 15:07:15 -0400
Subject: Removed deprecated call, unused variable
---
lib/videolist.php | 3 +--
start.php | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/videolist.php b/lib/videolist.php
index 96a2c6335..ae2441847 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -27,8 +27,7 @@ function videolist_parseurl($url){
*/
function videolist_get_data($parsed) {
$videotype = $parsed['videotype'];
- $video_id = $parsed['video_id'];
-
+
if(is_callable("videolist_get_data_$videotype")){
return array_merge($parsed, call_user_func("videolist_get_data_$videotype", $parsed));
} else {
diff --git a/start.php b/start.php
index d764a78c9..bfb1796b9 100644
--- a/start.php
+++ b/start.php
@@ -238,7 +238,7 @@ function videolist_embed_get_sections($hook, $type, $value, $params) {
*/
function videolist_embed_get_items($hook, $type, $value, $params) {
$options = array(
- 'owner_guid' => get_loggedin_userid(),
+ 'owner_guid' => elgg_get_logged_in_user_guid(),
'type_subtype_pair' => array('object' => 'videolist_item'),
'count' => TRUE
);
--
cgit v1.2.3
From f399afdd2e3cc072efaca069b7a874c7801b31f6 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Mon, 9 Apr 2012 17:05:57 -0400
Subject: switched to platform classes. see
https://github.com/Elgg/videolist/issues/4
---
actions/videolist/edit.php | 11 ++++---
lib/Videolist/Platform/Bliptv.php | 39 ++++++++++++++++++++++++
lib/Videolist/Platform/Gisstv.php | 51 +++++++++++++++++++++++++++++++
lib/Videolist/Platform/Metacafe.php | 39 ++++++++++++++++++++++++
lib/Videolist/Platform/Vimeo.php | 41 +++++++++++++++++++++++++
lib/Videolist/Platform/Youtube.php | 38 +++++++++++++++++++++++
lib/Videolist/PlatformInterface.php | 23 ++++++++++++++
lib/bliptv.php | 29 ------------------
lib/gisstv.php | 41 -------------------------
lib/metacafe.php | 29 ------------------
lib/videolist.php | 61 +++++++++++++++++++++----------------
lib/vimeo.php | 31 -------------------
lib/youtube.php | 28 -----------------
13 files changed, 273 insertions(+), 188 deletions(-)
create mode 100644 lib/Videolist/Platform/Bliptv.php
create mode 100644 lib/Videolist/Platform/Gisstv.php
create mode 100644 lib/Videolist/Platform/Metacafe.php
create mode 100644 lib/Videolist/Platform/Vimeo.php
create mode 100644 lib/Videolist/Platform/Youtube.php
create mode 100644 lib/Videolist/PlatformInterface.php
delete mode 100644 lib/bliptv.php
delete mode 100644 lib/gisstv.php
delete mode 100644 lib/metacafe.php
delete mode 100644 lib/vimeo.php
delete mode 100644 lib/youtube.php
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index be566de7e..1572d88ce 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -32,16 +32,19 @@ if(!$video_guid) {
forward(REFERER);
}
- $parsed_url = videolist_parseurl($input['video_url']);
- if(!$parsed_url) {
+ $parsedPlatform = videolist_parse_url($input['video_url']);
+
+ if (!$parsedPlatform) {
register_error(elgg_echo('videolist:error:invalid_url'));
forward(REFERER);
}
-
+ list ($parsed, $platform) = $parsedPlatform;
+ /* @var Videolist_PlatformInterface $platform */
+
unset($input['title']);
unset($input['description']);
- $input = array_merge(videolist_get_data($parsed_url), $input);
+ $input = array_merge($parsed, $platform->getData($parsed), $input);
} else {
unset($input['video_url']);
diff --git a/lib/Videolist/Platform/Bliptv.php b/lib/Videolist/Platform/Bliptv.php
new file mode 100644
index 000000000..6956e060d
--- /dev/null
+++ b/lib/Videolist/Platform/Bliptv.php
@@ -0,0 +1,39 @@
+ 'bliptv',
+ 'video_id' => $parsed['path'],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://blip.tv'.$video_id.'?skin=rss');
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => current($xml->xpath('/rss/channel/item/title')),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
+ 'embedurl' => current($xml->xpath('/rss/channel/item/blip:embedUrl')),
+ );
+ }
+}
diff --git a/lib/Videolist/Platform/Gisstv.php b/lib/Videolist/Platform/Gisstv.php
new file mode 100644
index 000000000..f811619a8
--- /dev/null
+++ b/lib/Videolist/Platform/Gisstv.php
@@ -0,0 +1,51 @@
+ 'gisstv',
+ 'video_id' => $video_id,
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
+ $xml = new SimpleXMLElement($buffer);
+
+ $data = array();
+ foreach($xml->xpath('/rss/channel/item') as $item){
+ if ($item->link === 'http://giss.tv/dmmdb//contents/'.$video_id) {
+ $data['title'] = $item->title;
+ $data['description'] = strip_tags($item->description);
+ $data['thumbnail'] = $item->thumbnail;
+ break;
+ }
+ }
+ return $data;
+ }
+}
diff --git a/lib/Videolist/Platform/Metacafe.php b/lib/Videolist/Platform/Metacafe.php
new file mode 100644
index 000000000..3cf2fb8ce
--- /dev/null
+++ b/lib/Videolist/Platform/Metacafe.php
@@ -0,0 +1,39 @@
+ 'metacafe',
+ 'video_id' => $path[2],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => current($xml->xpath('/rss/channel/item/title')),
+ 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
+ 'thumbnail' => current($xml->xpath('/rss/channel/item/media:thumbnail/@url')),
+ 'embedurl' => current($xml->xpath('/rss/channel/item/media:content/@url')),
+ );
+ }
+}
diff --git a/lib/Videolist/Platform/Vimeo.php b/lib/Videolist/Platform/Vimeo.php
new file mode 100644
index 000000000..82bd57309
--- /dev/null
+++ b/lib/Videolist/Platform/Vimeo.php
@@ -0,0 +1,41 @@
+ 'vimeo',
+ 'video_id' => $path[1],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml");
+ $xml = new SimpleXMLElement($buffer);
+
+ $videos = $xml->children();
+ $video = $videos[0];
+
+ return array(
+ 'title' => $video->title,
+ 'description' => strip_tags($video->description),
+ 'thumbnail' => $video->thumbnail_medium,
+ );
+ }
+}
diff --git a/lib/Videolist/Platform/Youtube.php b/lib/Videolist/Platform/Youtube.php
new file mode 100644
index 000000000..41c7d1252
--- /dev/null
+++ b/lib/Videolist/Platform/Youtube.php
@@ -0,0 +1,38 @@
+ 'youtube',
+ 'video_id' => $query['v'],
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id);
+ $xml = new SimpleXMLElement($buffer);
+
+ return array(
+ 'title' => $xml->title,
+ 'description' => strip_tags($xml->content),
+ 'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
+ );
+ }
+}
diff --git a/lib/Videolist/PlatformInterface.php b/lib/Videolist/PlatformInterface.php
new file mode 100644
index 000000000..25ca019e9
--- /dev/null
+++ b/lib/Videolist/PlatformInterface.php
@@ -0,0 +1,23 @@
+ 'bliptv',
- 'video_id' => $parsed['path'],
- );
-}
-
-function videolist_get_data_bliptv($parsed){
- $video_id = $parsed['video_id'];
-
- $buffer = file_get_contents('http://blip.tv'.$video_id.'?skin=rss');
- $xml = new SimpleXMLElement($buffer);
-
- return array(
- 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
- 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
- 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
- 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/blip:embedUrl'))),
- );
-}
diff --git a/lib/gisstv.php b/lib/gisstv.php
deleted file mode 100644
index 24e11340a..000000000
--- a/lib/gisstv.php
+++ /dev/null
@@ -1,41 +0,0 @@
- 'gisstv',
- 'video_id' => $video_id,
- );
-}
-
-function videolist_get_data_gisstv($parsed){
- $video_id = $parsed['video_id'];
-
- $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
- $xml = new SimpleXMLElement($buffer);
-
- $data = array();
- foreach($xml->xpath('/rss/channel/item') as $item){
- if(sanitize_string($item->link) == 'http://giss.tv/dmmdb//contents/'.$video_id) {
- $data['title'] = sanitize_string($item->title);
- $data['description'] = strip_tags($item->description);
- $data['thumbnail'] = sanitize_string($item->thumbnail);
- break;
- }
- }
- return $data;
-}
diff --git a/lib/metacafe.php b/lib/metacafe.php
deleted file mode 100644
index 34b006a32..000000000
--- a/lib/metacafe.php
+++ /dev/null
@@ -1,29 +0,0 @@
- 'metacafe',
- 'video_id' => $path[2],
- );
-}
-
-function videolist_get_data_metacafe($parsed){
- $video_id = $parsed['video_id'];
-
- $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
- $xml = new SimpleXMLElement($buffer);
-
- return array(
- 'title' => sanitize_string(current($xml->xpath('/rss/channel/item/title'))),
- 'description' => strip_tags(current($xml->xpath('/rss/channel/item/description'))),
- 'thumbnail' => sanitize_string(current($xml->xpath('/rss/channel/item/media:thumbnail/@url'))),
- 'embedurl' => sanitize_string(current($xml->xpath('/rss/channel/item/media:content/@url'))),
- );
-}
diff --git a/lib/videolist.php b/lib/videolist.php
index ae2441847..93b27b51c 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -1,36 +1,45 @@
getType()][] = $platform;
+ }
+ }
+ }
+ }
+ return $platforms;
}
/**
- * @param array $parsed
- * @return array
+ * @param string $url
+ * @return array [parsed, platform]
*/
-function videolist_get_data($parsed) {
- $videotype = $parsed['videotype'];
-
- if(is_callable("videolist_get_data_$videotype")){
- return array_merge($parsed, call_user_func("videolist_get_data_$videotype", $parsed));
- } else {
- return $parsed;
- }
+function videolist_parse_url($url) {
+ $parsed = parse_url($url);
+ $params['url'] = $url;
+ $platforms = videolist_get_default_platforms();
+ $platforms = elgg_trigger_plugin_hook('videolist:prepare', 'platforms', $params, $platforms);
+ foreach ($platforms as $list) {
+ foreach ($list as $platform) {
+ /* @var Videolist_PlatformInterface $platform */
+ $parsed = $platform->parseUrl($url);
+ if ($parsed) {
+ return array($parsed, $platform);
+ }
+ }
+ }
+ return false;
}
diff --git a/lib/vimeo.php b/lib/vimeo.php
deleted file mode 100644
index 0433c5a94..000000000
--- a/lib/vimeo.php
+++ /dev/null
@@ -1,31 +0,0 @@
- 'vimeo',
- 'video_id' => $path[1],
- );
-}
-
-function videolist_get_data_vimeo($parsed){
- $video_id = $parsed['video_id'];
-
- $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml");
- $xml = new SimpleXMLElement($buffer);
-
- $videos = $xml->children();
- $video = $videos[0];
-
- return array(
- 'title' => sanitize_string($video->title),
- 'description' => strip_tags($video->description),
- 'thumbnail' => sanitize_string($video->thumbnail_medium),
- );
-}
diff --git a/lib/youtube.php b/lib/youtube.php
deleted file mode 100644
index 6ed9344b0..000000000
--- a/lib/youtube.php
+++ /dev/null
@@ -1,28 +0,0 @@
- 'youtube',
- 'video_id' => $query['v'],
- );
-}
-
-function videolist_get_data_youtube($parsed){
- $video_id = $parsed['video_id'];
-
- $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id);
- $xml = new SimpleXMLElement($buffer);
-
- return array(
- 'title' => sanitize_string($xml->title),
- 'description' => strip_tags($xml->content),
- 'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
- );
-}
--
cgit v1.2.3
From 0577676d63ad90e1328ffd7ffaf7a93f2e73187c Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Mon, 9 Apr 2012 17:06:47 -0400
Subject: fix for ampersands getting HTML-escaped in URLs
---
actions/videolist/edit.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 1572d88ce..107cdc917 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -32,6 +32,8 @@ if(!$video_guid) {
forward(REFERER);
}
+ // get_input (htmlawed) "fixes" URLs by breaking them
+ $input['video_url'] = str_replace('&', '&', $input['video_url']);
$parsedPlatform = videolist_parse_url($input['video_url']);
--
cgit v1.2.3
From cb27322b1421bd4cb2ce1889c38da5c8666d68f2 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Mon, 9 Apr 2012 17:07:29 -0400
Subject: fix for users who paste from Chrome's address bar (sometimes leaves
off URL scheme)
---
lib/videolist.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/videolist.php b/lib/videolist.php
index 93b27b51c..776ce7093 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -29,6 +29,10 @@ function videolist_get_default_platforms() {
*/
function videolist_parse_url($url) {
$parsed = parse_url($url);
+ if (empty($parsed['host']) && ! empty($parsed['path']) && $parsed['path'][0] !== '/') {
+ // user probably forgot scheme
+ $url = 'http://' . $url;
+ }
$params['url'] = $url;
$platforms = videolist_get_default_platforms();
$platforms = elgg_trigger_plugin_hook('videolist:prepare', 'platforms', $params, $platforms);
--
cgit v1.2.3
From 6d4ac854d8f0a4480ffe16f2bd2a7861707074ee Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Tue, 10 Apr 2012 09:51:20 -0400
Subject: Move URL preprocessing to hook
---
actions/videolist/edit.php | 8 ++++----
lib/videolist.php | 9 +++------
start.php | 23 +++++++++++++++++++++++
3 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 107cdc917..fe614cd5a 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -27,14 +27,14 @@ elgg_load_library('elgg:videolist');
// If new video, get data from video providers
if(!$video_guid) {
- if (!$input['video_url']) {
+
+ $input['video_url'] = elgg_trigger_plugin_hook('videolist:preprocess', 'url', $input, $input['video_url']);
+
+ if (!$input['video_url']) {
register_error(elgg_echo('videolist:error:no_url'));
forward(REFERER);
}
- // get_input (htmlawed) "fixes" URLs by breaking them
- $input['video_url'] = str_replace('&', '&', $input['video_url']);
-
$parsedPlatform = videolist_parse_url($input['video_url']);
if (!$parsedPlatform) {
diff --git a/lib/videolist.php b/lib/videolist.php
index 776ce7093..b86db99cf 100644
--- a/lib/videolist.php
+++ b/lib/videolist.php
@@ -28,12 +28,9 @@ function videolist_get_default_platforms() {
* @return array [parsed, platform]
*/
function videolist_parse_url($url) {
- $parsed = parse_url($url);
- if (empty($parsed['host']) && ! empty($parsed['path']) && $parsed['path'][0] !== '/') {
- // user probably forgot scheme
- $url = 'http://' . $url;
- }
- $params['url'] = $url;
+ $params = array(
+ 'url' => $url,
+ );
$platforms = videolist_get_default_platforms();
$platforms = elgg_trigger_plugin_hook('videolist:prepare', 'platforms', $params, $platforms);
foreach ($platforms as $list) {
diff --git a/start.php b/start.php
index bfb1796b9..f423b75ed 100644
--- a/start.php
+++ b/start.php
@@ -61,6 +61,9 @@ function videolist_init() {
// register for embed
elgg_register_plugin_hook_handler('embed_get_sections', 'all', 'videolist_embed_get_sections');
elgg_register_plugin_hook_handler('embed_get_items', 'videolist', 'videolist_embed_get_items');
+
+ // handle URLs without scheme
+ elgg_register_plugin_hook_handler('videolist:preprocess', 'url', 'videolist_preprocess_url');
// Register actions
$actions_path = elgg_get_plugins_path() . "videolist/actions/videolist";
@@ -285,6 +288,26 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
}
}
+/**
+ * Prepend HTTP scheme if missing
+ * @param string $hook
+ * @param string $type
+ * @param string $returnvalue
+ * @param array $params
+ * @return string
+ */
+function videolist_preprocess_url($hook, $type, $returnvalue, $params) {
+ // undo get_input (htmlawed's) HTML-encoding
+ $returnvalue = str_replace('&', '&', $returnvalue);
+
+ $parsed = parse_url($returnvalue);
+ if (empty($parsed['host']) && ! empty($parsed['path']) && $parsed['path'][0] !== '/') {
+ // user probably forgot scheme
+ $returnvalue = 'http://' . $returnvalue;
+ }
+ return $returnvalue;
+}
+
/**
* Process upgrades for the videolist plugin
*/
--
cgit v1.2.3
From 595f87c960f0d0b01ebd386686d522f25fa56b91 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Tue, 10 Apr 2012 09:51:45 -0400
Subject: Handle shortened Youtube URLs
---
lib/Videolist/Platform/Youtube.php | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/lib/Videolist/Platform/Youtube.php b/lib/Videolist/Platform/Youtube.php
index 41c7d1252..648ac282c 100644
--- a/lib/Videolist/Platform/Youtube.php
+++ b/lib/Videolist/Platform/Youtube.php
@@ -10,16 +10,28 @@ class Videolist_Platform_Youtube implements Videolist_PlatformInterface
public function parseUrl($url)
{
$parsed = parse_url($url);
- parse_str($parsed['query'], $query);
-
- if ($parsed['host'] != 'www.youtube.com' || $parsed['path'] != '/watch' || !isset($query['v'])) {
- return false;
+ $id = '';
+ if (! empty($parsed['host'])) {
+ if ($parsed['host'] === 'youtu.be') {
+ // short URLs
+ $id = substr($parsed['path'], 1);
+ } elseif ($parsed['host'] === 'www.youtube.com'
+ && $parsed['path'] === '/watch'
+ && ! empty($parsed['query'])) {
+ // long URLs
+ parse_str($parsed['query'], $query);
+ if (! empty($query['v'])) {
+ $id = $query['v'];
+ }
+ }
}
-
- return array(
- 'videotype' => 'youtube',
- 'video_id' => $query['v'],
- );
+ if ($id) {
+ return array(
+ 'videotype' => 'youtube',
+ 'video_id' => $id,
+ );
+ }
+ return false;
}
public function getData($parsed)
--
cgit v1.2.3
From c70ec6161e4ef4d0daee6514da0a4d4e6b183207 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Tue, 10 Apr 2012 10:43:51 -0400
Subject: Remove filtering on URL input
---
actions/videolist/edit.php | 3 ++-
start.php | 3 ---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index fe614cd5a..480a3943b 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -8,7 +8,8 @@
$variables = elgg_get_config('videolist');
$input = array();
foreach ($variables as $name => $type) {
- $input[$name] = get_input($name);
+ $filter_input = ($name !== 'video_url');
+ $input[$name] = get_input($name, null, $filter_input);
if ($name == 'title') {
$input[$name] = strip_tags($input[$name]);
}
diff --git a/start.php b/start.php
index f423b75ed..2791b1185 100644
--- a/start.php
+++ b/start.php
@@ -297,9 +297,6 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
* @return string
*/
function videolist_preprocess_url($hook, $type, $returnvalue, $params) {
- // undo get_input (htmlawed's) HTML-encoding
- $returnvalue = str_replace('&', '&', $returnvalue);
-
$parsed = parse_url($returnvalue);
if (empty($parsed['host']) && ! empty($parsed['path']) && $parsed['path'][0] !== '/') {
// user probably forgot scheme
--
cgit v1.2.3
From d2bb8789a80215708517f4ffc88462382ec601a8 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Tue, 10 Apr 2012 10:44:40 -0400
Subject: Remove redundant videotype from parseUrl return array
---
actions/videolist/edit.php | 1 +
lib/Videolist/Platform/Bliptv.php | 1 -
lib/Videolist/Platform/Gisstv.php | 1 -
lib/Videolist/Platform/Metacafe.php | 1 -
lib/Videolist/Platform/Vimeo.php | 1 -
lib/Videolist/Platform/Youtube.php | 1 -
6 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 480a3943b..4b96720d8 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -48,6 +48,7 @@ if(!$video_guid) {
unset($input['title']);
unset($input['description']);
$input = array_merge($parsed, $platform->getData($parsed), $input);
+ $input['videotype'] = $platform->getType();
} else {
unset($input['video_url']);
diff --git a/lib/Videolist/Platform/Bliptv.php b/lib/Videolist/Platform/Bliptv.php
index 6956e060d..aa53032f9 100644
--- a/lib/Videolist/Platform/Bliptv.php
+++ b/lib/Videolist/Platform/Bliptv.php
@@ -17,7 +17,6 @@ class Videolist_Platform_Bliptv implements Videolist_PlatformInterface
}
return array(
- 'videotype' => 'bliptv',
'video_id' => $parsed['path'],
);
}
diff --git a/lib/Videolist/Platform/Gisstv.php b/lib/Videolist/Platform/Gisstv.php
index f811619a8..b79898449 100644
--- a/lib/Videolist/Platform/Gisstv.php
+++ b/lib/Videolist/Platform/Gisstv.php
@@ -25,7 +25,6 @@ class Videolist_Platform_Gisstv implements Videolist_PlatformInterface
}
return array(
- 'videotype' => 'gisstv',
'video_id' => $video_id,
);
}
diff --git a/lib/Videolist/Platform/Metacafe.php b/lib/Videolist/Platform/Metacafe.php
index 3cf2fb8ce..7da6d1647 100644
--- a/lib/Videolist/Platform/Metacafe.php
+++ b/lib/Videolist/Platform/Metacafe.php
@@ -17,7 +17,6 @@ class Videolist_Platform_Metacafe implements Videolist_PlatformInterface
}
return array(
- 'videotype' => 'metacafe',
'video_id' => $path[2],
);
}
diff --git a/lib/Videolist/Platform/Vimeo.php b/lib/Videolist/Platform/Vimeo.php
index 82bd57309..a4a1f275c 100644
--- a/lib/Videolist/Platform/Vimeo.php
+++ b/lib/Videolist/Platform/Vimeo.php
@@ -17,7 +17,6 @@ class Videolist_Platform_Vimeo implements Videolist_PlatformInterface
}
return array(
- 'videotype' => 'vimeo',
'video_id' => $path[1],
);
}
diff --git a/lib/Videolist/Platform/Youtube.php b/lib/Videolist/Platform/Youtube.php
index 648ac282c..d5a388356 100644
--- a/lib/Videolist/Platform/Youtube.php
+++ b/lib/Videolist/Platform/Youtube.php
@@ -27,7 +27,6 @@ class Videolist_Platform_Youtube implements Videolist_PlatformInterface
}
if ($id) {
return array(
- 'videotype' => 'youtube',
'video_id' => $id,
);
}
--
cgit v1.2.3
From 4a447a9cfe118373f3b5e7ec35382239455d1541 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Tue, 10 Apr 2012 12:04:03 -0400
Subject: Don't try to load null when there's no thumbnail URL
---
actions/videolist/edit.php | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/actions/videolist/edit.php b/actions/videolist/edit.php
index 4b96720d8..a5e6ea453 100644
--- a/actions/videolist/edit.php
+++ b/actions/videolist/edit.php
@@ -80,16 +80,19 @@ if ($video->save()) {
elgg_clear_sticky_form('videolist');
// Let's save the thumbnail in the data folder
- $thumbnail = file_get_contents($video->thumbnail);
- if ($thumbnail) {
- $prefix = "videolist/" . $video->guid;
- $filehandler = new ElggFile();
- $filehandler->owner_guid = $video->owner_guid;
- $filehandler->setFilename($prefix . ".jpg");
- $filehandler->open("write");
- $filehandler->write($thumbnail);
- $filehandler->close();
- }
+ $thumb_url = $video->thumbnail;
+ if ($thumb_url) {
+ $thumbnail = file_get_contents($thumb_url);
+ if ($thumbnail) {
+ $prefix = "videolist/" . $video->guid;
+ $filehandler = new ElggFile();
+ $filehandler->owner_guid = $video->owner_guid;
+ $filehandler->setFilename($prefix . ".jpg");
+ $filehandler->open("write");
+ $filehandler->write($thumbnail);
+ $filehandler->close();
+ }
+ }
system_message(elgg_echo('videolist:saved'));
--
cgit v1.2.3
From 4af120de2bd0fe2046795346a40102f00fbe5479 Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Tue, 10 Apr 2012 12:04:42 -0400
Subject: Allow plugins to alter video dimensions.
---
start.php | 28 ++++++++++++++++++++++++++++
views/default/object/videolist_item.php | 7 ++++---
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/start.php b/start.php
index 2791b1185..77bf0a7bc 100644
--- a/start.php
+++ b/start.php
@@ -288,6 +288,34 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
}
}
+/**
+ * @param ElggObject $videolist_item
+ * @return array
+ */
+function videolist_get_video_dimensions(ElggObject $videolist_item) {
+ $dimensions = array(
+ 'width' => 600,
+ 'height' => 400,
+ );
+ $params['entity'] = $videolist_item;
+ $params['videotype'] = $videolist_item->videotype;
+ $dimensions = elgg_trigger_plugin_hook(
+ 'videolist:setdimensions',
+ $params['videotype'],
+ $params,
+ $dimensions);
+ if (! is_array($dimensions)) {
+ $dimensions = array();
+ }
+ if (empty($dimensions['width']) || ! is_numeric($dimensions['width'])) {
+ $dimensions['width'] = 600;
+ }
+ if (empty($dimensions['height']) || ! is_numeric($dimensions['height'])) {
+ $dimensions['height'] = 400;
+ }
+ return $dimensions;
+}
+
/**
* Prepend HTTP scheme if missing
* @param string $hook
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index e30d9d95b..5e0db00ce 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -60,11 +60,12 @@ if (elgg_in_context('widgets')) {
}
if ($full && !elgg_in_context('gallery')) {
-
+
+ $dimensions = videolist_get_video_dimensions($entity);
$content = elgg_view("videolist/watch/{$entity->videotype}", array(
'entity' => $entity,
- 'width' => 600,
- 'height' => 400,
+ 'width' => $dimensions['width'],
+ 'height' => $dimensions['height'],
));
$content = "$content
";
--
cgit v1.2.3
From b6f8691bdc26986e031a3b2d5a63db4be67dea43 Mon Sep 17 00:00:00 2001
From: Sem
Date: Wed, 18 Apr 2012 09:07:37 +0200
Subject: Simplified video dimensions take.
---
start.php | 33 +++++----------------------------
views/default/object/videolist_item.php | 6 +++---
2 files changed, 8 insertions(+), 31 deletions(-)
diff --git a/start.php b/start.php
index 77bf0a7bc..d6a5ee8b1 100644
--- a/start.php
+++ b/start.php
@@ -34,6 +34,11 @@ function videolist_init() {
'tags' => 'tags',
'access_id' => 'access',
));
+
+ elgg_set_config('videolist_dimensions', array(
+ 'width' => 600,
+ 'height' => 400,
+ ));
// extend group main page
elgg_extend_view('groups/tool_latest', 'videolist/group_module');
@@ -288,34 +293,6 @@ function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
}
}
-/**
- * @param ElggObject $videolist_item
- * @return array
- */
-function videolist_get_video_dimensions(ElggObject $videolist_item) {
- $dimensions = array(
- 'width' => 600,
- 'height' => 400,
- );
- $params['entity'] = $videolist_item;
- $params['videotype'] = $videolist_item->videotype;
- $dimensions = elgg_trigger_plugin_hook(
- 'videolist:setdimensions',
- $params['videotype'],
- $params,
- $dimensions);
- if (! is_array($dimensions)) {
- $dimensions = array();
- }
- if (empty($dimensions['width']) || ! is_numeric($dimensions['width'])) {
- $dimensions['width'] = 600;
- }
- if (empty($dimensions['height']) || ! is_numeric($dimensions['height'])) {
- $dimensions['height'] = 400;
- }
- return $dimensions;
-}
-
/**
* Prepend HTTP scheme if missing
* @param string $hook
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 5e0db00ce..a1943216d 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -61,11 +61,11 @@ if (elgg_in_context('widgets')) {
if ($full && !elgg_in_context('gallery')) {
- $dimensions = videolist_get_video_dimensions($entity);
+ $dimensions = elgg_get_config('videolist_dimensions');
$content = elgg_view("videolist/watch/{$entity->videotype}", array(
'entity' => $entity,
- 'width' => $dimensions['width'],
- 'height' => $dimensions['height'],
+ 'width' => (int) $dimensions['width'],
+ 'height' => (int) $dimensions['height'],
));
$content = "$content
";
--
cgit v1.2.3
From 53b419ceb3cbcf52a77c7f93d2eea205c8a2c6e1 Mon Sep 17 00:00:00 2001
From: Sem
Date: Mon, 7 May 2012 19:01:49 +0200
Subject: Added spanish language file.
---
languages/es.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 languages/es.php
diff --git a/languages/es.php b/languages/es.php
new file mode 100644
index 000000000..e8a5cdaf9
--- /dev/null
+++ b/languages/es.php
@@ -0,0 +1,50 @@
+ 'Vídeos de %s',
+ 'videolist:all' => 'Vídeos del sitio',
+ 'videolist:add' => 'Añade un vídeo',
+ 'videolist:play:video' => 'Reproducir',
+ 'videolist:add:video' => 'Añade',
+ 'videolist:friends' => 'Vídeos de amigos',
+ 'videolist:edit' => 'Edita el vídeo',
+ 'videolist:ingroup' => 'en el grupo',
+ 'videolist:title' => 'Título',
+ 'videolist:description' => 'Descripción',
+ 'videolist:video_url' => 'Copia aquí la URL del vídeo',
+ 'videolist:error:no_save' => 'Ha habido un error mientras se guardaba el vídeo, por favor, pruebe en un momento',
+ 'videolist:saved' => 'Tu vídeo ha sido guardado satisfactoriamente!',
+ 'videolist_item:more' => 'Ver todos los vídeos',
+ 'videolist_item:none' => 'No se han encontrado vídeos',
+ 'videolist:deleted' => 'Tu vídeo ha sido borrado satisfactoriamente!',
+ 'videolist:deletefailed' => 'Por desgracia, este vídeo no se puede borrar ahora mismo. Prueba más tarde',
+ 'videolist:access_id' => '¿Quien puede ver que has añadido este vídeo?',
+ 'item:object:videolist_item' => 'Vídeos',
+ 'river:create:object:videolist_item' => '%s ha añadido el vídeo %s',
+ 'river:comment:object:videolist_item' => '%s ha comentado en %s',
+ 'videolist:delete:confirm' => 'Estás seguro de que quieres eliminar este vídeo?',
+ 'videolist' => 'Mis Videos',
+ 'videolist:home' => 'Vídeos de %s',
+ 'videolist:new' => 'Añadir vídeos',
+ 'videolist:find' => 'Vídeos de toda la red',
+ 'videolist:search' => 'Buscar Vídeos',
+ 'videolist:submit' => 'Aceptar',
+ 'videolist:widget' => 'Mis Vídeos',
+ 'videolist:widget:description' => 'Puedes compartir tu galería de vídeos personalizada con el resto de la red',
+ 'videolist:num_videos' => 'Número de vídeos a mostrar',
+ 'profile:videoheader' => 'Mis galería de Vídeos',
+ 'videolist:tags' => 'Añadir etiquetas',
+ 'videolist:browse' => 'Buscar vídeos de %s',
+ 'videolist:browsemenu' => 'Buscar vídeos',
+ 'videolist:title_search_tube' => 'Buscar vídeos en:',
+ 'videolist:searchTubeVideos' => 'Buscar en youtube',
+ 'videolist:comments' => 'Comentarios',
+ 'videolist:commentspost' => 'Entrada',
+ 'videolist:river:item' => 'un vídeo titulado:',
+ 'videolist:river:created' => '%s ha añadido',
+ 'videolist:group' => 'Vídeos',
+ 'videolist:groupall' => 'Todos los vídeos del grupo',
+ 'videolist:none' => 'El grupo no tiene vídeos subidos, o no tienes permiso para ver el contenido',
+);
+
+add_translation("es", $es);
+
--
cgit v1.2.3
From 6398b80ea9e22bc6d14c01c86667af7b4e73c3bb Mon Sep 17 00:00:00 2001
From: Sem
Date: Fri, 11 May 2012 02:07:09 +0200
Subject: Updated languages files.
---
languages/en.php | 113 ++++++++++++++----------
languages/es.php | 86 ++++++++----------
pages/videolist/owner.php | 2 +-
start.php | 5 +-
views/default/page/elements/videolist_block.php | 2 +-
views/default/widgets/videolist/content.php | 4 +-
6 files changed, 111 insertions(+), 101 deletions(-)
diff --git a/languages/en.php b/languages/en.php
index ce8a24a3d..04a9355bf 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -7,53 +7,72 @@
$english = array(
- "videolist" => "Videos",
-
- "videolist:home" => '%s \'s Videos',
- "videolist:user" => '%s \'s Videos',
- "videolist:new" => 'Add a Video',
- "videolist:find" => 'All Site videos',
- "videolist:all" => 'All Site videos',
- "videolist:add" => 'Add a Video',
- "videolist:play:video" => 'Play',
- "videolist:add:video" => 'Add',
- "videolist:search" => "All Site videos",
+ /**
+ * Menu items and titles
+ */
+
+ 'videolist' => "Videos",
+ 'videolist:owner' => "%s's videos",
'videolist:friends' => "Friends' videos",
- 'videolist:edit' => "Edit video",
- 'videolist:ingroup' => "in the group",
- "videolist:submit" => 'Submit',
- "videolist:title" => "Title",
- "videolist:description" => "Description",
- "videolist:video_url" => "Enter video URL",
- "videolist:error:no_save" => 'There was an error in saving the video, please try after sometime',
- "videolist:saved" => 'Your video has been saved successfully!',
- "videolist_item:more" => "View all videos",
- "videolist_item:none" => "sorry, no videos were found",
- "videolist:deleted" => "Your video was removed successfully!",
- "videolist:deletefailed" => "Unfortunately, this video could not be removed now. Please try again later",
- "videolist:widget" => "Videos",
- "videolist:widget:description" => "Your personal video playlist",
- "videolist:num_videos" => "Number of videos to display",
- 'videolist:widget' => "My Videos",
- "videolist:widget:description" => "Showcase your personal video gallery from youtube",
- "profile:videoheader" => "My Video Gallery",
- "videolist:access_id" => "Who can see you posted this video?",
- "item:object:videolist_item" => "Videos",
- "videolist:tags" => "Add Tags",
- "videolist:browse" => "Find Videos - %s",
- "videolist:browsemenu" => "Find Videos",
- "videolist:title_search_tube" => "Search Videos From",
- "videolist:searchTubeVideos" => "Search youtube.com",
- "videolist:comments" => "Comments",
- "videolist:commentspost" => "Post",
- "river:create:object:videolist_item" => "%s added the video %s",
- "river:comment:object:videolist_item" => "%s commented on %s",
- "videolist:river:item" => "a video",
- "videolist:river:created" => "%s added",
- "videolist:group" => "Group Videos",
- "videolist:groupall" => "All Group Videos",
- "videolist:delete:confirm" => "Are you sure you want to delete this video?",
- "videolist:none" => "No videos were found.",
+ 'videolist:all' => "All site videos",
+ 'videolist:add' => "Add video",
+
+ 'videolist:group' => "Group videos",
+ 'groups:enablevideolist' => 'Enable group videos',
+
+ 'videolist:edit' => "Edit this video",
+ 'videolist:delete' => "Delete this video",
+
+ 'videolist:new' => "A new video",
+ 'videolist:notification' =>
+'%s added a new video:
+
+%s
+%s
+
+View and comment on the new video:
+%s
+',
+ 'videolist:delete:confirm' => 'Are you sure you want to delete this video?',
+ 'item:object:videolist_item' => 'Video',
+ 'videolist:nogroup' => 'This group does not have any video yet',
+ 'videolist:more' => 'More videos',
+ 'videolist:none' => 'No videos posted yet.',
+
+ /**
+ * River
+ **/
+
+ 'river:create:object:videolist_item' => '%s created the video %s',
+ 'river:update:object:videolist_item' => '%s updated the video %s',
+ 'river:comment:object:videolist_item' => '%s commented on the video titled %s',
+
+ /**
+ * Form fields
+ */
+
+ 'videolist:title' => 'Title',
+ 'videolist:description' => 'Description',
+ 'videolist:video_url' => 'Enter video URL',
+ 'videolist:access_id' => 'Who can see you posted this video?',
+ 'videolist:tags' => 'Add tags',
+
+ /**
+ * Status and error messages
+ */
+ 'videolist:error:no_save' => 'There was an error in saving the video, please try after sometime',
+ 'videolist:saved' => 'Your video has been saved successfully!',
+ 'videolist:deleted' => 'Your video was removed successfully!',
+ 'videolist:deletefailed' => 'Unfortunately, this video could not be removed now. Please try again later',
+
+
+ /**
+ * Widget
+ **/
+
+ 'videolist:num_videos' => 'Number of videos to display',
+ 'videolist:widget:description' => 'Your personal video playlist.',
+
);
-add_translation("en",$english);
+add_translation("en", $english);
diff --git a/languages/es.php b/languages/es.php
index e8a5cdaf9..d52a40d78 100644
--- a/languages/es.php
+++ b/languages/es.php
@@ -1,50 +1,42 @@
'Vídeos de %s',
- 'videolist:all' => 'Vídeos del sitio',
- 'videolist:add' => 'Añade un vídeo',
- 'videolist:play:video' => 'Reproducir',
- 'videolist:add:video' => 'Añade',
- 'videolist:friends' => 'Vídeos de amigos',
- 'videolist:edit' => 'Edita el vídeo',
- 'videolist:ingroup' => 'en el grupo',
- 'videolist:title' => 'Título',
- 'videolist:description' => 'Descripción',
- 'videolist:video_url' => 'Copia aquí la URL del vídeo',
- 'videolist:error:no_save' => 'Ha habido un error mientras se guardaba el vídeo, por favor, pruebe en un momento',
- 'videolist:saved' => 'Tu vídeo ha sido guardado satisfactoriamente!',
- 'videolist_item:more' => 'Ver todos los vídeos',
- 'videolist_item:none' => 'No se han encontrado vídeos',
- 'videolist:deleted' => 'Tu vídeo ha sido borrado satisfactoriamente!',
- 'videolist:deletefailed' => 'Por desgracia, este vídeo no se puede borrar ahora mismo. Prueba más tarde',
- 'videolist:access_id' => '¿Quien puede ver que has añadido este vídeo?',
- 'item:object:videolist_item' => 'Vídeos',
- 'river:create:object:videolist_item' => '%s ha añadido el vídeo %s',
- 'river:comment:object:videolist_item' => '%s ha comentado en %s',
- 'videolist:delete:confirm' => 'Estás seguro de que quieres eliminar este vídeo?',
- 'videolist' => 'Mis Videos',
- 'videolist:home' => 'Vídeos de %s',
- 'videolist:new' => 'Añadir vídeos',
- 'videolist:find' => 'Vídeos de toda la red',
- 'videolist:search' => 'Buscar Vídeos',
- 'videolist:submit' => 'Aceptar',
- 'videolist:widget' => 'Mis Vídeos',
- 'videolist:widget:description' => 'Puedes compartir tu galería de vídeos personalizada con el resto de la red',
- 'videolist:num_videos' => 'Número de vídeos a mostrar',
- 'profile:videoheader' => 'Mis galería de Vídeos',
- 'videolist:tags' => 'Añadir etiquetas',
- 'videolist:browse' => 'Buscar vídeos de %s',
- 'videolist:browsemenu' => 'Buscar vídeos',
- 'videolist:title_search_tube' => 'Buscar vídeos en:',
- 'videolist:searchTubeVideos' => 'Buscar en youtube',
- 'videolist:comments' => 'Comentarios',
- 'videolist:commentspost' => 'Entrada',
- 'videolist:river:item' => 'un vídeo titulado:',
- 'videolist:river:created' => '%s ha añadido',
- 'videolist:group' => 'Vídeos',
- 'videolist:groupall' => 'Todos los vídeos del grupo',
- 'videolist:none' => 'El grupo no tiene vídeos subidos, o no tienes permiso para ver el contenido',
-);
-add_translation("es", $es);
+$spanish = array (
+ 'videolist' => 'Vídeos',
+ 'videolist:owner' => 'Vídeos de %s',
+ 'videolist:all' => 'Todos los vídeos',
+ 'videolist:group' => 'Vídeos del grupo',
+ 'groups:enablevideolist' => 'Habilitar vídeos del grupo',
+ 'videolist:delete' => 'Elimina el vídeo',
+ 'videolist:new' => 'Un nuevo vídeo',
+ 'videolist:notification' => '%s ha añadido este vídeo:
+
+%s
+%s
+
+Puedes verlo y comentar aquí:
+%s',
+ 'videolist:nogroup' => 'Este grupo aún no dispone de vídeos',
+ 'videolist:more' => 'Más vídeos',
+ 'river:update:object:videolist_item' => '%s ha actualizado el vídeo %s',
+ 'videolist:tags' => 'Añade etiquetas',
+ 'videolist:deletefailed' => 'Por desgracia, este vídeo no se puede borrar ahora mismo. Prueba más tarde.',
+ 'videolist:widget:description' => 'Puedes compartir tu galería de vídeos personalizada con el resto de la red.',
+ 'videolist:add' => 'Añade un vídeo',
+ 'videolist:friends' => 'Vídeos de amigos',
+ 'videolist:edit' => 'Edita el vídeo',
+ 'videolist:title' => 'Título',
+ 'videolist:description' => 'Descripción',
+ 'videolist:video_url' => 'Copia aquí la URL del vídeo',
+ 'videolist:error:no_save' => 'Ha habido un error mientras se guardaba el vídeo, por favor, pruebe en un momento',
+ 'videolist:saved' => 'Tu vídeo ha sido guardado satisfactoriamente!',
+ 'videolist:deleted' => 'Tu vídeo ha sido borrado satisfactoriamente!',
+ 'videolist:access_id' => '¿Quien puede ver que has añadido este vídeo?',
+ 'item:object:videolist_item' => 'Vídeos',
+ 'river:create:object:videolist_item' => '%s ha añadido el vídeo %s',
+ 'river:comment:object:videolist_item' => '%s ha comentado en %s',
+ 'videolist:delete:confirm' => 'Estás seguro de que quieres eliminar este vídeo?',
+ 'videolist:num_videos' => 'Número de vídeos a mostrar',
+ 'videolist:none' => 'El grupo no tiene vídeos subidos, o no tienes permiso para ver el contenido',
+);
+add_translation("es", $spanish);
diff --git a/pages/videolist/owner.php b/pages/videolist/owner.php
index 720281ee7..74917354e 100644
--- a/pages/videolist/owner.php
+++ b/pages/videolist/owner.php
@@ -29,7 +29,7 @@ if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$params['filter'] = '';
}
-$title = elgg_echo("videolist:user", array($page_owner->name));
+$title = elgg_echo("videolist:owner", array($page_owner->name));
// List videolist
$content = elgg_list_entities(array(
diff --git a/start.php b/start.php
index d6a5ee8b1..241d15aa8 100644
--- a/start.php
+++ b/start.php
@@ -46,9 +46,8 @@ function videolist_init() {
//add a widget
elgg_register_widget_type('videolist', elgg_echo('videolist'), elgg_echo('videolist:widget:description'));
- if (is_callable('register_notification_object')) {
- register_notification_object('object', 'videolist_item', elgg_echo('videolist:new'));
- }
+ // Register granular notification for this type
+ register_notification_object('object', 'videolist_item', elgg_echo('videolist:new'));
// Register entity type for search
elgg_register_entity_type('object', 'videolist_item');
diff --git a/views/default/page/elements/videolist_block.php b/views/default/page/elements/videolist_block.php
index 77ad75ab8..69f9394fb 100644
--- a/views/default/page/elements/videolist_block.php
+++ b/views/default/page/elements/videolist_block.php
@@ -22,7 +22,7 @@ $options = array(
);
if($container) {
- $title = elgg_echo('videolist:user', array($container->name));
+ $title = elgg_echo('videolist:owner', array($container->name));
} else {
$title = elgg_echo('videolist');
}
diff --git a/views/default/widgets/videolist/content.php b/views/default/widgets/videolist/content.php
index 2b8de92bf..aaf6076a3 100644
--- a/views/default/widgets/videolist/content.php
+++ b/views/default/widgets/videolist/content.php
@@ -23,10 +23,10 @@ if ($content) {
$url = "pages/owner/" . elgg_get_page_owner_entity()->username;
$more_link = elgg_view('output/url', array(
'href' => $url,
- 'text' => elgg_echo('videolist_item:more'),
+ 'text' => elgg_echo('videolist:more'),
'is_trusted' => true,
));
echo "$more_link ";
} else {
- echo elgg_echo('videolist_item:none');
+ echo elgg_echo('videolist:none');
}
--
cgit v1.2.3
From 647fc5b52bce0441f17d0810da8def69109a124b Mon Sep 17 00:00:00 2001
From: Sem
Date: Fri, 11 May 2012 02:22:53 +0200
Subject: Fixed unability to disable group videos bug.
---
start.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/start.php b/start.php
index 241d15aa8..9b7dd3084 100644
--- a/start.php
+++ b/start.php
@@ -40,7 +40,8 @@ function videolist_init() {
'height' => 400,
));
- // extend group main page
+ // add to groups
+ add_group_tool_option('videolist', elgg_echo('groups:enablevideolist'), true);
elgg_extend_view('groups/tool_latest', 'videolist/group_module');
//add a widget
--
cgit v1.2.3
From 7141da44e5aae888709b6db809025fa9015c3ef0 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 12 May 2012 06:21:48 +0200
Subject: Added french, galician and portugese languages.
---
languages/fr.php | 30 ++++++++++++++++++++++++++++++
languages/gl.php | 29 +++++++++++++++++++++++++++++
languages/pt.php | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 109 insertions(+)
create mode 100644 languages/fr.php
create mode 100644 languages/gl.php
create mode 100644 languages/pt.php
diff --git a/languages/fr.php b/languages/fr.php
new file mode 100644
index 000000000..293691969
--- /dev/null
+++ b/languages/fr.php
@@ -0,0 +1,30 @@
+
+
+ 'Mes videos',
+ 'videolist:home' => '%s \'s Videos',
+ 'videolist:new' => 'ajouter une video',
+ 'videolist:find' => 'toutes les videos',
+ 'videolist:search' => 'toutes les videos',
+ 'videolist:submit' => 'envoie',
+ 'videolist:widget' => 'Mes videos',
+ 'videolist:widget:description' => 'tes videos de youtube',
+ 'videolist:num_videos' => 'nombre de videos à afficher',
+ 'profile:videoheader' => 'ma galerie video',
+ 'videolist:tags' => 'ajoute des tags',
+ 'videolist:browse' => 'cherche des videos - %s',
+ 'videolist:browsemenu' => 'cherche des videos',
+ 'videolist:title_search_tube' => 'cherche des videos de',
+ 'videolist:searchTubeVideos' => 'cherche sur youtube.com',
+ 'videolist:comments' => 'commentaires',
+ 'videolist:commentspost' => 'poste',
+ 'videolist:river:item' => 'une video',
+ 'videolist:river:created' => '%s a ajouté',
+ 'videolist:group' => 'Videos',
+ 'videolist:groupall' => 'toutes les vidoes du groupe',
+ 'videolist:none' => 'ce groupe n\'as pas encore de videos',
+);
+
+add_translation("fr", $fr);
+
diff --git a/languages/gl.php b/languages/gl.php
new file mode 100644
index 000000000..90444e3fa
--- /dev/null
+++ b/languages/gl.php
@@ -0,0 +1,29 @@
+ 'Os meus vídeos',
+ 'videolist:home' => 'Vídeos de %s',
+ 'videolist:new' => 'Engadir vídeos',
+ 'videolist:find' => 'Vídeos de toda a rede',
+ 'videolist:search' => 'Procurar vídeos',
+ 'videolist:submit' => 'Aceptar',
+ 'videolist:widget' => 'Os meus vídeos',
+ 'videolist:widget:description' => 'Podes comparti-la túa galería de vídeos personalizada co resto da rede',
+ 'videolist:num_videos' => 'Número de vídeos a mostrar',
+ 'profile:videoheader' => 'As miñas galerías de vídeos',
+ 'videolist:tags' => 'Engadir etiquetas',
+ 'videolist:browse' => 'Procura-los vídeos de %s',
+ 'videolist:browsemenu' => 'Procurar vídeos',
+ 'videolist:title_search_tube' => 'Procurar vídeos en:',
+ 'videolist:searchTubeVideos' => 'Procurar en youtube',
+ 'videolist:comments' => 'Comentarios',
+ 'videolist:commentspost' => 'Entrada',
+ 'videolist:river:item' => 'un vídeo titulado:',
+ 'videolist:river:created' => '%s engadiu',
+ 'videolist:group' => 'Vídeos do grupo',
+ 'videolist:groupall' => 'Tódolos vídeos do grupo',
+ 'videolist:none' => 'O non hai vídeos subidos.',
+ 'videolist:edit' => 'Editar vídeo %s',
+);
+
+add_translation("gl", $gl);
+
diff --git a/languages/pt.php b/languages/pt.php
new file mode 100644
index 000000000..e8b28c182
--- /dev/null
+++ b/languages/pt.php
@@ -0,0 +1,50 @@
+ 'Meus vídeos',
+ 'videolist:home' => 'Vídeos de %s',
+ 'videolist:new' => 'Adicionar vídeo',
+ 'videolist:find' => 'Todos os vídeos',
+ 'videolist:search' => 'Todos os vídeos',
+ 'videolist:submit' => 'Publicar',
+ 'videolist:widget' => 'Meus Vídeos',
+ 'videolist:num_videos' => 'Número de visto a visualizar',
+ 'profile:videoheader' => 'Minha galeria de vídeos',
+ 'videolist:tags' => 'Adicionar etiquetas',
+ 'videolist:browse' => 'Procurar vídeos - %s',
+ 'videolist:browsemenu' => 'Procurar vídeos',
+ 'videolist:title_search_tube' => 'Procurar vídeos de',
+ 'videolist:searchTubeVideos' => 'Procurar no youtube',
+ 'videolist:comments' => 'Comentários',
+ 'videolist:commentspost' => 'Publicar',
+ 'videolist:river:item' => 'um video',
+ 'videolist:river:created' => 'adicionado por %s',
+ 'videolist:group' => 'Vídeos',
+ 'videolist:groupall' => 'Todos os vídeos do grupo',
+ 'videolist:none' => 'Este grupo ainda não tem vídeos',
+ 'videolist:user' => 'Vídeos de %s',
+ 'videolist:all' => 'Todos vídeos',
+ 'videolist:add' => 'Adicionar um vídeo',
+ 'videolist:play:video' => 'Tocar',
+ 'videolist:add:video' => 'Adicionar',
+ 'videolist:friends' => 'Vídeos dos amigos',
+ 'videolist:edit' => 'Editar vídeos',
+ 'videolist:ingroup' => 'na comunidade',
+ 'videolist:title' => 'Título',
+ 'videolist:description' => 'Descrição',
+ 'videolist:video_url' => 'Entrar um endereço do vídeo',
+ 'videolist:error:no_save' => 'Ocorreu um erro ao salvar o vídeo, por favor tente mais tarde',
+ 'videolist:saved' => 'Seu vídeo foi salvo com sucesso!',
+ 'videolist_item:more' => 'Ver todos vídeos',
+ 'videolist_item:none' => 'desculpe, nenhum vídeo foi encontrado',
+ 'videolist:deleted' => 'Seu vídeo foi removido com sucesso!',
+ 'videolist:deletefailed' => 'Infelizmente, este vídeo não pode ser removido agora. Por favor, tente mais tarde.',
+ 'videolist:widget:description' => 'Demonstre sua galeira de vídeos pessoas do youtube',
+ 'videolist:access_id' => 'Quem pode ver que você enviou este vídeo?',
+ 'item:object:videolist_item' => 'Vídeos',
+ 'river:create:object:videolist_item' => '%s adicionou o vídeo %s',
+ 'river:comment:object:videolist_item' => '%s comentou em %s',
+ 'videolist:delete:confirm' => 'Você tem certeza que deseja apagar este vídeo?',
+);
+
+add_translation("pt", $pt);
+
--
cgit v1.2.3
From cba9fdb1c72ff712f915da17abf68a8989fb265e Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 13 May 2012 07:03:28 +0200
Subject: Erased whitespaces before 'Mes videos',
--
cgit v1.2.3
From d2b3600e49bfac698042e39e6b6ac79124b1080e Mon Sep 17 00:00:00 2001
From: Sem
Date: Sun, 13 May 2012 07:14:24 +0200
Subject: It's time for beta 3.
---
manifest.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manifest.xml b/manifest.xml
index 2d5627dae..66914dd84 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -2,7 +2,7 @@
Videolist
Prateek Choudhary, Core developers, Lorea developers
- 1.8-beta2
+ 1.8-beta3
bundled
content
multimedia
--
cgit v1.2.3
From 3e44ab82c6e25d2ffe00cd23efffb32adffa2f78 Mon Sep 17 00:00:00 2001
From: Sem
Date: Sat, 6 Oct 2012 15:38:08 +0200
Subject: Added an unitary view to watch all videos.
---
views/default/object/videolist_item.php | 2 +-
views/default/videolist/watch.php | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
create mode 100644 views/default/videolist/watch.php
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index a1943216d..474394288 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -62,7 +62,7 @@ if (elgg_in_context('widgets')) {
if ($full && !elgg_in_context('gallery')) {
$dimensions = elgg_get_config('videolist_dimensions');
- $content = elgg_view("videolist/watch/{$entity->videotype}", array(
+ $content = elgg_view("videolist/watch", array(
'entity' => $entity,
'width' => (int) $dimensions['width'],
'height' => (int) $dimensions['height'],
diff --git a/views/default/videolist/watch.php b/views/default/videolist/watch.php
new file mode 100644
index 000000000..2e1dbacec
--- /dev/null
+++ b/views/default/videolist/watch.php
@@ -0,0 +1,8 @@
+videotype")) {
+ echo elgg_view("videolist/watch/$entity->videotype", $vars);
+} else {
+ echo elgg_view("videolist/watch/default", $vars);
+}
--
cgit v1.2.3
From d88344c667c996d9d25f5a1393321c675ce8f2f9 Mon Sep 17 00:00:00 2001
From: Pablo Martin
Date: Sat, 6 Oct 2012 19:22:27 +0200
Subject: fix upgrade script.
---
start.php | 8 +++-----
upgrades/2012022501.php | 26 ++++++++++++++++++--------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/start.php b/start.php
index 9b7dd3084..431015b24 100644
--- a/start.php
+++ b/start.php
@@ -313,10 +313,8 @@ function videolist_preprocess_url($hook, $type, $returnvalue, $params) {
/**
* Process upgrades for the videolist plugin
*/
-function videolist_run_upgrades() {
- $path = elgg_get_plugins_path() . 'videolist/upgrades/';
- $files = elgg_get_upgrade_files($path);
- foreach ($files as $file) {
- include "$path{$file}";
+function videolist_run_upgrades($event, $type, $details) {
+ if (include_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php')) {
+ upgrade_module_run('videolist');
}
}
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
index 50102e875..576aaba7d 100644
--- a/upgrades/2012022501.php
+++ b/upgrades/2012022501.php
@@ -7,7 +7,7 @@
$items = elgg_get_entities(array(
'type' => 'object',
- 'subtype' => 'videolist_item',
+ 'subtype' => 'videolist',
'limit' => 5,
'order_by' => 'e.time_created asc',
));
@@ -32,12 +32,9 @@ foreach ($items as $item) {
* @return bool
*/
function videolist_2012022501($item) {
+ require_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php');
- // do not upgrade videos that have already been upgraded
- if ($item->thumbnail === true) {
- return true;
- }
-
+ // get thumbnail image
$thumbnail = file_get_contents($item->thumbnail);
if (!$thumbnail) {
return false;
@@ -51,14 +48,27 @@ function videolist_2012022501($item) {
$filehandler->write($thumbnail);
$filehandler->close();
- $item->thumbnail = true;
+ // update properties
+ if ($item->url) {
+ $item->video_url = $item->url;
+ $item->deleteMetadata('url');
+ }
+ if ($item->desc) {
+ $item->description = $item->desc;
+ $item->deleteMetadata('desc');
+ $item->save();
+ }
+ if ($item->embedurl) {
+ $item->deleteMetadata('embedurl');
+ }
+ upgrade_change_subtype($item, 'videolist_item');
return true;
}
$previous_access = elgg_set_ignore_access(true);
$options = array(
'type' => 'object',
- 'subtype' => 'videolist_item',
+ 'subtype' => 'videolist',
'limit' => 0,
);
$batch = new ElggBatch('elgg_get_entities', $options, 'videolist_2012022501', 100);
--
cgit v1.2.3
From 34c2063a5e35817a2cb8a91ec7edd2a12fd0a57e Mon Sep 17 00:00:00 2001
From: Pablo Martin
Date: Sat, 6 Oct 2012 19:42:30 +0200
Subject: remove uneeded check.
---
upgrades/2012022501.php | 8 --------
1 file changed, 8 deletions(-)
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
index 576aaba7d..70f4398c4 100644
--- a/upgrades/2012022501.php
+++ b/upgrades/2012022501.php
@@ -17,14 +17,6 @@ if (!$items) {
return;
}
-// if all five of the items have empty thumbnails, we need to upgrade
-foreach ($items as $item) {
- if ($item->thumbnail === true) {
- return;
- }
-}
-
-
/**
* Downloads the thumbnail and saves into data folder
*
--
cgit v1.2.3
From cd216f6feae68146c8997a17c9fa37b674357b63 Mon Sep 17 00:00:00 2001
From: Pablo Martin
Date: Sat, 6 Oct 2012 21:01:26 +0200
Subject: upgrade river
---
upgrades/2012022501.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
index 70f4398c4..e109406d6 100644
--- a/upgrades/2012022501.php
+++ b/upgrades/2012022501.php
@@ -54,6 +54,16 @@ function videolist_2012022501($item) {
$item->deleteMetadata('embedurl');
}
upgrade_change_subtype($item, 'videolist_item');
+
+ // update river
+ $options = array('object_guid' => $item->guid);
+ $river_items = elgg_get_river($options);
+ foreach($river_items as $river_item) {
+ if ($river_item->action_type == 'create') {
+ upgrade_update_river($river_item->id, 'river/object/videolist_item/create', $item->guid, 0);
+ }
+ }
+
return true;
}
--
cgit v1.2.3
From a9a7473734a5948decb5d87f18901404e3ea17d5 Mon Sep 17 00:00:00 2001
From: Sem
Date: Fri, 12 Oct 2012 01:57:02 +0200
Subject: Changed languages.
---
languages/en.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/languages/en.php b/languages/en.php
index 04a9355bf..d357725a7 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -15,7 +15,7 @@ $english = array(
'videolist:owner' => "%s's videos",
'videolist:friends' => "Friends' videos",
'videolist:all' => "All site videos",
- 'videolist:add' => "Add video",
+ 'videolist:add' => "Add a video",
'videolist:group' => "Group videos",
'groups:enablevideolist' => 'Enable group videos',
@@ -23,7 +23,7 @@ $english = array(
'videolist:edit' => "Edit this video",
'videolist:delete' => "Delete this video",
- 'videolist:new' => "A new video",
+ 'videolist:new' => "Add a video",
'videolist:notification' =>
'%s added a new video:
--
cgit v1.2.3
From c02bb30c3539587511bd866efbb00ce33b0ba853 Mon Sep 17 00:00:00 2001
From: Sem
Date: Fri, 12 Oct 2012 18:21:00 +0200
Subject: Updated languages.
---
languages/ca.php | 40 +++++++++++++++++++++++++++++++++
languages/es.php | 68 +++++++++++++++++++++++++++-----------------------------
2 files changed, 73 insertions(+), 35 deletions(-)
create mode 100644 languages/ca.php
diff --git a/languages/ca.php b/languages/ca.php
new file mode 100644
index 000000000..289c1f44a
--- /dev/null
+++ b/languages/ca.php
@@ -0,0 +1,40 @@
+ 'Vídeos',
+ 'videolist:owner' => 'Vídeos de %s',
+ 'videolist:friends' => 'Vídeos dels amics',
+ 'videolist:all' => 'Tots els vídeos',
+ 'videolist:add' => 'Afegir vídeo',
+ 'videolist:group' => 'Vídeos del grup',
+ 'groups:enablevideolist' => 'Activar vídeos del grup',
+ 'videolist:edit' => 'Edita aquest vídeo',
+ 'videolist:delete' => 'Esborra aquest vídeo',
+ 'videolist:new' => 'Un nou vídeo',
+ 'videolist:notification' => '%s ha afegit un nou vídeo
+
+%s
+%s
+
+Veure i comentar al nou vídeo:
+%s',
+ 'videolist:delete:confirm' => 'Estàs segur de voler esborrar aquest vídeo?',
+ 'item:object:videolist_item' => 'Vídeo',
+ 'videolist:nogroup' => 'Aquest grup no té cap vídeo encara',
+ 'videolist:more' => 'Més vídeos',
+ 'videolist:none' => 'No hi ha cap vídeo',
+ 'river:create:object:videolist_item' => '%s ha creat el vídeo %s',
+ 'river:update:object:videolist_item' => '% ha actualitzat el vídeo %s',
+ 'river:comment:object:videolist_item' => '%s ha comentat al vídeo titulat %s',
+ 'videolist:title' => 'Títol',
+ 'videolist:description' => 'Descripció',
+ 'videolist:video_url' => 'Escriu la URL del vídeo',
+ 'videolist:access_id' => 'Qui pot veure que has penjat aquest vídeo?',
+ 'videolist:tags' => 'Afegir etiquetes',
+ 'videolist:error:no_save' => 'Hi ha hagut un error desant el vídeo, si us plau intenta-ho d\'aquí a una estona',
+ 'videolist:saved' => 'El teu vídeo s\'ha desat correctament!',
+ 'videolist:deleted' => 'El teu vídeo s\'ha esborrat correctament!',
+ 'videolist:deletefailed' => 'Malauradament, aquest vídeo no es pot esborrar ara. Si us plau, intenta-ho més tard',
+ 'videolist:num_videos' => 'Nombre de vídeos a mostrar',
+ 'videolist:widget:description' => 'La teva llista de reproducció de vídeos.',
+);
+add_translation("ca", $language);
\ No newline at end of file
diff --git a/languages/es.php b/languages/es.php
index d52a40d78..ad8cbe46c 100644
--- a/languages/es.php
+++ b/languages/es.php
@@ -1,42 +1,40 @@
'Vídeos',
- 'videolist:owner' => 'Vídeos de %s',
- 'videolist:all' => 'Todos los vídeos',
- 'videolist:group' => 'Vídeos del grupo',
- 'groups:enablevideolist' => 'Habilitar vídeos del grupo',
- 'videolist:delete' => 'Elimina el vídeo',
- 'videolist:new' => 'Un nuevo vídeo',
- 'videolist:notification' => '%s ha añadido este vídeo:
+$language = array (
+ 'videolist' => 'Vídeos',
+ 'videolist:owner' => 'vídeos de %s',
+ 'videolist:friends' => 'Vídeos de amigos',
+ 'videolist:all' => 'Todos los vídeos',
+ 'videolist:add' => 'Añadir vídeo',
+ 'videolist:group' => 'Vídeos del grupo',
+ 'groups:enablevideolist' => 'Habilitar vídeos de grupo',
+ 'videolist:edit' => 'Editar este vídeo',
+ 'videolist:delete' => 'Eliminar este vídeo',
+ 'videolist:new' => 'Nuevo vídeo',
+ 'videolist:notification' => '%s ha añadido un nuevo vídeo:
%s
%s
-Puedes verlo y comentar aquí:
+Ver y comentar el nuevo vídeo:
%s',
- 'videolist:nogroup' => 'Este grupo aún no dispone de vídeos',
- 'videolist:more' => 'Más vídeos',
- 'river:update:object:videolist_item' => '%s ha actualizado el vídeo %s',
- 'videolist:tags' => 'Añade etiquetas',
- 'videolist:deletefailed' => 'Por desgracia, este vídeo no se puede borrar ahora mismo. Prueba más tarde.',
- 'videolist:widget:description' => 'Puedes compartir tu galería de vídeos personalizada con el resto de la red.',
- 'videolist:add' => 'Añade un vídeo',
- 'videolist:friends' => 'Vídeos de amigos',
- 'videolist:edit' => 'Edita el vídeo',
- 'videolist:title' => 'Título',
- 'videolist:description' => 'Descripción',
- 'videolist:video_url' => 'Copia aquí la URL del vídeo',
- 'videolist:error:no_save' => 'Ha habido un error mientras se guardaba el vídeo, por favor, pruebe en un momento',
- 'videolist:saved' => 'Tu vídeo ha sido guardado satisfactoriamente!',
- 'videolist:deleted' => 'Tu vídeo ha sido borrado satisfactoriamente!',
- 'videolist:access_id' => '¿Quien puede ver que has añadido este vídeo?',
- 'item:object:videolist_item' => 'Vídeos',
- 'river:create:object:videolist_item' => '%s ha añadido el vídeo %s',
- 'river:comment:object:videolist_item' => '%s ha comentado en %s',
- 'videolist:delete:confirm' => 'Estás seguro de que quieres eliminar este vídeo?',
- 'videolist:num_videos' => 'Número de vídeos a mostrar',
- 'videolist:none' => 'El grupo no tiene vídeos subidos, o no tienes permiso para ver el contenido',
+ 'videolist:delete:confirm' => 'Estas seguro de que quieres eliminar este vídeo?',
+ 'item:object:videolist_item' => 'Vídeo',
+ 'videolist:nogroup' => 'Este grupo no tiene ningún video todavía',
+ 'videolist:more' => 'Más videos',
+ 'videolist:none' => 'No hay videos colgados.',
+ 'river:create:object:videolist_item' => '%s ha creado el video %s',
+ 'river:update:object:videolist_item' => '%s ha actualizado el video %s',
+ 'river:comment:object:videolist_item' => '%s ha comentado en el video titulado %s',
+ 'videolist:title' => 'Título',
+ 'videolist:description' => 'Descripción',
+ 'videolist:video_url' => 'URL del video',
+ 'videolist:access_id' => 'Quien puede ver que has colgado el video?',
+ 'videolist:tags' => 'Añadir etiquetas',
+ 'videolist:error:no_save' => 'Ha habido un error guardando el video, por favor inténtalo más tarde',
+ 'videolist:saved' => '¡Tu video se ha guardado correctamente!',
+ 'videolist:deleted' => '¡Tu video se ha borrado correctamente!',
+ 'videolist:deletefailed' => 'Desafortunadamente este video no se puede borrar ahora. Por favor inténtalo más tarde de nuevo',
+ 'videolist:num_videos' => 'Número de videos a mostrar',
+ 'videolist:widget:description' => 'Tu lista personal de reproducción de videos.',
);
-
-add_translation("es", $spanish);
+add_translation("es", $language);
\ No newline at end of file
--
cgit v1.2.3
From 148139db47cc43c9a651a841073a53bd4b503b38 Mon Sep 17 00:00:00 2001
From: Pablo Martin
Date: Tue, 23 Oct 2012 08:50:54 +0000
Subject: fix checking for checked thumbnail.
---
upgrades/2012022501.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
index 50102e875..4118744ed 100644
--- a/upgrades/2012022501.php
+++ b/upgrades/2012022501.php
@@ -34,7 +34,7 @@ foreach ($items as $item) {
function videolist_2012022501($item) {
// do not upgrade videos that have already been upgraded
- if ($item->thumbnail === true) {
+ if ($item->thumbnail === 1) {
return true;
}
@@ -51,7 +51,7 @@ function videolist_2012022501($item) {
$filehandler->write($thumbnail);
$filehandler->close();
- $item->thumbnail = true;
+ $item->thumbnail = 1;
return true;
}
--
cgit v1.2.3
From 22d34250d0f9d19c9da0c1c5742466f0b516284f Mon Sep 17 00:00:00 2001
From: Pablo Martin
Date: Mon, 5 Nov 2012 07:59:28 +0000
Subject: upgrade fixes
---
upgrades/2012022501.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/upgrades/2012022501.php b/upgrades/2012022501.php
index e109406d6..f832c8033 100644
--- a/upgrades/2012022501.php
+++ b/upgrades/2012022501.php
@@ -66,7 +66,6 @@ function videolist_2012022501($item) {
return true;
}
-
$previous_access = elgg_set_ignore_access(true);
$options = array(
'type' => 'object',
--
cgit v1.2.3
From 5a051b09c63a5d2b58e4cd7d93cdf747181a60b1 Mon Sep 17 00:00:00 2001
From: Sem
Date: Wed, 11 Sep 2013 07:14:37 +0200
Subject: Version 1.8
---
manifest.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/manifest.xml b/manifest.xml
index 66914dd84..c85e28175 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -2,13 +2,13 @@
Videolist
Prateek Choudhary, Core developers, Lorea developers
- 1.8-beta3
- bundled
+ 1.8
+ lorea
content
multimedia
This plugin allows users to create a library of videos.
- http://lorea.cc/
- (C) prateek.choudhary 2008-09, Elgg 2010, Lorea 2011
+ https://lorea.org/
+ (C) Prateek Choudhary 2008-09, Elgg 2010, Lorea 2011-13
GNU Public License version 2
elgg_release
--
cgit v1.2.3
From 24e097f126aee59206c7f44e2b37b915d85dfd23 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 7 Nov 2013 03:19:39 +0100
Subject: Setting responsive dimensions.
---
start.php | 5 -----
views/default/object/videolist_item.php | 7 +------
views/default/videolist/css.php | 17 +++++++++++++++--
views/default/videolist/watch/bliptv.php | 4 +---
views/default/videolist/watch/gisstv.php | 4 +---
views/default/videolist/watch/metacafe.php | 4 +---
views/default/videolist/watch/vimeo.php | 4 +---
views/default/videolist/watch/youtube.php | 4 +---
8 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/start.php b/start.php
index 431015b24..877992b1a 100644
--- a/start.php
+++ b/start.php
@@ -34,11 +34,6 @@ function videolist_init() {
'tags' => 'tags',
'access_id' => 'access',
));
-
- elgg_set_config('videolist_dimensions', array(
- 'width' => 600,
- 'height' => 400,
- ));
// add to groups
add_group_tool_option('videolist', elgg_echo('groups:enablevideolist'), true);
diff --git a/views/default/object/videolist_item.php b/views/default/object/videolist_item.php
index 474394288..5789c8475 100644
--- a/views/default/object/videolist_item.php
+++ b/views/default/object/videolist_item.php
@@ -61,12 +61,7 @@ if (elgg_in_context('widgets')) {
if ($full && !elgg_in_context('gallery')) {
- $dimensions = elgg_get_config('videolist_dimensions');
- $content = elgg_view("videolist/watch", array(
- 'entity' => $entity,
- 'width' => (int) $dimensions['width'],
- 'height' => (int) $dimensions['height'],
- ));
+ $content = elgg_view("videolist/watch", $vars);
$content = "$content
";
$params = array(
diff --git a/views/default/videolist/css.php b/views/default/videolist/css.php
index 931d80567..625935451 100644
--- a/views/default/videolist/css.php
+++ b/views/default/videolist/css.php
@@ -5,6 +5,19 @@
?>
.videolist-watch {
- margin-top: 40px;
- margin-left: 20px;
+ margin-top: 40px;
+ position: relative;
+ padding-bottom: 56.25%;
+ padding-top: 30px;
+ height: 0;
}
+
+.videolist-watch iframe,
+.videolist-watch object,
+.videolist-watch embed {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+}
\ No newline at end of file
diff --git a/views/default/videolist/watch/bliptv.php b/views/default/videolist/watch/bliptv.php
index b7f72dea6..241cf791b 100644
--- a/views/default/videolist/watch/bliptv.php
+++ b/views/default/videolist/watch/bliptv.php
@@ -1,7 +1,5 @@
embedurl;
-$width = $vars['width'];
-$height = $vars['height'];
-echo "";
+echo "";
diff --git a/views/default/videolist/watch/gisstv.php b/views/default/videolist/watch/gisstv.php
index 15a903ab1..a96894ada 100644
--- a/views/default/videolist/watch/gisstv.php
+++ b/views/default/videolist/watch/gisstv.php
@@ -1,9 +1,7 @@
video_id;
-$width = $vars['width'];
-$height = $vars['height'];
-echo "
+echo "
";
diff --git a/views/default/videolist/watch/metacafe.php b/views/default/videolist/watch/metacafe.php
index ddf2b155e..40b632cf6 100644
--- a/views/default/videolist/watch/metacafe.php
+++ b/views/default/videolist/watch/metacafe.php
@@ -1,7 +1,5 @@
embedurl;
-$width = $vars['width'];
-$height = $vars['height'];
-echo " ";
+echo " ";
diff --git a/views/default/videolist/watch/vimeo.php b/views/default/videolist/watch/vimeo.php
index 97b5e8d88..d3ffd4391 100644
--- a/views/default/videolist/watch/vimeo.php
+++ b/views/default/videolist/watch/vimeo.php
@@ -1,7 +1,5 @@
video_id;
-$width = $vars['width'];
-$height = $vars['height'];
-echo "";
+echo "";
diff --git a/views/default/videolist/watch/youtube.php b/views/default/videolist/watch/youtube.php
index e0b2ece06..b0b758718 100644
--- a/views/default/videolist/watch/youtube.php
+++ b/views/default/videolist/watch/youtube.php
@@ -1,7 +1,5 @@
video_id;
-$width = $vars['width'];
-$height = $vars['height'];
-echo "";
+echo "";
--
cgit v1.2.3
From b02119c597a1d806e7910e63ba20139234249fa0 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 7 Nov 2013 04:50:54 +0100
Subject: Using https instead http.
---
lib/Videolist/Platform/Bliptv.php | 2 +-
lib/Videolist/Platform/Metacafe.php | 2 +-
lib/Videolist/Platform/Vimeo.php | 2 +-
lib/Videolist/Platform/Youtube.php | 4 ++--
start.php | 2 +-
views/default/videolist/watch/bliptv.php | 1 +
views/default/videolist/watch/metacafe.php | 1 +
views/default/videolist/watch/vimeo.php | 2 +-
8 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/lib/Videolist/Platform/Bliptv.php b/lib/Videolist/Platform/Bliptv.php
index aa53032f9..62cefbd39 100644
--- a/lib/Videolist/Platform/Bliptv.php
+++ b/lib/Videolist/Platform/Bliptv.php
@@ -25,7 +25,7 @@ class Videolist_Platform_Bliptv implements Videolist_PlatformInterface
{
$video_id = $parsed['video_id'];
- $buffer = file_get_contents('http://blip.tv'.$video_id.'?skin=rss');
+ $buffer = file_get_contents('https://blip.tv'.$video_id.'?skin=rss');
$xml = new SimpleXMLElement($buffer);
return array(
diff --git a/lib/Videolist/Platform/Metacafe.php b/lib/Videolist/Platform/Metacafe.php
index 7da6d1647..74a346b34 100644
--- a/lib/Videolist/Platform/Metacafe.php
+++ b/lib/Videolist/Platform/Metacafe.php
@@ -25,7 +25,7 @@ class Videolist_Platform_Metacafe implements Videolist_PlatformInterface
{
$video_id = $parsed['video_id'];
- $buffer = file_get_contents("http://www.metacafe.com/api/item/$video_id");
+ $buffer = file_get_contents("https://www.metacafe.com/api/item/$video_id");
$xml = new SimpleXMLElement($buffer);
return array(
diff --git a/lib/Videolist/Platform/Vimeo.php b/lib/Videolist/Platform/Vimeo.php
index a4a1f275c..6930cdb2d 100644
--- a/lib/Videolist/Platform/Vimeo.php
+++ b/lib/Videolist/Platform/Vimeo.php
@@ -25,7 +25,7 @@ class Videolist_Platform_Vimeo implements Videolist_PlatformInterface
{
$video_id = $parsed['video_id'];
- $buffer = file_get_contents("http://vimeo.com/api/v2/video/$video_id.xml");
+ $buffer = file_get_contents("https://vimeo.com/api/v2/video/$video_id.xml");
$xml = new SimpleXMLElement($buffer);
$videos = $xml->children();
diff --git a/lib/Videolist/Platform/Youtube.php b/lib/Videolist/Platform/Youtube.php
index d5a388356..31a4bc950 100644
--- a/lib/Videolist/Platform/Youtube.php
+++ b/lib/Videolist/Platform/Youtube.php
@@ -37,13 +37,13 @@ class Videolist_Platform_Youtube implements Videolist_PlatformInterface
{
$video_id = $parsed['video_id'];
- $buffer = file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id);
+ $buffer = file_get_contents('https://gdata.youtube.com/feeds/api/videos/'.$video_id);
$xml = new SimpleXMLElement($buffer);
return array(
'title' => $xml->title,
'description' => strip_tags($xml->content),
- 'thumbnail' => "http://img.youtube.com/vi/$video_id/default.jpg",
+ 'thumbnail' => "https://img.youtube.com/vi/$video_id/default.jpg",
);
}
}
diff --git a/start.php b/start.php
index 877992b1a..2094ffacc 100644
--- a/start.php
+++ b/start.php
@@ -300,7 +300,7 @@ function videolist_preprocess_url($hook, $type, $returnvalue, $params) {
$parsed = parse_url($returnvalue);
if (empty($parsed['host']) && ! empty($parsed['path']) && $parsed['path'][0] !== '/') {
// user probably forgot scheme
- $returnvalue = 'http://' . $returnvalue;
+ $returnvalue = 'https://' . $returnvalue;
}
return $returnvalue;
}
diff --git a/views/default/videolist/watch/bliptv.php b/views/default/videolist/watch/bliptv.php
index 241cf791b..ae3d75901 100644
--- a/views/default/videolist/watch/bliptv.php
+++ b/views/default/videolist/watch/bliptv.php
@@ -1,5 +1,6 @@
embedurl;
+$embedurl = preg_replace('/https?:/', 'https:', $embedurl);
echo "";
diff --git a/views/default/videolist/watch/metacafe.php b/views/default/videolist/watch/metacafe.php
index 40b632cf6..ce8e257d5 100644
--- a/views/default/videolist/watch/metacafe.php
+++ b/views/default/videolist/watch/metacafe.php
@@ -1,5 +1,6 @@
embedurl;
+$embedurl = preg_replace('/https?:/', 'https:', $embedurl);
echo " ";
diff --git a/views/default/videolist/watch/vimeo.php b/views/default/videolist/watch/vimeo.php
index d3ffd4391..cdb4b6bfb 100644
--- a/views/default/videolist/watch/vimeo.php
+++ b/views/default/videolist/watch/vimeo.php
@@ -2,4 +2,4 @@
$video_id = $vars['entity']->video_id;
-echo "";
+echo "";
--
cgit v1.2.3
From 3ea9610796770bb2ba54d3c8c0f465a22eb9e3c8 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 7 Nov 2013 06:01:06 +0100
Subject: Making video thumbnails faster (thanks to ura soul).
---
start.php | 37 ++++++++++++++++++----------
thumbnail.php | 77 ++++++++++++++++++++++++++++++++++++++++-------------------
2 files changed, 78 insertions(+), 36 deletions(-)
diff --git a/start.php b/start.php
index 2094ffacc..6f94b97d0 100644
--- a/start.php
+++ b/start.php
@@ -270,22 +270,35 @@ function videolist_embed_get_items($hook, $type, $value, $params) {
* @return string Relative URL
*/
function videolist_icon_url_override($hook, $type, $returnvalue, $params) {
- $videolist_item = $params['entity'];
- /* @var ElggObject $videolist_item */
- $size = $params['size'];
- if($videolist_item->getSubtype() != 'videolist_item'){
- return $returnvalue;
- }
-
- // tiny thumbnails are too small to be useful, so give a generic video icon
- if ($size != 'tiny' && isset($videolist_item->thumbnail)) {
- return elgg_get_site_url() . "mod/videolist/thumbnail.php?guid=" . $videolist_item->guid;
+ // if someone already set this, quit
+ if ($return_value) {
+ return null;
}
- if (in_array($size, array('tiny', 'small', 'medium'))){
- return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ $videolist_item = $params['entity'];
+ $size = $params['size'];
+
+ if (!elgg_instanceof($videolist_item, 'object', 'videolist_item')) {
+ return null;
}
+
+ // tiny thumbnails are too small to be useful, so give a generic video icon
+ try {
+ if ($size != 'tiny' && isset($videolist_item->thumbnail)) {
+ $owner = $videolist_item->getOwnerEntity();
+ $owner_guid = $owner->getGUID();
+ $join_date = $owner->getTimeCreated();
+ return "mod/videolist/thumbnail.php?joindate=$join_date&guid={$videolist_item->guid}&owner_guid=$owner_guid&size=$size";
+ }
+ } catch (InvalidParameterException $e) {
+ elgg_log("Unable to get videolist icon for video with GUID {$videolist_item->guid}", 'ERROR');
+ return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ }
+ if (in_array($size, array('tiny', 'small', 'medium'))){
+ return "mod/videolist/graphics/videolist_icon_{$size}.png";
+ }
+ return null;
}
/**
diff --git a/thumbnail.php b/thumbnail.php
index bd93f8e63..7a4ca8b6c 100644
--- a/thumbnail.php
+++ b/thumbnail.php
@@ -1,35 +1,64 @@
getSubtype() != "videolist_item") {
+// won't be able to serve anything if no joindate or guid
+if (!isset($_GET['joindate']) || !isset($_GET['guid'])) {
+ header("HTTP/1.1 404 Not Found");
exit;
}
-$readfile = new ElggFile();
-$readfile->owner_guid = $item->owner_guid;
-$readfile->setFilename("videolist/{$item->guid}.jpg");
-$contents = $readfile->grabFile();
+$join_date = (int)$_GET['joindate'];
+$owner_guid = (int)$_GET['owner_guid'];
+$guid = (int)$_GET['guid'];
+
+$mysql_dblink = @mysql_connect($CONFIG->dbhost, $CONFIG->dbuser, $CONFIG->dbpass, true);
+if ($mysql_dblink) {
+ if (@mysql_select_db($CONFIG->dbname, $mysql_dblink)) {
+ $result = mysql_query("select name, value from {$CONFIG->dbprefix}datalists where name='dataroot'", $mysql_dblink);
+ if ($result) {
+ $row = mysql_fetch_object($result);
+ while ($row) {
+ if ($row->name == 'dataroot') {
+ $data_root = $row->value;
+ }
+ $row = mysql_fetch_object($result);
+ }
+ }
+
+ @mysql_close($mysql_dblink);
+
+ if (isset($data_root)) {
-// caching images for 10 days
-header("Content-type: image/jpeg");
-header('Expires: ' . date('r',time() + 864000));
-header("Pragma: public", true);
-header("Cache-Control: public", true);
-header("Content-Length: " . strlen($contents));
+ // this depends on ElggDiskFilestore::makeFileMatrix()
+ $user_path = date('Y/m/d/', $join_date) . $owner_guid;
-echo $contents;
-exit;
+ $filename = "$data_root$user_path/videolist/{$guid}.jpg";
+ $size = @filesize($filename);
+ if ($size) {
+ header("Content-type: image/jpeg");
+ header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true);
+ header("Pragma: public");
+ header("Cache-Control: public");
+ header("Content-Length: $size");
+ readfile($filename);
+ exit;
+ }
+ }
+ }
+
+}
+
+// something went wrong so load engine and try to forward to default icon
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+elgg_log("Profile icon direct failed.", "WARNING");
+forward("mod/videolist/graphics/videolist_icon_{$size}.png");
--
cgit v1.2.3
From c4d2081ecbd7e58c3a684c77ef18a675e534a153 Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 7 Nov 2013 06:13:49 +0100
Subject: Do not display watching video in sidebar (thanks to ura soul).
---
views/default/page/elements/videolist_block.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/views/default/page/elements/videolist_block.php b/views/default/page/elements/videolist_block.php
index 69f9394fb..a0653a09e 100644
--- a/views/default/page/elements/videolist_block.php
+++ b/views/default/page/elements/videolist_block.php
@@ -8,6 +8,7 @@
* @uses $vars['limit'] The number of comments to display
*/
+$entity_guid = get_input('guid', ELGG_ENTITIES_ANY_VALUE);
$container_guid = elgg_extract('container_guid', $vars, ELGG_ENTITIES_ANY_VALUE);
$container = get_entity($container_guid);
@@ -19,6 +20,7 @@ $options = array(
'subtypes' => 'videolist_item',
'full_view' => false,
'pagination' => false,
+ 'wheres' => array('guid <> ' . $entity_guid), // exclude this item from list.
);
if($container) {
--
cgit v1.2.3
From ee6387863810b553c876162136b2ac96ee9f512f Mon Sep 17 00:00:00 2001
From: Sem
Date: Thu, 7 Nov 2013 06:23:48 +0100
Subject: Bumped to 1.8.1
---
manifest.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/manifest.xml b/manifest.xml
index c85e28175..08539650a 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -2,7 +2,7 @@
Videolist
Prateek Choudhary, Core developers, Lorea developers
- 1.8
+ 1.8.1
lorea
content
multimedia
--
cgit v1.2.3
From 17d7adcb317d25e37d3091e94b66e3f16de54196 Mon Sep 17 00:00:00 2001
From: Sem
Date: Fri, 8 Nov 2013 02:58:43 +0100
Subject: Added changes and .gitignore files.
---
.gitignore | 15 +++++++++++++++
CHANGES.txt | 14 ++++++++++++++
2 files changed, 29 insertions(+)
create mode 100644 .gitignore
create mode 100644 CHANGES.txt
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..339142537
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+# ignore IDE/hidden/testing/OS cache files
+.*
+*~
+/nbproject
+/nb-configuration.xml
+Session.vim
+*.tmproj
+*.tmproject
+tmtags
+Thumbs.db
+Desktop.ini
+/JsTestDriver-*.jar
+
+# don't ignore travis config
+!/.travis.yml
diff --git a/CHANGES.txt b/CHANGES.txt
new file mode 100644
index 000000000..9a55a443f
--- /dev/null
+++ b/CHANGES.txt
@@ -0,0 +1,14 @@
+Version 1.8.1
+(November 8, 2013 from https://github.com/lorea/videolist.git)
+
+ Enhancements
+ * Setting responsive dimensions.
+ * Making video thumbnails faster (thanks to ura soul).
+ * Do not display watching video in sidebar (thanks to ura soul).
+
+ Bugfixes
+ * Using https instead http in embeded videos.
+
+Version 1.8.0 (Foxglove)
+(September 13th, 2013 from git://github.com/lorea/videolist.git)
+
--
cgit v1.2.3