Skip to content

Commit

Permalink
XHTML tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
archwisp committed Jun 27, 2011
1 parent c92559a commit 49407d2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
15 changes: 15 additions & 0 deletions Xhtml/Abstract.php
Expand Up @@ -95,6 +95,21 @@ public function getTag()
{
return $this->tag;
}

/**
* Sets an attribute
*
* @param string $name The key portion of the option
* @param string $value The value portion of the option
*
* @return bool
*/
public function setAttribute($name, $value)
{
$this->options[$name] = $value;

return TRUE;
}

/**
* Sets an option
Expand Down
13 changes: 10 additions & 3 deletions Xhtml/AbstractContainerElement.php
Expand Up @@ -145,20 +145,27 @@ public function render()
*
* @return Xhtml_Abstract
*/
public function getContentsByTagName($tag)
public function getElementsByTagName($tag)
{
$elements = array();

foreach ($this->contents as $element)
{
if ($element instanceof MindFrame2_Xhtml_Abstract)
{
if (strtolower($element->getTag()) == strtolower($tag))
{
return $element;
$elements[] = $element;
}
elseif (($element instanceof MindFrame2_Xhtml_AbstractContainerElement)
&& (($children = $element->getElementsByTagName($tag)) !== FALSE))
{
$elements = array_merge($elements, $children);
}
}
}

return FALSE;
return !empty($elements) ? $elements : FALSE;
}

/**
Expand Down

0 comments on commit 49407d2

Please sign in to comment.