Commit a3b5a7e4 authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

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

parents e5430524 5a5c9634
......@@ -8,19 +8,22 @@ class Media_glogster implements MediaBase {
private static $default_width = 480;
private static $default_height = 650;
private static $default_scale = 50;
private static $embed_sources = array(
array(
'match' => '#.*?glogster\.com/flash/flash_loader\.swf\?ver=(\d+).*?flashvars="([^"]+)".*#',
'url' => 'http://www.glogster.com/flash/flash_loader.swf?ver=$1&$2',
'match' => '#.*?glogster\.com/([a-zA-Z0-9\-\_\/]*)/g-([a-zA-Z0-9\-\_\/]*).*#',
'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(
array(
'match' => '#.*?https?://((www|edu)\.)?glogster\.com/glog\.php\?glog_id=([0-9]*).*#',
'url' => 'http://www.glogster.com/glog.php?glog_id=$3&scale=',
'match' => '#.*?https?://((www|edu)\.)?glogster\.com/glog/([a-zA-Z0-9\-\_]*)".*#',
'url' => 'http://www.glogster.com/glog/$3',
),
);
......@@ -38,14 +41,13 @@ class Media_glogster implements MediaBase {
$width = $width ? (int)$width : self::$default_width;
$height = $height ? (int)$height : self::$default_height;
$scale = (int) $width / self::$default_width * self::$default_scale;
foreach (self::$embed_sources as $source) {
if (preg_match($source['match'], $input)) {
$output = preg_replace($source['match'], $source['url'], $input);
$result = array(
'videoid' => $output,
'type' => 'embed',
'type' => 'iframe',
'width' => $width,
'height' => $height,
);
......@@ -57,7 +59,7 @@ class Media_glogster implements MediaBase {
if (preg_match($source['match'], $input)) {
$output = preg_replace($source['match'], $source['url'], $input);
$result = array(
'videoid' => $output . $scale,
'videoid' => $output,
'type' => 'iframe',
'width' => $width,
'height' => $height,
......
......@@ -8,7 +8,7 @@ class Media_voki implements MediaBase {
private static $default_width = 200;
private static $default_height = 267;
private static $scrape_sources = array(
private static $iframe_sources = array(
array(
'match' => '#http://www\.voki\.com/pickup\.php\?(partnerid=symbaloo&)?scid=([0-9]+)#',
'url' => 'http://voki.com/php/checksum/scid=$2'
......@@ -16,14 +16,19 @@ class Media_voki implements MediaBase {
array(
'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(
array(
'match' => '#.*http://vhss(-d)?\.oddcast\.com/vhss_editors/voki_player\.swf\?(.+)(%26)?sc%3d([0-9]+).*#',
'url' => 'http://vhss$1.oddcast.com/vhss_editors/voki_player.swf?$2$3sc%3D$4'
'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=$4'
),
);
......@@ -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)) {
$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;
}
......@@ -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)) {
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