public function toString($indent = '', $current = 0) { $indent = ar_html::$indenting ? $indent : ''; $result = "\n" . $indent . '<' . ar_html::name($this->tagName); if (is_array($this->attributes)) { foreach ($this->attributes as $name => $value) { $result .= ar_html::attribute($name, $value, $current); } } else { if (is_string($this->attributes)) { $result .= ltrim(' ' . $this->attributes); } } if (!ar_html::$xhtml || ar_html::canHaveContent($this->tagName)) { $result .= '>'; if (ar_html::canHaveContent($this->tagName)) { if (isset($this->childNodes) && count($this->childNodes)) { if (ar_html::canIndentInside($this->tagName)) { $result .= $this->childNodes->toString(ar_html::$indent . $indent); if (substr($result, -1) == ">") { $result .= "\n" . $indent; } } else { $result .= $this->childNodes->toString(''); } } $result .= '</' . ar_html::name($this->tagName) . '>'; } } else { $result .= ' />'; } return $result; }