VouchFor.php
| 1 | <?php |
| 2 | /** |
| 3 | * VouchFor.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 | * VouchFor Provider |
| 19 | * |
| 20 | * @link https://*.vouchfor.com |
| 21 | */ |
| 22 | class VouchFor extends ProviderAdapter implements ProviderInterface |
| 23 | { |
| 24 | /** inline {@inheritdoc} */ |
| 25 | protected $endpoint = 'https://embed.vouchfor.com/v1/oembed?format=json'; |
| 26 | |
| 27 | /** inline {@inheritdoc} */ |
| 28 | protected static $hosts = [ |
| 29 | '*.vouchfor.com' |
| 30 | ]; |
| 31 | |
| 32 | /** inline {@inheritdoc} */ |
| 33 | protected $allowedParams = [ 'maxwidth', 'maxheight' ]; |
| 34 | |
| 35 | /** inline {@inheritdoc} */ |
| 36 | protected $httpsSupport = true; |
| 37 | |
| 38 | /** inline {@inheritdoc} */ |
| 39 | protected $responsiveSupport = false; |
| 40 | |
| 41 | /** inline {@inheritdoc} */ |
| 42 | public function validateUrl(Url $url) |
| 43 | { |
| 44 | return (bool) (preg_match('~vouchfor\.com/([^/]+)~i', (string) $url)); |
| 45 | } |
| 46 | |
| 47 | } |
| 48 |