Exemplo n.º 1
0
function theme_get_full_avatar($object)
{
    //	Strip off the "_normal" from the image name to get full sized.
    if ($_SERVER['HTTPS'] == "on" || 0 == strpos(BASE_URL, "https://")) {
        return image_proxy(str_replace('_normal.', '.', $object->profile_image_url_https));
    } else {
        return image_proxy(str_replace('_normal.', '.', $object->profile_image_url));
    }
}
Exemplo n.º 2
0
function oembed_embed_thumbnails(&$feed)
{
    foreach ($feed as &$status) {
        // Loop through the feed
        if (stripos($status->text, 'NSFW') === FALSE) {
            // Ignore image fetching for tweets containing NSFW
            if ($status->entities) {
                // If there are entities
                $entities = $status->entities;
                if ($entities->urls) {
                    foreach ($entities->urls as $urls) {
                        // Loop through the URL entities
                        if ($urls->expanded_url != "") {
                            // Use the expanded URL, if it exists, to pass to Oembed provider
                            $url = $urls->expanded_url;
                        } else {
                            $url = $urls->url;
                        }
                        $matched_urls[urlencode($url)][] = $status->id;
                    }
                } else {
                    //	No URLs, do nothing
                    $matched_urls[] = null;
                }
            }
        }
    }
    //	Reduce the array of empty items
    foreach ($matched_urls as $key => $value) {
        if (null == $value) {
            unset($matched_urls[$key]);
        }
    }
    // Make a single API call to Embedkit.
    if (defined('EMBEDKIT_KEY') && EMBEDKIT_KEY != "") {
        //	Only the URLs which we're going to pass to Embedkit
        $justUrls = array_keys($matched_urls);
        $count = count($justUrls);
        if ($count == 0) {
            return;
        }
        // if ($count > 20) {
        // 	// Things can slow down with lots of links.
        // 	$justUrls = array_chunk ($justUrls, 10);
        // 	$justUrls = $justUrls[0];
        // }
        $url = 'https://embedkit.com/api/v1/embed?key=' . EMBEDKIT_KEY . '&urls=' . implode(',', $justUrls) . '&format=json';
        $embedly_json = url_fetch($url);
        $oembeds = json_decode($embedly_json);
        if ($oembeds->type != 'error') {
            //	Single statuses don't come back in an array
            if (!is_array($oembeds)) {
                $temp = array(0 => $oembeds);
                $oembeds = $temp;
            }
            foreach ($justUrls as $index => $url) {
                $thumb = "";
                $title = "";
                if ($oembeds[$index]->thumbnail_url) {
                    //	Direct links to files
                    $thumb = $oembeds[$index]->thumbnail_url;
                }
                if ($oembeds[$index]->title) {
                    //	Direct links to files
                    $title = $oembeds[$index]->title;
                }
                if ($thumb) {
                    //	Embed the thumbnail
                    $html = theme('external_link', urldecode($url), "<img src=\"" . image_proxy($thumb, "") . "\"" . " title=\"{$title}\" alt=\"{$title}\" class=\"embedded\" />");
                    foreach ($matched_urls[$url] as $statusId) {
                        $feed[$statusId]->text = $feed[$statusId]->text . '<br />' . '<span class="embed">' . $html . '</span>';
                    }
                } elseif ($title) {
                    //	Embed a link
                    $html = theme('external_link', urldecode($url), $title);
                    foreach ($matched_urls[$url] as $statusId) {
                        $feed[$statusId]->text = $feed[$statusId]->text . '<br />' . '<span class="embed">' . $html . '</span>';
                    }
                }
            }
        }
    }
}
Exemplo n.º 3
0
function twitter_get_media($status)
{
    //don't display images if: a) in the settings, b) NSFW
    if (setting_fetch('hide_inline') || stripos($status->text, 'NSFW') !== false) {
        return;
    }
    //	If there are multiple images - or videos / gifs
    if ($status->extended_entities) {
        $media_html = "<span class=\"embed\">";
        foreach ($status->extended_entities->media as $media) {
            if ($_SERVER['HTTPS'] == "on" || 0 === strpos(BASE_URL, "https://")) {
                $image = $media->media_url_https;
            } else {
                $image = $media->media_url;
            }
            if ($media->type == "video" || $media->type == "animated_gif") {
                $media_html .= "<video controls loop class=\"embedded\" poster=\"" . image_proxy($image) . "\">";
                //	Array is reversed in the hope that the highest resolution video is at the end
                foreach (array_reverse($media->video_info->variants) as $vid) {
                    $video_url = $vid->url;
                    $video_type = $vid->content_type;
                    $media_html .= "<source src=\"" . image_proxy($video_url) . "\" type=\"{$video_type}\">";
                }
                $media_html .= "Your browser does not support the video element.\n\t\t\t\t\t</video>";
            } else {
                $link = $media->url;
                $width = $media->sizes->small->w;
                $height = $media->sizes->small->h;
                $media_html .= "<a href=\"" . image_proxy($image) . ":large\" target=\"" . get_target() . "\" class=\"action\" >\n\t\t\t\t                  <img src=\"" . image_proxy($image) . ":small\" width=\"{$width}\" height=\"{$height}\" class=\"embedded\" >\n\t\t\t\t               </a>";
            }
        }
        $media_html .= "</span>";
        return $media_html;
    } else {
        if ($status->entities->media) {
            $media_html = '';
            foreach ($status->entities->media as $media) {
                if ($_SERVER['HTTPS'] == "on" || 0 === strpos(BASE_URL, "https://")) {
                    $image = $media->media_url_https;
                } else {
                    $image = $media->media_url;
                }
                $link = $media->url;
                $width = $media->sizes->small->w;
                $height = $media->sizes->small->h;
                $media_html .= "<span class=\"embed\"><a href=\"" . image_proxy($image) . ":large\" target=\"" . get_target() . "\" >";
                $media_html .= "<img src=\"" . image_proxy($image) . ":small\" width=\"{$width}\" height=\"{$height}\" class=\"embedded\" >";
                $media_html .= "</a></span>";
            }
            return $media_html;
        }
    }
}
Exemplo n.º 4
0
function twitter_get_media($status)
{
    //don't display images if: a) in the settings, b) NSFW
    if (setting_fetch('hide_inline') || stripos($status->text, 'NSFW') !== false) {
        return;
    }
    if ($status->entities->media) {
        $media_html = '';
        foreach ($status->entities->media as $media) {
            if ($_SERVER['HTTPS'] == "on" || 0 === strpos(BASE_URL, "https://")) {
                $image = $media->media_url_https;
            } else {
                $image = $media->media_url;
            }
            $link = $media->url;
            $width = $media->sizes->small->w;
            $height = $media->sizes->small->h;
            $media_html .= "<span class=\"embed\"><a href=\"" . image_proxy($image) . ":large\" target=\"" . get_target() . "\" >";
            $media_html .= "<img src=\"{$image}:small\" width=\"{$width}\" height=\"{$height}\" class=\"embedded\" >";
            $media_html .= "</a></span>";
        }
        return $media_html;
        //. "<br/>";
    }
}
Exemplo n.º 5
0
function embedly_embed_thumbnails(&$feed)
{
    // Find URLs throughout the $feed, noting the tweet IDs they occur in
    $to_expand_urls = array();
    //	Regex from http://api.longurl.org/v2/services
    $longurl_re = "/((http:\\/\\/(bit\\.ly\\/.*|1link\\.in\\/.*|1url\\.com\\/.*|2\\.gp\\/.*|2big\\.at\\/.*|2tu\\.us\\/.*|3\\.ly\\/.*|307\\.to\\/.*|4ms\\.me\\/.*|4sq\\.com\\/.*|4url\\.cc\\/.*|6url\\.com\\/.*|7\\.ly\\/.*|a\\.gg\\/.*|a\\.nf\\/.*|aa\\.cx\\/.*|abcurl\\.net\\/.*|ad\\.vu\\/.*|adf\\.ly\\/.*|adjix\\.com\\/.*|afx\\.cc\\/.*|all\\.fuseurl\\.com\\/.*|alturl\\.com\\/.*|amzn\\.to\\/.*|ar\\.gy\\/.*|arst\\.ch\\/.*|atu\\.ca\\/.*|azc\\.cc\\/.*|b23\\.ru\\/.*|b2l\\.me\\/.*|bacn\\.me\\/.*|bcool\\.bz\\/.*|binged\\.it\\/.*|bit\\.ly\\/.*|bizj\\.us\\/.*|bloat\\.me\\/.*|bravo\\.ly\\/.*|bsa\\.ly\\/.*|budurl\\.com\\/.*|canurl\\.com\\/.*|chilp\\.it\\/.*|chzb\\.gr\\/.*|cl\\.lk\\/.*|cl\\.ly\\/.*|clck\\.ru\\/.*|cli\\.gs\\/.*|cliccami\\.info\\/.*|clickthru\\.ca\\/.*|clop\\.in\\/.*|conta\\.cc\\/.*|cort\\.as\\/.*|cot\\.ag\\/.*|crks\\.me\\/.*|ctvr\\.us\\/.*|cutt\\.us\\/.*|dai\\.ly\\/.*|decenturl\\.com\\/.*|dfl8\\.me\\/.*|digbig\\.com\\/.*|digg\\.com\\/.*|disq\\.us\\/.*|dld\\.bz\\/.*|dlvr\\.it\\/.*|do\\.my\\/.*|doiop\\.com\\/.*|dopen\\.us\\/.*|easyuri\\.com\\/.*|easyurl\\.net\\/.*|eepurl\\.com\\/.*|eweri\\.com\\/.*|fa\\.by\\/.*|fav\\.me\\/.*|fb\\.me\\/.*|fbshare\\.me\\/.*|ff\\.im\\/.*|fff\\.to\\/.*|fire\\.to\\/.*|firsturl\\.de\\/.*|firsturl\\.net\\/.*|flic\\.kr\\/.*|flq\\.us\\/.*|fly2\\.ws\\/.*|fon\\.gs\\/.*|freak\\.to\\/.*|fuseurl\\.com\\/.*|fuzzy\\.to\\/.*|fwd4\\.me\\/.*|fwib\\.net\\/.*|g\\.ro\\.lt\\/.*|gizmo\\.do\\/.*|gl\\.am\\/.*|go\\.9nl\\.com\\/.*|go\\.ign\\.com\\/.*|go\\.usa\\.gov\\/.*|goo\\.gl\\/.*|goshrink\\.com\\/.*|gurl\\.es\\/.*|hex\\.io\\/.*|hiderefer\\.com\\/.*|hmm\\.ph\\/.*|href\\.in\\/.*|hsblinks\\.com\\/.*|htxt\\.it\\/.*|huff\\.to\\/.*|hulu\\.com\\/.*|hurl\\.me\\/.*|hurl\\.ws\\/.*|icanhaz\\.com\\/.*|idek\\.net\\/.*|ilix\\.in\\/.*|is\\.gd\\/.*|its\\.my\\/.*|ix\\.lt\\/.*|j\\.mp\\/.*|jijr\\.com\\/.*|kl\\.am\\/.*|klck\\.me\\/.*|korta\\.nu\\/.*|krunchd\\.com\\/.*|l9k\\.net\\/.*|lat\\.ms\\/.*|liip\\.to\\/.*|liltext\\.com\\/.*|linkbee\\.com\\/.*|linkbun\\.ch\\/.*|liurl\\.cn\\/.*|ln-s\\.net\\/.*|ln-s\\.ru\\/.*|lnk\\.gd\\/.*|lnk\\.ms\\/.*|lnkd\\.in\\/.*|lnkurl\\.com\\/.*|lru\\.jp\\/.*|lt\\.tl\\/.*|lurl\\.no\\/.*|macte\\.ch\\/.*|mash\\.to\\/.*|merky\\.de\\/.*|migre\\.me\\/.*|miniurl\\.com\\/.*|minurl\\.fr\\/.*|mke\\.me\\/.*|moby\\.to\\/.*|moourl\\.com\\/.*|mrte\\.ch\\/.*|myloc\\.me\\/.*|myurl\\.in\\/.*|n\\.pr\\/.*|nbc\\.co\\/.*|nblo\\.gs\\/.*|nn\\.nf\\/.*|not\\.my\\/.*|notlong\\.com\\/.*|nsfw\\.in\\/.*|nutshellurl\\.com\\/.*|nxy\\.in\\/.*|nyti\\.ms\\/.*|o-x\\.fr\\/.*|oc1\\.us\\/.*|om\\.ly\\/.*|omf\\.gd\\/.*|omoikane\\.net\\/.*|on\\.cnn\\.com\\/.*|on\\.mktw\\.net\\/.*|onforb\\.es\\/.*|orz\\.se\\/.*|ow\\.ly\\/.*|ping\\.fm\\/.*|pli\\.gs\\/.*|pnt\\.me\\/.*|politi\\.co\\/.*|post\\.ly\\/.*|pp\\.gg\\/.*|profile\\.to\\/.*|ptiturl\\.com\\/.*|pub\\.vitrue\\.com\\/.*|qlnk\\.net\\/.*|qte\\.me\\/.*|qu\\.tc\\/.*|qy\\.fi\\/.*|r\\.im\\/.*|rb6\\.me\\/.*|read\\.bi\\/.*|readthis\\.ca\\/.*|reallytinyurl\\.com\\/.*|redir\\.ec\\/.*|redirects\\.ca\\/.*|redirx\\.com\\/.*|retwt\\.me\\/.*|ri\\.ms\\/.*|rickroll\\.it\\/.*|riz\\.gd\\/.*|rt\\.nu\\/.*|ru\\.ly\\/.*|rubyurl\\.com\\/.*|rurl\\.org\\/.*|rww\\.tw\\/.*|s4c\\.in\\/.*|s7y\\.us\\/.*|safe\\.mn\\/.*|sameurl\\.com\\/.*|sdut\\.us\\/.*|shar\\.es\\/.*|shink\\.de\\/.*|shorl\\.com\\/.*|short\\.ie\\/.*|short\\.to\\/.*|shortlinks\\.co\\.uk\\/.*|shorturl\\.com\\/.*|shout\\.to\\/.*|show\\.my\\/.*|shrinkify\\.com\\/.*|shrinkr\\.com\\/.*|shrt\\.fr\\/.*|shrt\\.st\\/.*|shrten\\.com\\/.*|shrunkin\\.com\\/.*|simurl\\.com\\/.*|slate\\.me\\/.*|smallr\\.com\\/.*|smsh\\.me\\/.*|smurl\\.name\\/.*|sn\\.im\\/.*|snipr\\.com\\/.*|snipurl\\.com\\/.*|snurl\\.com\\/.*|sp2\\.ro\\/.*|spedr\\.com\\/.*|srnk\\.net\\/.*|srs\\.li\\/.*|starturl\\.com\\/.*|su\\.pr\\/.*|surl\\.co\\.uk\\/.*|surl\\.hu\\/.*|t\\.cn\\/.*|t\\.co\\/.*|t\\.lh\\.com\\/.*|ta\\.gd\\/.*|tbd\\.ly\\/.*|tcrn\\.ch\\/.*|tgr\\.me\\/.*|tgr\\.ph\\/.*|tighturl\\.com\\/.*|tiniuri\\.com\\/.*|tiny\\.cc\\/.*|tiny\\.ly\\/.*|tiny\\.pl\\/.*|tinylink\\.in\\/.*|tinyuri\\.ca\\/.*|tinyurl\\.com\\/.*|tk\\.\\/.*|tl\\.gd\\/.*|tmi\\.me\\/.*|tnij\\.org\\/.*|tnw\\.to\\/.*|tny\\.com\\/.*|to\\.\\/.*|to\\.ly\\/.*|togoto\\.us\\/.*|totc\\.us\\/.*|toysr\\.us\\/.*|tpm\\.ly\\/.*|tr\\.im\\/.*|tra\\.kz\\/.*|trunc\\.it\\/.*|twhub\\.com\\/.*|twirl\\.at\\/.*|twitclicks\\.com\\/.*|twitterurl\\.net\\/.*|twitterurl\\.org\\/.*|twiturl\\.de\\/.*|twurl\\.cc\\/.*|twurl\\.nl\\/.*|u\\.mavrev\\.com\\/.*|u\\.nu\\/.*|u76\\.org\\/.*|ub0\\.cc\\/.*|ulu\\.lu\\/.*|updating\\.me\\/.*|ur1\\.ca\\/.*|url\\.az\\/.*|url\\.co\\.uk\\/.*|url\\.ie\\/.*|url360\\.me\\/.*|url4\\.eu\\/.*|urlborg\\.com\\/.*|urlbrief\\.com\\/.*|urlcover\\.com\\/.*|urlcut\\.com\\/.*|urlenco\\.de\\/.*|urli\\.nl\\/.*|urls\\.im\\/.*|urlshorteningservicefortwitter\\.com\\/.*|urlx\\.ie\\/.*|urlzen\\.com\\/.*|usat\\.ly\\/.*|use\\.my\\/.*|vb\\.ly\\/.*|vgn\\.am\\/.*|vl\\.am\\/.*|vm\\.lc\\/.*|w55\\.de\\/.*|wapo\\.st\\/.*|wapurl\\.co\\.uk\\/.*|wipi\\.es\\/.*|wp\\.me\\/.*|x\\.vu\\/.*|xr\\.com\\/.*|xrl\\.in\\/.*|xrl\\.us\\/.*|xurl\\.es\\/.*|xurl\\.jp\\/.*|y\\.ahoo\\.it\\/.*|yatuc\\.com\\/.*|ye\\.pe\\/.*|yep\\.it\\/.*|yfrog\\.com\\/.*|yhoo\\.it\\/.*|yiyd\\.com\\/.*|youtu\\.be\\/.*|yuarel\\.com\\/.*|z0p\\.de\\/.*|zi\\.ma\\/.*|zi\\.mu\\/.*|zipmyurl\\.com\\/.*|zud\\.me\\/.*|zurl\\.ws\\/.*|zz\\.gd\\/.*|zzang\\.kr\\/.*|›\\.ws\\/.*|✩\\.ws\\/.*|✿\\.ws\\/.*|❥\\.ws\\/.*|➔\\.ws\\/.*|➞\\.ws\\/.*|➡\\.ws\\/.*|➨\\.ws\\/.*|➯\\.ws\\/.*|➹\\.ws\\/.*|➽\\.ws\\/.*)))/i";
    // Regex from http://embed.ly/tools/generator
    $matched_urls = array();
    $embedly_re = "/((http:\\/\\/(www\\.flickr\\.com\\/photos\\/.*|flic\\.kr\\/.*|i.*\\.photobucket\\.com\\/albums\\/.*|s.*\\.photobucket\\.com\\/albums\\/.*|media\\.photobucket\\.com\\/image\\/.*|xkcd\\.com\\/.*|www\\.xkcd\\.com\\/.*|imgs\\.xkcd\\.com\\/.*|www\\.asofterworld\\.com\\/index\\.php\\?id=.*|www\\.asofterworld\\.com\\/.*\\.jpg|asofterworld\\.com\\/.*\\.jpg|www\\.qwantz\\.com\\/index\\.php\\?comic=.*|23hq\\.com\\/.*\\/photo\\/.*|www\\.23hq\\.com\\/.*\\/photo\\/.*|.*dribbble\\.com\\/shots\\/.*|drbl\\.in\\/.*|.*\\.smugmug\\.com\\/.*|.*\\.smugmug\\.com\\/.*#.*|picasaweb\\.google\\.com.*\\/.*\\/.*#.*|picasaweb\\.google\\.com.*\\/lh\\/photo\\/.*|picasaweb\\.google\\.com.*\\/.*\\/.*|www\\.tinypic\\.com\\/view\\.php.*|tinypic\\.com\\/view\\.php.*|www\\.tinypic\\.com\\/player\\.php.*|tinypic\\.com\\/player\\.php.*|www\\.tinypic\\.com\\/r\\/.*\\/.*|tinypic\\.com\\/r\\/.*\\/.*|.*\\.tinypic\\.com\\/.*\\.jpg|.*\\.tinypic\\.com\\/.*\\.png|meadd\\.com\\/.*\\/.*|meadd\\.com\\/.*|.*\\.deviantart\\.com\\/art\\/.*|.*\\.deviantart\\.com\\/gallery\\/.*|.*\\.deviantart\\.com\\/#\\/.*|fav\\.me\\/.*|.*\\.deviantart\\.com|.*\\.deviantart\\.com\\/gallery|.*\\.deviantart\\.com\\/.*\\/.*\\.jpg|.*\\.deviantart\\.com\\/.*\\/.*\\.gif|.*\\.deviantart\\.net\\/.*\\/.*\\.jpg|.*\\.deviantart\\.net\\/.*\\/.*\\.gif|www\\.fotopedia\\.com\\/.*\\/.*|fotopedia\\.com\\/.*\\/.*|photozou\\.jp\\/photo\\/show\\/.*\\/.*|photozou\\.jp\\/photo\\/photo_only\\/.*\\/.*|skitch\\.com\\/.*\\/.*\\/.*|img\\.skitch\\.com\\/.*|www\\.questionablecontent\\.net\\/|questionablecontent\\.net\\/|www\\.questionablecontent\\.net\\/view\\.php.*|questionablecontent\\.net\\/view\\.php.*|questionablecontent\\.net\\/comics\\/.*\\.png|www\\.questionablecontent\\.net\\/comics\\/.*\\.png|www\\.someecards\\.com\\/.*\\/.*|someecards\\.com\\/.*\\/.*|some\\.ly\\/.*|www\\.some\\.ly\\/.*|achewood\\.com\\/.*|www\\.achewood\\.com\\/.*|achewood\\.com\\/index\\.php.*|www\\.achewood\\.com\\/index\\.php.*|www\\.whosay\\.com\\/.*\\/content\\/.*|www\\.whosay\\.com\\/.*\\/photos\\/.*|www\\.whosay\\.com\\/.*\\/videos\\/.*|say\\.ly\\/.*|mlkshk\\.com\\/p\\/.*|lockerz\\.com\\/s\\/.*|pics\\.lockerz\\.com\\/s\\/.*|d\\.pr\\/i\\/.*|www\\.eyeem\\.com\\/p\\/.*|www\\.eyeem\\.com\\/a\\/.*|www\\.eyeem\\.com\\/u\\/.*|giphy\\.com\\/gifs\\/.*|gph\\.is\\/.*|gist\\.github\\.com\\/.*|www\\.crunchbase\\.com\\/.*\\/.*|crunchbase\\.com\\/.*\\/.*|www\\.slideshare\\.net\\/.*\\/.*|www\\.slideshare\\.net\\/mobile\\/.*\\/.*|slidesha\\.re\\/.*|scribd\\.com\\/doc\\/.*|www\\.scribd\\.com\\/doc\\/.*|scribd\\.com\\/mobile\\/documents\\/.*|www\\.scribd\\.com\\/mobile\\/documents\\/.*|screenr\\.com\\/.*|polldaddy\\.com\\/community\\/poll\\/.*|polldaddy\\.com\\/poll\\/.*|answers\\.polldaddy\\.com\\/poll\\/.*|www\\.howcast\\.com\\/videos\\/.*|www\\.screencast\\.com\\/.*\\/media\\/.*|screencast\\.com\\/.*\\/media\\/.*|www\\.screencast\\.com\\/t\\/.*|screencast\\.com\\/t\\/.*|issuu\\.com\\/.*\\/docs\\/.*|www\\.kickstarter\\.com\\/projects\\/.*\\/.*|www\\.scrapblog\\.com\\/viewer\\/viewer\\.aspx.*|foursquare\\.com\\/.*|www\\.foursquare\\.com\\/.*|4sq\\.com\\/.*|linkedin\\.com\\/in\\/.*|linkedin\\.com\\/pub\\/.*|.*\\.linkedin\\.com\\/in\\/.*|.*\\.linkedin\\.com\\/pub\\/.*|www\\.sliderocket\\.com\\/.*|sliderocket\\.com\\/.*|app\\.sliderocket\\.com\\/.*|portal\\.sliderocket\\.com\\/.*|beta-sliderocket\\.com\\/.*|chart\\.ly\\/symbols\\/.*|chart\\.ly\\/.*|maps\\.google\\.com\\/maps\\?.*|maps\\.google\\.com\\/\\?.*|maps\\.google\\.com\\/maps\\/ms\\?.*|.*\\.craigslist\\.org\\/.*\\/.*|my\\.opera\\.com\\/.*\\/albums\\/show\\.dml\\?id=.*|my\\.opera\\.com\\/.*\\/albums\\/showpic\\.dml\\?album=.*&picture=.*|tumblr\\.com\\/.*|.*\\.tumblr\\.com\\/post\\/.*|www\\.polleverywhere\\.com\\/polls\\/.*|www\\.polleverywhere\\.com\\/multiple_choice_polls\\/.*|www\\.polleverywhere\\.com\\/free_text_polls\\/.*|www\\.quantcast\\.com\\/wd:.*|www\\.quantcast\\.com\\/.*|siteanalytics\\.compete\\.com\\/.*|.*\\.status\\.net\\/notice\\/.*|identi\\.ca\\/notice\\/.*|www\\.studivz\\.net\\/Profile\\/.*|www\\.studivz\\.net\\/l\\/.*|www\\.studivz\\.net\\/Groups\\/Overview\\/.*|www\\.studivz\\.net\\/Gadgets\\/Info\\/.*|www\\.studivz\\.net\\/Gadgets\\/Install\\/.*|www\\.studivz\\.net\\/.*|www\\.meinvz\\.net\\/Profile\\/.*|www\\.meinvz\\.net\\/l\\/.*|www\\.meinvz\\.net\\/Groups\\/Overview\\/.*|www\\.meinvz\\.net\\/Gadgets\\/Info\\/.*|www\\.meinvz\\.net\\/Gadgets\\/Install\\/.*|www\\.meinvz\\.net\\/.*|www\\.schuelervz\\.net\\/Profile\\/.*|www\\.schuelervz\\.net\\/l\\/.*|www\\.schuelervz\\.net\\/Groups\\/Overview\\/.*|www\\.schuelervz\\.net\\/Gadgets\\/Info\\/.*|www\\.schuelervz\\.net\\/Gadgets\\/Install\\/.*|www\\.schuelervz\\.net\\/.*|myloc\\.me\\/.*|pastebin\\.com\\/.*|pastie\\.org\\/.*|www\\.pastie\\.org\\/.*|redux\\.com\\/stream\\/item\\/.*\\/.*|redux\\.com\\/f\\/.*\\/.*|www\\.redux\\.com\\/stream\\/item\\/.*\\/.*|www\\.redux\\.com\\/f\\/.*\\/.*|cl\\.ly\\/.*|cl\\.ly\\/.*\\/content|speakerdeck\\.com\\/.*\\/.*|www\\.kiva\\.org\\/lend\\/.*|www\\.timetoast\\.com\\/timelines\\/.*|storify\\.com\\/.*\\/.*|.*meetup\\.com\\/.*|meetu\\.ps\\/.*|www\\.dailymile\\.com\\/people\\/.*\\/entries\\/.*|.*\\.kinomap\\.com\\/.*|www\\.metacdn\\.com\\/r\\/c\\/.*\\/.*|www\\.metacdn\\.com\\/r\\/m\\/.*\\/.*|prezi\\.com\\/.*\\/.*|.*\\.uservoice\\.com\\/.*\\/suggestions\\/.*|formspring\\.me\\/.*|www\\.formspring\\.me\\/.*|formspring\\.me\\/.*\\/q\\/.*|www\\.formspring\\.me\\/.*\\/q\\/.*|twitlonger\\.com\\/show\\/.*|www\\.twitlonger\\.com\\/show\\/.*|tl\\.gd\\/.*|www\\.qwiki\\.com\\/q\\/.*|crocodoc\\.com\\/.*|.*\\.crocodoc\\.com\\/.*|www\\.wikipedia\\.org\\/wiki\\/.*|.*\\.wikipedia\\.org\\/wiki\\/.*|www\\.wikimedia\\.org\\/wiki\\/File.*|graphicly\\.com\\/.*\\/.*\\/.*|gopollgo\\.com\\/.*|www\\.gopollgo\\.com\\/.*|360\\.io\\/.*|www\\.behance\\.net\\/gallery\\/.*|behance\\.net\\/gallery\\/.*|www\\.jdsupra\\.com\\/legalnews\\/.*|jdsupra\\.com\\/legalnews\\/.*|minilogs\\.com\\/.*|www\\.minilogs\\.com\\/.*|sketchfab\\.com\\/show\\/.*|jsfiddle\\.net\\/.*|ponga\\.com\\/.*|list\\.ly\\/list\\/.*|crowdmap\\.com\\/post\\/.*|.*\\.crowdmap\\.com\\/post\\/.*|crowdmap\\.com\\/map\\/.*|.*\\.crowdmap\\.com\\/map\\/.*|.*amazon\\..*\\/gp\\/product\\/.*|.*amazon\\..*\\/.*\\/dp\\/.*|.*amazon\\..*\\/dp\\/.*|.*amazon\\..*\\/o\\/ASIN\\/.*|.*amazon\\..*\\/gp\\/offer-listing\\/.*|.*amazon\\..*\\/.*\\/ASIN\\/.*|.*amazon\\..*\\/gp\\/product\\/images\\/.*|.*amazon\\..*\\/gp\\/aw\\/d\\/.*|www\\.amzn\\.com\\/.*|amzn\\.com\\/.*|www\\.shopstyle\\.com\\/browse.*|www\\.shopstyle\\.com\\/action\\/apiVisitRetailer.*|api\\.shopstyle\\.com\\/action\\/apiVisitRetailer.*|www\\.shopstyle\\.com\\/action\\/viewLook.*|itunes\\.apple\\.com\\/.*|shoplocket\\.com\\/products\\/.*|etsy\\.com\\/listing\\/.*|www\\.etsy\\.com\\/listing\\/.*|fiverr\\.com\\/.*\\/.*|www\\.fiverr\\.com\\/.*\\/.*|.*twitch\\.tv\\/.*|.*justin\\.tv\\/.*\\/b\\/.*|.*justin\\.tv\\/.*\\/w\\/.*|.*twitch\\.tv\\/.*|.*twitch\\.tv\\/.*\\/b\\/.*|www\\.ustream\\.tv\\/recorded\\/.*|www\\.ustream\\.tv\\/channel\\/.*|www\\.ustream\\.tv\\/.*|ustre\\.am\\/.*|.*revision3\\.com\\/.*|.*\\.dailymotion\\.com\\/video\\/.*|.*\\.dailymotion\\.com\\/.*\\/video\\/.*|collegehumor\\.com\\/video:.*|collegehumor\\.com\\/video\\/.*|www\\.collegehumor\\.com\\/video:.*|www\\.collegehumor\\.com\\/video\\/.*|telly\\.com\\/.*|www\\.telly\\.com\\/.*|break\\.com\\/.*\\/.*|www\\.break\\.com\\/.*\\/.*|vids\\.myspace\\.com\\/index\\.cfm\\?fuseaction=vids\\.individual&videoid.*|www\\.myspace\\.com\\/index\\.cfm\\?fuseaction=.*&videoid.*|www\\.metacafe\\.com\\/watch\\/.*|www\\.metacafe\\.com\\/w\\/.*|blip\\.tv\\/.*\\/.*|.*\\.blip\\.tv\\/.*\\/.*|video\\.google\\.com\\/videoplay\\?.*|video\\.yahoo\\.com\\/watch\\/.*\\/.*|video\\.yahoo\\.com\\/network\\/.*|sports\\.yahoo\\.com\\/video\\/.*|.*viddler\\.com\\/v\\/.*|liveleak\\.com\\/view\\?.*|www\\.liveleak\\.com\\/view\\?.*|animoto\\.com\\/play\\/.*|dotsub\\.com\\/view\\/.*|www\\.overstream\\.net\\/view\\.php\\?oid=.*|www\\.livestream\\.com\\/.*|new\\.livestream\\.com\\/.*|www\\.worldstarhiphop\\.com\\/videos\\/video.*\\.php\\?v=.*|worldstarhiphop\\.com\\/videos\\/video.*\\.php\\?v=.*|bambuser\\.com\\/v\\/.*|bambuser\\.com\\/channel\\/.*|bambuser\\.com\\/channel\\/.*\\/broadcast\\/.*|www\\.schooltube\\.com\\/video\\/.*\\/.*|bigthink\\.com\\/ideas\\/.*|bigthink\\.com\\/series\\/.*|sendables\\.jibjab\\.com\\/view\\/.*|sendables\\.jibjab\\.com\\/originals\\/.*|jibjab\\.com\\/view\\/.*|www\\.xtranormal\\.com\\/watch\\/.*|socialcam\\.com\\/v\\/.*|www\\.socialcam\\.com\\/v\\/.*|v\\.youku\\.com\\/v_show\\/.*|v\\.youku\\.com\\/v_playlist\\/.*|www\\.snotr\\.com\\/video\\/.*|snotr\\.com\\/video\\/.*|www\\.clipfish\\.de\\/.*\\/.*\\/video\\/.*|www\\.myvideo\\.de\\/watch\\/.*|www\\.vzaar\\.com\\/videos\\/.*|vzaar\\.com\\/videos\\/.*|www\\.vzaar\\.tv\\/.*|vzaar\\.tv\\/.*|vzaar\\.me\\/.*|.*\\.vzaar\\.me\\/.*|coub\\.com\\/view\\/.*|coub\\.com\\/embed\\/.*|www\\.streamio\\.com\\/api\\/v1\\/.*|streamio\\.com\\/api\\/v1\\/.*|vine\\.co\\/v\\/.*|www\\.vine\\.co\\/v\\/.*|www\\.viddy\\.com\\/video\\/.*|www\\.viddy\\.com\\/.*\\/v\\/.*|www\\.tudou\\.com\\/programs\\/view\\/.*|tudou\\.com\\/programs\\/view\\/.*|sproutvideo\\.com\\/videos\\/.*|www\\.whitehouse\\.gov\\/photos-and-video\\/video\\/.*|www\\.whitehouse\\.gov\\/video\\/.*|wh\\.gov\\/photos-and-video\\/video\\/.*|wh\\.gov\\/video\\/.*|www\\.hulu\\.com\\/watch.*|www\\.hulu\\.com\\/w\\/.*|www\\.hulu\\.com\\/embed\\/.*|hulu\\.com\\/watch.*|hulu\\.com\\/w\\/.*|.*crackle\\.com\\/c\\/.*|www\\.funnyordie\\.com\\/videos\\/.*|www\\.funnyordie\\.com\\/m\\/.*|funnyordie\\.com\\/videos\\/.*|funnyordie\\.com\\/m\\/.*|www\\.vimeo\\.com\\/groups\\/.*\\/videos\\/.*|www\\.vimeo\\.com\\/.*|vimeo\\.com\\/groups\\/.*\\/videos\\/.*|vimeo\\.com\\/.*|vimeo\\.com\\/m\\/#\\/.*|player\\.vimeo\\.com\\/.*|www\\.ted\\.com\\/talks\\/.*\\.html.*|www\\.ted\\.com\\/talks\\/lang\\/.*\\/.*\\.html.*|www\\.ted\\.com\\/index\\.php\\/talks\\/.*\\.html.*|www\\.ted\\.com\\/index\\.php\\/talks\\/lang\\/.*\\/.*\\.html.*|.*nfb\\.ca\\/film\\/.*|www\\.thedailyshow\\.com\\/watch\\/.*|www\\.thedailyshow\\.com\\/full-episodes\\/.*|www\\.thedailyshow\\.com\\/collection\\/.*\\/.*\\/.*|movies\\.yahoo\\.com\\/movie\\/.*\\/video\\/.*|movies\\.yahoo\\.com\\/movie\\/.*\\/trailer|movies\\.yahoo\\.com\\/movie\\/.*\\/video|www\\.colbertnation\\.com\\/the-colbert-report-collections\\/.*|www\\.colbertnation\\.com\\/full-episodes\\/.*|www\\.colbertnation\\.com\\/the-colbert-report-videos\\/.*|www\\.comedycentral\\.com\\/videos\\/index\\.jhtml\\?.*|www\\.theonion\\.com\\/video\\/.*|theonion\\.com\\/video\\/.*|wordpress\\.tv\\/.*\\/.*\\/.*\\/.*\\/|www\\.traileraddict\\.com\\/trailer\\/.*|www\\.traileraddict\\.com\\/clip\\/.*|www\\.traileraddict\\.com\\/poster\\/.*|www\\.escapistmagazine\\.com\\/videos\\/.*|www\\.trailerspy\\.com\\/trailer\\/.*\\/.*|www\\.trailerspy\\.com\\/trailer\\/.*|www\\.trailerspy\\.com\\/view_video\\.php.*|fora\\.tv\\/.*\\/.*\\/.*\\/.*|www\\.spike\\.com\\/video\\/.*|www\\.gametrailers\\.com\\/video.*|gametrailers\\.com\\/video.*|www\\.koldcast\\.tv\\/video\\/.*|www\\.koldcast\\.tv\\/#video:.*|mixergy\\.com\\/.*|video\\.pbs\\.org\\/video\\/.*|www\\.zapiks\\.com\\/.*|www\\.trutv\\.com\\/video\\/.*|www\\.nzonscreen\\.com\\/title\\/.*|nzonscreen\\.com\\/title\\/.*|app\\.wistia\\.com\\/embed\\/medias\\/.*|wistia\\.com\\/.*|.*\\.wistia\\.com\\/.*|.*\\.wi\\.st\\/.*|wi\\.st\\/.*|confreaks\\.net\\/videos\\/.*|www\\.confreaks\\.net\\/videos\\/.*|confreaks\\.com\\/videos\\/.*|www\\.confreaks\\.com\\/videos\\/.*|video\\.allthingsd\\.com\\/video\\/.*|videos\\.nymag\\.com\\/.*|aniboom\\.com\\/animation-video\\/.*|www\\.aniboom\\.com\\/animation-video\\/.*|grindtv\\.com\\/.*\\/video\\/.*|www\\.grindtv\\.com\\/.*\\/video\\/.*|ifood\\.tv\\/recipe\\/.*|ifood\\.tv\\/video\\/.*|ifood\\.tv\\/channel\\/user\\/.*|www\\.ifood\\.tv\\/recipe\\/.*|www\\.ifood\\.tv\\/video\\/.*|www\\.ifood\\.tv\\/channel\\/user\\/.*|logotv\\.com\\/video\\/.*|www\\.logotv\\.com\\/video\\/.*|lonelyplanet\\.com\\/Clip\\.aspx\\?.*|www\\.lonelyplanet\\.com\\/Clip\\.aspx\\?.*|streetfire\\.net\\/video\\/.*\\.htm.*|www\\.streetfire\\.net\\/video\\/.*\\.htm.*|sciencestage\\.com\\/v\\/.*\\.html|sciencestage\\.com\\/a\\/.*\\.html|www\\.sciencestage\\.com\\/v\\/.*\\.html|www\\.sciencestage\\.com\\/a\\/.*\\.html|link\\.brightcove\\.com\\/services\\/player\\/bcpid.*|wirewax\\.com\\/.*|www\\.wirewax\\.com\\/.*|canalplus\\.fr\\/.*|www\\.canalplus\\.fr\\/.*|www\\.vevo\\.com\\/watch\\/.*|www\\.vevo\\.com\\/video\\/.*|pixorial\\.com\\/watch\\/.*|www\\.pixorial\\.com\\/watch\\/.*|spreecast\\.com\\/events\\/.*|www\\.spreecast\\.com\\/events\\/.*|showme\\.com\\/sh\\/.*|www\\.showme\\.com\\/sh\\/.*|.*\\.looplogic\\.com\\/.*|on\\.aol\\.com\\/video\\/.*|on\\.aol\\.com\\/playlist\\/.*|videodetective\\.com\\/.*\\/.*|www\\.videodetective\\.com\\/.*\\/.*|khanacademy\\.org\\/.*|www\\.khanacademy\\.org\\/.*|.*vidyard\\.com\\/.*|www\\.veoh\\.com\\/watch\\/.*|veoh\\.com\\/watch\\/.*|.*\\.univision\\.com\\/.*\\/video\\/.*|www\\.godtube\\.com\\/featured\\/video\\/.*|godtube\\.com\\/featured\\/video\\/.*|www\\.godtube\\.com\\/watch\\/.*|godtube\\.com\\/watch\\/.*|mediamatters\\.org\\/mmtv\\/.*|www\\.clikthrough\\.com\\/theater\\/video\\/.*|www\\.clipsyndicate\\.com\\/video\\/playlist\\/.*\\/.*|www\\.srf\\.ch\\/player\\/tv\\/.*\\/video\\/.*\\?id=.*|www\\.srf\\.ch\\/player\\/radio\\/.*\\/audio\\/.*\\?id=.*|espn\\.go\\.com\\/video\\/clip.*|espn\\.go\\.com\\/.*\\/story.*|abcnews\\.com\\/.*\\/video\\/.*|abcnews\\.com\\/video\\/playerIndex.*|abcnews\\.go\\.com\\/.*\\/video\\/.*|abcnews\\.go\\.com\\/video\\/playerIndex.*|washingtonpost\\.com\\/wp-dyn\\/.*\\/video\\/.*\\/.*\\/.*\\/.*|www\\.washingtonpost\\.com\\/wp-dyn\\/.*\\/video\\/.*\\/.*\\/.*\\/.*|www\\.boston\\.com\\/video.*|boston\\.com\\/video.*|www\\.boston\\.com\\/.*video.*|boston\\.com\\/.*video.*|www\\.facebook\\.com\\/photo\\.php.*|www\\.facebook\\.com\\/video\\/video\\.php.*|www\\.facebook\\.com\\/.*\\/posts\\/.*|fb\\.me\\/.*|cnbc\\.com\\/id\\/.*\\?.*video.*|www\\.cnbc\\.com\\/id\\/.*\\?.*video.*|cnbc\\.com\\/id\\/.*\\/play\\/1\\/video\\/.*|www\\.cnbc\\.com\\/id\\/.*\\/play\\/1\\/video\\/.*|cbsnews\\.com\\/video\\/watch\\/.*|plus\\.google\\.com\\/.*|www\\.google\\.com\\/profiles\\/.*|google\\.com\\/profiles\\/.*|www\\.cnn\\.com\\/video\\/.*|edition\\.cnn\\.com\\/video\\/.*|money\\.cnn\\.com\\/video\\/.*|today\\.msnbc\\.msn\\.com\\/id\\/.*\\/vp\\/.*|www\\.msnbc\\.msn\\.com\\/id\\/.*\\/vp\\/.*|www\\.msnbc\\.msn\\.com\\/id\\/.*\\/ns\\/.*|today\\.msnbc\\.msn\\.com\\/id\\/.*\\/ns\\/.*|multimedia\\.foxsports\\.com\\/m\\/video\\/.*\\/.*|msn\\.foxsports\\.com\\/video.*|www\\.globalpost\\.com\\/video\\/.*|www\\.globalpost\\.com\\/dispatch\\/.*|theguardian\\.com\\/.*\\/video\\/.*\\/.*\\/.*\\/.*|www\\.theguardian\\.com\\/.*\\/video\\/.*\\/.*\\/.*\\/.*|guardian\\.co\\.uk\\/.*\\/video\\/.*\\/.*\\/.*\\/.*|www\\.guardian\\.co\\.uk\\/.*\\/video\\/.*\\/.*\\/.*\\/.*|bravotv\\.com\\/.*\\/.*\\/videos\\/.*|www\\.bravotv\\.com\\/.*\\/.*\\/videos\\/.*|video\\.nationalgeographic\\.com\\/video\\/.*\\/.*\\/.*\\/.*|dsc\\.discovery\\.com\\/videos\\/.*|animal\\.discovery\\.com\\/videos\\/.*|health\\.discovery\\.com\\/videos\\/.*|investigation\\.discovery\\.com\\/videos\\/.*|military\\.discovery\\.com\\/videos\\/.*|planetgreen\\.discovery\\.com\\/videos\\/.*|science\\.discovery\\.com\\/videos\\/.*|tlc\\.discovery\\.com\\/videos\\/.*|video\\.forbes\\.com\\/fvn\\/.*|distrify\\.com\\/film\\/.*|muvi\\.es\\/.*|video\\.foxnews\\.com\\/v\\/.*|video\\.foxbusiness\\.com\\/v\\/.*|www\\.reuters\\.com\\/video\\/.*|reuters\\.com\\/video\\/.*|live\\.huffingtonpost\\.com\\/r\\/segment\\/.*\\/.*|soundcloud\\.com\\/.*|soundcloud\\.com\\/.*\\/.*|soundcloud\\.com\\/.*\\/sets\\/.*|soundcloud\\.com\\/groups\\/.*|snd\\.sc\\/.*|open\\.spotify\\.com\\/.*|spoti\\.fi\\/.*|www\\.last\\.fm\\/music\\/.*|www\\.last\\.fm\\/music\\/+videos\\/.*|www\\.last\\.fm\\/music\\/+images\\/.*|www\\.last\\.fm\\/music\\/.*\\/_\\/.*|www\\.last\\.fm\\/music\\/.*\\/.*|www\\.mixcloud\\.com\\/.*\\/.*\\/|www\\.radionomy\\.com\\/.*\\/radio\\/.*|radionomy\\.com\\/.*\\/radio\\/.*|www\\.hark\\.com\\/clips\\/.*|www\\.rdio\\.com\\/#\\/artist\\/.*\\/album\\/.*|www\\.rdio\\.com\\/artist\\/.*\\/album\\/.*|www\\.zero-inch\\.com\\/.*|.*\\.bandcamp\\.com\\/|.*\\.bandcamp\\.com\\/track\\/.*|.*\\.bandcamp\\.com\\/album\\/.*|freemusicarchive\\.org\\/music\\/.*|www\\.freemusicarchive\\.org\\/music\\/.*|freemusicarchive\\.org\\/curator\\/.*|www\\.freemusicarchive\\.org\\/curator\\/.*|www\\.npr\\.org\\/.*\\/.*\\/.*\\/.*\\/.*|www\\.npr\\.org\\/.*\\/.*\\/.*\\/.*\\/.*\\/.*|www\\.npr\\.org\\/.*\\/.*\\/.*\\/.*\\/.*\\/.*\\/.*|www\\.npr\\.org\\/templates\\/story\\/story\\.php.*|huffduffer\\.com\\/.*\\/.*|www\\.audioboo\\.fm\\/boos\\/.*|audioboo\\.fm\\/boos\\/.*|boo\\.fm\\/b.*|www\\.xiami\\.com\\/song\\/.*|xiami\\.com\\/song\\/.*|www\\.saynow\\.com\\/playMsg\\.html.*|www\\.saynow\\.com\\/playMsg\\.html.*|grooveshark\\.com\\/.*|radioreddit\\.com\\/songs.*|www\\.radioreddit\\.com\\/songs.*|radioreddit\\.com\\/\\?q=songs.*|www\\.radioreddit\\.com\\/\\?q=songs.*|www\\.gogoyoko\\.com\\/song\\/.*|hypem\\.com\\/premiere\\/.*))|(https:\\/\\/(picasaweb\\.google\\.com.*\\/.*\\/.*#.*|picasaweb\\.google\\.com.*\\/lh\\/photo\\/.*|picasaweb\\.google\\.com.*\\/.*\\/.*|skitch\\.com\\/.*\\/.*\\/.*|img\\.skitch\\.com\\/.*|gist\\.github\\.com\\/.*|foursquare\\.com\\/.*|www\\.foursquare\\.com\\/.*|maps\\.google\\.com\\/maps\\?.*|maps\\.google\\.com\\/\\?.*|maps\\.google\\.com\\/maps\\/ms\\?.*|speakerdeck\\.com\\/.*\\/.*|crocodoc\\.com\\/.*|.*\\.crocodoc\\.com\\/.*|urtak\\.com\\/u\\/.*|urtak\\.com\\/clr\\/.*|ganxy\\.com\\/.*|www\\.ganxy\\.com\\/.*|sketchfab\\.com\\/show\\/.*|itunes\\.apple\\.com\\/.*|www\\.streamio\\.com\\/api\\/v1\\/.*|streamio\\.com\\/api\\/v1\\/.*|vine\\.co\\/v\\/.*|www\\.vine\\.co\\/v\\/.*|mixbit\\.com\\/v\\/.*|www\\.vimeo\\.com\\/.*|vimeo\\.com\\/.*|player\\.vimeo\\.com\\/.*|app\\.wistia\\.com\\/embed\\/medias\\/.*|wistia\\.com\\/.*|.*\\.wistia\\.com\\/.*|.*\\.wi\\.st\\/.*|wi\\.st\\/.*|.*\\.looplogic\\.com\\/.*|khanacademy\\.org\\/.*|www\\.khanacademy\\.org\\/.*|.*vidyard\\.com\\/.*|www\\.facebook\\.com\\/photo\\.php.*|www\\.facebook\\.com\\/video\\/video\\.php.*|www\\.facebook\\.com\\/.*\\/posts\\/.*|fb\\.me\\/.*|plus\\.google\\.com\\/.*|soundcloud\\.com\\/.*|soundcloud\\.com\\/.*\\/.*|soundcloud\\.com\\/.*\\/sets\\/.*|soundcloud\\.com\\/groups\\/.*|open\\.spotify\\.com\\/.*)))/i";
    $services = array('#ow\\.ly\\/i\\/([_-\\d\\w]+)#i' => 'http://static.ow.ly/photos/normal/%s.jpg', '#youtube\\.com\\/watch\\?v=([_-\\d\\w]+)#i' => 'https://i.ytimg.com/vi/%s/hqdefault.jpg', '#youtu\\.be\\/([_-\\d\\w]+)#i' => 'https://i.ytimg.com/vi/%s/hqdefault.jpg', '#qik\\.ly\\/([_-\\d\\w]+)#i' => 'http://qik.ly/%s.jpg', '#twitpic\\.com\\/([\\d\\w]+)#i' => 'http://twitpic.com/show/full/%s', '#twitgoo\\.com\\/([\\d\\w]+)#i' => 'http://twitgoo.com/show/thumb/%s', '#hellotxt\\.com\\/i\\/([\\d\\w]+)#i' => 'http://hellotxt.com/image/%s.s.jpg', '#ts1\\.in\\/(\\d+)#i' => 'http://ts1.in/mini/%s', '#moby\\.to\\/\\?([\\w\\d]+)#i' => 'http://moby.to/%s:square', '#mobypicture\\.com\\/\\?([\\w\\d]+)#i' => 'http://mobypicture.com/?%s:square', '#twic\\.li\\/photo\\/([\\w]+)#i' => 'http://twic.li/userimg/thumb_%s.jpg', '#tweetphoto\\.com\\/(\\d+)#' => 'http://api.plixi.com/api/tpapi.svc/imagefromurl?url=http://tweetphoto.com/%s', '#plixi\\.com\\/p\\/(\\d+)#' => 'http://api.plixi.com/api/tpapi.svc/imagefromurl?url=http://plixi.com/p/%s&size=small', '#imgur\\.com\\/([\\w]{5})[\\s\\.ls][\\.\\w]*#i' => 'http://imgur.com/%sl.jpg', '#imgur\\.com\\/gallery\\/([\\w]+)#i' => 'http://imgur.com/%sl.jpg', '#brizzly\\.com\\/pic\\/([\\w]+)#i' => 'http://pics.brizzly.com/thumb_sm_%s.jpg', '#img\\.ly\\/([\\w\\d]+)#i' => 'http://img.ly/show/thumb/%s', '#picplz\\.com\\/([\\d\\w\\.]+)#' => 'http://picplz.com/%s/thumb', '#pk\\.gd\\/([\\d\\w]+)#i' => 'http://img.pikchur.com/pic_%s_s.jpg', '#pikchur\\.com\\/([\\d\\w]+)#i' => 'http://img.pikchur.com/pic_%s_s.jpg', '#znl\\.me\\/([\\d\\w]+)#' => 'http://www.zannel.com/webservices/content/%s/Image-164x123-JPG.jpg', '#yfrog\\.com\\/([\\d\\w]+)#' => 'http://yfrog.com/%s:iphone', '#instagr\\.am\\/p\\/([_-\\d\\w]+)#i' => 'http://instagr.am/p/%s/media/?size=m', '#instagram\\.com\\/p\\/([_-\\d\\w]+)#i' => 'http://instagr.am/p/%s/media/?size=m', '#twitrpix.com/([\\d\\w]+)#i' => 'http://img.twitrpix.com/thumb/%s');
    foreach ($feed as &$status) {
        // Loop through the feed
        if (stripos($status->text, 'NSFW') === FALSE) {
            // Ignore image fetching for tweets containing NSFW
            if ($status->entities) {
                // If there are entities
                $entities = $status->entities;
                if ($entities->urls) {
                    foreach ($entities->urls as $urls) {
                        // Loop through the URL entities
                        if ($urls->expanded_url != "") {
                            // Use the expanded URL, if it exists, to pass to Embedly
                            $url = $urls->expanded_url;
                        } else {
                            $url = $urls->url;
                        }
                        if (preg_match($longurl_re, $url) > 0) {
                            // If it matches an LongURL supported URL
                            $to_expand_urls[urlencode($url)][] = $status->id;
                        }
                        if (preg_match($embedly_re, $url) > 0) {
                            // If it matches an Embedly supported URL
                            $matched_urls[urlencode($url)][] = $status->id;
                        } else {
                            // Can we handle it without an Embedly call?
                            foreach ($services as $pattern => $thumbnail_url) {
                                if (preg_match_all($pattern, $url, $matches, PREG_PATTERN_ORDER) > 0) {
                                    foreach ($matches[1] as $key => $match) {
                                        $html = theme('external_link', $url, "<img src=\"" . image_proxy(sprintf($thumbnail_url, $match), "x45/") . "\" class=\"embeded\" />");
                                        $feed[$status->id]->text = $feed[$status->id]->text . '<br />' . '<span class="embed">' . $html . '</span>';
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    // Make a single API call to Embedly.
    if (defined('EMBEDLY_KEY') && EMBEDLY_KEY != "") {
        $justUrls = array_keys($matched_urls);
        $count = count($justUrls);
        if ($count == 0) {
            return;
        }
        if ($count > 20) {
            // Embedly has a limit of 10 URLs processed at a time. Not ideal for @dabr, but fair enough to ignore images after that.
            // http://embed.ly/docs/embed/api/arguments
            $justUrls = array_chunk($justUrls, 10);
            $justUrls = $justUrls[0];
        }
        $url = 'http://api.embed.ly/1/oembed?key=' . EMBEDLY_KEY . '&urls=' . implode(',', $justUrls) . '&format=json';
        $embedly_json = twitter_fetch($url);
        $oembeds = json_decode($embedly_json);
        // Put the thumbnails into the $feed
        if ($oembeds->type != 'error') {
            foreach ($justUrls as $index => $url) {
                if ($thumb = $oembeds[$index]->thumbnail_url) {
                    $html = theme('external_link', urldecode($url), "<img src='" . image_proxy($thumb, "x45/") . "' class=\"embeded\" />");
                    foreach ($matched_urls[$url] as $statusId) {
                        $feed[$statusId]->text = $feed[$statusId]->text . '<br />' . '<span class="embed">' . $html . '</span>';
                    }
                }
            }
        }
    }
    //	Make calls to LongURL
    $justUrls = array_keys($to_expand_urls);
    foreach ($justUrls as $index => $url) {
        $LongURL_api = 'http://api.longurl.org/v2/expand?user-agent=Dabr&title=1&format=json&url=' . $url;
        $LongURL_json = twitter_fetch($LongURL_api);
        $LongURL_data = json_decode($LongURL_json);
        $long_url_ref = 'long-url';
        $long_url = $LongURL_data->{$long_url_ref};
        $long_url_title = $LongURL_data->title;
        $html = theme('external_link', urldecode($long_url), $long_url_title);
        foreach ($to_expand_urls[$url] as $statusId) {
            $feed[$statusId]->text = $feed[$statusId]->text . '<br />' . $html;
        }
    }
}
Exemplo n.º 6
0
function theme_get_full_avatar($object)
{
    if ($_SERVER['HTTPS'] == "on" && $object->profile_image_url_https) {
        return image_proxy(str_replace('_normal.', '.', $object->profile_image_url_https));
    } else {
        return image_proxy(str_replace('_normal.', '.', $object->profile_image_url));
    }
}
Exemplo n.º 7
0
function oembed_embed_thumbnails(&$feed)
{
    foreach ($feed as &$status) {
        // Loop through the feed
        if (stripos($status->text, 'NSFW') === FALSE) {
            // Ignore image fetching for tweets containing NSFW
            if ($status->entities) {
                // If there are entities
                $entities = $status->entities;
                if ($entities->urls) {
                    foreach ($entities->urls as $urls) {
                        // Loop through the URL entities
                        if ($urls->expanded_url != "") {
                            // Use the expanded URL, if it exists, to pass to Oembed provider
                            $url = $urls->expanded_url;
                        } else {
                            $url = $urls->url;
                        }
                        $matched_urls[urlencode($url)][] = $status->id;
                    }
                } else {
                    //	No URLs, do nothing
                    $matched_urls[] = null;
                }
            }
        }
    }
    //	Reduce the array of empty items
    foreach ($matched_urls as $key => $value) {
        if (null == $value) {
            unset($matched_urls[$key]);
        }
    }
    // Make a single API call to Embedkit.
    if (defined('EMBEDKIT_KEY') && EMBEDKIT_KEY != "") {
        //	Only the URLs which we're going to pass to Embedkit
        $justUrls = array_keys($matched_urls);
        $count = count($justUrls);
        if ($count == 0) {
            return;
        }
        // if ($count > 20) {
        // 	// Things can slow down with lots of links.
        // 	$justUrls = array_chunk ($justUrls, 10);
        // 	$justUrls = $justUrls[0];
        // }
        $url = 'https://embedkit.com/api/v1/embed?key=' . EMBEDKIT_KEY . '&urls=' . implode(',', $justUrls) . '&format=json';
        $embedly_json = url_fetch($url);
        $oembeds = json_decode($embedly_json);
        $tumblr_js_once = 0;
        if ($oembeds->type != 'error') {
            //	Single statuses don't come back in an array
            if (!is_array($oembeds)) {
                $temp = array(0 => $oembeds);
                $oembeds = $temp;
            }
            foreach ($justUrls as $index => $url) {
                $thumb = "";
                $title = "";
                $html = "";
                $embedHTML = "";
                if ($oembeds[$index]->thumbnail_url) {
                    //	Direct links to files
                    $thumb = $oembeds[$index]->thumbnail_url;
                }
                if ($oembeds[$index]->title) {
                    //	Direct links to files
                    $title = $oembeds[$index]->title;
                }
                if ($oembeds[$index]->html) {
                    //	Direct links to files
                    $embedHTML = $oembeds[$index]->html;
                }
                if ($embedHTML) {
                    //	Embed an HTML fragment
                    $html = $embedHTML;
                    //	Remove embedded Tweets
                    if (strstr($html, "//platform.twitter.com/widgets.js") != FALSE) {
                        $html = "";
                    }
                    //	Stop Tumblr JavaScript duplication
                    if (strstr($html, "secure.assets.tumblr.com/post.js") != FALSE) {
                        if ($tumblr_js_once > 0) {
                            // <script async src=\"https:\/\/secure.assets.tumblr.com\/post.js\"><\/script>
                            $html = str_replace('src="https://secure.assets.tumblr.com/post.js"', '', $html);
                        }
                        $tumblr_js_once++;
                    }
                    foreach ($matched_urls[$url] as $statusId) {
                        if ($html != "") {
                            $feed[$statusId]->text = $feed[$statusId]->text . '<br />' . '<span class="embed">' . $html . '</span>';
                        }
                    }
                } elseif ($thumb) {
                    //	Embed the thumbnail
                    $html = theme('external_link', urldecode($url), "<img src=\"" . image_proxy($thumb, "") . "\"" . " title=\"{$title}\" alt=\"{$title}\" class=\"embedded\" />");
                    foreach ($matched_urls[$url] as $statusId) {
                        //	Do *not* display a thumb if there is a native image attached.
                        //	Not a perfect way to avoid duplication.
                        if ($feed[$statusId]->entities->media) {
                            //	Do nothing
                        } else {
                            $feed[$statusId]->text = $feed[$statusId]->text . '<br>' . '<span class="embed">' . $html . '</span>';
                        }
                    }
                } elseif ($title) {
                    //	Embed a link
                    $html = theme('external_link', urldecode($url), $title);
                    foreach ($matched_urls[$url] as $statusId) {
                        $feed[$statusId]->text = $feed[$statusId]->text . '<br />' . '<span class="embed">' . $html . '</span>';
                    }
                }
            }
        }
    }
}