]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Oembed/lib/oembedhelper.php
Some work on ActivityModeration with notice deletion
[quix0rs-gnu-social.git] / plugins / Oembed / lib / oembedhelper.php
index 34a4923c484aa552e70ca7149b568a48fb6306b4..3454ac7fc76e9791cf95ce7f91611a82c7f2c61f 100644 (file)
@@ -48,7 +48,6 @@ class oEmbedHelper
         'vimeo.com' => 'https://vimeo.com/api/oembed.json',
     );
     protected static $functionMap = array(
-        'twitpic.com' => 'oEmbedHelper::twitPic',
     );
 
     /**
@@ -121,7 +120,6 @@ class oEmbedHelper
             case 'service':
                 $api = common_config('oembed', 'endpoint');
                 common_log(LOG_INFO, 'Using service API endpoint ' . $api);
-                break 2;
                 break;
             }
         }
@@ -250,51 +248,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.
      *