From 18bf23af605ac00d2bd89e622e87fb922dda9af7 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sat, 2 Oct 2010 18:38:15 -0400 Subject: [PATCH] delete files to rename by case --- .../Horde/Core/Mime/Viewer/SyntaxHighlighter.php | 59 ------ .../lib/Horde/Mime/Viewer/SyntaxHighlighter.php | 199 --------------------- 2 files changed, 258 deletions(-) delete mode 100644 framework/Core/lib/Horde/Core/Mime/Viewer/SyntaxHighlighter.php delete mode 100644 framework/Mime_Viewer/lib/Horde/Mime/Viewer/SyntaxHighlighter.php diff --git a/framework/Core/lib/Horde/Core/Mime/Viewer/SyntaxHighlighter.php b/framework/Core/lib/Horde/Core/Mime/Viewer/SyntaxHighlighter.php deleted file mode 100644 index e29089936..000000000 --- a/framework/Core/lib/Horde/Core/Mime/Viewer/SyntaxHighlighter.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @package Mime_Viewer - */ -class Horde_Core_Mime_Viewer_Syntaxhighlighter extends Horde_Mime_Viewer_Syntaxhighlighter -{ - protected static $_shLoaded = false; - protected static $_shBrushes = array(); - - /** - * 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); - - if (!self::$_shLoaded) { - Horde::addScriptFile('syntaxhighlighter/scripts/shCore.js', 'horde', true); - Horde::addInlineScript(array( - 'SyntaxHighlighter.defaults[\'toolbar\'] = false', - 'SyntaxHighlighter.all()', - ), 'dom'); - 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/'; - Horde_Themes::includeStylesheetFiles(array('additional' => array( - array('f' => $sh_js_fs . 'shCoreEclipse.css', 'u' => $sh_js_uri . 'shCoreEclipse.css'), - array('f' => $sh_js_fs . 'shThemeEclipse.css', 'u' => $sh_js_uri . 'shThemeEclipse.css'), - ))); - } - if (empty(self::$_shBrushes[$brush])) { - Horde::addScriptFile('syntaxhighlighter/scripts/shBrush' . $brush . '.js', 'horde', true); - self::$_shBrushes[$brush] = true; - } - - $results = '
' . htmlspecialchars($this->_mimepart->getContents(), ENT_QUOTES, $this->getConfigParam('charset')) . '
'; - return $this->_renderReturn( - $results, - 'text/html; charset=' . $this->getConfigParam('charset') - ); - } -} diff --git a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/SyntaxHighlighter.php b/framework/Mime_Viewer/lib/Horde/Mime/Viewer/SyntaxHighlighter.php deleted file mode 100644 index 6a75dc305..000000000 --- a/framework/Mime_Viewer/lib/Horde/Mime/Viewer/SyntaxHighlighter.php +++ /dev/null @@ -1,199 +0,0 @@ - - * @category Horde - * @license http://www.fsf.org/copyleft/lgpl.html LGPL - * @package Mime_Viewer - */ -class Horde_Mime_Viewer_Syntaxhighlighter extends Horde_Mime_Viewer_Base -{ - /** - * This driver's display capabilities. - * - * @var array - */ - protected $_capability = array( - 'full' => true, - 'info' => false, - 'inline' => true, - 'raw' => false, - ); - - /** - * Return the full rendered version of the Horde_Mime_Part object. - * - * @return array See parent::render(). - */ - protected function _render() - { - return $this->_renderFullReturn($this->_renderInline()); - } - - /** - * 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); - - $results = '
' . htmlspecialchars($this->_mimepart->getContents(), ENT_QUOTES, $this->getConfigParam('charset')) . '
'; - return $this->_renderReturn( - $results, - 'text/html; charset=' . $this->getConfigParam('charset') - ); - } - - protected function _getLanguageOptions($language) - { - if ($language == 'php') { - return 'html-script: true'; - } - } - - /** - * Attempts to determine what mode to use for the source-highlight - * program from a MIME type. - * - * @param string $type The MIME type. - * - * @return string The mode to use. - */ - protected function _mimeTypeToLanguage($type) - { - $type = str_replace('x-unknown', 'x-extension', $type); - - switch ($type) { - case 'application/x-javascript': - case 'x-extension/javascript': - case 'x-extension/js': - return 'js'; - - case 'application/x-perl': - case 'x-extension/pl': - return 'perl'; - - case 'application/x-php': - case 'x-extension/php': - case 'x-extension/phps': - case 'x-extension/php3s': - case 'application/x-httpd-php': - case 'application/x-httpd-php3': - case 'application/x-httpd-phps': - return 'php'; - - case 'application/x-python': - return 'python'; - - case 'application/x-ruby': - return 'ruby'; - - case 'application/x-sh': - case 'application/x-shellscript': - case 'x-extension/bash': - case 'x-extension/sh': - return 'bash'; - - case 'application/xml': - case 'text/xml': - case 'text/xslt': - case 'text/html': - case 'text/xhtml': - case 'application/xhtml': - return 'xml'; - - case 'text/css': - case 'x-extension/css': - return 'css'; - - case 'text/diff': - case 'text/x-diff': - case 'text/x-patch': - return 'diff'; - - case 'text/cpp': - case 'text/x-c++': - case 'text/x-c++src': - case 'text/x-c++hdr': - case 'text/x-c': - case 'text/x-chdr': - case 'text/x-csrc': - return 'cpp'; - - case 'text/x-java': - return 'java'; - - case 'text/x-pascal': - return 'pascal'; - - case 'text/x-sql': - return 'sql'; - - case 'x-extension/bat': - return 'batch'; - - case 'x-extension/cs': - return 'csharp'; - - case 'x-extension/vb': - case 'x-extension/vba': - return 'vb'; - - default: - return 'plain'; - } - } - - protected function _languageToBrush($language) - { - switch ($language) { - case 'php': - return 'Php'; - - case 'xml': - case 'html': - case 'xhtml': - case 'xslt': - return 'Xml'; - - case 'bash': - case 'shell': - return 'Bash'; - - case 'diff': - case 'patch': - case 'pas': - return 'Diff'; - - case 'css': - return 'Css'; - - case 'c': - case 'cpp': - return 'Cpp'; - - case 'java': - return 'Java'; - - case 'js': - case 'jscript': - case 'javascript': - return 'JScript'; - - default: - return 'Plain'; - } - } -} -- 2.11.0