All pastes #2075545 Raw Edit

Stuff

public php v1 · immutable
#2075545 ·published 2011-06-06 12:55 UTC
rendered paste body
function WakabaMark($string){    $patterns = array(    '`\\\\\\\\`',    '`\\\\\*`',    '`\\\\_`',    '`\\\\\:`',    '`\\\\\^`',    '`\\\\\#`',    '`\\\\\%`',    '`\*\*(.+?)\*\*`is',     '`\*(.+?)\*`is',    '`\:\:(.+?)\:\:`is',     '`\^\^(.+?)\^\^`is',     '`\#\#(.+?)\#\#`is',     '`\%\%(.+?)\%\%`is',     '`\_\_(.+?)\_\_`is',     '`\_(.+?)\_`is', );$replaces =  array(    '&#92;',    '&#42;',    '&#95;',    '&#58;',    '&#94;',    '&#35;',    '&#37;',    "<b>\\1</b>",     "<span style=\"border-bottom: 1px solid\">\\1</span>",     "<i>\\1</i>",     "<strike>\\1</strike>",    "<span style='font-family: \"Segoe Script Typeface\";'>\\1</span>",     "<span class='spoiler' onmouseover='this.style.color=\"green\";' onmouseout='this.style.color=\"gray\"'>\\1</span>",    "<b>\\1</b>",     "<i>\\1</i>");  $link_app = stripos($string, "://");  $space_app = 0;  if ($link_app != false) {  $space_app = strpos(substr($string, $link_app, strlen($string)), " ");    if ($space_app != false) {    $space_app = $link_app + $space_app;  } else {    $space_app = strlen($string);  }  }  $before = substr($string, 0, $link_app);  $middle = substr($string, $link_app, $space_app-$link_app);  $after = substr($string, $space_app);  $before = preg_replace($patterns, $replaces , $before);  $after = preg_replace($patterns, $replaces , $after);  $string = $before.$middle.$after;$string = preg_replace_callback('`\@\@(.+?)\@\@`is', array(&$this, 'code_callback'), $string);return $string;}