'); add_to_footer(''); $text = preg_replace_callback( "#\[code(=(?P.*?))?\](?P.*?)\[/code\]#si", function ($m) use (&$i) { global $pid; $data = []; add_to_head(''); add_to_footer(''); if (isset($_GET['thread_id'])) { if (preg_match("/\/forum\//i", FUSION_REQUEST)) { $result = dbquery("SELECT p.post_id, t.thread_id FROM ".DB_FORUM_POSTS." p INNER JOIN ".DB_FORUM_THREADS." t ON t.thread_id = p.thread_id WHERE p.thread_id='".intval($_GET['thread_id'])."' AND p.post_id ='".intval($pid)."' AND post_hidden='0' "); $data = dbarray($result); } } $locale = fusion_get_locale(); if (preg_match("/\/forum\//i", FUSION_REQUEST) && isset($_GET['thread_id']) && (isset($data['post_id']) && isnum($data['post_id'])) ) { // this one rely on global. $code_save = ' '.$locale['bb_code_save'].'  '; } else { $code_save = ''; } $i++; $html = '
'; $html .= '
'.$locale['bb_code_code'].''.$code_save.'
'; $lang = !empty($m['lang']) ? $m['lang'] : 'php'; $html .= '
'.formatcode($m['code']).'
'; $html .= '
'; return $html; }, $text ); /* * Adds a rule to ```` (markdown) to translate to */ $mcode_count = substr_count($text, "````"); // obtained if ($mcode_count) { for ($i = 0; $i < $mcode_count; $i++) { $text = preg_replace_callback( "#````(.*?)````#si", function ($m) use (&$i) { return "
".formatcode($m['1'])."
"; }, $text); } } $text = preg_replace("#\[php\](.*?)\[/php\]#si", "
".formatcode('\\1')."
", $text); $text = preg_replace("#\[geshi=(.*?)\](.*?)\[/geshi\]#si", "
".formatcode('\\2')."
", $text); }