diff options
author | Steve Clay <steve@mrclay.org> | 2012-04-09 17:05:57 -0400 |
---|---|---|
committer | Steve Clay <steve@mrclay.org> | 2012-04-09 17:05:57 -0400 |
commit | f399afdd2e3cc072efaca069b7a874c7801b31f6 (patch) | |
tree | a2f5d4fb13f5d2b142953451f37294d4b8981598 /lib/Videolist/Platform/Gisstv.php | |
parent | e80bb29671b7887d5749a9eb147be38e6f0401f4 (diff) | |
download | elgg-f399afdd2e3cc072efaca069b7a874c7801b31f6.tar.gz elgg-f399afdd2e3cc072efaca069b7a874c7801b31f6.tar.bz2 |
switched to platform classes. see https://github.com/Elgg/videolist/issues/4
Diffstat (limited to 'lib/Videolist/Platform/Gisstv.php')
-rw-r--r-- | lib/Videolist/Platform/Gisstv.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/Videolist/Platform/Gisstv.php b/lib/Videolist/Platform/Gisstv.php new file mode 100644 index 000000000..f811619a8 --- /dev/null +++ b/lib/Videolist/Platform/Gisstv.php @@ -0,0 +1,51 @@ +<?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( + 'videotype' => 'gisstv', + 'video_id' => $video_id, + ); + } + + public function getData($parsed) + { + $video_id = $parsed['video_id']; + + $buffer = file_get_contents('http://giss.tv/dmmdb//rss.php'); + $xml = new SimpleXMLElement($buffer); + + $data = array(); + foreach($xml->xpath('/rss/channel/item') as $item){ + if ($item->link === 'http://giss.tv/dmmdb//contents/'.$video_id) { + $data['title'] = $item->title; + $data['description'] = strip_tags($item->description); + $data['thumbnail'] = $item->thumbnail; + break; + } + } + return $data; + } +} |