From: Michael M Slusarz Date: Wed, 12 Nov 2008 04:36:17 +0000 (-0700) Subject: Update source Viewer. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2999b2b920f52d44873f6156ae33e68c7ee0a1eb;p=horde.git Update source Viewer. --- diff --git a/framework/Mime/lib/Horde/Mime/Viewer/source.php b/framework/Mime/lib/Horde/Mime/Viewer/source.php index cbd163976..553640bdd 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/source.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/source.php @@ -17,24 +17,15 @@ class Horde_Mime_Viewer_source extends Horde_Mime_Viewer_Driver * Add line numbers to a block of code. * * @param string $code The code to number. - */ - public function lineNumber($code, $linebreak = "\n") - { - $lines = substr_count($code, $linebreak) + 1; - $html = '
'; - for ($l = 1; $l <= $lines; $l++) { - $html .= sprintf('%s
', $l, $l, $l) . "\n"; - } - return $html . '
' . $code . '
'; - } - - /** - * Return the MIME content type of the rendered content. * - * @return string The content type of the output. + * @return string The code with line numbers added. */ - public function getType() + protected function _lineNumber($code, $linebreak = "\n") { - return 'text/html; charset=' . NLS::getCharset(); + $html = array('
'); + for ($l = 1, $lines = substr_count($code, $linebreak) + 1; $l <= $lines; ++$l) { + $html[] = sprintf('%s
', $l, $l, $l); + } + return implode("\n", $html) . '
' . $code . '
'; } }