Your IP : 216.73.216.240
<?php
/**
* {provider}.php
*
* @package Embera
* @author Michael Pratt <yo@michael-pratt.com>
* @link http://www.michael-pratt.com/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Embera\Provider;
use Embera\Url;
/**
* {provider} Provider
*
* @link https://{host}
*/
class {provider} extends ProviderAdapter implements ProviderInterface
{
/** inline {@inheritdoc} */
protected $endpoint = '{endpoint}';
/** inline {@inheritdoc} */
protected static $hosts = [
'{host}'
];
/** inline {@inheritdoc} */
protected $allowedParams = [ 'maxwidth', 'maxheight' ];
/** inline {@inheritdoc} */
protected $httpsSupport = true;
/** inline {@inheritdoc} */
protected $responsiveSupport = false;
/** inline {@inheritdoc} */
public function validateUrl(Url $url)
{
return (bool) (preg_match('~{host_escaped}/([^/]+)~i', (string) $url));
}
/** inline {@inheritdoc} */
public function normalizeUrl(Url $url)
{
$url->convertToHttps();
$url->removeQueryString();
$url->removeLastSlash();
return $url;
}
/** inline {@inheritdoc} */
public function modifyResponse(array $response = [])
{
return $response;
}
/** inline {@inheritdoc} */
public function getFakeResponse()
{
preg_match('~v=([a-z0-9_\-]+)~i', (string) $this->url, $matches);
$embedUrl = '';
$attr = [];
$attr[] = 'width="{width}"';
$attr[] = 'height="{height}"';
$attr[] = 'src="' . $embedUrl . '"';
$attr[] = 'frameborder="0"';
$attr[] = 'allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"';
$attr[] = 'allowfullscreen';
return [
'type' => '',
'provider_name' => '{provider}',
'provider_url' => 'https://{host}',
'title' => 'Unknown title',
'html' => '<iframe ' . implode(' ', $attr). '></iframe>',
];
}
}