Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/xml_helper.php
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | |||||
$this->RootElement =& new $class_name('ERROR', array ('code' => xml_get_error_code($xml_parser), 'message' => $message)); | $this->RootElement =& new $class_name('ERROR', array ('code' => xml_get_error_code($xml_parser), 'message' => $message)); | ||||
trigger_error($message, E_USER_WARNING); | trigger_error($message, E_USER_WARNING); | ||||
} | } | ||||
xml_parser_free($xml_parser); | xml_parser_free($xml_parser); | ||||
/** @var kXMLNode $root_copy */ | |||||
$root_copy = $this->RootElement; | $root_copy = $this->RootElement; | ||||
/* @var $root_copy kXMLNode */ | |||||
unset($this->RootElement); | unset($this->RootElement); | ||||
unset($this->CurrentElement); | unset($this->CurrentElement); | ||||
return $root_copy; | return $root_copy; | ||||
} | } | ||||
function ConvertHTMLEntities($s) | function ConvertHTMLEntities($s) | ||||
Show All 31 Lines | |||||
$parent->AddChild($this->CurrentElement); | $parent->AddChild($this->CurrentElement); | ||||
} | } | ||||
} | } | ||||
function characterData($Parser, $Line) | function characterData($Parser, $Line) | ||||
{ | { | ||||
if ($this->Mode == self::XML_WITH_TEXT_NODES) { | if ($this->Mode == self::XML_WITH_TEXT_NODES) { | ||||
$class_name = $this->XMLNodeClassName; | $class_name = $this->XMLNodeClassName; | ||||
/** @var kXMLNode $text_node */ | |||||
$text_node = new $class_name('_TEXT_'); | $text_node = new $class_name('_TEXT_'); | ||||
/* @var $text_node kXMLNode */ | |||||
$text_node->AppendData($Line); | $text_node->AppendData($Line); | ||||
$this->CurrentElement->AddChild( $text_node ); | $this->CurrentElement->AddChild( $text_node ); | ||||
} | } | ||||
else { | else { | ||||
$this->CurrentElement->AppendData($Line); | $this->CurrentElement->AppendData($Line); | ||||
} | } | ||||
} | } | ||||
Show All 15 Lines | |||||
{ | { | ||||
unset($this->RootElement); | unset($this->RootElement); | ||||
unset($this->CurrentElement); | unset($this->CurrentElement); | ||||
} | } | ||||
function &CreateNode($name, $value=null, $attributes=array()) | function &CreateNode($name, $value=null, $attributes=array()) | ||||
{ | { | ||||
$class_name = $this->XMLNodeClassName; | $class_name = $this->XMLNodeClassName; | ||||
/** @var kXMLNode $node */ | |||||
$node = new $class_name($name, $attributes); | $node = new $class_name($name, $attributes); | ||||
/* @var $node kXMLNode */ | |||||
if ($value) { | if ($value) { | ||||
$node->SetData($value); | $node->SetData($value); | ||||
} | } | ||||
return $node; | return $node; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Line(s) | |||||
/*if ( isset($this->Children[$name]) ) { | /*if ( isset($this->Children[$name]) ) { | ||||
return $this->Children[$name]; | return $this->Children[$name]; | ||||
} | } | ||||
$children = array_keys($this->Children);*/ | $children = array_keys($this->Children);*/ | ||||
foreach ($this->Children as $elem) { | foreach ($this->Children as $elem) { | ||||
/* @var $elem kXMLNode */ | /** @var kXMLNode $elem */ | ||||
$child =& $elem->FindChild($name); | $child =& $elem->FindChild($name); | ||||
if ( $child !== false ) { | if ( $child !== false ) { | ||||
return $child; | return $child; | ||||
} | } | ||||
} | } | ||||
if ( isset($child) && is_object($child) ) { | if ( isset($child) && is_object($child) ) { | ||||
$child->_destruct(); | $child->_destruct(); | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | |||||
if ($content_only) { | if ($content_only) { | ||||
$xml .= $this->Data; | $xml .= $this->Data; | ||||
} | } | ||||
else { | else { | ||||
$xml .= preg_match('/&|</', $this->Data) ? '<![CDATA['.$this->Data.']]>' : $this->Data; | $xml .= preg_match('/&|</', $this->Data) ? '<![CDATA['.$this->Data.']]>' : $this->Data; | ||||
} | } | ||||
foreach ($this->Children as $node) { | foreach ($this->Children as $node) { | ||||
/* @var $node kXMLNode */ | /** @var kXMLNode $node */ | ||||
$xml .= $node->GetXML($node->Name == '_TEXT_' ? true : false); | $xml .= $node->GetXML($node->Name == '_TEXT_' ? true : false); | ||||
} | } | ||||
if (!$content_only) { | if (!$content_only) { | ||||
$xml .= '</'.$this->OriginalName.'>'; | $xml .= '</'.$this->OriginalName.'>'; | ||||
} | } | ||||
} | } | ||||
Show All 38 Lines | |||||
} | } | ||||
function SetAttribute($name, $value) | function SetAttribute($name, $value) | ||||
{ | { | ||||
$this->Attributes[strtoupper($name)] = $value; | $this->Attributes[strtoupper($name)] = $value; | ||||
$this->OriginalAttributes[$name] = $value; | $this->OriginalAttributes[$name] = $value; | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |