/** * Return the rendered inline version of the Horde_Mime_Part object. * * @return array See parent::render(). */ protected function _renderInline() { /* Determine the language and brush from the mime type. */ $mimeType = $this->_mimepart->getType(); $language = $this->_mimeTypeToLanguage($mimeType); $brush = $this->_languageToBrush($language); $page_output = $GLOBALS['injector']->getInstance('Horde_PageOutput'); if (!self::$_shLoaded) { $page_output->addScriptFile('syntaxhighlighter/scripts/syntaxhighlighter.js', 'horde'); self::$_shLoaded = true; $sh_js_fs = $this->getConfigParam('registry')->get('jsfs', 'horde') . '/syntaxhighlighter/styles/'; $sh_js_uri = Horde::url($this->getConfigParam('registry')->get('jsuri', 'horde'), false, -1) . '/syntaxhighlighter/styles/'; $page_output->addStylesheet($sh_js_fs . 'theme.css', $sh_js_uri . 'theme.css'); } $results = '<pre class="brush: ' . $language . '; toolbar: false;">' . htmlspecialchars(Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset(), $this->getConfigParam('charset')), ENT_QUOTES, $this->getConfigParam('charset')) . '</pre>'; return $this->_renderReturn($results, 'text/html; charset=' . $this->getConfigParam('charset')); }
public function __construct(Horde_Mime_Part $part, array $conf = array()) { parent::__construct($part, $conf); $GLOBALS['page_output']->addScriptfile('syntaxhighlighter.js'); }