src/core/Feed/Writer.php
private function makeNode($tagName, $tagContent, $attributes = null)
	{
		$nodeText = '';
		$attrText = '';

		if (is_array($attributes))
		{
			foreach ($attributes as $key => $value)
			{
				$attrText .= " $key=\"$value\" ";
			}
		}

		if (is_array($tagContent) && $this->version == self::RSS1)
		{
			$attrText = ' rdf:parseType="Resource"';
		}


		$attrText .= (in_array($tagName, $this->CDATAEncoding) && $this->version == self::ATOM)?
			' type="html" ' : '';
		$nodeText .= (in_array($tagName, $this->CDATAEncoding))?
			"<{$tagName}{$attrText}><![CDATA[" : "<{$tagName}{$attrText}>";

		if (is_array($tagContent))
		{
			foreach ($tagContent as $key => $value)
			{
				$nodeText .= $this->makeNode($key, $value);
			}
		}
		else
		{
			$nodeText .= (in_array($tagName, $this->CDATAEncoding)) ?
				$this->sanitizeCDATA($tagContent) : 
				htmlspecialchars($tagContent);
		}

		$nodeText .= (in_array($tagName, $this->CDATAEncoding))? "]]></$tagName>" : "</$tagName>";

		return $nodeText . PHP_EOL;
	}
private function makeNode($tagName, $tagContent, $attributes = null)
	{
		$nodeText = '';
		$attrText = '';

		if (is_array($attributes))
		{
			foreach ($attributes as $key => $value)
			{
				$attrText .= " $key=\"$value\" ";
			}
		}

		if (is_array($tagContent) && $this->version == self::RSS1)
		{
			$attrText = ' rdf:parseType="Resource"';
		}


		$attrText .= (in_array($tagName, $this->CDATAEncoding) && $this->version == self::ATOM)?
			' type="html" ' : '';
		$nodeText .= (in_array($tagName, $this->CDATAEncoding))?
			"<{$tagName}{$attrText}><![CDATA[" : "<{$tagName}{$attrText}>";

		if (is_array($tagContent))
		{
			foreach ($tagContent as $key => $value)
			{
				$nodeText .= $this->makeNode($key, $value);
			}
		}
		else
		{
			$nodeText .= (in_array($tagName, $this->CDATAEncoding)) ?
				$this->sanitizeCDATA($tagContent) : 
				htmlspecialchars($tagContent);
		}

		$nodeText .= (in_array($tagName, $this->CDATAEncoding))? "]]></$tagName>" : "</$tagName>";

		return $nodeText . PHP_EOL;
	}
private function makeNode ( $ tagName , $ tagContent , $ attributes = null ) { $ nodeText = '' ; $ attrText = '' ; if ( is_array ( $ attributes ) ) { foreach ( $ attributes as $ key => $ value ) { $ attrText .= " $key=\"$value\" " ; } } if ( is_array ( $ tagContent ) && $ this -> version == self :: RSS1 ) { $ attrText = ' rdf:parseType="Resource"' ; } $ attrText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) && $ this -> version == self :: ATOM ) ? ' type="html" ' : '' ; $ nodeText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) ) ? "<{$tagName}{$attrText}><![CDATA[" : "<{$tagName}{$attrText}>" ; if ( is_array ( $ tagContent ) ) { foreach ( $ tagContent as $ key => $ value ) { $ nodeText .= $ this -> makeNode ( $ key , $ value ) ; } } else { $ nodeText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) ) ? $ this -> sanitizeCDATA ( $ tagContent ) : htmlspecialchars ( $ tagContent ) ; } $ nodeText .= ( in_array ( $ tagName , $ this -> CDATAEncoding ) ) ? "]]></$tagName>" : "</$tagName>" ; return $ nodeText . PHP_EOL ; }
Creates a single node as xml format

@param string $tagName     name of the tag
@param mixed  $tagContent  tag value as string or array of nested tags in 'tagName' => 'tagValue' format
@param array  $attributes  Attributes (if any) in 'attrName' => 'attrValue' format
@return string  formatted xml tag
Creates a single node as xml format