Guest User

bbPress backtick patch

a guest
Jun 7th, 2010
172
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function bb_decodeit( $matches ) {
  2.     $text = $matches[2];
  3.     $trans_table = array_flip(get_html_translation_table(HTML_ENTITIES));
  4.     $text = strtr($text, $trans_table);
  5.     $text = str_replace('<br />', '<coded_br />', $text);
  6.     $text = str_replace('<p>', '<coded_p>', $text);
  7.     $text = str_replace('</p>', '</coded_p>', $text);
  8.     $text = str_replace(array('&#38;','&amp;'), '&', $text);
  9.     $text = str_replace('&#39;', "'", $text);
  10.     if ( '<pre><code>' == $matches[1] )
  11.         $text = "\n$text\n";
  12.     //return "`$text`";
  13.     return "<code>$text</code>";
  14. }
  15.  
  16. function bb_code_trick( $text ) {
  17.     $text = str_replace(array("\r\n", "\r"), "\n", $text);
  18.     //$text = preg_replace_callback("|(`)(.*?)`|", 'bb_encodeit', $text);
  19.     //$text = preg_replace_callback("!(^|\n)`(.*?)`!s", 'bb_encodeit', $text);
  20.     return $text;
  21. }
RAW Paste Data