aboutsummaryrefslogtreecommitdiff
path: root/lib/Videolist/Platform/Gisstv.php
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-04-17 23:54:30 -0700
committerSem <sembrestels@riseup.net>2012-04-17 23:54:30 -0700
commita613b944015fd82f97a15392c0de0e7df104706d (patch)
tree5022ba0160427bec07cf9fdf337ef8161e4071b9 /lib/Videolist/Platform/Gisstv.php
parentf1a0a4d5aa28753620552df9d5e88bd983d0aca4 (diff)
parent4af120de2bd0fe2046795346a40102f00fbe5479 (diff)
downloadelgg-a613b944015fd82f97a15392c0de0e7df104706d.tar.gz
elgg-a613b944015fd82f97a15392c0de0e7df104706d.tar.bz2
Merge pull request #1 from mrclay/master
Partial rewrite
Diffstat (limited to 'lib/Videolist/Platform/Gisstv.php')
-rw-r--r--lib/Videolist/Platform/Gisstv.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/Videolist/Platform/Gisstv.php b/lib/Videolist/Platform/Gisstv.php
new file mode 100644
index 000000000..b79898449
--- /dev/null
+++ b/lib/Videolist/Platform/Gisstv.php
@@ -0,0 +1,50 @@
+<?php
+
+class Videolist_Platform_Gisstv implements Videolist_PlatformInterface
+{
+ public function getType()
+ {
+ return "gisstv";
+ }
+
+ public function parseUrl($url)
+ {
+ $parsed = parse_url($url);
+ $path = explode('/', $parsed['path']);
+
+ if ($parsed['host'] != 'giss.tv' || $path[1] != 'dmmdb') {
+ return false;
+ }
+
+ if($path[2] == 'contents' && isset($path[3])) {
+ $video_id = $path[3];
+ } elseif($path[3] == 'contents' && isset($path[4])) {
+ $video_id = $path[4];
+ } else {
+ return false;
+ }
+
+ return array(
+ 'video_id' => $video_id,
+ );
+ }
+
+ public function getData($parsed)
+ {
+ $video_id = $parsed['video_id'];
+
+ $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php');
+ $xml = new SimpleXMLElement($buffer);
+
+ $data = array();
+ foreach($xml->xpath('/rss/channel/item') as $item){
+ if ($item->link === 'http://giss.tv/dmmdb//contents/'.$video_id) {
+ $data['title'] = $item->title;
+ $data['description'] = strip_tags($item->description);
+ $data['thumbnail'] = $item->thumbnail;
+ break;
+ }
+ }
+ return $data;
+ }
+}