Exemplo n.º 1
0
	function open($parser, $tag, $attributes){
		$this->data = ''; #stores temporary cdata
		$this->last_opened_tag = $tag;
		if(is_array($this->parent) and array_key_exists($tag,$this->parent)){ #if you've seen this tag before
			if(is_array($this->parent[$tag]) and array_key_exists(0,$this->parent[$tag])){ #if the keys are numeric
				#this is the third or later instance of $tag we've come across
				$key = count_numeric_items($this->parent[$tag]);
			}else{
				#this is the second instance of $tag that we've seen. shift around
				if(array_key_exists("$tag attr",$this->parent)){
					$arr = array('0 attr'=>&$this->parent["$tag attr"], &$this->parent[$tag]);
					unset($this->parent["$tag attr"]);
				}else{
					$arr = array(&$this->parent[$tag]);
				}
				$this->parent[$tag] = &$arr;
				$key = 1;
			}
			$this->parent = &$this->parent[$tag];
		}else{
			$key = $tag;
		}
		if($attributes) $this->parent["$key attr"] = $attributes;
		$this->parent  = &$this->parent[$key];
		$this->stack[] = &$this->parent;
	}
Exemplo n.º 2
0
 function open(&$parser, $tag, $attributes)
 {
     $this->data = '';
     $this->last_opened_tag = $tag;
     if (is_array($this->parent) and array_key_exists($tag, $this->parent)) {
         if (is_array($this->parent[$tag]) and array_key_exists(0, $this->parent[$tag])) {
             $key = count_numeric_items($this->parent[$tag]);
         } else {
             if (array_key_exists($tag . '_attr', $this->parent)) {
                 $arr = array('0_attr' => &$this->parent[$tag . '_attr'], &$this->parent[$tag]);
                 unset($this->parent[$tag . '_attr']);
             } else {
                 $arr = array(&$this->parent[$tag]);
             }
             $this->parent[$tag] =& $arr;
             $key = 1;
         }
         $this->parent =& $this->parent[$tag];
     } else {
         $key = $tag;
     }
     if ($attributes) {
         $this->parent[$key . '_attr'] = $attributes;
     }
     $this->parent =& $this->parent[$key];
     $this->stack[] =& $this->parent;
 }
Exemplo n.º 3
0
 function open(&$parser, $tag, $attributes)
 {
     $this->data = '';
     #stores temporary cdata
     $this->last_opened_tag = $tag;
     $key = count_numeric_items($this->parent[$tag]);
     if ($attributes) {
         $this->parent[$tag]["{$key} attr"] = $attributes;
     }
     $this->parent[$tag][$key] = array();
     $this->parent =& $this->parent[$tag][$key];
     $this->stack[] =& $this->parent;
 }
Exemplo n.º 4
0
 function open($parser, $tag, $attributes)
 {
     #echo "Opening tag $tag<br>\n";
     $this->data = "";
     $this->last_opened_tag = $tag;
     #tag is a string
     if (array_key_exists($tag, $this->parent)) {
         #echo "There's already an instance of '$tag' at the current level ($level)<br>\n";
         if (is_array($this->parent[$tag]) and array_key_exists(0, $this->parent[$tag])) {
             #if the keys are numeric
             #need to make sure they're numeric (account for attributes)
             $key = count_numeric_items($this->parent[$tag]);
             #echo "There are $key instances: the keys are numeric.<br>\n";
         } else {
             #echo "There is only one instance. Shifting everything around<br>\n";
             $temp =& $this->parent[$tag];
             unset($this->parent[$tag]);
             $this->parent[$tag][0] =& $temp;
             if (array_key_exists("{$tag} attr", $this->parent)) {
                 #shift the attributes around too if they exist
                 $temp =& $this->parent["{$tag} attr"];
                 unset($this->parent["{$tag} attr"]);
                 $this->parent[$tag]["0 attr"] =& $temp;
             }
             $key = 1;
         }
         $this->parent =& $this->parent[$tag];
     } else {
         $key = $tag;
     }
     if ($attributes) {
         $this->parent["{$key} attr"] = $attributes;
     }
     $this->parent[$key] = array();
     $this->parent =& $this->parent[$key];
     // Changed by Igor Borisov for PHP >= 5.4
     // array_unshift($this->parents, &$this->parent); Original
     array_unshift($this->parents, 0);
     // Changed
     $this->parents[0] =& $this->parent;
     // Added
 }
Exemplo n.º 5
0
 function open($parser, $tag, $attributes)
 {
     #echo "Opening tag $tag<br>\n";
     $this->data = "";
     $this->last_opened_tag = $tag;
     #tag is a string
     if (array_key_exists($tag, $this->parent)) {
         #echo "There's already an instance of '$tag' at the current level ($level)<br>\n";
         if (is_array($this->parent[$tag]) and array_key_exists(0, $this->parent[$tag])) {
             #if the keys are numeric
             #need to make sure they're numeric (account for attributes)
             $key = count_numeric_items($this->parent[$tag]);
             #echo "There are $key instances: the keys are numeric.<br>\n";
         } else {
             #echo "There is only one instance. Shifting everything around<br>\n";
             $temp =& $this->parent[$tag];
             unset($this->parent[$tag]);
             $this->parent[$tag][0] =& $temp;
             if (array_key_exists("{$tag} attr", $this->parent)) {
                 #shift the attributes around too if they exist
                 $temp =& $this->parent["{$tag} attr"];
                 unset($this->parent["{$tag} attr"]);
                 $this->parent[$tag]["0 attr"] =& $temp;
             }
             $key = 1;
         }
         $this->parent =& $this->parent[$tag];
     } else {
         $key = $tag;
     }
     if ($attributes) {
         $this->parent["{$key} attr"] = $attributes;
     }
     $this->parent[$key] = array();
     $this->parent =& $this->parent[$key];
     // Can't unshift by reference, so insert dummy and replace it with reference afterwards
     array_unshift($this->parents, NULL);
     $this->parents[0] =& $this->parent;
 }