includes/render.php
changeset 1216 4125e19d3b27
parent 1171 d42d46e13b36
child 1227 bdac73ed481e
--- a/includes/render.php	Mon Feb 01 02:14:02 2010 -0500
+++ b/includes/render.php	Mon Feb 01 02:15:04 2010 -0500
@@ -351,6 +351,32 @@
   }
   
   /**
+   * Strip out an arbitrary HTML tag, pushing on to the existing list of stripped data.
+   * @access private
+   */
+  
+  public static function tag_strip_push($tag, &$text, &$stripdata)
+  {
+    if ( !is_array($stripdata) )
+    {
+      $stripdata = array(
+          'random_id' => md5( time() . mt_rand() ),
+          'blocks' => array()
+        );
+    }
+    $random_id =& $stripdata['random_id'];
+    
+    preg_match_all("#<$tag>(.*?)</$tag>#is", $text, $blocks);
+    
+    foreach ( $blocks[0] as $i => $match )
+    {
+      $j = count($stripdata['blocks']);
+      $stripdata['blocks'][] = $blocks[1][$i];
+      $text = str_replace($match, "{{$tag}:{$random_id}:{$j}}", $text);
+    }
+  }
+  
+  /**
    * Restore stripped <nowiki> tags.
    * @access private
    */