MyBB Community Forums

Full Version: [pawn] tag
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello myBB users,
I need [pawn] tag into my forum.

I've found [pawn] tag code, but it's for SMF and anyone can convert to myBB?

That is [pawn] tag of SMF:
         array(
            'tag' => 'pawn',
            'type' => 'unparsed_content',
            'content' => '<div class="codeheader">' . $txt['pawn'] . ':</div><div class="code">' . ($context['browser']['is_gecko'] ? '<pre style="margin-top: 0; display: inline;">$1</pre>' : '$1') . '</div>',
            'validate' => create_function('&$tag, &$data, $disabled', '
                global $context;

               if (!isset($disabled[\'pawn\']))
               {
               
               $data = str_replace(
               array(
                  \'public\',
                  \'return\',
                  \'sizeof\',
                  \'switch\',
                  \'true\',
                  \'false\',
                  \'if\',
                  \'new\',
                  \'else\',
                  \'for(\',
                  \'while\',
                  \'(\',
                  \')\',
                  \'[\',
                  \']\',
                  \'{\',
                  \'}\',
                  \''\'
               ),
               array(
                  \'<span style="color: blue;">public</span>\',
                  \'<span style="color: blue;">return</span>\',
                  \'<span style="color: blue;">sizeof</span>\',
                  \'<span style="color: blue;">switch</span>\',
                  \'<span style="color: blue;">true</span>\',
                  \'<span style="color: blue;">false</span>\',
                  \'<span style="color: blue;">if</span>\',
                  \'<span style="color: blue;">new</span>\',
                  \'<span style="color: blue;">else</span>\',
                  \'<span style="color: blue;">for</span>(\',
                  \'<span style="color: blue;">while</span>\',
                  \'<span style="color: red;">(</span>\',
                  \'<span style="color: red;">)</span>\',
                  \'<span style="color: red;">[</span>\',
                  \'<span style="color: red;">]</span>\',
                  \'<span style="color: red;">{</span>\',
                  \'<span style="color: red;">}</span>\',
                  \'|||\'
               ), $data);
                 
                $data = preg_replace(
                  array(
                     \'~#(.+?)\<br \/>~is\',
                     \'~\/\/(.+?)\<br \/\>~i\',
                     \'~\/\*(.+?)\*\/~i\'
                  ),
                  array(
                     \'<span style="color: blue;">#$1<br /></span>\',                       
                     \'<span style="color: green;">//$1<br /></span>\',
                     \'<span style="color: green;">/*$1*/</span>\'
                   ), $data);               
                   $data = str_replace(\'|||\', \''\', $data);

                  // Older browsers are annoying, aren\'t they?
                  if ($context[\'browser\'][\'is_ie4\'] || $context[\'browser\'][\'is_ie5\'] || $context[\'browser\'][\'is_ie5.5\'])
                     $data = str_replace("\t", "<pre style=\"display: inline;\">\t</pre>", $data);
                  elseif (!$context[\'browser\'][\'is_gecko\'])
                     $data = str_replace("\t", "<span style=\"white-space: pre;\">\t</span>", $data);
               }'),
            'block_level' => true,
         ),

Thanks,
Typhome.