private static function loadData($name, $type)
 {
     // we don't really do 'resources', so limiting this to files only
     if ($type == 'FILE') {
         return JsLibrary::loadFile($name);
     }
     return null;
 }
Esempio n. 2
0
 private function processContext(&$feature, $context, $isContainer)
 {
     foreach ($context->script as $script) {
         $attributes = $script->attributes();
         if (!isset($attributes['src'])) {
             // inline content
             $type = 'INLINE';
             $content = (string) $script;
         } else {
             $content = trim($attributes['src']);
             if (strtolower(substr($content, 0, strlen("http://"))) == "http://") {
                 $type = 'URL';
             } elseif (strtolower(substr($content, 0, strlen("//"))) == "//") {
                 $type = 'URL';
             } else {
                 // as before, we skip over the resource parts since we dont support them
                 $type = 'FILE';
                 $content = $feature->basePath . '/' . $content;
             }
         }
         $library = JsLibrary::create($type, $content, $this->debug);
         if ($library != null) {
             if ($isContainer) {
                 $feature->containerJs[] = $library;
             } else {
                 $feature->gadgetJs[] = $library;
             }
         }
     }
     return $feature;
 }
 /**
  * Tests JsLibrary->toString()
  */
 public function testToString()
 {
     $output = $this->JsLibrary->toString();
     $this->assertEquals("<script src=\"" . $this->JsLibrary->getContent() . "\"></script>", $output);
 }