Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getProviderUrl()
 {
     return Utils::getFirstValue(Utils::getData($this->providers, 'providerUrl', $this->request)) ?: $this->request->getScheme() . '://' . $this->request->getDomain(true);
 }
Example #2
0
 /**
  * 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']]];
     }
 }
Example #3
0
 /**
  * Return the class name implementing an oEmbed provider
  * @param Request $request
  *
  * @return string
  */
 protected static function getClassFromRequest(Request $request)
 {
     return 'Embed\\Providers\\OEmbed\\' . str_replace(' ', '', ucwords(strtolower(str_replace('-', ' ', $request->getDomain()))));
 }