MTrack/Wiki.php
authorAlan Knowles <alan@akbkhome.com>
Sun, 7 Aug 2011 14:06:58 +0000 (22:06 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sun, 7 Aug 2011 14:06:58 +0000 (22:06 +0800)
MTrack/Wiki.php [deleted file]

diff --git a/MTrack/Wiki.php b/MTrack/Wiki.php
deleted file mode 100644 (file)
index 6afe33b..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-require_once 'Wiki/Parser.php';
-require_once 'Wiki/HTMLFormatter.php';
-require_once 'Wiki/OneLinerFormatter.php';
-require_once 'Wiki/Item.php';
-
-
-
-
-
-class MTrack_Wiki {
-  static $macros = array();
-  static $processors = array();
-
-  static function format_to_html($text) {
-    $f = new MTrack_Wiki_HTMLFormatter;
-    $f->format($text);
-    $html = $f->out;
-    if (false) { /* saveHTML messes with the encoding */
-      /* tidy it up */
-      @$d = DOMDocument::loadHTML($html);
-      if ($d) {
-        $d->formatOutput = true;
-        $d->substituteEntities = false;
-        $html = $d->saveHTML();
-        $html = preg_replace("/^.*<body>/sm", '', $html);
-        $html = preg_replace(",</body>.*,sm", '', $html);
-      }
-    }
-    return $html;
-  }
-
-  static function format_to_oneliner($text) {
-    $f = new MTrack_Wiki_OneLinerFormatter;
-    $f->format($text);
-    return $f->out;
-  }
-  static function format_wiki_page($name) {
-    $d = new MTrack_Wiki_Item($name);
-    if ($d->file) {
-      return self::format_to_html($d->content);
-    }
-    return null;
-  }
-
-  static function register_macro($name, $callback) {
-    self::$macros[$name] = $callback;
-  }
-
-  static function register_processor($name, $callback) {
-    self::$processors[$name] = $callback;
-  }
-
-  static function macro_IncludeWiki($pagename) {
-    return self::format_wiki_page($pagename);
-  }
-  static function macro_IncludeHelp($pagename) {
-    return self::format_to_html(file_get_contents(
-      dirname(__FILE__) . '/../defaults/help/' . basename($pagename)));
-  }
-  static function macro_comment() {
-    return '';
-  }
-  static function processor_comment($name, $content) {
-    return '';
-  }
-  static function processor_html($name, $content) {
-    return join("\n", $content);
-  }
-  static function processor_dataset($name, $content) {
-    $res = '<table class="report wiki dataset">';
-    while (count($content)) {
-      $row = array_shift($content);
-      $next_row = array_shift($content);
-      $cols = preg_split("/\s*\|\s*/", $row);
-      if ($next_row[0] == '-') {
-        // it's a header
-        $res .= '<thead><tr>';
-        foreach ($cols as $c) {
-          $res .= "<th>" . htmlentities($c, ENT_QUOTES, 'utf-8') . "</th>\n";
-        }
-        $res .= "</tr></thead><tbody>";
-      } else {
-        if (is_string($next_row)) {
-          array_unshift($content, $next_row);
-        }
-        // regular row
-        $res .= "<tr>";
-        foreach ($cols as $c) {
-          $res .= "<td>" . htmlentities($c, ENT_QUOTES, 'utf-8') . "</td>\n";
-        }
-        $res .= "</tr>\n";
-      }
-    }
-    $res .= "</tbody></table>\n";
-    return $res;
-  }
-}
\ No newline at end of file