includes/render.php
changeset 1221 d8c6b8d49604
parent 1216 4125e19d3b27
child 1227 bdac73ed481e
equal deleted inserted replaced
1220:fbfd6c852c89 1221:d8c6b8d49604
   346     
   346     
   347     $stripdata = array(
   347     $stripdata = array(
   348         'random_id' => $random_id,
   348         'random_id' => $random_id,
   349         'blocks' => $blocks[1]
   349         'blocks' => $blocks[1]
   350       );
   350       );
       
   351   }
       
   352   
       
   353   /**
       
   354    * Strip out an arbitrary HTML tag, pushing on to the existing list of stripped data.
       
   355    * @access private
       
   356    */
       
   357   
       
   358   public static function tag_strip_push($tag, &$text, &$stripdata)
       
   359   {
       
   360     if ( !is_array($stripdata) )
       
   361     {
       
   362       $stripdata = array(
       
   363           'random_id' => md5( time() . mt_rand() ),
       
   364           'blocks' => array()
       
   365         );
       
   366     }
       
   367     $random_id =& $stripdata['random_id'];
       
   368     
       
   369     preg_match_all("#<$tag>(.*?)</$tag>#is", $text, $blocks);
       
   370     
       
   371     foreach ( $blocks[0] as $i => $match )
       
   372     {
       
   373       $j = count($stripdata['blocks']);
       
   374       $stripdata['blocks'][] = $blocks[1][$i];
       
   375       $text = str_replace($match, "{{$tag}:{$random_id}:{$j}}", $text);
       
   376     }
   351   }
   377   }
   352   
   378   
   353   /**
   379   /**
   354    * Restore stripped <nowiki> tags.
   380    * Restore stripped <nowiki> tags.
   355    * @access private
   381    * @access private