• Модуль: xmpp
  • Путь к файлу: ~/bitrix/modules/xmpp/classes/parser.php
  • Класс: CXMPPParser
  • Вызов: CXMPPParser::__toStringInternal
function __toStringInternal($ar = false)
{
	if ($ar === false)
		$ar = $this->array;

	$str = '';
	foreach($ar as $name => $child)
	{
		$attr = array();
		$content = null;

		if (array_key_exists('#', $child))
		{
			$content = $child['#'];
			if (is_array($child['.']))
				foreach($child['.'] as $k => $v)
					$attr[] = $k.'="'.$v.'"'; // there are no quotes in attributes
		}
		else
		{
			if ($name == '.')
				continue;
			else
			{
				if ($child[0])
				{
					if (is_array($child))
						foreach($child as $item)
							$str .=  $this->__toStringInternal(array($name => $item));
					continue;
				}
				else
				{
					if (is_array($child['.']))
						foreach($child['.'] as $k => $v)
							$attr[] = $k.'="'.$v.'"'; // there are no quotes in attributes
					$content = $this->__toStringInternal($child);
				}
			}
		}
		$str .= '<'.$name.(count($attr)?' '.implode(' ',$attr):'').(isset($content)?'>'.$content.'':'/>');
	}


	$this->string = $str;
	return $this->string;
}