當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。