Digiteka.php
| 1 | <?php |
| 2 | /** |
| 3 | * Digiteka.php |
| 4 | * |
| 5 | * @package Embera |
| 6 | * @author Michael Pratt <yo@michael-pratt.com> |
| 7 | * @link http://www.michael-pratt.com/ |
| 8 | * |
| 9 | * For the full copyright and license information, please view the LICENSE |
| 10 | * file that was distributed with this source code. |
| 11 | */ |
| 12 | |
| 13 | namespace Embera\Provider; |
| 14 | |
| 15 | use Embera\Url; |
| 16 | |
| 17 | /** |
| 18 | * Digiteka Provider |
| 19 | * The Digiteka Smart Video Player automatically displays |
| 20 | * contextually relevant video on every article |
| 21 | * |
| 22 | * @link https://digiteka.com/ |
| 23 | */ |
| 24 | class Digiteka extends ProviderAdapter implements ProviderInterface |
| 25 | { |
| 26 | /** inline {@inheritdoc} */ |
| 27 | protected $endpoint = 'https://www.ultimedia.com/api/search/oembed?format=json'; |
| 28 | |
| 29 | /** inline {@inheritdoc} */ |
| 30 | protected static $hosts = [ |
| 31 | 'ultimedia.com' |
| 32 | ]; |
| 33 | |
| 34 | /** inline {@inheritdoc} */ |
| 35 | protected $httpsSupport = true; |
| 36 | |
| 37 | /** inline {@inheritdoc} */ |
| 38 | protected $responsiveSupport = true; |
| 39 | |
| 40 | /** inline {@inheritdoc} */ |
| 41 | public function validateUrl(Url $url) |
| 42 | { |
| 43 | return (bool) (preg_match('~ultimedia\.com/(central|default)/(video|index)/(edit|videogeneric/id)/([^/]+)/?~i', (string) $url)); |
| 44 | } |
| 45 | |
| 46 | /** inline {@inheritdoc} */ |
| 47 | public function normalizeUrl(Url $url) |
| 48 | { |
| 49 | $url->addWWW(); |
| 50 | $url->convertToHttps(); |
| 51 | $url->removeQueryString(); |
| 52 | |
| 53 | return $url; |
| 54 | } |
| 55 | |
| 56 | } |
| 57 |