aboutsummaryrefslogtreecommitdiff
path: root/src/Phorkie/File.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-03-26 22:37:04 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-03-26 22:37:04 +0200
commit089fcac67ae3c3e83e2c330498d211e6b7693534 (patch)
tree721eccb6f16d7bc089f23c4e38d605d475310d2b /src/Phorkie/File.php
parente3757ad55ac7f161d4de11e38fb57166a8ee85f7 (diff)
downloadphorkie-089fcac67ae3c3e83e2c330498d211e6b7693534.tar.gz
phorkie-089fcac67ae3c3e83e2c330498d211e6b7693534.zip
syntax highlighting with geshi
Diffstat (limited to 'src/Phorkie/File.php')
-rw-r--r--src/Phorkie/File.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Phorkie/File.php b/src/Phorkie/File.php
index 14a7bbf..6e71de3 100644
--- a/src/Phorkie/File.php
+++ b/src/Phorkie/File.php
@@ -57,6 +57,19 @@ class File
return file_get_contents($this->path);
}
+ public function getHighlightedContent()
+ {
+ /**
+ * Yes, geshi needs to be in your include path
+ * We use the mediawiki geshi extension package.
+ */
+ require 'MediaWiki/geshi/geshi/geshi.php';
+ $geshi = new \GeSHi($this->getContent(), $this->getType());
+ $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
+ $geshi->set_header_type(GESHI_HEADER_DIV);
+ return $geshi->parse_code();
+ }
+
public function getMimeType()
{
$type = $this->getType();