Commit 5a5c9634 authored by Melissa Draper's avatar Melissa Draper
Browse files

Fix voki/glogster externalvideo filters due to url changes(bug #905097)



Voki and glogster externalvideo filters were changed by the providers.
We get to play catchup.

Change-Id: I7427a78fac2cbce1949bf223ab15d51c184ad06f
Signed-off-by: default avatarMelissa Draper <melissa@catalyst.net.nz>
parent a0a92f06
...@@ -8,19 +8,22 @@ class Media_glogster implements MediaBase { ...@@ -8,19 +8,22 @@ class Media_glogster implements MediaBase {
private static $default_width = 480; private static $default_width = 480;
private static $default_height = 650; private static $default_height = 650;
private static $default_scale = 50;
private static $embed_sources = array( private static $embed_sources = array(
array( array(
'match' => '#.*?glogster\.com/flash/flash_loader\.swf\?ver=(\d+).*?flashvars="([^"]+)".*#', 'match' => '#.*?glogster\.com/([a-zA-Z0-9\-\_\/]*)/g-([a-zA-Z0-9\-\_\/]*).*#',
'url' => 'http://www.glogster.com/flash/flash_loader.swf?ver=$1&$2', 'url' => 'http://www.glogster.com/glog/$2',
),
array(
'match' => '#.*?glogster\.com/glog/([a-zA-Z0-9\-\_\/]*).*#',
'url' => 'http://www.glogster.com/glog/$1',
), ),
); );
private static $iframe_sources = array( private static $iframe_sources = array(
array( array(
'match' => '#.*?https?://((www|edu)\.)?glogster\.com/glog\.php\?glog_id=([0-9]*).*#', 'match' => '#.*?https?://((www|edu)\.)?glogster\.com/glog/([a-zA-Z0-9\-\_]*)".*#',
'url' => 'http://www.glogster.com/glog.php?glog_id=$3&scale=', 'url' => 'http://www.glogster.com/glog/$3',
), ),
); );
...@@ -38,14 +41,13 @@ class Media_glogster implements MediaBase { ...@@ -38,14 +41,13 @@ class Media_glogster implements MediaBase {
$width = $width ? (int)$width : self::$default_width; $width = $width ? (int)$width : self::$default_width;
$height = $height ? (int)$height : self::$default_height; $height = $height ? (int)$height : self::$default_height;
$scale = (int) $width / self::$default_width * self::$default_scale;
foreach (self::$embed_sources as $source) { foreach (self::$embed_sources as $source) {
if (preg_match($source['match'], $input)) { if (preg_match($source['match'], $input)) {
$output = preg_replace($source['match'], $source['url'], $input); $output = preg_replace($source['match'], $source['url'], $input);
$result = array( $result = array(
'videoid' => $output, 'videoid' => $output,
'type' => 'embed', 'type' => 'iframe',
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
); );
...@@ -57,7 +59,7 @@ class Media_glogster implements MediaBase { ...@@ -57,7 +59,7 @@ class Media_glogster implements MediaBase {
if (preg_match($source['match'], $input)) { if (preg_match($source['match'], $input)) {
$output = preg_replace($source['match'], $source['url'], $input); $output = preg_replace($source['match'], $source['url'], $input);
$result = array( $result = array(
'videoid' => $output . $scale, 'videoid' => $output,
'type' => 'iframe', 'type' => 'iframe',
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
......
...@@ -8,7 +8,7 @@ class Media_voki implements MediaBase { ...@@ -8,7 +8,7 @@ class Media_voki implements MediaBase {
private static $default_width = 200; private static $default_width = 200;
private static $default_height = 267; private static $default_height = 267;
private static $scrape_sources = array( private static $iframe_sources = array(
array( array(
'match' => '#http://www\.voki\.com/pickup\.php\?(partnerid=symbaloo&)?scid=([0-9]+)#', 'match' => '#http://www\.voki\.com/pickup\.php\?(partnerid=symbaloo&)?scid=([0-9]+)#',
'url' => 'http://voki.com/php/checksum/scid=$2' 'url' => 'http://voki.com/php/checksum/scid=$2'
...@@ -16,14 +16,19 @@ class Media_voki implements MediaBase { ...@@ -16,14 +16,19 @@ class Media_voki implements MediaBase {
array( array(
'match' => '#http://www\.voki\.com/pickup\.php\?(partnerid=symbaloo&)?scid=([0-9]+)&height=([0-9]+)&width=([0-9]+)#', 'match' => '#http://www\.voki\.com/pickup\.php\?(partnerid=symbaloo&)?scid=([0-9]+)&height=([0-9]+)&width=([0-9]+)#',
'url' => 'http://voki.com/php/checksum/scid=$2/height=$3/width=$4' 'url' => 'http://voki.com/php/checksum/scid=$2&height=$3&width=$4'
),
array(
'match' => '#http://voki\.com/php/checksum/scid=([0-9]+)&height=([0-9]+)&width=([0-9]+)#',
'url' => 'http://voki.com/php/checksum/scid=$1&height=$2&width=$3'
), ),
); );
private static $embed_sources = array( private static $embed_sources = array(
array( array(
'match' => '#.*http://vhss(-d)?\.oddcast\.com/vhss_editors/voki_player\.swf\?(.+)(%26)?sc%3d([0-9]+).*#', 'match' => '#.*http://vhss(-d)?\.oddcast\.com/vhss_editors/voki_player\.swf\?(.+)(%26)?sc=([0-9]+).*#',
'url' => 'http://vhss$1.oddcast.com/vhss_editors/voki_player.swf?$2$3sc%3D$4' 'url' => 'http://vhss$1.oddcast.com/vhss_editors/voki_player.swf?$2$3sc=$4'
), ),
); );
...@@ -45,12 +50,20 @@ class Media_voki implements MediaBase { ...@@ -45,12 +50,20 @@ class Media_voki implements MediaBase {
} }
} }
foreach (self::$scrape_sources as $source) { foreach (self::$iframe_sources as $source) {
if (preg_match($source['match'], $input)) { if (preg_match($source['match'], $input)) {
$output = preg_replace($source['match'], $source['url'], $input); $output = preg_replace($source['match'], $source['url'], $input);
return self::process_url(self::scrape_url($output)); $result = array(
'videoid' => $output,
'type' => 'iframe',
'width' => ($width + 20),
'height' => ($height + 20),
);
error_log(print_r($result, true));
return $result;
} }
} }
return false; return false;
} }
...@@ -62,7 +75,7 @@ class Media_voki implements MediaBase { ...@@ -62,7 +75,7 @@ class Media_voki implements MediaBase {
} }
} }
foreach (self::$scrape_sources as $source) { foreach (self::$iframe_sources as $source) {
if (preg_match($source['match'], $input)) { if (preg_match($source['match'], $input)) {
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment