Открыть: theme/frontend/nebula/template/template.html.php, найти:
</body>
</html>
{/if}
Выше добавить:
<script type="text/javascript">
hljs.initHighlightingOnLoad();
</script>
Открыть: include/library/phpfox/phpfox/phpfox.class.php, найти:
if (Phpfox::isModule('friend'))
{
$oTpl->setPhrase(array('friend.show_more_results_for_search_term'));
}
Выше добавить:
if (Phpfox::isModule('forum') | Phpfox::isModule('blog'))
{
$oTpl->setHeader('cache', array(
'code.css' => 'style_css',
'highlight.pack.js' => 'static_script'
)
);
}
Открыть: include/library/phpfox/parse/bbcode.class.php, найти:
$sTxt = '<div class="quote">' . ($bNoTitle ? '' : '<div class="quote_title">' . trim($sTitle) . ':</div>') . '<div class="quote_body" style="overflow:auto;' . ($this->_aBlockHeight[$sTxt] >= 540 ? ' height:' . $this->_aBlockHeight[$sTxt] . 'px;' : '') . '">' . $sPrefix . $sNewTxt . $sSuffix . '</div></div>';
Заменить на:
$sTxt = '<div class="quote"><div class="quote_title">' . trim($sTitle) . ':</div><div class="quote_body" style="overflow: auto; max-height: 180px;"><pre><code>' . $sNewTxt . '</code></pre></div></div>';
Найти и удалить или закомментировать:
$sPrefix = '';
$sSuffix = '';
if ($sType != 'php')
{
$sPrefix = '<pre>';
$sSuffix = '</pre>';
}
Удалить или закомментировать:
$sNewTxt = preg_replace('#<((?>[^&"\']+?|".*"|&(?!gt;)|"[^"]*"|\'[^\']*\')+)>#esiU', "\$this->_htmlTags('\\1')", $sNewTxt);
В этом же файле удалить или закомментировать две функции: _htmlTags и _getHtmlColors.
Функция _htmlTags:
/**
* Handles an individual HTML tag in a [html] tag.
*
* @param string The body of the tag.
* @return string Syntax highlighted, displayable HTML tag.
*/
private function _htmlTags($sTag)
{
static $aHtmlColors = array();
if (!$aHtmlColors)
{
$aHtmlColors = $this->_getHtmlColors();
}
// change any embedded URLs so they don't cause any problems
$sTag = preg_replace('#\[(email|url)="(.*)"\]#siU', '[$1="$2"]', $sTag);
// find if the tag has attributes
$iSpacepos = strpos($sTag, ' ');
if ($iSpacepos != false)
{
// tag has attributes - get the tag name and parse the attributes
$sTagname = substr($sTag, 0, $iSpacepos);
$sTag = preg_replace('# (\w+)="(.*)"#siU', ' \1=<span style="color:' . $aHtmlColors['attribs'] . '">"\2"</span>', $sTag);
}
else
{
// no attributes found
$sTagname = $sTag;
}
// remove leading slash if there is one
if ($sTag{0} == '/')
{
$sTagname = substr($sTagname, 1);
}
// convert tag name to lower case
$sTagname = strtolower($sTagname);
// get highlight colour based on tag type
switch($sTagname)
{
// table tags
case 'table':
case 'tr':
case 'td':
case 'th':
case 'tbody':
case 'thead':
$sTagcolor = $aHtmlColors['table'];
break;
// form tags
//NOTE: Supposed to be a semi colon here ?
case 'form';
case 'input':
case 'select':
case 'option':
case 'textarea':
case 'label':
case 'fieldset':
case 'legend':
$sTagcolor = $aHtmlColors['form'];
break;
// script tags
case 'script':
$sTagcolor = $aHtmlColors['script'];
break;
// style tags
case 'style':
$sTagcolor = $aHtmlColors['style'];
break;
// anchor tags
case 'a':
$sTagcolor = $aHtmlColors['a'];
break;
// img tags
case 'img':
$sTagcolor = $aHtmlColors['img'];
break;
// all other tags
default:
$sTagcolor = $aHtmlColors['default'];
break;
}
$sTag = '<span style="color:' . $sTagcolor . '"><' . str_replace('\\"', '"', $sTag) . '></span>';
return $sTag;
}
Функция _getHtmlColors:
/**
* Color code.
*
* @return array array of type (key) to color (value)
*/
private function _getHtmlColors()
{
return array(
'attribs' => '#0000FF',
'table' => '#008080',
'form' => '#FF8000',
'script' => '#800000',
'style' => '#800080',
'a' => '#008000',
'img' => '#800080',
'if' => '#FF0000',
'default' => '#000080'
);
}
Залить файл highlight.pack.js в папку: static/jscript/.
Файл code.css (стиль подсветки) в папку: theme/frontend/default/style/default/css/.
Почистить кэш. Готово.