本文整理汇总了PHP中Embed\Request类的典型用法代码示例。如果您正苦于以下问题:PHP Request类的具体用法?PHP Request怎么用?PHP Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Request类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* {@inheritdoc}
*/
public function __construct(Request $request, array $config = null)
{
$this->request = $request;
if (isset($config['adapter']['config'])) {
$this->config = array_replace($this->config, $config['adapter']['config']);
}
if (isset($config['providers'])) {
$this->providersConfig = $config['providers'];
}
if (isset($config['image']['class'])) {
$this->imageClass = $config['image']['class'];
}
if (isset($config['image']['config'])) {
$this->imageConfig = $config['image']['config'];
}
$this->run();
if ($request->url->getUrl() !== $this->url) {
$subRequest = $request->createRequest($this->url);
if ($subRequest->isValid()) {
$this->request = $subRequest;
$this->run();
} else {
$this->url = $request->url->getUrl();
}
}
}
示例2: __construct
/**
* {@inheritdoc}
*/
public function __construct(Request $request, array $config = null)
{
$this->request = $request;
if (isset($config['adapter']['config'])) {
$this->config = array_replace($this->config, $config['adapter']['config']);
}
if (isset($config['providers'])) {
$this->providersConfig = $config['providers'];
}
if (isset($config['image']['class'])) {
$this->imageClass = $config['image']['class'];
}
if (isset($config['image']['config'])) {
$this->imageConfig = $config['image']['config'];
}
$this->run();
//if the canonical url is different, repeat the proccess
$canonical = $this->getUrl();
if ($request->getUrl() !== $canonical) {
$request = $request->withUrl($canonical);
if ($request->isValid()) {
$this->request = $request;
$this->run();
}
}
}
示例3: init
/**
* {@inheritdoc}
*/
public function init(Request $request, array $config = null)
{
$this->bag = new Bag();
$this->request = $request;
$this->bag->set('request', $this->request);
$this->bag->set('request_url', $request->getResolver()->getUrl());
if ($config) {
$this->config = array_replace($this->config, $config);
}
}
示例4: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
switch ($request->getMimeType()) {
case 'text/xml':
case 'text/html':
case 'application/xml':
case 'application/atom+xml':
case 'application/rss+xml':
return true;
}
return false;
}
示例5: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->isValid() && $request->match(['*://www.parleys.com/play/*']);
}
示例6: getEndPointFromRequest
/**
* Returns the oembed link from the request
*
* @param Request $request
* @param array $config
*
* @return array|null
*/
protected static function getEndPointFromRequest(Request $request, array $config)
{
//Search the oembed provider using the domain
$class = 'Embed\\Providers\\OEmbed\\' . str_replace(' ', '', ucwords(strtolower(str_replace('-', ' ', $request->getDomain()))));
if (class_exists($class) && $request->match($class::getPatterns())) {
return ['endPoint' => $class::getEndpoint(), 'params' => $class::getParams($request)];
}
//Search using embedly
if (!empty($config['embedlyKey']) && $request->match(OEmbed\Embedly::getPatterns())) {
return ['endPoint' => OEmbed\Embedly::getEndpoint(), 'params' => OEmbed\Embedly::getParams($request) + ['key' => $config['embedlyKey']]];
}
}
示例7: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->match(['https://line.do/*']);
}
示例8: getClassFromRequest
/**
* Return the class name implementing an oEmbed provider.
*
* @param Request $request
*
* @return string
*/
protected static function getClassFromRequest(Request $request)
{
return 'Embed\\Providers\\OEmbed\\' . $request->getClassNameForDomain();
}
示例9: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->isValid() && $request->match(['https?://soundcloud.com/*', 'https?://m.soundcloud.com/*']);
}
示例10: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->isValid() && isset(self::$contentTypes[$request->getMimeType()]);
}
示例11: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->match(['https://maps.google.*', 'https://www.google.*/maps*', 'https://drive.google.com/file/*/view']);
}
示例12: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->isValid([200, 429]) && $request->match(['https?://*.youtube.*']);
}
示例13: check
/**
* {@inheritdoc}
*/
public static function check(Request $request)
{
return $request->isValid();
}