includes/wikiengine/parse_mediawiki.php
changeset 1134 4fdd92da4fe8
parent 1131 adfbe522c95f
child 1138 a7b490f0c418
equal deleted inserted replaced
1133:6e51ca5e29eb 1134:4fdd92da4fe8
   217     // get wrapped X number of times instead of all matches getting wrapped once; replacing each
   217     // get wrapped X number of times instead of all matches getting wrapped once; replacing each
   218     // with a unique token id remedies this
   218     // with a unique token id remedies this
   219     
   219     
   220     $tokens = array();
   220     $tokens = array();
   221     $rand_id = sha1(microtime() . mt_rand());
   221     $rand_id = sha1(microtime() . mt_rand());
       
   222     
       
   223     // Temporary hack to fix crashes under win32. Sometime I'll write a loop based
       
   224     // parser for this whole section. Maybe. Perhaps the Apache folks will fix their
       
   225     // Windows binaries first.
       
   226     if ( PHP_OS == 'WIN32' || PHP_OS == 'WINNT' )
       
   227     {
       
   228       $regex = str_replace("(?: (?R) | .*? )*", "(?: .*? )", $regex);
       
   229     }
   222     if ( preg_match_all($regex, $text, $matches) )
   230     if ( preg_match_all($regex, $text, $matches) )
   223     {
   231     {
   224       foreach ( $matches[0] as $i => $match )
   232       foreach ( $matches[0] as $i => $match )
   225       {
   233       {
   226         $text = str_replace_once($match, "{_pb_:$rand_id:$i}", $text);
   234         $text = str_replace_once($match, "{_pb_:$rand_id:$i}", $text);
   232     {
   240     {
   233       $text = str_replace_once("{_pb_:$rand_id:$i}", $match, $text);
   241       $text = str_replace_once("{_pb_:$rand_id:$i}", $match, $text);
   234     }
   242     }
   235     
   243     
   236     // die('<pre>' . htmlspecialchars($text) . '</pre>');
   244     // die('<pre>' . htmlspecialchars($text) . '</pre>');
   237     
   245 	
   238     RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw, true);
   246     RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw, true);
   239     
   247     
   240     // This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags
   248     // This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags
   241     // to prevent the paragraph parser from interfering with pretty HTML generated elsewhere.
   249     // to prevent the paragraph parser from interfering with pretty HTML generated elsewhere.
   242     RenderMan::tag_strip('_paragraph_bypass', $text, $_nw);
   250     RenderMan::tag_strip('_paragraph_bypass', $text, $_nw);