Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/11/2011, 20:56
iovan
 
Fecha de Ingreso: septiembre-2007
Ubicación: PyRoot
Mensajes: 1.515
Antigüedad: 16 años, 7 meses
Puntos: 188
Respuesta: Advanced Syntax Highlighting - BBCode [highlight] PARA VBULLETIN

En fin, no encontré la respuesta pero seguramente es porque los creadores y administradores del foro (forosdelweb => vbulletin) u otros usuarios con foros vbulletin no han visto mi pregunta por que seguro que ellos si saben como solucionar este problemita.

Yo opté por un camino corto y lo que hice fue modificar el XML de instalación (Antes de importarlo)

se ve como esto:

>>> product-advhighlight.xml
Código XML:
Ver original
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3. <product productid="advhighlight" title="Advanced Syntax Highlighting" description="This Hacks allows you to use advanced Sysntax Hightlighting for Several Languages" version="1.0.0" active="1">
  4.     <codes>
  5.     </codes>
  6.     <templates>
  7.         <template name="bbcode_highlight" templatetype="template" date="1122565653" username="Kirby" version="3.5.0 Release Candidate 1"><![CDATA[<div style="margin:20px; margin-top:5px">
  8.     <div class="smallfont" style="margin-bottom:2px">$type $vbphrase[code]:</div>
  9.     <pre class="alt2" style="margin:0px; background-color:#E5E5E5; padding:10px; border:1px inset; width:$stylevar[codeblockwidth]; height:auto; overflow:auto"><div dir="ltr" style="text-align:left;">$code</div></pre>
  10. </div>]]></template>
  11.         <template name="bbcode_highlight_printthread" templatetype="template" date="1122567141" username="Kirby" version="3.5.0 Release Candidate 1"><![CDATA[<div style="margin:20px; margin-top:5px">
  12.     <div class="smallfont" style="margin-bottom:2px">$type $vbphrase[code]:</div>
  13.     <hr /><pre class="alt2" style="margin:0px"><div dir="ltr" style="text-align:left;">$code</div></pre><hr />
  14. </div>]]></template>
  15.     </templates>
  16.     <plugins>
  17.         <plugin active="1">
  18.             <title>Advanced Syntax Highlighting</title>
  19.             <hookname>bbcode_create</hookname>
  20.             <phpcode><![CDATA[if (!function_exists('handle_bbcode_highlight'))
  21. {
  22.     function handle_bbcode_highlight(&$parser, $code, $type)
  23.     {
  24.         global $vbulletin, $vbphrase, $stylevar, $show;
  25.         static $codefind1, $codereplace1, $codefind2, $codereplace2;
  26.  
  27.         $code = $parser->strip_front_back_whitespace($code, 1);
  28.  
  29.         if (!is_array($codefind))
  30.         {
  31.             $codefind1 = array(
  32.                 '<br>',     // <br> to nothing
  33.                 '<br />'    // <br /> to nothing
  34.             );
  35.             $codereplace1 = array(
  36.                 '',
  37.                 ''
  38.             );
  39.  
  40.             $codefind2 = array(
  41.                 '&gt;',     // &gt; to >
  42.                 '&lt;',     // &lt; to <
  43.                 '&quot;',   // &quot; to ",
  44.                 '&amp;',    // &amp; to &
  45.                 '[',    // [ to [
  46.                 ']',    // ] to ]
  47.             );
  48.             $codereplace2 = array(
  49.                 '>',
  50.                 '<',
  51.                 '"',
  52.                 '&',
  53.                 '[',
  54.                 ']',
  55.             );
  56.         }
  57.  
  58.         // remove htmlspecialchars'd bits and excess spacing
  59.         $code = trim(str_replace($codefind1, $codereplace1, $code));
  60.         $blockheight = $parser->fetch_block_height($code) + 18; // fetch height of block element
  61.         $code = str_replace($codefind2, $codereplace2, $code); // finish replacements
  62.  
  63.         // PARSE
  64.         $path = DIR . '/includes/geshi';
  65.         // $code = geshi_highlight($code, $type, $path, true);
  66.         $geshi = new GeSHi($code, $type, $path);
  67.         $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
  68.         $tabs = 4;
  69.         $geshi->set_header_type(GESHI_HEADER_DIV);
  70.         $geshi->set_tab_width($tabs);
  71.         $code = $geshi->parse_code();
  72.  
  73.         $code = preg_replace('/&amp;#([0-9]+);/', '&#$1;', $code); // allow unicode entities back through
  74.         $code = str_replace(array('[', ']', "\n"), array('[', ']', ''), $code);
  75.         $template = $parser->printthread ? 'bbcode_highlight_printthread' : 'bbcode_highlight';
  76.         eval('$html = "' . fetch_template($template) . '";');
  77.         return $html;
  78.     }
  79. }
  80. $this->tag_list['option']['highlight'] = array(
  81.     'callback' => 'handle_external',
  82.     'strip_empty' => true,
  83.     'stop_parse' => true,
  84.     'disable_smilies' => true,
  85.     'disable_wordwrap' => true,
  86.     'strip_space_after' => 1,
  87.     'external_callback' => 'handle_bbcode_highlight'
  88. );
  89. require_once(DIR . '/includes/geshi.php');]]></phpcode>
  90.         </plugin>
  91.         <plugin active="1">
  92.             <title>Advanced Syntax Highlighting</title>
  93.             <hookname>cache_templates</hookname>
  94.             <phpcode><![CDATA[if (THIS_SCRIPT != 'printthread')
  95. {
  96.     $globaltemplates = array_merge($globaltemplates, array('bbcode_highlight'));
  97. }
  98. else
  99. {
  100.     $globaltemplates = array_merge($globaltemplates, array('bbcode_highlight_printthread'));
  101. }]]></phpcode>
  102.         </plugin>
  103.     </plugins>
  104.     <phrases>
  105.     </phrases>
  106.     <options>
  107.     </options>
  108. </product>

Solo modifica la linea 9, dejandola como yo lo hice.

Cambie las propiedades de Style de la etiqueta <pre; de la siguiente manera:

padding:10px;
height:auto;

Es todo.


Esto no es la solución adecuada, y no estoy seguro que sea correcta pero, de cierta manera, funcionará bien.
Saludos
__________________
Si quieres agradecer el triangulo obscuro de la parte derecha debes presionar +.