/**
  * @param array $atts
  */
 function __construct($atts = array(), $tag = '', $value = '')
 {
     if ($atts instanceof DOMElement) {
         $this->element = $atts;
         return $this;
     }
     parent::__construct(0, $atts, $tag, $value);
 }
Exemplo n.º 2
0
 /**
  * convert xml to valid element known as domelement
  * @param $item
  * @return DOMElement|HWIE_Param
  */
 public function convert_element($item)
 {
     return HWIE_Param::get_hw_element($item, false);
 }
Exemplo n.º 3
0
 /**
  * @param $string
  * @param $tag
  * @Param $xml_object return xml in object without string
  * @return mixed|string
  */
 function get_tag($string, $tag, $xml_object = false)
 {
     preg_match("|<{$tag}.*?>(.*?)</{$tag}>|is", $string, $return);
     if (isset($return[1])) {
         if (substr($return[1], 0, 9) == '<![CDATA[') {
             if (strpos($return[1], ']]]]><![CDATA[>') !== false) {
                 preg_match_all('|<!\\[CDATA\\[(.*?)\\]\\]>|s', $return[1], $matches);
                 $return = '';
                 foreach ($matches[1] as $match) {
                     $return .= $match;
                 }
             } else {
                 $return = preg_replace('|^<!\\[CDATA\\[(.*)\\]\\]>$|s', '$1', $return[1]);
             }
         } else {
             $return = $return[1];
         }
     } else {
         $return = '';
     }
     if ($xml_object && trim($return) && HW_XML::string_is_xml_format($return)) {
         return HWIE_Param::string2xml_withNS($return);
     }
     return $return;
 }