当前位置: 首页>>代码示例>>PHP>>正文


PHP Embed\Request类代码示例

本文整理汇总了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();
         }
     }
 }
开发者ID:heatery,项目名称:Embed,代码行数:29,代码来源:Adapter.php

示例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();
         }
     }
 }
开发者ID:slawus,项目名称:Embed,代码行数:29,代码来源:Adapter.php

示例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);
     }
 }
开发者ID:jooorooo,项目名称:embed,代码行数:13,代码来源:Provider.php

示例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;
 }
开发者ID:SmartCrowd,项目名称:Embed,代码行数:15,代码来源:Feed.php

示例5: check

 /**
  * {@inheritdoc}
  */
 public static function check(Request $request)
 {
     return $request->isValid() && $request->match(['*://www.parleys.com/play/*']);
 }
开发者ID:SmartCrowd,项目名称:Embed,代码行数:7,代码来源:Parleys.php

示例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']]];
     }
 }
开发者ID:slawus,项目名称:Embed,代码行数:20,代码来源:OEmbed.php

示例7: check

 /**
  * {@inheritdoc}
  */
 public static function check(Request $request)
 {
     return $request->match(['https://line.do/*']);
 }
开发者ID:slawus,项目名称:Embed,代码行数:7,代码来源:Line.php

示例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();
 }
开发者ID:mastito03,项目名称:Embed,代码行数:11,代码来源:OEmbed.php

示例9: check

 /**
  * {@inheritdoc}
  */
 public static function check(Request $request)
 {
     return $request->isValid() && $request->match(['https?://soundcloud.com/*', 'https?://m.soundcloud.com/*']);
 }
开发者ID:SmartCrowd,项目名称:Embed,代码行数:7,代码来源:Soundcloud.php

示例10: check

 /**
  * {@inheritdoc}
  */
 public static function check(Request $request)
 {
     return $request->isValid() && isset(self::$contentTypes[$request->getMimeType()]);
 }
开发者ID:mastito03,项目名称:Embed,代码行数:7,代码来源:File.php

示例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']);
 }
开发者ID:slawus,项目名称:Embed,代码行数:7,代码来源:Google.php

示例12: check

 /**
  * {@inheritdoc}
  */
 public static function check(Request $request)
 {
     return $request->isValid([200, 429]) && $request->match(['https?://*.youtube.*']);
 }
开发者ID:RJacksonm1,项目名称:Embed,代码行数:7,代码来源:Youtube.php

示例13: check

 /**
  * {@inheritdoc}
  */
 public static function check(Request $request)
 {
     return $request->isValid();
 }
开发者ID:SmartCrowd,项目名称:Embed,代码行数:7,代码来源:Webpage.php


注:本文中的Embed\Request类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。