Пример #1
0
 /**
  * Returns the processed gadget spec
  *
  * @return GadgetSpec
  */
 public function createGadget()
 {
     $gadgetUrl = $this->context->getUrl();
     if ($this->context->getBlacklist() != null && $this->context->getBlacklist()->isBlacklisted($gadgetUrl)) {
         throw new GadgetException("The Gadget ({$gadgetUrl}) is blacklisted and can not be rendered");
     }
     // Fetch the gadget's content and create a GadgetSpec
     $gadgetContent = $this->fetchGadget($gadgetUrl);
     $gadgetSpecParser = new GadgetSpecParser();
     $gadgetSpec = $gadgetSpecParser->parse($gadgetContent);
     $gadget = new Shindig_Gadget($gadgetSpec, $this->context);
     // Process the gadget: fetching remote resources, processing & applying the correct translations, user prefs and feature resolving
     $this->fetchResources($gadget);
     $this->mergeLocales($gadget);
     $this->parseUserPrefs($gadget);
     $this->addSubstitutions($gadget);
     $this->applySubstitutions($gadget);
     $this->parseFeatures($gadget);
     return $gadget;
 }