Source of file Flickr.php
Size: 0,818 Bytes - Last Modified: 2021-12-23T10:19:05+00:00
/var/www/docs.ssmods.com/process/src/code/providers/Flickr.php
12345678910111213141516171819202122232425 | <?php namespace RichardsJoqvist\silverstripeEmbedder; /** * Flickr Embedder provider */ class Flickr extends EmbedderProvider implements IEmbedderProvider { // Render embed from Flickr links, the following formats are recognized: // http://[www.]flickr.com/photos/asimomytis_photography/8594949556 protected $pattern = "/([^\"|'|=])(https?:\/\/)(www\.|)(flickr\.com\/photos\/)([^\/]*)(\/)([\d]*)([^\d])/isU"; public function render($matches) { // Render from oEmbed json if ($html = $this->embedder->renderHTML('http://www.flickr.com/services/oembed/?url=http://flickr.com/photos/' . $matches[5] . '/' . $matches[7])) { return $matches[1] . $html . end($matches); } // Failed to get oembed, return original HTML return $matches[0]; } } |