From f5efbd8037550c06028e8b493e1b53c4c85e22f4 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 17 Jan 2015 12:07:57 +0100 Subject: [PATCH] twitPic no longer exists/is active --- plugins/Oembed/lib/oembedhelper.php | 46 ----------------------------- plugins/Oembed/tests/oEmbedTest.php | 4 +-- 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/plugins/Oembed/lib/oembedhelper.php b/plugins/Oembed/lib/oembedhelper.php index 34a4923c48..7435a38919 100644 --- a/plugins/Oembed/lib/oembedhelper.php +++ b/plugins/Oembed/lib/oembedhelper.php @@ -48,7 +48,6 @@ class oEmbedHelper 'vimeo.com' => 'https://vimeo.com/api/oembed.json', ); protected static $functionMap = array( - 'twitpic.com' => 'oEmbedHelper::twitPic', ); /** @@ -250,51 +249,6 @@ class oEmbedHelper return $data; } - /** - * Using a local function for twitpic lookups, as oohembed's adapter - * doesn't return a valid result: - * http://code.google.com/p/oohembed/issues/detail?id=19 - * - * This code fetches metadata from Twitpic's own API, and attempts - * to guess proper thumbnail size from the original's size. - * - * @todo respect maxwidth and maxheight params - * - * @param string $url - * @param array $params - * @return object - */ - static function twitPic($url, $params=array()) - { - $matches = array(); - if (preg_match('!twitpic\.com/(\w+)!', $url, $matches)) { - $id = $matches[1]; - } else { - throw new Exception("Invalid twitpic URL"); - } - - // Grab metadata from twitpic's API... - // http://dev.twitpic.com/docs/2/media_show - $data = self::json('http://api.twitpic.com/2/media/show.json', - array('id' => $id)); - $oembed = (object)array('type' => 'photo', - 'url' => 'http://twitpic.com/show/full/' . $data->short_id, - 'width' => $data->width, - 'height' => $data->height); - if (!empty($data->message)) { - $oembed->title = $data->message; - } - - // Thumbnail is cropped and scaled to 150x150 box: - // http://dev.twitpic.com/docs/thumbnails/ - $thumbSize = 150; - $oembed->thumbnail_url = 'http://twitpic.com/show/thumb/' . $data->short_id; - $oembed->thumbnail_width = $thumbSize; - $oembed->thumbnail_height = $thumbSize; - - return $oembed; - } - /** * Fetch some URL and return JSON data. * diff --git a/plugins/Oembed/tests/oEmbedTest.php b/plugins/Oembed/tests/oEmbedTest.php index 49e070cb6d..a50328c91c 100644 --- a/plugins/Oembed/tests/oEmbedTest.php +++ b/plugins/Oembed/tests/oEmbedTest.php @@ -98,9 +98,7 @@ class oEmbedTest extends PHPUnit_Framework_TestCase static public function knownSources() { $sources = array( - array('http://www.flickr.com/photos/brionv/5172500179/', 'photo'), - array('http://yfrog.com/fy42747177j', 'photo'), - array('http://twitpic.com/36adw6', 'photo'), + array('https://www.flickr.com/photos/brionv/5172500179/', 'photo'), ); return $sources; } -- 2.39.5