-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
- \r
-// Make sure we're logged in (send us to the front page if not)\r
-gatekeeper();\r
-\r
-// Get the current page's owner \r
-set_page_owner($_SESSION['container_guid']);\r
-\r
-$page_owner = page_owner_entity();\r
-\r
-if ($page_owner === false || is_null($page_owner)) {\r
- $page_owner = $_SESSION['user'];\r
- set_page_owner($_SESSION['guid']);\r
-}\r
-\r
-if($page_owner->type == "group")\r
- $entity_referer = $page_owner->type.":".$page_owner->getGUID();\r
-else \r
- $entity_referer = $page_owner->username;\r
-\r
-require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");\r
-\r
-function fetchyoutubeDatatitle($videoid){\r
- $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);\r
- /**\r
- ** generate XML View \r
- **/\r
- $xml_buffer = new SimpleXMLElement($buffer);\r
- $vidDataTitle = $xml_buffer->video_details->title;\r
- return $vidDataTitle; \r
- //return ""; \r
-}\r
-\r
-function fetchyoutubeDatadesc($videoid){\r
- $buffer = file_get_contents('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id='.$videoid);\r
- /**\r
- ** generate XML View \r
- **/\r
- $xml_buffer = new SimpleXMLElement($buffer);\r
- $vidDataDesc = $xml_buffer->video_details->description;\r
- return $vidDataDesc; \r
- //return ""; \r
-}\r
-\r
-function getVimeoInfoDataTitle($iGetVideoId){\r
- // Now lets do the search query. We will get an response object containing everything we need\r
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);\r
- // We want the result videos as an array of objects\r
- $aoVideos = $oResponse->getVideo();\r
- $title = $aoVideos->getTitle();\r
- return $title;\r
-}\r
-\r
-function getVimeoInfoDataDesc($iGetVideoId){\r
- // Now lets do the search query. We will get an response object containing everything we need\r
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);\r
- // We want the result videos as an array of objects\r
- $aoVideos = $oResponse->getVideo();\r
- $description = $aoVideos->getCaption();\r
- return $description;\r
-}\r
-\r
-function getVimeoInfoImage($iGetVideoId){\r
- // Now lets do the search query. We will get an response object containing everything we need\r
- $oResponse = VimeoVideosRequest::getInfo($iGetVideoId);\r
- // We want the result videos as an array of objects\r
- $aoVideos = $oResponse->getVideo();\r
- //get all thumbnails\r
-\r
- $aThumbnails = array();\r
- foreach($aoVideos->getThumbnails() as $oThumbs) {\r
- $aThumbnails[] = $oThumbs->getImageContent();\r
- }\r
- \r
- foreach($aThumbnails as $thumbnailArray){\r
- $thumbnail = $thumbnailArray;\r
- break;\r
- }\r
- \r
- return $thumbnail;\r
-}\r
-\r
-function fetchyoutubeDatathumbnail($videoId){\r
- $thumbnail = "http://img.youtube.com/vi/".$videoId."/default.jpg";\r
- return $thumbnail;\r
-}\r
-\r
-function metacafeFetchData($getVideoId){\r
- $feedURL = "http://www.metacafe.com/api/item/".$getVideoId;\r
- $sxml = new DomDocument;\r
- $sxml->load($feedURL);\r
- $myitem = $sxml->getElementsByTagName('item');\r
- return $myitem;\r
-}\r
-\r
-function fetchmetacafeTitle($getVideoId){\r
- $myitem = metacafeFetchData($getVideoId);\r
- foreach($myitem as $searchNode){\r
- $xmlTitle = $searchNode->getElementsByTagName("title");\r
- $valueTitle = $xmlTitle->item(0)->nodeValue; \r
- }\r
- return $valueTitle;\r
-}\r
-\r
-function fetchmetacafeDesc($getVideoId){\r
- $myitem = metacafeFetchData($getVideoId);\r
- foreach($myitem as $searchNode){\r
- $xmlDesc = $searchNode->getElementsByTagName("description");\r
- $valueDesc = $xmlDesc->item(0)->nodeValue;\r
- $ot = "<p>";\r
- $ct = "</p>";\r
- $string = trim($valueDesc);\r
- $start = intval(strpos($string, $ot) + strlen($ot));\r
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start)); \r
- }\r
- return $desc_src;\r
-}\r
-\r
-function fetchmetacafeImg($getVideoId){\r
- $myitem = metacafeFetchData($getVideoId);\r
- foreach($myitem as $searchNode){\r
- $xmlDesc = $searchNode->getElementsByTagName("description");\r
- $valueDesc = $xmlDesc->item(0)->nodeValue;\r
- $pattern = '/<img[^>]+src[\\s=\'"]';\r
- $pattern .= '+([^"\'>\\s]+)/is';\r
- if(preg_match($pattern,$valueDesc,$match)){\r
- $thumbnail = $match[1];\r
- }\r
- }\r
- return $thumbnail;\r
-}\r
-\r
- $pageContainer = $_SESSION['Pagecontainer'];\r
-\r
- \r
- // Initialise a new ElggObject\r
- $videolist = new ElggObject();\r
- // Tell the system it's a blog post\r
- $videolist->subtype = "videolist";\r
- // Set its owner to the current user\r
- $videolist->owner_guid = $_SESSION['user']->getGUID();\r
- \r
- // Set container of the video whether it was uploaded to groups or profile\r
- $videolist->container_guid = $_SESSION['container_guid'];\r
- // For now, set its access to public (we'll add an access dropdown shortly)\r
- $videolist->access_id = $_SESSION['candidate_profile_video_access_id'];\r
- \r
- // In order to Set its title and description appropriately WE need the video ID\r
- $videolist->url = $_SESSION['candidate_profile_video'];\r
- \r
- if($pageContainer == "youtube"){\r
- $videoIDArray = split("/v/", $videolist->url);\r
- $videolist->video_id = $videoIDArray[1];\r
- // Now set the video title and description appropriately \r
- $videolist->title = fetchyoutubeDatatitle($videoIDArray[1]);\r
- $videolist->desc = fetchyoutubeDatadesc($videoIDArray[1]);\r
- $videolist->thumbnail = fetchyoutubeDatathumbnail($videoIDArray[1]);\r
- $videolist->videotype = "youtube";\r
- }\r
- else if($pageContainer == "metacafe"){\r
- $videolist->video_id = $_SESSION['candidate_profile_video'];\r
- // Now set the video title and description appropriately \r
- $videolist->title = fetchmetacafeTitle($_SESSION['candidate_profile_video']);\r
- $videolist->desc = fetchmetacafeDesc($_SESSION['candidate_profile_video']);\r
- $videolist->thumbnail = fetchmetacafeImg($_SESSION['candidate_profile_video']);\r
- $videolist->videotype = "metacafe";\r
- }\r
- else if($pageContainer == "vimeo"){\r
- $videolist->video_id = $_SESSION['candidate_profile_video'];\r
- \r
- // Now set the video title and description appropriately \r
- $videolist->title = getVimeoInfoDataTitle($_SESSION['candidate_profile_video']);\r
- $videolist->desc = getVimeoInfoDataDesc($_SESSION['candidate_profile_video']);\r
- $videolist->thumbnail = getVimeoInfoImage($_SESSION['candidate_profile_video']);\r
- $videolist->videotype = "vimeo";\r
- }\r
- \r
- // Before we can set metadata, we need to save the blog post\r
- if (!$videolist->save()) {\r
- register_error(elgg_echo("videolist:error"));\r
- forward("pg/videolist/new");\r
- }\r
- //add video tags\r
- $videolist_tags_array = string_to_tag_array($_SESSION['videolisttags']);\r
- if (is_array($videolist_tags_array)) {\r
- $videolist->tags = $videolist_tags_array;\r
- }\r
- \r
- // add to river\r
- add_to_river('river/object/videolist/create', 'create', $_SESSION['user']->guid, $videolist->guid);\r
- \r
- // add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);\r
- // Success message\r
- system_message(elgg_echo("videolist:posted"));\r
- // Remove the videolist cache\r
- unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']); \r
- unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);\r
- // Forward to the main videolist page\r
- \r
-forward("pg/videolist/owned/".page_owner_entity()->username);\r
-\r
-// Remove the videolist cache\r
- unset($_SESSION['candidate_profile_video_access_id']); unset($_SESSION['candidate_profile_video']); \r
- unset($_SESSION['videolisttags']);unset($_SESSION['Pagecontainer']);unset($_SESSION['container_guid']);\r
-\r
-?>\r
+<?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 <synapticfield@gmail.com>
+ * @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 = "<p>";
+ $ct = "</p>";
+ $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 = '/<img[^>]+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']);
+
+?>
-<?php\r
-\r
- /**\r
- * Elgg add comment action\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Curverider <curverider.co.uk>\r
- * @copyright Curverider Ltd 2008-2009\r
- * @link http://elgg.org/\r
- */\r
-\r
- // Make sure we're logged in; forward to the front page if not\r
- gatekeeper();\r
- action_gatekeeper();\r
- \r
- // Get input\r
- $entity_guid = (int) get_input('entity_guid');\r
- $comment_text = get_input('generic_comment');\r
- \r
- // Let's see if we can get an entity with the specified GUID\r
- if ($entity = get_entity($entity_guid)) {\r
- \r
- // If posting the comment was successful, say so\r
- if ($entity->annotate('generic_comment',$comment_text,$entity->access_id, $_SESSION['guid'])) {\r
- \r
- if ($entity->owner_guid != $_SESSION['user']->getGUID())\r
- notify_user($entity->owner_guid, $_SESSION['user']->getGUID(), elgg_echo('generic_comment:email:subject'), \r
- sprintf(\r
- elgg_echo('generic_comment:email:body'),\r
- $entity->title,\r
- $_SESSION['user']->name,\r
- $comment_text,\r
- $entity->getURL(),\r
- $_SESSION['user']->name,\r
- $_SESSION['user']->getURL()\r
- )\r
- ); \r
- \r
- system_message(elgg_echo("generic_comment:posted"));\r
- //add to river\r
- add_to_river('annotation/annotate','comment',$_SESSION['user']->guid,$entity->guid);\r
-\r
- \r
- } else {\r
- register_error(elgg_echo("generic_comment:failure"));\r
- }\r
- \r
- } else {\r
- \r
- register_error(elgg_echo("generic_comment:notfound"));\r
- \r
- }\r
- \r
- // Forward to the \r
- forward($_SERVER['HTTP_REFERER']);\r
-\r
+<?php
+
+ /**
+ * 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 <curverider.co.uk>
+ * @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']);
+
?>
<?php
-/**\r
- * Elgg Videolist Plugin -\r
- * This plugin allows users to delete videos \r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+/**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
// Make sure we're logged in (send us to the front page if not)
-gatekeeper();\r
- \r
- // Get the current page's owner \r
- $page_owner = page_owner_entity();\r
- if ($page_owner === false || is_null($page_owner)) {\r
- $page_owner = $_SESSION['user'];\r
- set_page_owner($_SESSION['guid']);\r
- }\r
-\r
- // Get input data\r
- $guid = (int) get_input('video_id');\r
-\r
- // Make sure we actually have permission to edit\r
- $videos = get_entity($guid);\r
- if ($videos->getSubtype() == "videolist" && $videos->canEdit()) {\r
- \r
- // Get owning user\r
+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!\r
- $rowsaffected = $videos->delete();\r
- if ($rowsaffected > 0) {\r
- // Success message\r
- system_message(elgg_echo("videos:deleted"));\r
- } else {\r
- register_error(elgg_echo("videos:notdeleted"));\r
- }\r
- // Forward to the main video list page\r
+ // 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']);\r
+ forward($_SERVER['HTTP_REFERER']);
+
+ }
- }\r
- \r
?>
<?php
- /**\r
- * Elgg Candidate Profile Video Plugin\r
- * This plugin allows users to create a library of youtube videos\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
-<?php \r
- \r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * @file - allows search for video from vimeo/youtube/and metacafe\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-\r
-// Get the current page's owner \r
-//set_page_owner($_SESSION['container_guid']);\r
-\r
-$page_ownerx = get_entity(get_input('container'));\r
-if(!$page_ownerx)\r
- $page_ownerx = get_user_by_username(get_input('container'));\r
-set_page_owner($page_ownerx->getGUID());\r
-$page_owner = page_owner_entity();\r
-\r
-if($page_owner->type == "group")\r
- $container = "group:".$page_ownerx->getGUID();\r
-else\r
- $container = $page_ownerx->username;\r
-\r
-if ($page_owner === false || is_null($page_owner)) {\r
- $page_owner = $_SESSION['user'];\r
- set_page_owner($_SESSION['guid']);\r
-}\r
-\r
-global $CONFIG; \r
- $queryFeed = get_input('q');\r
- $start_index = get_input('start_index');\r
- $results_perpage = 10;\r
- $queryCatgory = get_input('page');\r
-if (!isset($queryFeed) || empty($queryFeed)) {\r
- \r
-} \r
-else \r
-{\r
- $q = $queryFeed;\r
- if($queryCatgory == "youtube")\r
- {\r
- $feedURL = "http://gdata.youtube.com/feeds/api/videos?vq=".$queryFeed."&orderby=relevance&start-index=".$start_index."&max-results=10";\r
- $sxml = simplexml_load_file($feedURL);\r
-\r
- $counts = $sxml->children('http://a9.com/-/spec/opensearchrss/1.0/');\r
- $total = $counts->totalResults; \r
- $startOffset = $counts->startIndex; \r
- $endOffset = ($startOffset-1) + $counts->itemsPerPage; \r
-\r
- $body = '<div id="paginateSearch">';\r
- $rem = floor($total/10);\r
- $rem*=10;\r
- if($rem<$total)\r
- $last = $rem+1;\r
- $lpVid = $total - $rem;\r
- if($startOffset==1 && ($endOffset)==$total){}\r
- else if($startOffset==1 && ($endOffset)<$total){\r
- $body .= '<a href="javascript:void(0);">first</a> | ';\r
- $body .= '<a href="javascript:void(0);">previous</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';\r
- }\r
- else if($startOffset>1 && ($endOffset)<$total){\r
- $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';\r
- }\r
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){\r
- $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';\r
- $body .= '<a href="javascript:void(0);">next</a> | ';\r
- $body .= '<a href="javascript:void(0);">last</a>';\r
- }\r
- $body .= '</div>';\r
- $body .= '<div id="videosearch-tablecontainer">';\r
- $k = 0;$counter = 0;\r
- foreach ($sxml->entry as $entry) {\r
- $k++;\r
- $media = $entry->children('http://search.yahoo.com/mrss/');\r
- $attrs = $media->group->player->attributes();\r
- $watch = $attrs['url']; \r
- $vid_array = explode("?v=", $watch);\r
- if(preg_match("/&/", $vid_array[1])){\r
- $vid_array = explode("&", $vid_array[1]);\r
- $vid_array[1] = $vid_array[0];\r
- }\r
- \r
- $attrs = $media->group->thumbnail[0]->attributes();\r
- $thumbnail = $attrs['url']; \r
- $yt = $media->children('http://gdata.youtube.com/schemas/2007');\r
- $attrs = $yt->duration->attributes();\r
- $length = $attrs['seconds']; \r
- $gd = $entry->children('http://schemas.google.com/g/2005'); \r
- if ($gd->rating) {\r
- $attrs = $gd->rating->attributes();\r
- $rating = $attrs['average']; \r
- } else {\r
- $rating = 0; \r
- }\r
- $tags = array();\r
- $tags[] = $media->group->keywords;\r
- $showEncodedVideo = preg_replace('/(http:)(\/\/)(www.)([^ \/"]*)([^ >"]*)watch\?(v=)([^ >"]*)/i', '$1$2$3$4$5v/$7', $watch);\r
- $body .= '<div class="parentTabClass"><table id="parentTab" cellpadding="4" cellspacing="4" border="1">';\r
- $body .= '<tr class="searchvideorow">';\r
-\r
- $body .= '<td class="tabcellText" width="15%">';\r
- $body .= "<span class=\"HoverLink\"><a href=\"javascript:void(0);\" onclick=\"showV_idFeed('".$showEncodedVideo."', ".$k.")\"><img src=\"".$thumbnail."\" width=\"90%\" height=\"90%\" class=\"tubesearch\"/></a></span>";\r
- $body .= '<div id="vidContainer'.$k.'" class="videoDisp"></div></td>';\r
-\r
- $body .= '<td class="tabcellDesc" width="60%">';\r
- $body .= "<a href=\"javascript:void(0);\" onclick=\"showV_idFeed('".$showEncodedVideo."', ".$k.")\">".$media->group->title."</a><br>";\r
- $body .= "<b>Duration : </b>" . sprintf("%0.2f", $length/60) . " min.<br /><b>user rating : </b>".$rating."<br/>";\r
- $body .= "<b>Description : </b>".substr($media->group->description, 0, 140)." ...";\r
- $body .= '</td>';\r
-\r
- //$body .= "<td class=\"tabcellText\" width=\"12%\"><a href=\"javascript:void(0);\" onclick=\"javascript:showV_idFeed('".$showEncodedVideo."', ".$k.")\">play</a> | <a href=\"javascript:void(0);\" onclick=\"javascript:InsertVideoUrl('".$showEncodedVideo."','".$tags[$counter]."');\">add</a></td>";\r
-\r
- $body .= "<td class=\"tabcellText\" width=\"15%\"><input type=\"button\" name=\"play\" value=\"Play\" onclick=\"javascript:showV_idFeed('".$showEncodedVideo."', ".$k.")\" class=\"submit_button\"> <a href=\"".$CONFIG->wwwroot."pg/videolist/new/".$container."/title_videourl/".$vid_array[1]."/page/".$queryCatgory."\");\"><input type=\"button\" name=\"add\" value=\"Add\" class=\"submit_button\"></a></td>";\r
-\r
- $body .= '</tr>';\r
- $body .= '</table></div>';\r
- }\r
- $body .= '</div>';\r
- print $body;\r
- }\r
- else if($queryCatgory == "metacafe")\r
- { \r
- \r
- \r
- $feedURL = "http://www.metacafe.com/api/videos/?vq=".$queryFeed."&orderby=rating&start-index=".$start_index."&max-results=10";\r
- \r
- \r
- $sxml = new DomDocument;\r
- $sxml->load($feedURL);\r
- $total = 999; \r
- $startOffset = $start_index; \r
- $endOffset = ($startOffset-1) + $results_perpage; \r
- \r
- $body = '<div id="paginateSearch">';\r
- $rem = floor($total/10);\r
- $rem*=10;\r
- if($rem<$total)\r
- $last = $rem+1;\r
- $lpVid = $total - $rem;\r
- if($startOffset==1 && ($endOffset)==$total){}\r
- else if($startOffset==1 && ($endOffset)<$total){\r
- $body .= '<a href="javascript:void(0);">first</a> | ';\r
- $body .= '<a href="javascript:void(0);">previous</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';\r
- }\r
- else if($startOffset>1 && ($endOffset)<$total){\r
- $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';\r
- }\r
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){\r
- $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';\r
- $body .= '<a href="javascript:void(0);">next</a> | ';\r
- $body .= '<a href="javascript:void(0);">last</a>';\r
- }\r
- $body .= '</div>';\r
- $k = 0;\r
- $body .= '<div id="videosearch-tablecontainer">';\r
- $myitem = $sxml->getElementsByTagName('item');\r
- foreach($myitem as $searchNode){\r
- $k++;\r
- $xmlTitle = $searchNode->getElementsByTagName("title");\r
- $valueTitle = $xmlTitle->item(0)->nodeValue; \r
- \r
- $xmlLink = $searchNode->getElementsByTagName("link");\r
- $valueLink = $xmlLink->item(0)->nodeValue; \r
- \r
- $xmlDesc = $searchNode->getElementsByTagName("description");\r
- $valueDesc = $xmlDesc->item(0)->nodeValue; \r
- \r
- $pattern = '/<img[^>]+src[\\s=\'"]';\r
- $pattern .= '+([^"\'>\\s]+)/is';\r
- if(preg_match($pattern,$valueDesc,$match)){\r
- $thumbnail = $match[1];\r
- }\r
- \r
- $pattern = '/<a[^>]+href[\\s=\'"]';\r
- $pattern .= '+([^"\'>\\s]+)/is';\r
- if(preg_match($pattern,$valueDesc,$match)){\r
- $anchor_src = $match[1];\r
- }\r
- \r
- $encodedVideoUrlArray = explode("/watch/", $valueLink);\r
- $showEncodedVideo = $encodedVideoUrlArray[1];\r
- $metacafevideoIdArray = explode("/", $showEncodedVideo);\r
- \r
- $ot = "<p>";\r
- $ct = "</p>";\r
- $string = trim($valueDesc);\r
- $start = intval(strpos($string, $ot) + strlen($ot));\r
- $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start)); \r
- \r
- $body .= '<div class="parentTabClass">';\r
- $body .= '<table id="parentTab" cellpadding="4" cellspacing="4" border="1">';\r
- $body .= '<tr class="searchvideorow">';\r
-\r
- $body .= '<td class="tabcellText" width="15%">';\r
- $body .= "<span class=\"HoverLink\"><a href=\"javascript:void(0);\" onclick=\"showV_idFeedMetacafe('".$showEncodedVideo."', ".$k.")\"><img src=\"".$thumbnail."\" width=\"90%\" height=\"90%\" class=\"tubesearch\"/></a></span>";\r
- $body .= '<div id="vidContainer'.$k.'" class="videoDisp"></div></td>';\r
-\r
- $body .= '<td class="tabcellDesc" width="60%">';\r
- $body .= "<a href=\"javascript:void(0);\" onclick=\"showV_idFeedMetacafe('".$showEncodedVideo."', ".$k.")\">".$valueTitle."</a><br>";\r
- //$body .= "<b>Duration : </b>" . sprintf("%0.2f", $length/60) . " min.<br /><b>user rating : </b>".$rating."<br/>";\r
- $body .= "<b>Description : </b>".$desc_src;\r
- $body .= '</td>';\r
-\r
- //$body .= "<td class=\"tabcellText\" width=\"12%\"><a href=\"javascript:void(0);\" onclick=\"javascript:showV_idFeed('".$showEncodedVideo."', ".$k.")\">play</a> | <a href=\"javascript:void(0);\" onclick=\"javascript:InsertVideoUrl('".$showEncodedVideo."','".$tags[$counter]."');\">add</a></td>";\r
-\r
- $body .= "<td class=\"tabcellText\" width=\"15%\"><input type=\"button\" name=\"play\" value=\"Play\" onclick=\"javascript:showV_idFeedMetacafe('".$showEncodedVideo."', ".$k.")\" class=\"submit_button\"> <a href=\"".$CONFIG->wwwroot."pg/videolist/new/".$container."/title_videourl/".$metacafevideoIdArray[0]."/page/".$queryCatgory."\");\"><input type=\"button\" name=\"add\" value=\"Add\" class=\"submit_button\"></a></td>";\r
-\r
- $body .= '</tr>';\r
- $body .= '</table>';\r
- $body .= '</div>';\r
- }\r
- $body .= '</div>';\r
- print $body;\r
- }\r
- else if($queryCatgory == "vimeo")\r
- { \r
- require_once(dirname(dirname(__FILE__)) . "/models/lib/class.vimeo.php");\r
- // Now lets do the search query. We will get an response object containing everything we need\r
- $oResponse = VimeoVideosRequest::search($queryFeed);\r
-\r
- // We want the result videos as an array of objects\r
- $aoVideos = $oResponse->getVideos();\r
- \r
- // Just for code completion\r
- $oVideo = new VimeoVideoEntity();\r
-\r
- $total = count($aoVideos); \r
- $startOffset = $start_index; \r
- \r
- $endOffset = ($startOffset-1) + $results_perpage; \r
- $body = '<div id="paginateSearch">';\r
- $rem = floor($total/10);\r
- $rem*=10;\r
- if($rem<$total)\r
- $last = $rem+1;\r
- $lpVid = $total - $rem;\r
- if($startOffset==1 && ($endOffset)==$total){}\r
- else if($startOffset==1 && ($endOffset)<$total){\r
- $body .= '<a href="javascript:void(0);">first</a> | ';\r
- $body .= '<a href="javascript:void(0);">previous</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';\r
- }\r
- else if($startOffset>1 && ($endOffset)<$total){\r
- $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';\r
- }\r
- else if($startOffset>1 && ($endOffset+$lpVid)>=$total){\r
- $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';\r
- $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';\r
- $body .= '<a href="javascript:void(0);">next</a> | ';\r
- $body .= '<a href="javascript:void(0);">last</a>';\r
- }\r
- $body .= '</div>';\r
- $body .= '<div id="videosearch-tablecontainer">';\r
- $counter = 0;$k = 0;\r
- foreach($aoVideos as $oVideo) {\r
- $k++; \r
- if(($counter > $startOffset) && ($counter < $endOffset))\r
- {\r
- //get all thumbnails\r
- $aThumbnails = array();\r
- foreach($oVideo->getThumbnails() as $oThumbs) {\r
- $aThumbnails[] = $oThumbs->getImageContent();\r
- }\r
- \r
- foreach($aThumbnails as $thumbnailArray){\r
- $thumbnail = $thumbnailArray;\r
- break;\r
- }\r
- //print_r($oVideo);\r
- $title = $oVideo->getTitle();\r
- $description = $oVideo->getCaption();\r
- $url = $oVideo->getUrl();\r
- $rating = $oVideo->getNumberOfLikes();\r
- $playedTimes = $oVideo->getNumberOfPlays();\r
- // Print all tags\r
- $aTags = array();\r
- foreach($oVideo->getTags() as $oTag) {\r
- $aTags[] = $oTag->getTag();\r
- }\r
- $play_idArray = explode("http://vimeo.com/", $url);\r
- $embedidArray = explode("/", $play_idArray[1]);\r
- $body .= '<div class="parentTabClass">';\r
- $body .= '<table id="parentTab" cellpadding="4" cellspacing="4" border="1">';\r
- $body .= '<tr class="searchvideorow">';\r
-\r
- $body .= '<td class="tabcellText" width="15%">';\r
- $body .= "<span class=\"HoverLink\"><a href=\"javascript:showV_idFeedVimeo('".$embedidArray[0]."', ".$k.")\"><img src=\"".$thumbnail."\" width=\"90%\" height=\"90%\" class=\"tubesearch\"/></a></span>";\r
- $body .= '<div id="vidContainer'.$k.'" class="videoDisp"></div></td>';\r
-\r
- $body .= '<td class="tabcellDesc" width="60%">';\r
- $body .= "<a href=\"javascript:void(0);\" onclick=\"javascript:showV_idFeedVimeo('".$embedidArray[0]."', ".$k.")\">".$title."</a><br>";\r
- $body .= "<b>User Likes : </b>".$rating."<br/>";\r
- $body .= "<b>Played : </b>".$playedTimes." times<br/>";\r
- $body .= "<b>Description : </b>".$description." ...<br/>";\r
- $body .= "<b>Tags : </b>".implode(', ', $aTags);\r
- $body .= '</td>';\r
- \r
- $body .= "<td class=\"tabcellText\" width=\"15%\"><input type=\"button\" name=\"play\" value=\"Play\" onclick=\"javascript:showV_idFeedVimeo('".$embedidArray[0]."', ".$k.")\" class=\"submit_button\"> <a href=\"".$CONFIG->wwwroot."pg/videolist/new/".$container."/title_videourl/".$embedidArray[0]."/page/".$queryCatgory."\");\"><input type=\"button\" name=\"add\" value=\"Add\" class=\"submit_button\"></a></td>";\r
-\r
- $body .= '</tr>';\r
- $body .= '</table>';\r
- $body .= '</div>';\r
- }\r
- $counter++;\r
- }\r
- $body .= '</div>';\r
- print $body;\r
- }\r
-}\r
-exit;\r
-?>\r
+<?php
+
+ /**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of youtube/vimeo/metacafe videos
+ * @file - allows search for video from vimeo/youtube/and metacafe
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary <synapticfield@gmail.com>
+ * @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 = '<div id="paginateSearch">';
+ $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 .= '<a href="javascript:void(0);">first</a> | ';
+ $body .= '<a href="javascript:void(0);">previous</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';
+ $body .= '<a href="javascript:void(0);">next</a> | ';
+ $body .= '<a href="javascript:void(0);">last</a>';
+ }
+ $body .= '</div>';
+ $body .= '<div id="videosearch-tablecontainer">';
+ $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 .= '<div class="parentTabClass"><table id="parentTab" cellpadding="4" cellspacing="4" border="1">';
+ $body .= '<tr class="searchvideorow">';
+
+ $body .= '<td class="tabcellText" width="15%">';
+ $body .= "<span class=\"HoverLink\"><a href=\"javascript:void(0);\" onclick=\"showV_idFeed('".$showEncodedVideo."', ".$k.")\"><img src=\"".$thumbnail."\" width=\"90%\" height=\"90%\" class=\"tubesearch\"/></a></span>";
+ $body .= '<div id="vidContainer'.$k.'" class="videoDisp"></div></td>';
+
+ $body .= '<td class="tabcellDesc" width="60%">';
+ $body .= "<a href=\"javascript:void(0);\" onclick=\"showV_idFeed('".$showEncodedVideo."', ".$k.")\">".$media->group->title."</a><br>";
+ $body .= "<b>Duration : </b>" . sprintf("%0.2f", $length/60) . " min.<br /><b>user rating : </b>".$rating."<br/>";
+ $body .= "<b>Description : </b>".substr($media->group->description, 0, 140)." ...";
+ $body .= '</td>';
+
+ //$body .= "<td class=\"tabcellText\" width=\"12%\"><a href=\"javascript:void(0);\" onclick=\"javascript:showV_idFeed('".$showEncodedVideo."', ".$k.")\">play</a> | <a href=\"javascript:void(0);\" onclick=\"javascript:InsertVideoUrl('".$showEncodedVideo."','".$tags[$counter]."');\">add</a></td>";
+
+ $body .= "<td class=\"tabcellText\" width=\"15%\"><input type=\"button\" name=\"play\" value=\"Play\" onclick=\"javascript:showV_idFeed('".$showEncodedVideo."', ".$k.")\" class=\"submit_button\"> <a href=\"".$CONFIG->wwwroot."pg/videolist/new/".$container."/title_videourl/".$vid_array[1]."/page/".$queryCatgory."\");\"><input type=\"button\" name=\"add\" value=\"Add\" class=\"submit_button\"></a></td>";
+
+ $body .= '</tr>';
+ $body .= '</table></div>';
+ }
+ $body .= '</div>';
+ 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 = '<div id="paginateSearch">';
+ $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 .= '<a href="javascript:void(0);">first</a> | ';
+ $body .= '<a href="javascript:void(0);">previous</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';
+ $body .= '<a href="javascript:void(0);">next</a> | ';
+ $body .= '<a href="javascript:void(0);">last</a>';
+ }
+ $body .= '</div>';
+ $k = 0;
+ $body .= '<div id="videosearch-tablecontainer">';
+ $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 = '/<img[^>]+src[\\s=\'"]';
+ $pattern .= '+([^"\'>\\s]+)/is';
+ if(preg_match($pattern,$valueDesc,$match)){
+ $thumbnail = $match[1];
+ }
+
+ $pattern = '/<a[^>]+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 = "<p>";
+ $ct = "</p>";
+ $string = trim($valueDesc);
+ $start = intval(strpos($string, $ot) + strlen($ot));
+ $desc_src = substr($string,$start,intval(strpos($string,$ct) - $start));
+
+ $body .= '<div class="parentTabClass">';
+ $body .= '<table id="parentTab" cellpadding="4" cellspacing="4" border="1">';
+ $body .= '<tr class="searchvideorow">';
+
+ $body .= '<td class="tabcellText" width="15%">';
+ $body .= "<span class=\"HoverLink\"><a href=\"javascript:void(0);\" onclick=\"showV_idFeedMetacafe('".$showEncodedVideo."', ".$k.")\"><img src=\"".$thumbnail."\" width=\"90%\" height=\"90%\" class=\"tubesearch\"/></a></span>";
+ $body .= '<div id="vidContainer'.$k.'" class="videoDisp"></div></td>';
+
+ $body .= '<td class="tabcellDesc" width="60%">';
+ $body .= "<a href=\"javascript:void(0);\" onclick=\"showV_idFeedMetacafe('".$showEncodedVideo."', ".$k.")\">".$valueTitle."</a><br>";
+ //$body .= "<b>Duration : </b>" . sprintf("%0.2f", $length/60) . " min.<br /><b>user rating : </b>".$rating."<br/>";
+ $body .= "<b>Description : </b>".$desc_src;
+ $body .= '</td>';
+
+ //$body .= "<td class=\"tabcellText\" width=\"12%\"><a href=\"javascript:void(0);\" onclick=\"javascript:showV_idFeed('".$showEncodedVideo."', ".$k.")\">play</a> | <a href=\"javascript:void(0);\" onclick=\"javascript:InsertVideoUrl('".$showEncodedVideo."','".$tags[$counter]."');\">add</a></td>";
+
+ $body .= "<td class=\"tabcellText\" width=\"15%\"><input type=\"button\" name=\"play\" value=\"Play\" onclick=\"javascript:showV_idFeedMetacafe('".$showEncodedVideo."', ".$k.")\" class=\"submit_button\"> <a href=\"".$CONFIG->wwwroot."pg/videolist/new/".$container."/title_videourl/".$metacafevideoIdArray[0]."/page/".$queryCatgory."\");\"><input type=\"button\" name=\"add\" value=\"Add\" class=\"submit_button\"></a></td>";
+
+ $body .= '</tr>';
+ $body .= '</table>';
+ $body .= '</div>';
+ }
+ $body .= '</div>';
+ 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 = '<div id="paginateSearch">';
+ $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 .= '<a href="javascript:void(0);">first</a> | ';
+ $body .= '<a href="javascript:void(0);">previous</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';
+ }
+ else if($startOffset>1 && ($endOffset)<$total){
+ $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($endOffset+1).');">next</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.$last.');">last</a>';
+ }
+ else if($startOffset>1 && ($endOffset+$lpVid)>=$total){
+ $body .= '<a href="javascript:sendSearchRequest(1);">first</a> | ';
+ $body .= '<a href="javascript:sendSearchRequest('.($startOffset-10).');">previous</a> | ';
+ $body .= '<a href="javascript:void(0);">next</a> | ';
+ $body .= '<a href="javascript:void(0);">last</a>';
+ }
+ $body .= '</div>';
+ $body .= '<div id="videosearch-tablecontainer">';
+ $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 .= '<div class="parentTabClass">';
+ $body .= '<table id="parentTab" cellpadding="4" cellspacing="4" border="1">';
+ $body .= '<tr class="searchvideorow">';
+
+ $body .= '<td class="tabcellText" width="15%">';
+ $body .= "<span class=\"HoverLink\"><a href=\"javascript:showV_idFeedVimeo('".$embedidArray[0]."', ".$k.")\"><img src=\"".$thumbnail."\" width=\"90%\" height=\"90%\" class=\"tubesearch\"/></a></span>";
+ $body .= '<div id="vidContainer'.$k.'" class="videoDisp"></div></td>';
+
+ $body .= '<td class="tabcellDesc" width="60%">';
+ $body .= "<a href=\"javascript:void(0);\" onclick=\"javascript:showV_idFeedVimeo('".$embedidArray[0]."', ".$k.")\">".$title."</a><br>";
+ $body .= "<b>User Likes : </b>".$rating."<br/>";
+ $body .= "<b>Played : </b>".$playedTimes." times<br/>";
+ $body .= "<b>Description : </b>".$description." ...<br/>";
+ $body .= "<b>Tags : </b>".implode(', ', $aTags);
+ $body .= '</td>';
+
+ $body .= "<td class=\"tabcellText\" width=\"15%\"><input type=\"button\" name=\"play\" value=\"Play\" onclick=\"javascript:showV_idFeedVimeo('".$embedidArray[0]."', ".$k.")\" class=\"submit_button\"> <a href=\"".$CONFIG->wwwroot."pg/videolist/new/".$container."/title_videourl/".$embedidArray[0]."/page/".$queryCatgory."\");\"><input type=\"button\" name=\"add\" value=\"Add\" class=\"submit_button\"></a></td>";
+
+ $body .= '</tr>';
+ $body .= '</table>';
+ $body .= '</div>';
+ }
+ $counter++;
+ }
+ $body .= '</div>';
+ print $body;
+ }
+}
+exit;
+?>
-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");\r
- \r
- //get videolist GUID\r
- $container_guid = get_input('container');\r
- $parent_container = "";\r
- if(isset($container_guid) && !empty($container_guid)){\r
- $container_guid = explode(":", $container_guid);\r
- if($container_guid[0] == "group"){\r
- $container = get_entity($container_guid[1]);\r
- set_page_owner($container->getGUID());\r
- $page_owner = page_owner_entity();\r
- set_context("groupsvideos");\r
- }\r
- else{\r
- $page_owner = page_owner_entity();\r
- if ($page_owner === false || is_null($page_owner)) {\r
- $page_owner = $_SESSION['user'];\r
- set_page_owner($_SESSION['guid']);\r
- }\r
- }\r
- }\r
- // Get the current page's owner \r
- \r
- \r
- $title = sprintf(elgg_echo("videolist:browse"), $page_owner->name);\r
- \r
- $area2 = elgg_view_title($title);\r
- $area2 .= elgg_view("forms/browsetube");\r
- \r
- $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);\r
- \r
- page_draw($title, $body);\r
-?>\r
+<?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 <synapticfield@gmail.com>
+ * @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);
+?>
-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");\r
-\r
- $owner = page_owner_entity();\r
- \r
- //get videolist GUID\r
- $container_guid = get_input('username');\r
- if(isset($container_guid) && !empty($container_guid)){\r
- $container_guid = explode(":", $container_guid);\r
- if($container_guid[0] == "group"){\r
- $container = get_entity($container_guid[1]);\r
- set_context("groupsvideos");\r
- //$page_owner = page_owner_entity();\r
- }\r
- else{\r
- \r
- }\r
- }\r
- //set page owner\r
- //set_page_owner($videolist_guid);\r
-\r
- $title = sprintf(elgg_echo("videolist:home"), "$owner->name");\r
-\r
- // Get objects\r
- $area2 = elgg_view_title($title);\r
- //set_input('search_viewtype', 'gallery');\r
- $area2 .= list_entities("object","videolist", page_owner(), 10);\r
- \r
- //$area2 .= elgg_view("staticvideo/index");\r
- \r
- set_context('videolist');\r
- $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);\r
- \r
- // Finally draw the page\r
- page_draw($title, $body);\r
-?>\r
+<?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 <synapticfield@gmail.com>
+ * @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);
+?>
-<?php\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * @file - language file 'en'\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
- $english = array(\r\r
+<?php
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
+ */
+ $english = array(
+
"videolist" => "My Videos",
"videolist:home" => '%s \'s Videos',
"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",\r
- );\r
- \r
- add_translation("en",$english);\r
-\r
+ "videolist:none" => "This group does not have any videos yet",
+ );
+
+ add_translation("en",$english);
+
?>
<field key="version" value="1.5" />
<field key="description" value="Elgg Videolist" />
<field key="copyright" value="(C) prateek.choudhary 2008-09" />
- <field key="licence" value="GNU Public License version 2" />\r
+ <field key="licence" value="GNU Public License version 2" />
<field key="elgg_version" value="2009030702" />
</plugin_manifest>
-<?php\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
- \r
- \r
- // Render the video upload page\r
- // Load Elgg engine\r
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");\r
- gatekeeper();\r
- \r
- //get videolist GUID\r
- $container_guid = get_input('container');\r
- if(isset($container_guid) && !empty($container_guid)){\r
- $container_guid = explode(":", $container_guid);\r
- if($container_guid[0] == "group"){\r
- $container = get_entity($container_guid[1]);\r
- set_page_owner($container->getGUID());\r
- $page_owner = page_owner_entity();\r
- set_context("groupsvideos");\r
- set_input("container_guid", $container->getGUID());\r
- }\r
- else{\r
- // Get the current page's owner \r
- $page_owner = page_owner_entity();\r
- if ($page_owner === false || is_null($page_owner)) {\r
- $page_owner = $_SESSION['user'];\r
- set_page_owner($_SESSION['guid']);\r
- set_input("container_guid", $_SESSION['guid']);\r
- }\r
- }\r
- }\r
-\r
- $title = sprintf(elgg_echo("videolist:new"), $page_owner->name);\r
- \r
- $area2 = elgg_view_title($title);\r
- $area2 .= elgg_view("forms/add");\r
- $body = elgg_view_layout('one_column_with_sidebar', $area1 . $area2);\r
- \r
- page_draw($title, $body);\r
-?>\r
+<?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 <synapticfield@gmail.com>
+ * @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);
+?>
-<?php\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
- function videolist_init() {\r
- \r
- // Load system configuration\r
- global $CONFIG;\r
+<?php
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @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);
}
- \r
+
// Extend system CSS with our own styles
- extend_view('css','videolist/css');\r \r
- // Load the language file - default is english\r
+ 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\r
+ // 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\r
+ // 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'))\r
- register_notification_object('object', 'videolist', elgg_echo('videolist:new'));\r
+ 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');\r
+ 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\r
+ // Register entity type
register_entity_type('object','videolist');
- \r
- }\r
- \r
- /**\r
- * videolist page handler; allows the use of fancy URLs\r
- *\r
- * @param array $page From the page_handler function\r
- * @return true|false Depending on success\r
- */\r
+
+ }
+
+ /**
+ * 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) {
- \r
- if (isset($page[0])) {\r
- switch($page[0]) {\r
+
+ 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");\r
+ case "search": @include(dirname(__FILE__) . "/world.php");
+ break;
+ case "video": @include(dirname(__FILE__) . "/video.php");
break;
- case "video": @include(dirname(__FILE__) . "/video.php");\r
- break;\r
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");\r
+ @include(dirname(__FILE__) . "/new.php");
break;
case "watch": set_input('video_id',$page[1]);
- @include(dirname(__FILE__) . "/watch.php");\r
+ @include(dirname(__FILE__) . "/watch.php");
break;
case "browse": if (isset($page[1])) set_input('container',$page[1]);
- @include(dirname(__FILE__) . "/browse.php");\r
+ @include(dirname(__FILE__) . "/browse.php");
break;
default : if (isset($page[1])) set_input('username',$page[1]);
@include(dirname(__FILE__) . "/index.php");
- break;\r
- }\r
- // If the URL is just 'videolist/username', or just 'videolist/', load the standard index file\r
+ 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;\r
- }\r
- \r
- return false;\r
-\r
- }\r
+ return true;
+ }
+
+ return false;
+
+ }
- function videolist_pagesetup() {\r
- \r
- global $CONFIG;\r
+ function videolist_pagesetup() {
+
+ global $CONFIG;
$page_owner = page_owner_entity();
- if ($page_owner instanceof ElggGroup && get_context() == "groups") {\r
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);\r
- }\r
- //add submenu options\r
- else if (get_context() == "videolist") {\r
+ 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);\r
+ 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()) {\r
- add_submenu_item(sprintf(elgg_echo("videolist:home"),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/owned/" . page_owner_entity()->username);\r
+ 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);\r
- add_submenu_item(sprintf(elgg_echo('videolist:find'),page_owner_entity()->name), $CONFIG->wwwroot . "pg/videolist/search/"); \r
- } else if (page_owner() && $page_owner instanceof ElggUser) {\r
- add_submenu_item(sprintf(elgg_echo("videolist:home"),$page_owner->name), $CONFIG->wwwroot . "pg/videolist/owned/". $page_owner->username);\r
- } \r
+ 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);
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);
}
- }\r
- }\r
+ }
+ }
- function video_url($entity) { \r
+ function video_url($entity) {
global $CONFIG;
- $video_id = $entity->video_id;\r
- return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;\r
- \r
+ $video_id = $entity->video_id;
+ return $CONFIG->url . "pg/videolist/watch/" . $entity->getGUID() . "/" . $video_id;
+
}
- function videolist_url($videolistpage) {\r
- \r
+ function videolist_url($videolistpage) {
+
global $CONFIG;
$owner = $videolistpage->container_guid;
- $userdata = get_entity($owner);\r
- $title = $videolistpage->title;\r
+ $userdata = get_entity($owner);
+ $title = $videolistpage->title;
$title = friendly_title($title);
- return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();\r
+ return $CONFIG->url . "pg/videolist/watch/" . $videolistpage->getGUID();
}
- /**\r
- * Event handler for videolist\r
- *\r
- */\r
- function videolist_object_notifications($event, $object_type, $object) {\r
- \r
- static $flag;\r
- if (!isset($flag)) $flag = 0;\r
- \r
- if (is_callable('object_notifications'))\r
- if ($object instanceof ElggObject) {\r
- if ($object->getSubtype() == 'videolist') {\r
- if ($flag == 0) {\r
- $flag = 1;\r
- object_notifications($event, $object_type, $object);\r
- }\r
- }\r
- } \r
+ /**
+ * 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);
+ }
+ }
+ }
}
- /**\r
- * Intercepts the notification on an event of new video being created and prevents a notification from going out\r
- * (because one will be sent on the annotation)\r
- *\r
- * @param unknown_type $hook\r
- * @param unknown_type $entity_type\r
- * @param unknown_type $returnvalue\r
- * @param unknown_type $params\r
- * @return unknown\r
- */\r
- function videolist_object_notifications_intercept($hook, $entity_type, $returnvalue, $params) {\r
- if (isset($params)) {\r
- if ($params['event'] == 'create' && $params['object'] instanceof ElggObject) {\r
- if ($params['object']->getSubtype() == 'videolist') {\r
- return true;\r
- }\r
- }\r
- }\r
- return null;\r
+ /**
+ * 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;
}
- \r
- // Register a handler for adding videos\r
- register_elgg_event_handler('create', 'videolist', 'videolist_create_event_listener');\r
-\r
- // Register a handler for delete videos\r
+
+ // 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');
- \r
- // Make sure the status initialisation function is called on initialisation\r
- register_elgg_event_handler('init','system','videolist_init');\r
+
+ // 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');\r
+ register_elgg_event_handler('annotate','all','videolist_object_notifications');
- // Register actions\r
- global $CONFIG;\r
+ // 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");
-\r
+
?>
-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * @file - the add user interface\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-// Make sure we're logged in (send us to the front page if not)\r
- gatekeeper(); \r
- $page_owner = page_owner_entity(); \r
- $error = array(\r
- 'no-video' => 1\r
- );\r
- $error_msg = array(\r
- 'no-video' => "Please enter a valid video url"\r
- );\r
- \r
- $container_guid = get_input("container_guid");\r
- set_page_owner($container_guid);\r
- \r
- $confirm_action = get_input('video_action');\r
- $guid = get_input('guid');\r
- $access_id = get_input('access_id');\r
- $title_videourl = get_input('title_videourl');\r
- $Pagecontainer = get_input('page');\r
- $get_addvideourl = get_input('add_videourl');\r
- $timestamp = time();\r
- $token = generate_action_token(time());\r
- if(!empty($get_addvideourl) && ($Pagecontainer == "youtube"))\r
- $title_add_videourl = "http://www.youtube.com/watch?v=".$get_addvideourl;\r
- else if(!empty($get_addvideourl) && ($Pagecontainer == "metacafe"))\r
- $title_add_videourl = "http://www.metacafe.com/api/item/".$get_addvideourl;\r
- else if(!empty($get_addvideourl) && ($Pagecontainer == "vimeo"))\r
- $title_add_videourl = "http://vimeo.com/".$get_addvideourl;\r
- else\r
- $title_add_videourl = "";\r
- \r
- \r
- $tags = get_input('videolisttags');\r
-\r
- function video_youtube_parse_url($url)\r
- { \r
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(youtube\.com\/)(.*)/', $url, $matches))\r
- {\r
- return false; \r
- }\r
- \r
- $domain = $matches[2] . $matches[3];\r
- $path = $matches[4]; \r
- \r
- if (!preg_match('/^(watch\?v=)([a-zA-Z0-9_-]*)(&.*)?$/',$path, $matches))\r
- {\r
- return false; \r
- }\r
- \r
- $hash = $matches[2];\r
- \r
- \r
- return $domain . 'v/' . $hash;\r
- }\r
- \r
- function video_vimeo_parse_url($url)\r
- { \r
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(vimeo\.com\/)(.*)/', $url, $matches))\r
- {\r
- return false; \r
- }\r
- \r
- $domain = $matches[2] . $matches[3];\r
- $path = $matches[4]; \r
- \r
- $hash = $matches[2];\r
- \r
- \r
- return $domain . '/' . $hash;\r
- }\r
- \r
- function video_metacafe_parse_url($url)\r
- { \r
- if (!preg_match('/(http:\/\/)([a-zA-Z]{2,3}\.)(metacafe\.com\/)(.*)/', $url, $matches))\r
- {\r
- return false; \r
- }\r
- \r
- $domain = $matches[2] . $matches[3];\r
- $path = $matches[4]; \r
- \r
- $hash = $matches[2];\r
- \r
- \r
- return $domain . '/' . $hash;\r
- }\r
- \r
- if(isset($confirm_action) && ($confirm_action == 'add_video'))\r
- {\r
- if(isset($title_videourl) && ($title_videourl != ''))\r
- {\r
- if($Pagecontainer != "youtube" || $Pagecontainer != "vimeo" || $Pagecontainer != "metacafe"){\r
- if(preg_match("/youtube/i", $title_videourl))\r
- $Pagecontainer = "youtube";\r
- if(preg_match("/vimeo/i", $title_videourl))\r
- $Pagecontainer = "vimeo";\r
- if(preg_match("/metacafe/i", $title_videourl))\r
- $Pagecontainer = "metacafe";\r
- }\r
- if($Pagecontainer == "youtube")\r
- $is_valid_video = video_youtube_parse_url($title_videourl);\r
- else if($Pagecontainer == "vimeo"){\r
- $is_valid_video = video_vimeo_parse_url($title_videourl);\r
- $is_valid_video = $get_addvideourl;\r
- }\r
- else if($Pagecontainer == "metacafe"){\r
- $is_valid_video = video_metacafe_parse_url($title_videourl);\r
- $is_valid_video = $get_addvideourl;\r
- }\r
- if($is_valid_video)\r
- { \r
- $error['no-video'] = 1;\r
- $_SESSION['candidate_profile_video'] = $is_valid_video;\r
- $_SESSION['candidate_profile_video_access_id'] = $access_id;\r
- $_SESSION['videolisttags'] = $tags;\r
- $_SESSION['Pagecontainer'] = $Pagecontainer;\r
- $_SESSION['container_guid'] = $container_guid;\r
- //echo $_SESSION['candidate_profile_video'];\r
- $url = "action/videolist/addvideo?__elgg_ts={$timestamp}&__elgg_token={$token}";\r
- forward($url);\r
- }\r
- else\r
- $error['no-video'] = 0;\r
- } \r
- else\r
- {\r
- $error['no-video'] = 0;\r
- }\r
- } \r
-\r
-\r
- \r
- $body = '<div class="videolist-content">';\r
-\r
- $body .= '<form action="'.$_SERVER['php_self'].'" method="post">';\r
- $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video'));\r
- $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid']));\r
- \r
- \r
- $body .= '<p><label>'.elgg_echo("videolist:title_videourl").'<br />';\r
- $body .= elgg_view("input/text",array('internalname' => 'title_videourl','value'=>$title_add_videourl));\r
- if($error['no-video'] == 0)\r
- {\r
- $body .= '<div class="error">'.$error_msg['no-video'].'</div>';\r
- }\r
- $body .= '</label></p>';\r
- \r
- $body .= '<p><label>'.elgg_echo('videolist:tags');\r
- $body .= elgg_view('input/tags', array('internalname' => 'videolisttags', 'value' => $tags));\r
- $body .= '</label></p>';\r
- \r
- $body .= '<p><label>'.elgg_echo("videolist:title_access").'<br />';\r
- $body .= elgg_view('input/access',array('internalname'=>'access_id', 'value' => $access_id));\r
- $body .= '</label></p>';\r
- $body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit')));\r
- $body .= '</form>';\r
- $body .= '</div>';\r
- \r
- print $body."<br /><br />";\r
- \r
- \r
-?>\r
-\r
-<script type="text/javascript">\r
-\r
-</script>\r
+<?php
+
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @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 = '<div class="videolist-content">';
+
+ $body .= '<form action="'.$_SERVER['php_self'].'" method="post">';
+ $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'add_video'));
+ $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid']));
+
+
+ $body .= '<p><label>'.elgg_echo("videolist:title_videourl").'<br />';
+ $body .= elgg_view("input/text",array('internalname' => 'title_videourl','value'=>$title_add_videourl));
+ if($error['no-video'] == 0)
+ {
+ $body .= '<div class="error">'.$error_msg['no-video'].'</div>';
+ }
+ $body .= '</label></p>';
+
+ $body .= '<p><label>'.elgg_echo('videolist:tags');
+ $body .= elgg_view('input/tags', array('internalname' => 'videolisttags', 'value' => $tags));
+ $body .= '</label></p>';
+
+ $body .= '<p><label>'.elgg_echo("videolist:title_access").'<br />';
+ $body .= elgg_view('input/access',array('internalname'=>'access_id', 'value' => $access_id));
+ $body .= '</label></p>';
+ $body .= elgg_view('input/submit', array('internalname'=>'submit','value'=>elgg_echo('videolist:submit')));
+ $body .= '</form>';
+ $body .= '</div>';
+
+ print $body."<br /><br />";
+
+
+?>
+
+<script type="text/javascript">
+
+</script>
-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * @file - load the browse view\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-\r
-$getcontainer_guid = get_input("container");\r
-$container_guid = explode(":", $getcontainer_guid);\r
-if($container_guid[0] == "group"){\r
- $container = $container_guid[1];\r
-}\r
-else{\r
- $container = $getcontainer_guid;\r
-}\r
- $error = array(\r
- 'no-search' => 1\r
- );\r
- $error_msg = array(\r
- 'no-search' => "Please enter a valid search term"\r
- );\r
- $browseCat = get_input('q');\r
- if(empty($browseCat) || !isset($browseCat))\r
- $browseCat = "youtube";\r
- $confirm_action = get_input('video_action');\r
- \r
- if(isset($confirm_action) && ($confirm_action == 'search_video'))\r
- {\r
- if(isset($title_search) && ($title_search != ''))\r
- $error['no-search'] = 0;\r
- else\r
- $error['no-search'] = 1;\r
- } \r
-\r
- \r
- //$body = '<div class="videolist-content">';\r
- //Load youtube menu\r
- $body .= "<br /><div class=\"elgg_horizontal_tabbed_nav\">";\r
- $body .= "<ul id=\"videonav\">";\r
- $body .= "<li class=\"active\" id=\"YT\">";\r
- $body .= "<a href=\"".$vars['url']."pg/videolist/browse/".$getcontainer_guid."?q=youtube\">YouTube</a>";\r
- $body .= "</li>";\r
- $body .= "<li id=\"MC\">";\r
- $body .= "<a href=\"".$vars['url']."pg/videolist/browse/".$getcontainer_guid."?q=metacafe\">Metacafe</a>";\r
- $body .= "</li>";\r
- $body .= "<li id=\"VM\">";\r
- $body .= "<a href=\"".$vars['url']."pg/videolist/browse/".$getcontainer_guid."?q=vimeo\">Vimeo</a>";\r
- $body .= "</li>";\r
- /*\r
- $body .= "<li id=\"GV\">";\r
- $body .= "<a href=\"".$vars['url']."pg/videolist/browse?q=googlevideos\">Google Videos</a>";\r
- $body .= "</li>";\r
- */\r
- $body .= "</ul>";\r
- $body .= "</div>";\r
- \r
- $body .= "<div class=\"clearfloat\"></div>";\r
- \r
- //$body .= "<div id=\"videosearch-interface\">";\r
- $body .= '<form action="javascript:sendSearchRequest(1);" method="get">';\r
- //$body .= "<form action=\"".$vars['url']."action/videolist/tubesearch\" method=\"get\">";\r
- $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'search_video'));\r
- $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid']));\r
- //$body .= elgg_view('input/hidden',array('internalname'=>'start_index', 'value'=>1));\r
- \r
- switch($browseCat)\r
- {\r
- case "youtube" : \r
- $body .= elgg_view('forms/labels/youtube');\r
- break;\r
- case "metacafe" :\r
- $body .= elgg_view('forms/labels/metacafe');\r
- break;\r
- case "vimeo" :\r
- $body .= elgg_view('forms/labels/vimeo');\r
- break;\r
- case "googlevideos" :\r
- $body .= elgg_view('forms/labels/googlevideos');\r
- break;\r
- default :\r
- $body .= elgg_view('forms/labels/youtube');\r
- break;\r
- }\r
- $body .= elgg_view('input/hidden',array('internalname'=>'page', 'value'=>$browseCat));\r
- $body .= '</form>';\r
- //$body .= '</div>';\r
- //$body .= '</div>';\r
- \r
- $body .= '<div id="SearchContainer">';\r
- $body .= '<div id="loadingSearch">';\r
- $body .= '</div>';\r
- $body .= '<div id="responseSearch" align="center">';\r
- $body .= '</div>';\r
- $body .= '</div>';\r
- \r
- print $body."<br /><br />";\r
- \r
- \r
-?>\r
-<style type="text/css">\r
-#videosearch-menu{\r
-position:relative;\r
-width:675px;\r
-height:31px;\r
-border:0px solid #CCC;\r
-border-width:0px 0px 1px 0px;\r
-margin:0px 0px 15px 0px;\r
-}\r
-#videosearch-menu ul{\r
-position:relative;\r
-text-align:left;\r
-width:600px;\r
-}\r
-#videosearch-menu ul li{\r
-position:relative;\r
-float:left;\r
-list-style-type:none;\r
-min-width:20%;\r
-cursor:pointer;\r
-margin:0px 22px 0px -20px;\r
-padding:8px 5px 5px 3px;\r
-border:0px solid #CCC;\r
-border-width:0px 0px 0px 0px;\r
-text-align:center;\r
-}\r
-\r
-</style>\r
-<script type="text/javascript">\r
-var page = "<?php echo $browseCat;?>";\r
-var container = "<?php echo $container;?>";\r
-$('#videonav li').removeClass();\r
-switch(page)\r
-{\r
- case "youtube" : $('#YT').removeClass().addClass('active');\r
- break;\r
- case "metacafe" : $('#MC').removeClass().addClass('active');\r
- break;\r
- case "vimeo" : $('#VM').removeClass().addClass('active');\r
- break;\r
- case "googlevideos" : $('#GV').removeClass().addClass('active');\r
- break; \r
- default : $('#YT').removeClass().addClass('active');\r
- break; \r
-}\r
-\r
-function sendSearchRequest(p){\r
- var queryFeed = $("#title_search").val(); \r
- if(trim(queryFeed) != '')\r
- {\r
- $("#loadingSearch").html("<div align=\"center\" class=\"ajax_loader\"></div>");\r
- var elggTS = "<?php echo time(); ?>";\r
- var elggToken = "<?php echo generate_action_token(time()); ?>";\r
- $.ajax({\r
- type: "GET",\r
- url: "<?php echo $vars['url']; ?>"+"action/videolist/tubesearch",\r
- data: "bustcache="+new Date().getTime()+"&__elgg_ts="+elggTS+"&__elgg_token="+elggToken+"&page="+page+"&q="+queryFeed+"&start_index="+p+"&container="+container,\r
- success: function(html){\r
- $("#loadingSearch").html("");\r
- $("#responseSearch").html('');\r
- $("#responseSearch").html(html);\r
- }\r
- });\r
- }\r
- else{}\r
-}\r
-\r
-function showV_idFeed(param, param2){\r
- var arg = param;\r
- var embed_video = "<div style='text-align:right;'><a href='javascript:void(0);' onclick='javascript:closeit("+param2+");'>close</a></div><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' width='475' height='350'>"+\r
- "<param name='movie' value='"+arg+"&autoplay=1'>"+ \r
- "<param name='quality' value='high'>"+\r
- "<param name='bgcolor' value='#CEEFFF'>"+\r
- "<!--[if !IE]> <-->"+\r
- "<object data='"+arg+"&autoplay=1' width='475' height='350' autoplay=1 type='application/x-shockwave-flash'>"+\r
- "<param name='quality' value='high'>"+\r
- "<param name='bgcolor' value='#CEEFFF'>"+\r
- "<param name='pluginurl' value='http://www.adobe.com/go/getflashplayer'>"+\r
- "FAIL (the browser should render some flash content, not this)."+\r
- "</object>"+\r
- "<!--> <![endif]-->"+\r
- "</object>";\r
- disableScreen(embed_video, param2);\r
-}\r
-\r
-function showV_idFeedMetacafe(param, param2){\r
- var argArray = param.split("/");\r
- var arg = argArray[0]+"/"+argArray[1]+".swf";\r
- var embed_video = "<div style='text-align:right;'><a href='javascript:void(0);' onclick='javascript:closeit("+param2+");'>close</a></div><object width=\"475\" height=\"350\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"Metacafe_"+argArray[0]+"\" value=\"http://www.metacafe.com/fplayer/"+arg+"&autoplay=1\" /><embed src=\"http://www.metacafe.com/fplayer/"+arg+"&autoplay=1\" type=\"application/x-shockwave-flash\" name=\"Metacafe_"+argArray[0]+"\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"475\" height=\"350\"></embed></object>";\r
- \r
- disableScreen(embed_video, param2);\r
-}\r
-\r
-function showV_idFeedVimeo(param, param2){\r
- var arg = param;\r
- var embed_video = "<div style='text-align:right;'><a href='javascript:void(0);' onclick='javascript:closeit("+param2+");'>close</a></div><object width=\"475\" height=\"350\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"movie\" value=\"http://vimeo.com/moogaloop.swf?clip_id="+arg+"&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" /><embed src=\"http://vimeo.com/moogaloop.swf?clip_id="+arg+"&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"475\" height=\"350\"></embed></object>";\r
- disableScreen(embed_video, param2);\r
-}\r
-\r
-function disableScreen(embed_video, param2)\r
-{\r
- var getContainer = "#vidContainer"+param2;\r
- $('#page_container').append("<div id='page_overlay' style='position:absolute;'/>");\r
- $('#page_overlay').css({\r
- backgroundColor: "#000",\r
- opacity: "0.8",\r
- width: $(window).width(),\r
- height: $('#page_container').height(),\r
- top: "0px",\r
- left: -(($(window).width() - $('body').width()) / 2)\r
- }).fadeIn();\r
- $(getContainer).css("width", "0%");\r
- $(getContainer).animate( { width:"45%"}, 300 );\r
- document.getElementById("vidContainer"+param2).innerHTML = embed_video;\r
-}\r
-\r
-function trim(stringToTrim)\r
-{\r
- return ltrim(rtrim(stringToTrim));\r
-}\r
-\r
-function ltrim(stringToTrim) {\r
- return stringToTrim.replace(/^\s+/,"");\r
-}\r
-\r
-function rtrim(stringToTrim) {\r
- return stringToTrim.replace(/\s+$/,"");\r
-}\r
-\r
-function closeit(param){\r
- document.getElementById("vidContainer"+param).innerHTML = "";\r
- document.getElementById("vidContainer"+param).style.display = "none";\r
- $('#page_overlay').remove();\r
-}\r
-\r
-function InsertVideoUrl(param, param2){\r
- var actionAction = "add_video";\r
- var access_id = 2;\r
- var elggTS = "<?php echo time(); ?>";\r
- var elggToken = "<?php echo generate_action_token(time()); ?>";\r
- $.ajax({\r
- type: "GET",\r
- url: "<?php echo $vars['url']; ?>"+"action/videolist/addvideo",\r
- data: "bustcache="+new Date().getTime()+"&__elgg_ts="+elggTS+"&__elgg_token="+elggToken+"&video_action="+actionAction+"&title_videourl="+param+"&videolisttags="+param2+"&access_id="+access_id,\r
- success: function(html){\r
- $("#loadingSearch").html("");\r
- $("#responseSearch").html('');\r
- $("#responseSearch").html(html);\r
- }\r
- });\r
- \r
-}\r
-</script>\r
+<?php
+
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @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 = '<div class="videolist-content">';
+ //Load youtube menu
+ $body .= "<br /><div class=\"elgg_horizontal_tabbed_nav\">";
+ $body .= "<ul id=\"videonav\">";
+ $body .= "<li class=\"active\" id=\"YT\">";
+ $body .= "<a href=\"".$vars['url']."pg/videolist/browse/".$getcontainer_guid."?q=youtube\">YouTube</a>";
+ $body .= "</li>";
+ $body .= "<li id=\"MC\">";
+ $body .= "<a href=\"".$vars['url']."pg/videolist/browse/".$getcontainer_guid."?q=metacafe\">Metacafe</a>";
+ $body .= "</li>";
+ $body .= "<li id=\"VM\">";
+ $body .= "<a href=\"".$vars['url']."pg/videolist/browse/".$getcontainer_guid."?q=vimeo\">Vimeo</a>";
+ $body .= "</li>";
+ /*
+ $body .= "<li id=\"GV\">";
+ $body .= "<a href=\"".$vars['url']."pg/videolist/browse?q=googlevideos\">Google Videos</a>";
+ $body .= "</li>";
+ */
+ $body .= "</ul>";
+ $body .= "</div>";
+
+ $body .= "<div class=\"clearfloat\"></div>";
+
+ //$body .= "<div id=\"videosearch-interface\">";
+ $body .= '<form action="javascript:sendSearchRequest(1);" method="get">';
+ //$body .= "<form action=\"".$vars['url']."action/videolist/tubesearch\" method=\"get\">";
+ $body .= elgg_view('input/hidden',array('internalname'=>'video_action', 'value'=>'search_video'));
+ $body .= elgg_view('input/hidden',array('internalname'=>'guid', 'value'=>$vars['guid']));
+ //$body .= elgg_view('input/hidden',array('internalname'=>'start_index', 'value'=>1));
+
+ switch($browseCat)
+ {
+ case "youtube" :
+ $body .= elgg_view('forms/labels/youtube');
+ break;
+ case "metacafe" :
+ $body .= elgg_view('forms/labels/metacafe');
+ break;
+ case "vimeo" :
+ $body .= elgg_view('forms/labels/vimeo');
+ break;
+ case "googlevideos" :
+ $body .= elgg_view('forms/labels/googlevideos');
+ break;
+ default :
+ $body .= elgg_view('forms/labels/youtube');
+ break;
+ }
+ $body .= elgg_view('input/hidden',array('internalname'=>'page', 'value'=>$browseCat));
+ $body .= '</form>';
+ //$body .= '</div>';
+ //$body .= '</div>';
+
+ $body .= '<div id="SearchContainer">';
+ $body .= '<div id="loadingSearch">';
+ $body .= '</div>';
+ $body .= '<div id="responseSearch" align="center">';
+ $body .= '</div>';
+ $body .= '</div>';
+
+ print $body."<br /><br />";
+
+
+?>
+<style type="text/css">
+#videosearch-menu{
+position:relative;
+width:675px;
+height:31px;
+border:0px solid #CCC;
+border-width:0px 0px 1px 0px;
+margin:0px 0px 15px 0px;
+}
+#videosearch-menu ul{
+position:relative;
+text-align:left;
+width:600px;
+}
+#videosearch-menu ul li{
+position:relative;
+float:left;
+list-style-type:none;
+min-width:20%;
+cursor:pointer;
+margin:0px 22px 0px -20px;
+padding:8px 5px 5px 3px;
+border:0px solid #CCC;
+border-width:0px 0px 0px 0px;
+text-align:center;
+}
+
+</style>
+<script type="text/javascript">
+var page = "<?php echo $browseCat;?>";
+var container = "<?php echo $container;?>";
+$('#videonav li').removeClass();
+switch(page)
+{
+ case "youtube" : $('#YT').removeClass().addClass('active');
+ break;
+ case "metacafe" : $('#MC').removeClass().addClass('active');
+ break;
+ case "vimeo" : $('#VM').removeClass().addClass('active');
+ break;
+ case "googlevideos" : $('#GV').removeClass().addClass('active');
+ break;
+ default : $('#YT').removeClass().addClass('active');
+ break;
+}
+
+function sendSearchRequest(p){
+ var queryFeed = $("#title_search").val();
+ if(trim(queryFeed) != '')
+ {
+ $("#loadingSearch").html("<div align=\"center\" class=\"ajax_loader\"></div>");
+ var elggTS = "<?php echo time(); ?>";
+ var elggToken = "<?php echo generate_action_token(time()); ?>";
+ $.ajax({
+ type: "GET",
+ url: "<?php echo $vars['url']; ?>"+"action/videolist/tubesearch",
+ data: "bustcache="+new Date().getTime()+"&__elgg_ts="+elggTS+"&__elgg_token="+elggToken+"&page="+page+"&q="+queryFeed+"&start_index="+p+"&container="+container,
+ success: function(html){
+ $("#loadingSearch").html("");
+ $("#responseSearch").html('');
+ $("#responseSearch").html(html);
+ }
+ });
+ }
+ else{}
+}
+
+function showV_idFeed(param, param2){
+ var arg = param;
+ var embed_video = "<div style='text-align:right;'><a href='javascript:void(0);' onclick='javascript:closeit("+param2+");'>close</a></div><object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' width='475' height='350'>"+
+ "<param name='movie' value='"+arg+"&autoplay=1'>"+
+ "<param name='quality' value='high'>"+
+ "<param name='bgcolor' value='#CEEFFF'>"+
+ "<!--[if !IE]> <-->"+
+ "<object data='"+arg+"&autoplay=1' width='475' height='350' autoplay=1 type='application/x-shockwave-flash'>"+
+ "<param name='quality' value='high'>"+
+ "<param name='bgcolor' value='#CEEFFF'>"+
+ "<param name='pluginurl' value='http://www.adobe.com/go/getflashplayer'>"+
+ "FAIL (the browser should render some flash content, not this)."+
+ "</object>"+
+ "<!--> <![endif]-->"+
+ "</object>";
+ disableScreen(embed_video, param2);
+}
+
+function showV_idFeedMetacafe(param, param2){
+ var argArray = param.split("/");
+ var arg = argArray[0]+"/"+argArray[1]+".swf";
+ var embed_video = "<div style='text-align:right;'><a href='javascript:void(0);' onclick='javascript:closeit("+param2+");'>close</a></div><object width=\"475\" height=\"350\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"Metacafe_"+argArray[0]+"\" value=\"http://www.metacafe.com/fplayer/"+arg+"&autoplay=1\" /><embed src=\"http://www.metacafe.com/fplayer/"+arg+"&autoplay=1\" type=\"application/x-shockwave-flash\" name=\"Metacafe_"+argArray[0]+"\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"475\" height=\"350\"></embed></object>";
+
+ disableScreen(embed_video, param2);
+}
+
+function showV_idFeedVimeo(param, param2){
+ var arg = param;
+ var embed_video = "<div style='text-align:right;'><a href='javascript:void(0);' onclick='javascript:closeit("+param2+");'>close</a></div><object width=\"475\" height=\"350\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"movie\" value=\"http://vimeo.com/moogaloop.swf?clip_id="+arg+"&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" /><embed src=\"http://vimeo.com/moogaloop.swf?clip_id="+arg+"&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"475\" height=\"350\"></embed></object>";
+ disableScreen(embed_video, param2);
+}
+
+function disableScreen(embed_video, param2)
+{
+ var getContainer = "#vidContainer"+param2;
+ $('#page_container').append("<div id='page_overlay' style='position:absolute;'/>");
+ $('#page_overlay').css({
+ backgroundColor: "#000",
+ opacity: "0.8",
+ width: $(window).width(),
+ height: $('#page_container').height(),
+ top: "0px",
+ left: -(($(window).width() - $('body').width()) / 2)
+ }).fadeIn();
+ $(getContainer).css("width", "0%");
+ $(getContainer).animate( { width:"45%"}, 300 );
+ document.getElementById("vidContainer"+param2).innerHTML = embed_video;
+}
+
+function trim(stringToTrim)
+{
+ return ltrim(rtrim(stringToTrim));
+}
+
+function ltrim(stringToTrim) {
+ return stringToTrim.replace(/^\s+/,"");
+}
+
+function rtrim(stringToTrim) {
+ return stringToTrim.replace(/\s+$/,"");
+}
+
+function closeit(param){
+ document.getElementById("vidContainer"+param).innerHTML = "";
+ document.getElementById("vidContainer"+param).style.display = "none";
+ $('#page_overlay').remove();
+}
+
+function InsertVideoUrl(param, param2){
+ var actionAction = "add_video";
+ var access_id = 2;
+ var elggTS = "<?php echo time(); ?>";
+ var elggToken = "<?php echo generate_action_token(time()); ?>";
+ $.ajax({
+ type: "GET",
+ url: "<?php echo $vars['url']; ?>"+"action/videolist/addvideo",
+ data: "bustcache="+new Date().getTime()+"&__elgg_ts="+elggTS+"&__elgg_token="+elggToken+"&video_action="+actionAction+"&title_videourl="+param+"&videolisttags="+param2+"&access_id="+access_id,
+ success: function(html){
+ $("#loadingSearch").html("");
+ $("#responseSearch").html('');
+ $("#responseSearch").html(html);
+ }
+ });
+
+}
+</script>
<?php
- /**\r
- * Elgg User Profile Video Plugin\r
- * This plugin allows users to browse youtube videos\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
$body = '<p><label>'.elgg_echo("videolist:title_search_tube").'<br />';
//$body .= '<input type="submit" value="Submit" class="submit_button" name="submit" onclick="sendSearchRequest(1);"/>';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
//$body .= "</div>";
- $body .= "</div>";\r
+ $body .= "</div>";
$body .= '</label></p>';
$body .= '<div id="searchcontrol">Loading...</div>';
print $body;
<?php
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * @file - load metacafe label\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
$body = '<p><label>'.elgg_echo("videolist:title_search_tube").'<br />';
//$body .= '<input type="submit" value="Submit" class="submit_button" name="submit" onclick="sendSearchRequest(1);"/>';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:metacafe')));
//$body .= "</div>";
- $body .= "</div>";\r
+ $body .= "</div>";
$body .= '</label></p>';
print $body;
<?php
- /**\r
- * Elgg Video Plugin\r
+ /**
+ * Elgg Video Plugin
* This plugin allows users to create a library of youtube/vimeo/metacafe videos
- * @file - load vimeo label\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+ * @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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
$body = '<p><label>'.elgg_echo("videolist:title_search_tube").'<br />';
//$body .= '<input type="submit" value="Submit" class="submit_button" name="submit" onclick="sendSearchRequest(1);"/>';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos:vimeo')));
//$body .= "</div>";
- $body .= "</div>";\r
+ $body .= "</div>";
$body .= '</label></p>';
print $body;
<?php
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * @file - load youtube label\r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
$body = '<p><label>'.elgg_echo("videolist:title_search_tube").'<br />';
//$body .= '<input type="submit" value="Submit" class="submit_button" name="submit" onclick="sendSearchRequest(1);"/>';
$body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('videolist:searchTubeVideos')));
//$body .= "</div>";
- $body .= "</div>";\r
+ $body .= "</div>";
$body .= '</label></p>';
print $body;
-<?php\r
- /**\r
- * Elgg Videolist Plugin -\r
- * This plugin allows users to watch videos \r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-$videodiv = '';\r
-$width = "600";\r
-$height = "400";\r
-$file = $vars['entity'];\r
-if(isset($vars['entity']))\r
-{\r
-\r
-$videos = get_entity($vars['entity']);\r
-$title = $videos->title;\r
-$url = $videos->url;\r
-$videoid = $videos->video_id;\r
-$videodiv = "<h2>".$title."</h2>";\r
-if($videos->videotype == "youtube"){\r
- $videodiv .= "<div align=\"center\" style=\"margin-top:20px;\"><object width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"http://{$url}&hl=en&fs=1&showinfo=0&auoplay=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://{$url}&hl=en&fs=1&showinfo=0&autoplay=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed></object>";\r
-}\r
-else if($videos->videotype == "metacafe"){\r
- $videoid_id = $videoid;\r
- $path = explode("/", $videos->thumbnail);\r
- $path = array_reverse($path);\r
- $thumbnailArray = explode(".", $path[0]);\r
- $videoid = $videoid_id."/".$thumbnailArray[0].".swf";\r
- $videodiv .= "<div align=\"center\" style=\"margin-top:20px;\"><embed src=\"http://www.metacafe.com/fplayer/".$videoid."\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"$width\" height=\"$height\" name=\"Metacafe_".$videoid_id."\"></embed>";\r
-\r
-}\r
-else if($videos->videotype == "vimeo"){\r
- $videodiv .= "<div align=\"center\" style=\"margin-top:20px;\"><object width=\"$width\" height=\"$height\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"movie\" value=\"http://vimeo.com/moogaloop.swf?clip_id=".$videoid."&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" /><embed src=\"http://vimeo.com/moogaloop.swf?clip_id=".$videoid."&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"$width\" height=\"$height\"></embed></object>";\r
-}\r
-$videodiv .= "</div>";\r
-$videodiv .= elgg_view_likes($videos);\r
-$videodiv .= elgg_view_comments($videos);\r
-print $videodiv;\r
-\r
-//echo elgg_view_comments($videos);\r
-}\r
-?>\r
+<?php
+ /**
+ * Elgg Videolist Plugin -
+ * This plugin allows users to watch videos
+ *
+ * @package Elgg
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary <synapticfield@gmail.com>
+ * @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 = "<h2>".$title."</h2>";
+if($videos->videotype == "youtube"){
+ $videodiv .= "<div align=\"center\" style=\"margin-top:20px;\"><object width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"http://{$url}&hl=en&fs=1&showinfo=0&auoplay=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://{$url}&hl=en&fs=1&showinfo=0&autoplay=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed></object>";
+}
+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 .= "<div align=\"center\" style=\"margin-top:20px;\"><embed src=\"http://www.metacafe.com/fplayer/".$videoid."\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"$width\" height=\"$height\" name=\"Metacafe_".$videoid_id."\"></embed>";
+
+}
+else if($videos->videotype == "vimeo"){
+ $videodiv .= "<div align=\"center\" style=\"margin-top:20px;\"><object width=\"$width\" height=\"$height\"><param name=\"allowfullscreen\" value=\"true\" /><param name=\"allowscriptaccess\" value=\"always\" /><param name=\"movie\" value=\"http://vimeo.com/moogaloop.swf?clip_id=".$videoid."&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" /><embed src=\"http://vimeo.com/moogaloop.swf?clip_id=".$videoid."&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" allowscriptaccess=\"always\" width=\"$width\" height=\"$height\"></embed></object>";
+}
+$videodiv .= "</div>";
+$videodiv .= elgg_view_likes($videos);
+$videodiv .= elgg_view_comments($videos);
+print $videodiv;
+
+//echo elgg_view_comments($videos);
+}
+?>
-<?php\r
-\r
- $statement = $vars['statement'];\r
- $performed_by = $statement->getSubject();\r
- $object = $statement->getObject();\r
- \r
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";\r
- $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " ";\r
- $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("videolist:river:item") . "</a>";\r
-\r
- echo $string; \r
- \r
+<?php
+
+ $statement = $vars['statement'];
+ $performed_by = $statement->getSubject();
+ $object = $statement->getObject();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $string = sprintf(elgg_echo("videolist:river:annotate"),$url) . " ";
+ $string .= "<a href=\"" . $object->getURL() . "\">" . elgg_echo("videolist:river:item") . "</a>";
+
+ echo $string;
+
?>
-<?php\r
-\r
- $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();\r
- $object = get_entity($vars['item']->object_guid);\r
- $thumbnail = $object->thumbnail;\r
- //$url = $object->getURL();\r
- \r
- $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";\r
- $title = $object->title;\r
- if(!$title)\r
- $title = "untitled";\r
- $string = sprintf(elgg_echo("videolist:river:created"),$url) . " ";\r
- $string .= elgg_echo("videolist:river:item") . " titled <a href=\"" . $object->getURL() . "\">" . $title . "</a>";\r
- $string .= "<div class=\"river_content_display\">";\r
- $string .= "<a href=\"" . $object->getURL() . "\"><img src='".$thumbnail."' width='120' class='tubesearch'/></a>";\r
- $string .= "</div>";\r
-\r
+<?php
+
+ $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject();
+ $object = get_entity($vars['item']->object_guid);
+ $thumbnail = $object->thumbnail;
+ //$url = $object->getURL();
+
+ $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
+ $title = $object->title;
+ if(!$title)
+ $title = "untitled";
+ $string = sprintf(elgg_echo("videolist:river:created"),$url) . " ";
+ $string .= elgg_echo("videolist:river:item") . " titled <a href=\"" . $object->getURL() . "\">" . $title . "</a>";
+ $string .= "<div class=\"river_content_display\">";
+ $string .= "<a href=\"" . $object->getURL() . "\"><img src='".$thumbnail."' width='120' class='tubesearch'/></a>";
+ $string .= "</div>";
+
echo $string;
\ No newline at end of file
<?php
-/**\r
- * Elgg Candidate Profile Plugin - file search.php\r
- * This plugin allows users to create custom candidate profile\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+/**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
-<?php\r
-/**\r
- * Elgg Candidate Profile Video Plugin\r
- * This plugin allows users to create a library of youtube videos\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-\r
-\r
-?>\r
-\r
-.error{\r
-color:red;\r
-font-weight:bold;\r
-font-size:11px;\r
-}\r
-#video-list-main{\r
-padding:10px;\r
-}\r
-#videocontainer{\r
-width:100%;\r
-margin-bottom:10px;\r
-}\r
-.search_gallery_item{\r
-border:0px solid #CCCCCC;\r
-}\r
-#videobox{\r
-width:98%;\r
-text-align:center;\r
-margin-top:10px;\r
-}\r
-#videoDescbox{\r
-width:95%;\r
-margin:0px 5px 0px 8px;\r
-}\r
-#videoActionbox{\r
-width:90%;\r
-margin:0px 5px 0px 8px;\r
-float:left;\r
-}\r
-#videothumbnail-box{\r
-float:left;\r
-width:35%;\r
-background: #333333;\r
-text-align:center;\r
-padding:3px 1px 3px 0px;\r
-}\r
-#videotitle-box{\r
-width:60%;\r
-float:left;\r
-font-size:12px;\r
-font-weight:bold;\r
-text-align:left;\r
-padding-left:5px;\r
-color:#474B9F;\r
-}\r
-.title{\r
-font-weight:bold;\r
-}\r
-#profile_video_widget_container{\r
-margin:0px 10px 10px 10px;\r
-padding:8px;\r
--moz-border-radius-topleft:8px;\r
--moz-border-radius-topright:8px;\r
--moz-border-radius-bottomleft:8px;\r
--moz-border-radius-bottomright:8px;\r
-border:0px solid #C3C3C3;\r
-background: #FFFFFF;\r
-max-height:250px;\r
-overflow-y:auto;\r
-}\r
-#profile_video_image_container{\r
-float:left;\r
-width:95%;\r
-margin:6px 2px 0px 6px;\r
-border-bottom:1px solid #CCC;\r
-padding-bottom:3px;\r
-}\r
-\r
-#widget_container_header{\r
-color:#474B9F;\r
-margin:0px 0px 5px 0px;\r
-font-weight:bold;\r
-font-size:13px;\r
-}\r
-#loadingSearch{\r
-width:100%;\r
-}\r
-#SearchContainer{\r
-width:100%;\r
-}\r
-#responseSearch{\r
-padding:15px;\r
-}\r
-#paginateSearch{\r
--moz-border-radius-topleft:5px;\r
--moz-border-radius-topright:5px;\r
-padding:2px 5px 2px 0px;\r
-text-align:right;\r
-background:#FFF;\r
-border:0px solid #CCC;\r
-color:#666;\r
-}\r
-th{\r
-text-align:center;\r
-font-weight:bold;\r
-font-size:13px;\r
-}\r
-#parentTab{\r
--moz-border-radius-bottomleft:8px;\r
--moz-border-radius-bottomright:8px;\r
--moz-border-radius-topleft:8px;\r
--moz-border-radius-topright:8px;\r
-border-top:1px solid #CCC;\r
-border-bottom:6px solid #CCC;\r
-border-left:1px solid #CCC;\r
-border-right:5px solid #CCC;\r
-background:#FFFFFF;\r
-margin-top:7px;\r
-}\r
-.tabcellDesc{\r
-padding:5px 5px 5px 10px;\r
-text-align: left;\r
-}\r
-.tabcellText{\r
-padding:5px;\r
-text-align: center;\r
-}\r
-.videoDisp{\r
-position:absolute;\r
--moz-border-radius-topleft:5px;\r
--moz-border-radius-topright:5px;\r
--moz-border-radius-bottomleft:5px;\r
--moz-border-radius-bottomright:5px;\r
-border:1px solid #000000;\r
-display:none;\r
-padding:10px;\r
-margin-left:120px;\r
-margin-top:-100px;\r
-background:#FFFFFF;\r
-z-index:300000;\r
-}\r
-.videolist-content{\r
--moz-border-radius-topleft:5px;\r
--moz-border-radius-topright:5px;\r
--moz-border-radius-bottomleft:5px;\r
--moz-border-radius-bottomright:5px;\r
-border:1px solid #C3C3C3;\r
-width:675px;\r
-margin:10px 0px 10px 10px;\r
-padding:10px;\r
-background:#FFFFFF;\r
-}\r
-.tubesearch{\r
--moz-border-radius-topleft:5px;\r
--moz-border-radius-topright:5px;\r
--moz-border-radius-bottomleft:5px;\r
--moz-border-radius-bottomright:5px;\r
-border:1px solid #666666;\r
-}\r
-#comment_area_video_title{\r
-padding:10px;\r
--moz-border-radius-topleft:5px;\r
--moz-border-radius-topright:5px;\r
--moz-border-radius-bottomleft:5px;\r
--moz-border-radius-bottomright:5px;\r
-border:1px solid #CCCCCC;\r
-border:1px solid #CCCCCC;\r
-background:#FFFFFF;\r
-}\r
-.vid-comment-widget{\r
-font-size:11px;\r
-font-weight:normal;\r
-}\r
-.searchvideorow{\r
-padding:10px;\r
--moz-border-radius-topleft:5px;\r
--moz-border-radius-topright:5px;\r
--moz-border-radius-bottomleft:5px;\r
--moz-border-radius-bottomright:5px;\r
-border:1px solid #CCCCCC;\r
-}\r
-#videosearch-tablecontainer{\r
--moz-border-radius-bottomleft:5px;\r
--moz-border-radius-bottomright:5px;\r
-border:1px solid #CCCCCC;\r
-background:#FFF;\r
-padding:10px;\r
-}\r
-#videosearch-interface{\r
-border-color:#CCCCCC;\r
-border-style:solid;\r
-border-width:0 1px 1px;\r
-margin-top:-15px;\r
-padding:15px 0 15px 20px;\r
-}\r
+<?php
+/**
+ * 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 <synapticfield@gmail.com>
+ * @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;
+}
-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of videos for groups\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+<?php
+
+ /**
+ * Elgg Video Plugin
+ * This plugin allows users to create a library of videos for groups
+ *
+ * @package ElggProfile
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Prateek Choudhary <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
?>
-<div id="filerepo_widget_layout"> \r
-<h2><?php echo elgg_echo("videolist:group"); ?></h2>\r
-\r
-<?php\r
-\r
- //the number of files to display\r
- $number = (int) $vars['entity']->num_display;\r
- if (!$number)\r
- $number = 5;\r
- \r
- //get the user's files\r
- $videos = get_user_objects($vars['entity']->guid, "videolist", $number, 0);\r
- \r
- //if there are some files, go get them\r
- if ($videos) {\r
- \r
+<div id="filerepo_widget_layout">
+<h2><?php echo elgg_echo("videolist:group"); ?></h2>
+
+<?php
+
+ //the number of files to display
+ $number = (int) $vars['entity']->num_display;
+ if (!$number)
+ $number = 5;
+
+ //get the user's files
+ $videos = get_user_objects($vars['entity']->guid, "videolist", $number, 0);
+
+ //if there are some files, go get them
+ if ($videos) {
+
//display in list mode
- echo "<div class=\"filerepo_widget_singleitem\" style=\"width:310px;padding:5px;\">";\r
- foreach($videos as $f){\r
- \r
+ echo "<div class=\"filerepo_widget_singleitem\" style=\"width:310px;padding:5px;\">";
+ foreach($videos as $f){
+
$mime = $f->mimetype;
- $owner = get_entity($f->getOwner());\r
- $numcomments = elgg_count_comments($f);\r
- echo "<div class=\"filerepo_listview_icon\" style=\"float:left;width:90px;padding:8px 0 0 0;\"><a href=\"{$vars['url']}pg/videolist/watch/{$f->guid}\"><img src=\"".$f->thumbnail."\" border=\"0\" width=\"85\" /></a></div>";\r
- echo "<div class=\"filerepo_widget_content\" style=\"width:210px;margin-left:100px;\">";\r
- echo "<div class=\"filerepo_listview_title\"><p class=\"filerepo_title\" style=\"font-weight:normal;font-size:12px;\"><a href=\"{$vars['url']}pg/videolist/watch/{$f->guid}\">" . $f->title ."</a></p><br />by <a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a>";\r
+ $owner = get_entity($f->getOwner());
+ $numcomments = elgg_count_comments($f);
+ echo "<div class=\"filerepo_listview_icon\" style=\"float:left;width:90px;padding:8px 0 0 0;\"><a href=\"{$vars['url']}pg/videolist/watch/{$f->guid}\"><img src=\"".$f->thumbnail."\" border=\"0\" width=\"85\" /></a></div>";
+ echo "<div class=\"filerepo_widget_content\" style=\"width:210px;margin-left:100px;\">";
+ echo "<div class=\"filerepo_listview_title\"><p class=\"filerepo_title\" style=\"font-weight:normal;font-size:12px;\"><a href=\"{$vars['url']}pg/videolist/watch/{$f->guid}\">" . $f->title ."</a></p><br />by <a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a>";
if ($numcomments)
echo "<br /><a href=\"{$vars['url']}pg/videolist/watch/{$f->guid}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>";
echo "</div>";
- echo "<div class=\"filerepo_listview_date\"><p class=\"filerepo_timestamp\"><small>" . friendly_time($f->time_created) . "</small></p></div>";\r
- echo "</div><div class=\"clearfloat\" style=\"height:8px;\"></div>";\r
- \r
- }\r
- echo "</div>";\r
- \r
- //get a link to the users files\r
- $users_file_url = $vars['url'] . "pg/videolist/owned/" . page_owner_entity()->username;\r
- \r
- echo "<div class=\"forum_latest\"><a href=\"{$users_file_url}\">" . elgg_echo("videolist:groupall") . "</a></div>";\r
- \r
- } else {\r
- \r
- echo "<div class=\"forum_latest\">" . elgg_echo("videolist:none") . "</div>";\r
-\r
- }\r
-\r
-?>\r
-<div class="clearfloat" /></div>\r
+ echo "<div class=\"filerepo_listview_date\"><p class=\"filerepo_timestamp\"><small>" . friendly_time($f->time_created) . "</small></p></div>";
+ echo "</div><div class=\"clearfloat\" style=\"height:8px;\"></div>";
+
+ }
+ echo "</div>";
+
+ //get a link to the users files
+ $users_file_url = $vars['url'] . "pg/videolist/owned/" . page_owner_entity()->username;
+
+ echo "<div class=\"forum_latest\"><a href=\"{$users_file_url}\">" . elgg_echo("videolist:groupall") . "</a></div>";
+
+ } else {
+
+ echo "<div class=\"forum_latest\">" . elgg_echo("videolist:none") . "</div>";
+
+ }
+
+?>
+<div class="clearfloat" /></div>
</div>
-<?php\r
-\r
- /**\r
- * Elgg blog not found page\r
- * \r
- * @package ElggBlog\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Curverider Ltd <info@elgg.com>\r
- * @copyright Curverider Ltd 2008\r
- * @link http://elgg.com/\r
- */\r
-\r
-?>\r
-\r
- <p>\r
- <?php\r
-\r
- echo elgg_echo("video:none");\r
- \r
- ?>\r
+<?php
+
+ /**
+ * Elgg blog not found page
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+?>
+
+ <p>
+ <?php
+
+ echo elgg_echo("video:none");
+
+ ?>
</p>
-<p>\r
- <?php echo elgg_echo("videolist:num_videos"); ?>:\r
- \r
- <?\r
- if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;\r
- ?>\r
- <select name="params[num_display]">\r
- <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>\r
- <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>\r
- <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>\r
- <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>\r
- <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>\r
- <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>\r
- <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>\r
- <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>\r
- <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>\r
- <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>\r
- <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>\r
- <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option>\r
- </select>\r
-</p>\r
+<p>
+ <?php echo elgg_echo("videolist:num_videos"); ?>:
+
+ <?
+ if($vars['entity']->num_display == '') $vars['entity']->num_display = 6;
+ ?>
+ <select name="params[num_display]">
+ <option value="1" <?php if($vars['entity']->num_display == 1) echo "SELECTED"; ?>>1</option>
+ <option value="2" <?php if($vars['entity']->num_display == 2) echo "SELECTED"; ?>>2</option>
+ <option value="3" <?php if($vars['entity']->num_display == 3) echo "SELECTED"; ?>>3</option>
+ <option value="4" <?php if($vars['entity']->num_display == 4) echo "SELECTED"; ?>>4</option>
+ <option value="5" <?php if($vars['entity']->num_display == 5) echo "SELECTED"; ?>>5</option>
+ <option value="6" <?php if($vars['entity']->num_display == 6) echo "SELECTED"; ?>>6</option>
+ <option value="7" <?php if($vars['entity']->num_display == 7) echo "SELECTED"; ?>>7</option>
+ <option value="8" <?php if($vars['entity']->num_display == 8) echo "SELECTED"; ?>>8</option>
+ <option value="9" <?php if($vars['entity']->num_display == 9) echo "SELECTED"; ?>>9</option>
+ <option value="10" <?php if($vars['entity']->num_display == 10) echo "SELECTED"; ?>>10</option>
+ <option value="15" <?php if($vars['entity']->num_display == 15) echo "SELECTED"; ?>>15</option>
+ <option value="20" <?php if($vars['entity']->num_display == 20) echo "SELECTED"; ?>>20</option>
+ </select>
+</p>
<?php
-/**\r
- * Elgg Videolist Plugin\r
- * This plugin allows users to create a library of youtube videos\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+/**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
-<?php\r
- /**\r
- * Elgg Videolist Plugin\r
- * This plugin allows users to create a library of youtube videos\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+<?php
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
- \r
- echo $vars['body'];\r
-\r
+
+ echo $vars['body'];
+
?>
-<?php\r
- /**\r
- * Elgg Videolist Plugin\r
- * This plugin allows users to create a library of youtube videos\r
- * \r
- * @package ElggProfile\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
+<?php
+ /**
+ * 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 <synapticfield@gmail.com>
+ * @copyright Prateek Choudhary
*/
-\r
- if ($foreach = get_entities('object','',$vars['entity']->guid)) {\r
- foreach($foreach as $videos)\r
- echo elgg_view_entity($videos);\r
- }\r
- \r
+
+ if ($foreach = get_entities('object','',$vars['entity']->guid)) {
+ foreach($foreach as $videos)
+ echo elgg_view_entity($videos);
+ }
+
?>
-<?php\r
-\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");\r
-\r
-\r
- // Get objects\r
- $video_id = (int) get_input('video_id');\r
- \r
- // If we can get out the video corresponding to video_id object ...\r
- if ($videos = get_entity($video_id)) {\r
- set_page_owner($videos->container_guid);\r
- $videos_container = get_entity($videos->container_guid);\r
- if($videos_container->type == "group")\r
- set_context("groupsvideos");\r
- $page_owner = page_owner_entity();\r
- $title = sprintf(elgg_echo("videolist:home"),page_owner_entity()->name); \r
- // Display it\r
- $area2 = elgg_view("object/watch",array(\r
- 'entity' => $video_id,\r
- 'entity_owner' => $page_owner,\r
- 'full' => true\r
- ));\r
- //$area2 .= elgg_view("videolist/comments", array('entity' => $videos));\r
- $body = elgg_view_layout("one_column_with_sidebar", $area1 . $area2);\r
- }\r
- else\r
- {\r
- // Display the 'post not found' page instead\r
- $body = elgg_view("videolist/notfound");\r
- $title = elgg_echo("video:none");\r
- \r
- }\r
- // Finally draw the page\r
- page_draw($title, $body);\r
-?>\r
+<?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 <synapticfield@gmail.com>
+ * @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);
+?>
-<?php\r
- /**\r
- * Elgg Video Plugin\r
- * This plugin allows users to create a library of youtube/vimeo/metacafe videos\r
- * \r
- * @package Elgg\r
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2\r
- * @author Prateek Choudhary <synapticfield@gmail.com>\r
- * @copyright Prateek Choudhary\r
- */\r
-// Render the video upload page\r
- // Load Elgg engine\r
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");\r
- gatekeeper();\r
- \r
- // Get the current page's owner \r
- $page_owner = page_owner_entity();\r
- if ($page_owner === false || is_null($page_owner)) {\r
- $page_owner = $_SESSION['user'];\r
- set_page_owner($_SESSION['guid']);\r
- }\r
-\r
- $title = sprintf(elgg_echo("videolist:search"));\r
-\r
- // Get objects\r
- $area2 = elgg_view_title($title);\r
- set_input('show_viewtype', 'all');\r
- $area2 .= list_entities("object","videolist", 0, 10, $fullview=true, $viewtypetoggle=false,$pagination=true);\r
- \r
- //$area2 .= elgg_view("staticvideo/index");\r
- \r
- set_context('videolist');\r
- $body = elgg_view_layout('one_column_with_sidebar',$area1. $area2);\r
- \r
- // Finally draw the page\r
- page_draw($title, $body);\r
-\r
-?>\r
+<?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 <synapticfield@gmail.com>
+ * @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);
+
+?>