context = $context; return $this->getGadgetSpecUri($context->getUrl(), $context->getIgnoreCache()); } /** * Retrieves a gadget specification from the cache or from the Internet. * * @param string $url * @param boolean $ignoreCache * @return GadgetSpec */ public function getGadgetSpecUri($url, $ignoreCache) { return $this->fetchFromWeb($url, $ignoreCache); } /** * Retrieves a gadget specification from the Internet, processes its views and * adds it to the cache. * * @param string $url * @param boolean $ignoreCache * @return GadgetSpec */ private function fetchFromWeb($url, $ignoreCache) { $remoteContentRequest = new RemoteContentRequest($url); $remoteContentRequest->getOptions()->ignoreCache = $ignoreCache; $remoteContent = new BasicRemoteContent(); $spec = $remoteContent->fetch($remoteContentRequest); $gadgetSpecParserClass = Config::get('gadget_spec_parser'); $gadgetSpecParser = new $gadgetSpecParserClass(); $gadgetSpec = $gadgetSpecParser->parse($spec->getResponseContent(), $this->context); return $gadgetSpec; } }