include geshi only once
[phorkie.git] / src / Phorkie / File.php
index bf2eb601d40b7d34d8c06a23dc0f18d7335aa8b4..44970ed9ffd681e7a5aa2c16f5af2f92de189bb0 100644 (file)
@@ -42,7 +42,7 @@ class File
         'html' => 'xml',
     );
 
-    public function __construct($path, Repository $repo)
+    public function __construct($path, Repository $repo = null)
     {
         $this->path = $path;
         $this->repo = $repo;
@@ -58,6 +58,16 @@ class File
         return basename($this->path);
     }
 
+    /**
+     * Return the full path to the file
+     *
+     * @return string
+     */
+    public function getPath()
+    {
+        return $this->path;
+    }
+
     /**
      * Get file extension without dot
      *
@@ -94,7 +104,7 @@ class File
          * Yes, geshi needs to be in your include path
          * We use the mediawiki geshi extension package.
          */
-        require 'MediaWiki/geshi/geshi/geshi.php';
+        require_once '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);