/** * 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']]]; } }
/** * 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 = self::getClassFromRequest($request); if (class_exists($class) && $request->match($class::getPatterns())) { return ['endPoint' => $class::getEndpoint($request), 'params' => $class::getParams($request)]; } //Search using embedly if (!empty($config['embedlyKey']) && $request->match(OEmbed\Embedly::getPatterns())) { return ['endPoint' => OEmbed\Embedly::getEndpoint($request), 'params' => OEmbed\Embedly::getParams($request) + ['key' => $config['embedlyKey']]]; } //Search using iframely if (!empty($config['iframelyKey']) && $request->match(OEmbed\Iframely::getPatterns())) { return ['endPoint' => OEmbed\Iframely::getEndpoint($request), 'params' => OEmbed\Iframely::getParams($request) + ['api_key' => $config['iframelyKey']]]; } }