Genially.php
| 1 | <?php |
| 2 | /** |
| 3 | * Genially.php |
| 4 | * |
| 5 | * @package Embera |
| 6 | * @author Matías Minevitz <matias.minevitz@gmail.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | |
| 12 | namespace Embera\Provider; |
| 13 | |
| 14 | use Embera\Url; |
| 15 | |
| 16 | /** |
| 17 | * Genially Provider |
| 18 | * Engage your audience with clickable, gamified, media-rich experiences. Create your interactive content now! |
| 19 | * |
| 20 | * @link https://genially.com |
| 21 | */ |
| 22 | class Genially extends ProviderAdapter implements ProviderInterface |
| 23 | { |
| 24 | /** inline {@inheritdoc} */ |
| 25 | protected $endpoint = 'https://genially.com/services/oembed?format=json'; |
| 26 | |
| 27 | /** inline {@inheritdoc} */ |
| 28 | protected static $hosts = [ |
| 29 | '*.genial.ly', |
| 30 | '*.genially.com', |
| 31 | ]; |
| 32 | |
| 33 | /** inline {@inheritdoc} */ |
| 34 | protected $httpsSupport = true; |
| 35 | |
| 36 | /** inline {@inheritdoc} */ |
| 37 | protected $responsiveSupport = true; |
| 38 | |
| 39 | /** inline {@inheritdoc} */ |
| 40 | public function validateUrl(Url $url) |
| 41 | { |
| 42 | return (bool) (preg_match('~view\.(?:genial\.ly|genially\.com)/[a-z0-9]{24}(?:$|/)~i', (string) $url)); |
| 43 | } |
| 44 | |
| 45 | /** inline {@inheritdoc} */ |
| 46 | public function normalizeUrl(Url $url) |
| 47 | { |
| 48 | $url->convertToHttps(); |
| 49 | $url->removeQueryString(); |
| 50 | |
| 51 | return $url; |
| 52 | } |
| 53 | } |
| 54 |