]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
twitPic no longer exists/is active
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 17 Jan 2015 11:07:57 +0000 (12:07 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 17 Jan 2015 11:07:57 +0000 (12:07 +0100)
plugins/Oembed/lib/oembedhelper.php
plugins/Oembed/tests/oEmbedTest.php

index 34a4923c484aa552e70ca7149b568a48fb6306b4..7435a3891978ca354da7620d9f851dbc8fa4108b 100644 (file)
@@ -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.
      *
index 49e070cb6d47100d61dc58e8c6d160d5cc874bef..a50328c91c957372f0f7e15225553a39fba38708 100644 (file)
@@ -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;
     }