Ejemplo n.º 1
0
 function testStartTagIsWactTagWithForbidEndTag()
 {
     $tag = 'test';
     $attrs = array('foo' => 'bar');
     $info = new WactTagInfo($tag, $tag_class = 'SomeTagClass');
     $info->setForbidEndTag(true);
     $this->tag_dictionary->setReturnValue('findTagInfo', $info, array($tag, $attrs, FALSE, new ReferenceExpectation($this->cursor_node)));
     $location = new WactSourceLocation('my_file', 10);
     $this->tree_builder->expectOnce('buildTagNode', array($info, $tag, $location, $attrs, FALSE, FALSE));
     $this->tree_builder->expectNever('pushExpectedWactTag');
     $this->tree_builder->expectOnce('pushNode');
     $this->tree_builder->expectOnce('popNode');
     $this->state->startTag($tag, $attrs, $location);
 }
Ejemplo n.º 2
0
 function findTagInfo($tag, $attrs, $isEmpty, $current_node)
 {
     $tag = strtolower($tag);
     if (isset($attrs['wact:id'])) {
         $attrs['runat'] = 'server';
     }
     // Does the tag have the runat attribute? If so it might be a component
     if (isset($attrs['runat'])) {
         if (strtolower($attrs['runat']) == 'server') {
             if (isset($this->info[$tag])) {
                 return $this->info[$tag];
             } else {
                 // we are a generic tag.  We run at the server, but have no
                 // specific WactTagInfo record in the dictionary.
                 if (!$isEmpty) {
                     $generic = new WactTagInfo($tag, 'WactGenericContainerHTMLTag');
                     $generic->File = 'limb/wact/src/compiler/tag_node/WactGenericContainerHTMLTag.class.php';
                 } else {
                     $generic = new WactTagInfo($tag, 'WactGenericHTMLTag');
                     $generic->File = 'limb/wact/src/compiler/tag_node/WactGenericHTMLTag.class.php';
                     $generic->setForbidEndTag();
                 }
                 $generic->setRunat('client');
                 return $generic;
             }
         }
     } else {
         if (isset($this->info[$tag])) {
             $WactTagInfo = $this->info[$tag];
             if ($WactTagInfo->getRunat() == 'server') {
                 return $WactTagInfo;
             }
             // Check if tag allowed to inherit runat attribute from parent
             if ($runat_as = $WactTagInfo->getRunatAs()) {
                 if ($parent = $current_node->findSelfOrParentByClass($runat_as)) {
                     if ($parent->getBoolAttribute('children_reuse_runat', TRUE)) {
                         return $WactTagInfo;
                     }
                 }
             }
         }
     }
     return NULL;
 }