First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
authorDan
Sun, 21 Jun 2009 00:20:32 -0400
changeset 1027 98c052fc3337
parent 1026 f0431eb8161e
child 1028 dde4416dea00
First implementation of new parser; Text_Wiki is now gone. VERY BETA! WiP.
includes/constants.php
includes/functions.php
includes/pageprocess.php
includes/render.php
includes/wikiengine/Default.php
includes/wikiengine/Mediawiki.php
includes/wikiengine/Parse.php
includes/wikiengine/Parse/Default/Anchor.php
includes/wikiengine/Parse/Default/Blockquote.php
includes/wikiengine/Parse/Default/Bold.php
includes/wikiengine/Parse/Default/Break.php
includes/wikiengine/Parse/Default/Center.php
includes/wikiengine/Parse/Default/Code.php
includes/wikiengine/Parse/Default/Colortext.php
includes/wikiengine/Parse/Default/Deflist.php
includes/wikiengine/Parse/Default/Delimiter.php
includes/wikiengine/Parse/Default/Embed.php
includes/wikiengine/Parse/Default/Emphasis.php
includes/wikiengine/Parse/Default/Freelink.php
includes/wikiengine/Parse/Default/Function.php
includes/wikiengine/Parse/Default/Heading.php
includes/wikiengine/Parse/Default/Horiz.php
includes/wikiengine/Parse/Default/Html.php
includes/wikiengine/Parse/Default/Image.php
includes/wikiengine/Parse/Default/Include.php
includes/wikiengine/Parse/Default/Interwiki.php
includes/wikiengine/Parse/Default/Italic.php
includes/wikiengine/Parse/Default/List.php
includes/wikiengine/Parse/Default/Newline.php
includes/wikiengine/Parse/Default/Paragraph.php
includes/wikiengine/Parse/Default/Phplookup.php
includes/wikiengine/Parse/Default/Prefilter.php
includes/wikiengine/Parse/Default/Raw.php
includes/wikiengine/Parse/Default/Revise.php
includes/wikiengine/Parse/Default/Smiley.php
includes/wikiengine/Parse/Default/Strong.php
includes/wikiengine/Parse/Default/Subscript.php
includes/wikiengine/Parse/Default/Superscript.php
includes/wikiengine/Parse/Default/Table.php
includes/wikiengine/Parse/Default/Tighten.php
includes/wikiengine/Parse/Default/Toc.php
includes/wikiengine/Parse/Default/Tt.php
includes/wikiengine/Parse/Default/Underline.php
includes/wikiengine/Parse/Default/Url.php
includes/wikiengine/Parse/Default/Wikilink.php
includes/wikiengine/Parse/Mediawiki/Anchor.php
includes/wikiengine/Parse/Mediawiki/Blockquote.php
includes/wikiengine/Parse/Mediawiki/Bold.php
includes/wikiengine/Parse/Mediawiki/Break.php
includes/wikiengine/Parse/Mediawiki/Center.php
includes/wikiengine/Parse/Mediawiki/Code.php
includes/wikiengine/Parse/Mediawiki/Colortext.php
includes/wikiengine/Parse/Mediawiki/Deflist.php
includes/wikiengine/Parse/Mediawiki/Delimiter.php
includes/wikiengine/Parse/Mediawiki/Embed.php
includes/wikiengine/Parse/Mediawiki/Emphasis.php
includes/wikiengine/Parse/Mediawiki/Freelink.php
includes/wikiengine/Parse/Mediawiki/Function.php
includes/wikiengine/Parse/Mediawiki/Heading.php
includes/wikiengine/Parse/Mediawiki/Horiz.php
includes/wikiengine/Parse/Mediawiki/Html.php
includes/wikiengine/Parse/Mediawiki/Image.php
includes/wikiengine/Parse/Mediawiki/Include.php
includes/wikiengine/Parse/Mediawiki/Interwiki.php
includes/wikiengine/Parse/Mediawiki/Italic.php
includes/wikiengine/Parse/Mediawiki/List.php
includes/wikiengine/Parse/Mediawiki/Newline.php
includes/wikiengine/Parse/Mediawiki/Paragraph.php
includes/wikiengine/Parse/Mediawiki/Phplookup.php
includes/wikiengine/Parse/Mediawiki/Prefilter.php
includes/wikiengine/Parse/Mediawiki/Raw.php
includes/wikiengine/Parse/Mediawiki/Revise.php
includes/wikiengine/Parse/Mediawiki/Smiley.php
includes/wikiengine/Parse/Mediawiki/Strong.php
includes/wikiengine/Parse/Mediawiki/Subscript.php
includes/wikiengine/Parse/Mediawiki/Superscript.php
includes/wikiengine/Parse/Mediawiki/Table.php
includes/wikiengine/Parse/Mediawiki/Tighten.php
includes/wikiengine/Parse/Mediawiki/Toc.php
includes/wikiengine/Parse/Mediawiki/Tt.php
includes/wikiengine/Parse/Mediawiki/Underline.php
includes/wikiengine/Parse/Mediawiki/Url.php
includes/wikiengine/Parse/Mediawiki/Wikilink.php
includes/wikiengine/Render.php
includes/wikiengine/Render/Plain.php
includes/wikiengine/Render/Plain/Anchor.php
includes/wikiengine/Render/Plain/Blockquote.php
includes/wikiengine/Render/Plain/Bold.php
includes/wikiengine/Render/Plain/Box.php
includes/wikiengine/Render/Plain/Break.php
includes/wikiengine/Render/Plain/Center.php
includes/wikiengine/Render/Plain/Code.php
includes/wikiengine/Render/Plain/Colortext.php
includes/wikiengine/Render/Plain/Deflist.php
includes/wikiengine/Render/Plain/Delimiter.php
includes/wikiengine/Render/Plain/Embed.php
includes/wikiengine/Render/Plain/Emphasis.php
includes/wikiengine/Render/Plain/Font.php
includes/wikiengine/Render/Plain/Freelink.php
includes/wikiengine/Render/Plain/Function.php
includes/wikiengine/Render/Plain/Heading.php
includes/wikiengine/Render/Plain/Horiz.php
includes/wikiengine/Render/Plain/Html.php
includes/wikiengine/Render/Plain/Image.php
includes/wikiengine/Render/Plain/Include.php
includes/wikiengine/Render/Plain/Interwiki.php
includes/wikiengine/Render/Plain/Italic.php
includes/wikiengine/Render/Plain/List.php
includes/wikiengine/Render/Plain/Newline.php
includes/wikiengine/Render/Plain/Page.php
includes/wikiengine/Render/Plain/Paragraph.php
includes/wikiengine/Render/Plain/Phplookup.php
includes/wikiengine/Render/Plain/Plugin.php
includes/wikiengine/Render/Plain/Prefilter.php
includes/wikiengine/Render/Plain/Preformatted.php
includes/wikiengine/Render/Plain/Raw.php
includes/wikiengine/Render/Plain/Revise.php
includes/wikiengine/Render/Plain/Smiley.php
includes/wikiengine/Render/Plain/Specialchar.php
includes/wikiengine/Render/Plain/Strong.php
includes/wikiengine/Render/Plain/Subscript.php
includes/wikiengine/Render/Plain/Superscript.php
includes/wikiengine/Render/Plain/Table.php
includes/wikiengine/Render/Plain/Tighten.php
includes/wikiengine/Render/Plain/Titlebar.php
includes/wikiengine/Render/Plain/Toc.php
includes/wikiengine/Render/Plain/Tt.php
includes/wikiengine/Render/Plain/Underline.php
includes/wikiengine/Render/Plain/Url.php
includes/wikiengine/Render/Plain/Wikilink.php
includes/wikiengine/Render/Xhtml.php
includes/wikiengine/Render/Xhtml/Anchor.php
includes/wikiengine/Render/Xhtml/Blockquote.php
includes/wikiengine/Render/Xhtml/Bold.php
includes/wikiengine/Render/Xhtml/Box.php
includes/wikiengine/Render/Xhtml/Break.php
includes/wikiengine/Render/Xhtml/Center.php
includes/wikiengine/Render/Xhtml/Code.php
includes/wikiengine/Render/Xhtml/Colortext.php
includes/wikiengine/Render/Xhtml/Deflist.php
includes/wikiengine/Render/Xhtml/Delimiter.php
includes/wikiengine/Render/Xhtml/Embed.php
includes/wikiengine/Render/Xhtml/Emphasis.php
includes/wikiengine/Render/Xhtml/Font.php
includes/wikiengine/Render/Xhtml/Freelink.php
includes/wikiengine/Render/Xhtml/Function.php
includes/wikiengine/Render/Xhtml/Heading.php
includes/wikiengine/Render/Xhtml/Horiz.php
includes/wikiengine/Render/Xhtml/Html.php
includes/wikiengine/Render/Xhtml/Image.php
includes/wikiengine/Render/Xhtml/Include.php
includes/wikiengine/Render/Xhtml/Interwiki.php
includes/wikiengine/Render/Xhtml/Italic.php
includes/wikiengine/Render/Xhtml/List.php
includes/wikiengine/Render/Xhtml/Newline.php
includes/wikiengine/Render/Xhtml/Page.php
includes/wikiengine/Render/Xhtml/Paragraph.php
includes/wikiengine/Render/Xhtml/Phplookup.php
includes/wikiengine/Render/Xhtml/Plugin.php
includes/wikiengine/Render/Xhtml/Prefilter.php
includes/wikiengine/Render/Xhtml/Preformatted.php
includes/wikiengine/Render/Xhtml/Raw.php
includes/wikiengine/Render/Xhtml/Revise.php
includes/wikiengine/Render/Xhtml/Smiley.php
includes/wikiengine/Render/Xhtml/Specialchar.php
includes/wikiengine/Render/Xhtml/Strong.php
includes/wikiengine/Render/Xhtml/Subscript.php
includes/wikiengine/Render/Xhtml/Superscript.php
includes/wikiengine/Render/Xhtml/Table.php
includes/wikiengine/Render/Xhtml/Tighten.php
includes/wikiengine/Render/Xhtml/Titlebar.php
includes/wikiengine/Render/Xhtml/Toc.php
includes/wikiengine/Render/Xhtml/Tt.php
includes/wikiengine/Render/Xhtml/Underline.php
includes/wikiengine/Render/Xhtml/Url.php
includes/wikiengine/Render/Xhtml/Wikilink.php
includes/wikiengine/Tables.php
includes/wikiengine/TagSanitizer.php
includes/wikiengine/parse_mediawiki.php
includes/wikiengine/render_xhtml.php
includes/wikiformat.php
--- a/includes/constants.php	Sun Jun 21 00:16:21 2009 -0400
+++ b/includes/constants.php	Sun Jun 21 00:20:32 2009 -0400
@@ -106,13 +106,6 @@
 // Rendering options!
 
 /**
- * Render using the default engine (Text_Wiki + Enano pre- and post-processing).
- * @const int
- */
-
-define('RENDER_WIKI_DEFAULT', 1);
-
-/**
  * Render using template/wiki hybrid syntax (Enano processing + template variable/logic access)
  * @const int
  */
@@ -124,14 +117,14 @@
  * @const int
  */
 
-define('RENDER_BLOCKONLY', 4);
+define('RENDER_BLOCK', 4);
 
 /**
  * Only render inline-level things, like links.
  * @const int
  */
 
-define('RENDER_INLINEONLY', 8);
+define('RENDER_INLINE', 8);
 
 /**
  * Disable smilies when rendering.
@@ -140,6 +133,19 @@
 
 define('RENDER_NOSMILIES', 16);
 
+/**
+ * Render using the default engine
+ * @const int
+ */
+
+define('RENDER_WIKI_DEFAULT', RENDER_BLOCK | RENDER_INLINE);
+
+// parser order
+define('PO_BEFORE', 1);
+define('PO_AFTER', 2);
+define('PO_FIRST', 3);
+define('PO_LAST', 4);
+
 //
 // User types - don't touch these
 //
--- a/includes/functions.php	Sun Jun 21 00:16:21 2009 -0400
+++ b/includes/functions.php	Sun Jun 21 00:20:32 2009 -0400
@@ -1835,7 +1835,7 @@
   $rand_seed = md5( sha1(microtime()) . mt_rand() );
   
   // We need MediaWiki
-  require_once(ENANO_ROOT . '/includes/wikiengine/Tables.php');
+  require_once(ENANO_ROOT . '/includes/wikiengine/TagSanitizer.php');
   
   // Strip out comments that are already escaped
   preg_match_all('/<!--(.*?)-->/', $html, $comment_match);
--- a/includes/pageprocess.php	Sun Jun 21 00:16:21 2009 -0400
+++ b/includes/pageprocess.php	Sun Jun 21 00:20:32 2009 -0400
@@ -502,7 +502,7 @@
     // Rebuild the search index
     $paths->rebuild_page_index($this->page_id, $this->namespace);
     
-    $this->text_cache = $text;
+    $this->text_cache = $text_undb;
     
     return true;
     
--- a/includes/render.php	Sun Jun 21 00:16:21 2009 -0400
+++ b/includes/render.php	Sun Jun 21 00:20:32 2009 -0400
@@ -185,21 +185,17 @@
     global $db, $session, $paths, $template, $plugins; // Common objects
     global $lang;
     
-    require_once(ENANO_ROOT.'/includes/wikiformat.php');
-    require_once(ENANO_ROOT.'/includes/wikiengine/Tables.php');
+    profiler_log("RenderMan: starting wikitext render");
+    require_once( ENANO_ROOT . '/includes/wikiformat.php' );
+    require_once( ENANO_ROOT . '/includes/wikiengine/TagSanitizer.php' );
+    require_once( ENANO_ROOT . '/includes/wikiengine/Tables.php' );
     
-    profiler_log("RenderMan: starting wikitext render");
-    
+    // this is still needed by parser plugins
     $random_id = md5( time() . mt_rand() );
     
     // Strip out <nowiki> sections and PHP code
     
-    $nw = preg_match_all('#<nowiki>(.*?)<\/nowiki>#is', $text, $nowiki);
-    
-    for($i=0;$i<sizeof($nowiki[1]);$i++)
-    {
-      $text = str_replace('<nowiki>'.$nowiki[1][$i].'</nowiki>', '{NOWIKI:'.$random_id.':'.$i.'}', $text);
-    }
+    self::nowiki_strip($text, $nowiki_stripped);
     
     $code = $plugins->setHook('render_wikiformat_veryearly');
     foreach ( $code as $cmd )
@@ -207,131 +203,173 @@
       eval($cmd);
     }
     
-    $php = preg_match_all('#<\?php(.*?)\?>#is', $text, $phpsec);
+    self::php_strip($text, $php_stripped);
     
-    for($i=0;$i<sizeof($phpsec[1]);$i++)
+    $carpenter = new Carpenter();
+    $carpenter->flags = $flags;
+    $carpenter->hook(array(__CLASS__, 'hook_pre'), PO_AFTER, 'lang');
+    $carpenter->hook(array(__CLASS__, 'hook_posttemplates'), PO_AFTER, 'templates');
+    if ( $flags & RENDER_WIKI_TEMPLATE )
     {
-      $text = str_replace('<?php'.$phpsec[1][$i].'?>', '{PHP:'.$random_id.':'.$i.'}', $text);
+      // FIXME: process noinclude/nodisplay
+    }
+    $text = $carpenter->render($text);
+    
+    // For plugin compat
+    $result =& $text;
+    
+    $code = $plugins->setHook('render_wikiformat_post');
+    foreach ( $code as $cmd )
+    {
+      eval($cmd);
     }
     
+    /*
     $text = preg_replace('/<noinclude>(.*?)<\/noinclude>/is', '\\1', $text);
     if ( $paths->namespace == 'Template' )
     {
       $text = preg_replace('/<nodisplay>(.*?)<\/nodisplay>/is', '', $text);
     }
     
-    if ( !($flags & RENDER_BLOCKONLY) )
-    {
-      preg_match_all('/<lang (?:code|id)="([a-z0-9_-]+)">([\w\W]+?)<\/lang>/', $text, $langmatch);
-      foreach ( $langmatch[0] as $i => $match )
-      {
-        if ( $langmatch[1][$i] == $lang->lang_code )
-        {
-          $text = str_replace_once($match, $langmatch[2][$i], $text);
-        }
-        else
-        {
-          $text = str_replace_once($match, '', $text);
-        }
-      }
-    
-      $code = $plugins->setHook('render_wikiformat_pre');
-      foreach ( $code as $cmd )
-      {
-        eval($cmd);
-      }
-    
-    //$template_regex = "/\{\{([^\]]+?)((\n([ ]*?)[A-z0-9]+([ ]*?)=([ ]*?)(.+?))*)\}\}/is";
-      $template_regex = "/\{\{(.+)((\n|\|[ ]*([A-z0-9]+)[ ]*=[ ]*(.+))*)\}\}/isU";
-      $i = 0;
-      while ( preg_match($template_regex, $text) )
-      {
-        $i++;
-        if ( $i == 5 )
-          break;
-        $text = RenderMan::include_templates($text);
-      }
-      
-      $code = $plugins->setHook('render_wikiformat_posttemplates');
-      foreach ( $code as $cmd )
-      {
-        eval($cmd);
-      }
-      
-      // Process images
-      $text = RenderMan::process_image_tags($text, $taglist);
-      $text = RenderMan::process_imgtags_stage2($text, $taglist);
-    }
-    
-    // Before shipping it out to the renderer, replace spaces in between headings and paragraphs:
-    $text = preg_replace('/<\/(h[0-9]|div|p)>([\s]+)<(h[0-9]|div|p)( .+?)?>/i', '</\\1><\\3\\4>', $text);
-    
     $text = process_tables($text);
-    
-    if ( !($flags & RENDER_BLOCKONLY) )
-      $text = RenderMan::parse_internal_links($text);
+    */
     
-    $wiki = Text_Wiki::singleton('Mediawiki');
-    $wiki->setRenderConf('Xhtml', 'wikilink', 'view_url', contentPath);
-    $wiki->setRenderConf('Xhtml', 'Url', 'css_descr', 'external');
-    if ( $flags & RENDER_BLOCKONLY )
-    {
-      $wiki->disableRule('Freelink');
-      $wiki->disableRule('Url');
-      $wiki->disableRule('Toc');
-      $wiki->disableRule('Image');
-    }
-    else if ( $flags & RENDER_INLINEONLY )
-    {
-      foreach ( array('code', 'html', 'raw', 'include', 'embed', 'horiz', 'break', 'blockquote', 'list', 'newline', 'paragraph', 'revise', 'tighten') as $rule )
-      {
-        $wiki->disableRule($rule);
-      }
-    }
-    $result = $wiki->transform($text, 'Xhtml');
-    
-    // HTML fixes
-    $result = preg_replace('#<tr>([\s]*?)<\/tr>#is', '', $result);
-    $result = preg_replace('#<p>([\s]*?)<\/p>#is', '', $result);
-    $result = preg_replace('#<br />([\s]*?)<table#is', '<table', $result);
-    $result = str_replace("<pre><code>\n", "<pre><code>", $result);
-    $result = preg_replace("/<p><table([^>]*?)><\/p>/", "<table\\1>", $result);
-    $result = str_replace("<br />\n</td>", "\n</td>", $result);
-    $result = str_replace("<p><tr>", "<tr>", $result);
-    $result = str_replace("<tr><br />", "<tr>", $result);
-    $result = str_replace("</tr><br />", "</tr>", $result);
-    $result = str_replace("</table><br />", "</table>", $result);
-    $result = preg_replace('/<\/table>$/', "</table><br /><br />", $result);
-    $result = str_replace("<p></div></p>", "</div>", $result);
-    $result = str_replace("<p></table></p>", "</table>", $result);
-    
-    if ( !($flags & RENDER_BLOCKONLY) )
-    {
-      $code = $plugins->setHook('render_wikiformat_post');
-      foreach ( $code as $cmd )
-      {
-        eval($cmd);
-      }
-    }
-    
-    // Reinsert <nowiki> sections
-    for($i=0;$i<$nw;$i++)
-    {
-      $result = str_replace('{NOWIKI:'.$random_id.':'.$i.'}', $nowiki[1][$i], $result);
-    }
-    
-    // Reinsert PHP
-    for($i=0;$i<$php;$i++)
-    {
-      $result = str_replace('{PHP:'.$random_id.':'.$i.'}', '<?php'.$phpsec[1][$i].'?>', $result);
-    }
+    self::nowiki_unstrip($text, $nowiki_stripped);
+    self::php_unstrip($text, $php_stripped);
     
     profiler_log("RenderMan: finished wikitext render");
     
-    return $result;
+    return $text;
+  }
+  
+  public static function hook_pre($text)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    $code = $plugins->setHook('render_wikiformat_pre');
+    foreach ( $code as $cmd )
+    {
+      eval($cmd);
+    }
+    
+    return $text;
+  }
+  
+  public static function hook_posttemplates($text)
+  {
+    global $db, $session, $paths, $template, $plugins; // Common objects
+    
+    $code = $plugins->setHook('render_wikiformat_posttemplates');
+    foreach ( $code as $cmd )
+    {
+      eval($cmd);
+    }
+    
+    return $text;
+  }
+  
+  /**
+   * Strip out <nowiki> tags (to bypass parsing on them)
+   * @access private
+   */
+  
+  private static function nowiki_strip(&$text, &$stripdata)
+  {
+    self::tag_strip('nowiki', $text, $stripdata);
+  }
+  
+  /**
+   * Restore stripped <nowiki> tags.
+   * @access private
+   */
+  
+  public static function nowiki_unstrip(&$text, &$stripdata)
+  {
+    self::tag_unstrip('nowiki', $text, $stripdata);
+  }
+  
+  /**
+   * Strip out an arbitrary HTML tag.
+   * @access private
+   */
+  
+  public static function tag_strip($tag, &$text, &$stripdata)
+  {
+    $random_id = md5( time() . mt_rand() );
+    
+    preg_match_all("#<$tag>(.*?)</$tag>#is", $text, $blocks);
+    
+    foreach ( $blocks[0] as $i => $match )
+    {
+      $text = str_replace($match, "{{$tag}:{$random_id}:{$i}}", $text);
+    }
     
+    $stripdata = array(
+        'random_id' => $random_id,
+        'blocks' => $blocks[1]
+      );
   }
   
+  /**
+   * Restore stripped <nowiki> tags.
+   * @access private
+   */
+  
+  public static function tag_unstrip($tag, &$text, &$stripdata)
+  {
+    $random_id = $stripdata['random_id'];
+    
+    foreach ( $stripdata['blocks'] as $i => $block )
+    {
+      $text = str_replace("{{$tag}:{$random_id}:{$i}}", $block, $text);
+    }
+    
+    $stripdata = array();
+  }
+  
+  /**
+   * Strip out PHP code (to prevent it from being sent through the parser). Private because it does not do what you think it does. (The method you are looking for is strip_php.)
+   * @access private
+   */
+  
+  private static function php_strip(&$text, &$stripdata)
+  {
+    $random_id = md5( time() . mt_rand() );
+    
+    preg_match_all('#<\?(?:php)?[\s=].+?\?>#is', $text, $blocks);
+    
+    foreach ( $blocks[0] as $i => $match )
+    {
+      $text = str_replace($match, "{PHP:$random_id:$i}", $text);
+    }
+    
+    $stripdata = array(
+        'random_id' => $random_id,
+        'blocks' => $blocks[0]
+      );
+  }
+  
+  /**
+   * Restore stripped PHP code
+   * @access private
+   */
+  
+  private static function php_unstrip(&$text, &$stripdata)
+  {
+    $random_id = $stripdata['random_id'];
+    
+    foreach ( $stripdata['blocks'] as $i => $block )
+    {
+      $text = str_replace("{PHP:$random_id:$i}", $block, $text);
+    }
+    
+    $stripdata = array();
+  }
+  
+  /**
+   * Deprecated.
+   */
+  
   public static function wikiFormat($message, $filter_links = true, $do_params = false, $plaintext = false)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
@@ -781,9 +819,11 @@
   /**
    * Preprocesses an HTML text string prior to being sent to MySQL.
    * @param string $text
-   * @param bool $strip_all_php - if true, strips all PHP regardless of user permissions. Else, strips PHP only if user level < USER_LEVEL_ADMIN.
+   * @param bool $strip_all_php - if true, strips all PHP regardless of user permissions. Else, strips PHP only if user level < USER_LEVEL_ADMIN. Defaults to true.
+   * @param bool $sqlescape - if true, sends text through $db->escape(). Otherwise returns unescaped text. Defaults to true.
+   * @param bool $reduceheadings - if true, finds HTML headings and replaces them with wikitext. Else, does not touch headings. Defaults to true.
    */
-  public static function preprocess_text($text, $strip_all_php = true, $sqlescape = true)
+  public static function preprocess_text($text, $strip_all_php = true, $sqlescape = true, $reduceheadings = true)
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     $random_id = md5( time() . mt_rand() );
@@ -836,8 +876,9 @@
       eval($cmd);
     }
     
-    // gently apply some reverse-processing to allow Text_Wiki to do magic with TOCs and stuff
-    $text = self::reverse_process_headings($text);
+    // gently apply some reverse-processing to allow the parser to do magic with TOCs and stuff
+    if ( $reduceheadings )
+      $text = self::reverse_process_headings($text);
     
     // Reinsert <nowiki> sections
     for($i=0;$i<$nw;$i++)
--- a/includes/wikiengine/Default.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Parse structured wiki text and render into arbitrary formats such as XHTML.
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Justin Patrin <justinpatrin@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Default.php,v 1.1 2006/03/01 16:58:17 justinpatrin Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-require_once('Text/Wiki.php');
-
-/**
- * This is the parser for the Default ruleset. For now, this simply extends Text_Wiki.
- *
- * @category   Text
- * @package    Text_Wiki
- * @version    Release: @package_version@
- * @author     Justin Patrin <justinpatrin@php.net>
- */
-class Text_Wiki_Default extends Text_Wiki {
-}
--- a/includes/wikiengine/Mediawiki.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Parse structured wiki text and render into arbitrary formats such as XHTML.
- * This is the Text_Wiki extension for Mediawiki markup
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Mediawiki.php,v 1.8 2006/02/25 09:59:34 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * "master" class for handling the management and convenience
- */
-require_once(ENANO_ROOT.'/includes/wikiformat.php');
-
-/**
- * Base Text_Wiki handler class extension for Mediawiki markup
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki::Text_Wiki()
- */
-class Text_Wiki_Mediawiki extends Text_Wiki {
-    var $rules = array(
-        'Prefilter',
-        'Delimiter',
-        'Code',
-//        'Plugin',
-//        'Function',
-//        'Html',
-        'Raw',
-//        'Preformatted',
-//        'Include',
-//        'Embed',
-//        'Page',
-//        'Anchor',
-        'Heading',
-        'Toc',
-//        'Titlebar',
-        'Horiz',
-        'Break',
-        'Blockquote',
-        'List',
-        'Deflist',
-//        'Table',
-//        'Box',
-//        'Image', // done by Wikilink but still possible to disable/configure
-//        'Phplookup',
-        'Center',
-        'Newline',
-        'Paragraph',
-        'Url',
-//        'Freelink',
-//        'Colortext',
-        'Wikilink',
-//        'Strong',  ** will be only fake inserted by Emphasis if needed for render
-        'Bold',
-        'Emphasis',
-        'Italic',
-        'Underline',
-        'Tt',
-        'Superscript',
-        'Subscript',
-//        'Specialchar',
-        'Revise',
-//        'Interwiki', // done by Wikilink but still possible to disable/configure
-        'Tighten'
-    );
-
-	/**
-     * Constructor: just adds the path to Mediawiki rules
-     *
-     * @access public
-     * @param array $rules The set of rules to load for this object.
-     */
-    function Text_Wiki_Mediawiki($rules = null) {
-        parent::Text_Wiki($rules);
-        $this->addPath('parse', $this->fixPath(dirname(__FILE__)).'Parse/Mediawiki');
-    }
-}
-
-?>
--- a/includes/wikiengine/Parse.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,264 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Baseline rule class for extension into a "real" parser component.
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Parse.php,v 1.5 2005/07/29 08:57:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Baseline rule class for extension into a "real" parser component.
- *
- * Text_Wiki_Rule classes do not stand on their own; they are called by a
- * Text_Wiki object, typcially in the transform() method. Each rule class
- * performs three main activities: parse, process, and render.
- *
- * The parse() method takes a regex and applies it to the whole block of
- * source text at one time. Each match is sent as $matches to the
- * process() method.
- *
- * The process() method acts on the matched text from the source, and
- * then processes the source text is some way.  This may mean the
- * creation of a delimited token using addToken().  In every case, the
- * process() method returns the text that should replace the matched text
- * from parse().
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Parse {
-
-
-    /**
-    *
-    * Configuration options for this parser rule.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $conf = array();
-
-
-    /**
-    *
-    * Regular expression to find matching text for this rule.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    * @see parse()
-    *
-    */
-
-    var $regex = null;
-
-
-    /**
-    *
-    * The name of this rule for new token array elements.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $rule = null;
-
-
-    /**
-    *
-    * A reference to the calling Text_Wiki object.
-    *
-    * This is needed so that each rule has access to the same source
-    * text, token set, URLs, interwiki maps, page names, etc.
-    *
-    * @access public
-    *
-    * @var object
-    */
-
-    var $wiki = null;
-
-
-    /**
-    *
-    * Constructor for this parser rule.
-    *
-    * @access public
-    *
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    *
-    */
-
-    function Text_Wiki_Parse(&$obj)
-    {
-        // set the reference to the calling Text_Wiki object;
-        // this allows us access to the shared source text, token
-        // array, etc.
-        $this->wiki =& $obj;
-
-        // set the name of this rule; generally used when adding
-        // to the tokens array. strip off the Text_Wiki_Parse_ portion.
-        // text_wiki_parse_
-        // 0123456789012345
-        $tmp = substr(get_class($this), 16);
-        $this->rule = ucwords(strtolower($tmp));
-
-        // override config options for the rule if specified
-        if (isset($this->wiki->parseConf[$this->rule]) &&
-            is_array($this->wiki->parseConf[$this->rule])) {
-
-            $this->conf = array_merge(
-                $this->conf,
-                $this->wiki->parseConf[$this->rule]
-            );
-
-        }
-    }
-
-
-    /**
-    *
-    * Abstrct method to parse source text for matches.
-    *
-    * Applies the rule's regular expression to the source text, passes
-    * every match to the process() method, and replaces the matched text
-    * with the results of the processing.
-    *
-    * @access public
-    *
-    * @see Text_Wiki_Parse::process()
-    *
-    */
-
-    function parse()
-    {
-        $this->wiki->source = preg_replace_callback(
-            $this->regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-    }
-
-
-    /**
-    *
-    * Abstract method to generate replacements for matched text.
-    *
-    * @access public
-    *
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    *
-    * @return string The processed text replacement; defaults to the
-    * full matched string (i.e., no changes to the text).
-    *
-    * @see Text_Wiki_Parse::parse()
-    *
-    */
-
-    function process(&$matches)
-    {
-        return $matches[0];
-    }
-
-
-    /**
-    *
-    * Simple method to safely get configuration key values.
-    *
-    * @access public
-    *
-    * @param string $key The configuration key.
-    *
-    * @param mixed $default If the key does not exist, return this value
-    * instead.
-    *
-    * @return mixed The configuration key value (if it exists) or the
-    * default value (if not).
-    *
-    */
-
-    function getConf($key, $default = null)
-    {
-        if (isset($this->conf[$key])) {
-            return $this->conf[$key];
-        } else {
-            return $default;
-        }
-    }
-
-
-    /**
-    *
-    * Extract 'attribute="value"' portions of wiki markup.
-    *
-    * This kind of markup is typically used only in macros, but is useful
-    * anywhere.
-    *
-    * The syntax is pretty strict; there can be no spaces between the
-    * option name, the equals, and the first double-quote; the value
-    * must be surrounded by double-quotes.  You can escape characters in
-    * the value with a backslash, and the backslash will be stripped for
-    * you.
-    *
-    * @access public
-    *
-    * @param string $text The "attributes" portion of markup.
-    *
-    * @return array An associative array of key-value pairs where the
-    * key is the option name and the value is the option value.
-    *
-    */
-
-    function getAttrs($text)
-    {
-        // find the =" sections;
-        $tmp = explode('="', trim($text));
-
-        // basic setup
-        $k = count($tmp) - 1;
-        $attrs = array();
-        $key = null;
-
-        // loop through the sections
-        foreach ($tmp as $i => $val) {
-
-            // first element is always the first key
-            if ($i == 0) {
-                $key = trim($val);
-                continue;
-            }
-
-            // find the last double-quote in the value.
-            // the part to the left is the value for the last key,
-            // the part to the right is the next key name
-            $pos = strrpos($val, '"');
-            $attrs[$key] = stripslashes(substr($val, 0, $pos));
-            $key = trim(substr($val, $pos+1));
-
-        }
-
-        return $attrs;
-
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Anchor.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for anchor targets.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Manuel Holtgrewe <purestorm at ggnore dot net>
-*
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Anchor.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* This class implements a Text_Wiki_Parse to add an anchor target name
-* in the wiki page.
-*
-* @author Manuel Holtgrewe <purestorm at ggnore dot net>
-*
-* @author Paul M. Jones <pmjones at ciaweb dot net>
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-*/
-
-class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.  Looks like a macro: [[# anchor_name]]
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i';
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text, not including the <code></code> tags.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches) {
-    
-        $name = $matches[2];
-        $text = $matches[3];
-        
-        $start = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'start', 'name' => $name)
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'end', 'name' => $name)
-        );
-        
-        // done, place the script output directly in the source
-        return $start . trim($text) . $end;
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Blockquote.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-<?php
-
-/**
-* 
-* Parse for block-quoted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Blockquote.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parse for block-quoted text.
-* 
-* Find source text marked as a blockquote, identified by any number of
-* greater-than signs '>' at the start of the line, followed by a space,
-* and then the quote text; each '>' indicates an additional level of
-* quoting.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Regex for parsing the source text.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/\n((\>).*\n)(?!(\>))/Us';
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.
-    * 
-    * Token options are:
-    * 
-    * 'type' =>
-    *     'start' : the start of a blockquote
-    *     'end'   : the end of a blockquote
-    *
-    * 'level' => the indent level (0 for the first level, 1 for the
-    * second, etc)
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * list text and list elements.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // the replacement text we will return to parse()
-        $return = '';
-        
-        // the list of post-processing matches
-        $list = array();
-        
-        // $matches[1] is the text matched as a list set by parse();
-        // create an array called $list that contains a new set of
-        // matches for the various list-item elements.
-        preg_match_all(
-            '=^(\>+) (.*\n)=Ums',
-            $matches[1],
-            $list,
-            PREG_SET_ORDER
-        );
-        
-        // a stack of starts and ends; we keep this so that we know what
-        // indent level we're at.
-        $stack = array();
-        
-        // loop through each list-item element.
-        foreach ($list as $key => $val) {
-            
-            // $val[0] is the full matched list-item line
-            // $val[1] is the number of initial '>' chars (indent level)
-            // $val[2] is the quote text
-            
-            // we number levels starting at 1, not zero
-            $level = strlen($val[1]);
-            
-            // get the text of the line
-            $text = $val[2];
-            
-            // add a level to the list?
-            while ($level > count($stack)) {
-                
-                // the current indent level is greater than the number
-                // of stack elements, so we must be starting a new
-                // level.  push the new level onto the stack with a 
-                // dummy value (boolean true)...
-                array_push($stack, true);
-                
-                $return .= "\n";
-                
-                // ...and add a start token to the return.
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array(
-                        'type' => 'start',
-                        'level' => $level - 1
-                    )
-                );
-                
-                $return .= "\n\n";
-            }
-            
-            // remove a level?
-            while (count($stack) > $level) {
-                
-                // as long as the stack count is greater than the
-                // current indent level, we need to end list types.
-                // continue adding end-list tokens until the stack count
-                // and the indent level are the same.
-                array_pop($stack);
-                
-                $return .= "\n\n";
-                
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array (
-                        'type' => 'end',
-                        'level' => count($stack)
-                    )
-                );
-                
-                $return .= "\n";
-            }
-            
-            // add the line text.
-            $return .= $text;
-        }
-        
-        // the last line may have been indented.  go through the stack
-        // and create end-tokens until the stack is empty.
-        $return .= "\n";
-        
-        while (count($stack) > 0) {
-            array_pop($stack);
-            $return .= $this->wiki->addToken(
-                $this->rule, 
-                array (
-                    'type' => 'end',
-                    'level' => count($stack)
-                )
-            );
-        }
-        
-        // we're done!  send back the replacement text.
-        return "\n$return\n\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Bold.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for bold text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Bold.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for bold text.
-* 
-* This class implements a Text_Wiki_Rule to find source text marked for
-* strong emphasis (bold) as defined by text surrounded by three
-* single-quotes. On parsing, the text itself is left in place, but the
-* starting and ending instances of three single-quotes are replaced with
-* tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Bold extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/'''(()|[^'].*)'''/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
-        $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Break.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for explicit line breaks.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Break.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for explicit line breaks.
-* 
-* This class implements a Text_Wiki_Parse to mark forced line breaks in the
-* source text.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Break extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/ _\n/';
-    
-    
-    /**
-    * 
-    * Generates a replacement token for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A delimited token to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $this->wiki->addToken($this->rule);
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Center.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for centered lines of text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Center.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for centered lines of text.
-* 
-* This class implements a Text_Wiki_Parse to find lines marked for centering.
-* The line must start with "= " (i.e., an equal-sign followed by a space).
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/\n\= (.*?)\n/';
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'end')
-        );
-        
-        return "\n" . $start . $matches[1] . $end . "\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Code.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for text marked as a code example block.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Code.php,v 1.10 2006/02/21 14:33:53 toggg Exp $
-* 
-*/
-
-/**
-* 
-* Parses for text marked as a code example block.
-* 
-* This class implements a Text_Wiki_Parse to find sections marked as code
-* examples.  Blocks are marked as the string <code> on a line by itself,
-* followed by the inline code example, and terminated with the string
-* </code> on a line by itself.  The code example is run through the
-* native PHP highlight_string() function to colorize it, then surrounded
-* with <pre>...</pre> tags when rendered as XHTML.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-/*    var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/
-    var $regex = ';^<code(\s[^>]*)?>((?:(?R)|.)*?)\n</code>(\s|$);msi';
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text, not including the <code></code> tags.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // are there additional attribute arguments?
-        $args = trim($matches[1]);
-        
-        if ($args == '') {
-            $options = array(
-                'text' => $matches[2],
-                'attr' => array('type' => '')
-            );
-        } else {
-        	// get the attributes...
-        	$attr = $this->getAttrs($args);
-        	
-        	// ... and make sure we have a 'type'
-        	if (! isset($attr['type'])) {
-        		$attr['type'] = '';
-        	}
-        	
-        	// retain the options
-            $options = array(
-                'text' => $matches[2],
-                'attr' => $attr
-            );
-        }
-        
-        return $this->wiki->addToken($this->rule, $options) . $matches[3];
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Colortext.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for colorized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Colortext.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for colorized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\#\#(.+?)\|(.+?)\#\#/";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * 'color' => the color indicator
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the text to be
-    * emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'start',
-                'color' => $matches[1]
-            )
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'end',
-                'color' => $matches[1]
-            )
-        );
-        
-        return $start . $matches[2] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Deflist.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for definition lists.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Deflist.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for definition lists.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as a
-* definition list.  In short, if a line starts with ':' then it is a
-* definition list item; another ':' on the same line indicates the end
-* of the definition term and the beginning of the definition narrative.
-* The list items must be on sequential lines (no blank lines between
-* them) -- a blank line indicates the beginning of a new list.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/\n((: ).*\n)(?!(: |\n))/Us';
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' =>
-    *     'list_start'    : the start of a definition list
-    *     'list_end'      : the end of a definition list
-    *     'term_start'    : the start of a definition term
-    *     'term_end'      : the end of a definition term
-    *     'narr_start'    : the start of definition narrative
-    *     'narr_end'      : the end of definition narrative
-    *     'unknown'       : unknown type of definition portion
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * list text and list elements.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // the replacement text we will return to parse()
-        $return = '';
-        
-        // the list of post-processing matches
-        $list = array();
-        
-        // start the deflist
-        $options = array('type' => 'list_start');
-        $return .= $this->wiki->addToken($this->rule, $options);
-        
-        // $matches[1] is the text matched as a list set by parse();
-        // create an array called $list that contains a new set of
-        // matches for the various definition-list elements.
-        preg_match_all(
-            '/^(: )(.*)?( : )(.*)?$/Ums',
-            $matches[1],
-            $list,
-            PREG_SET_ORDER
-        );
-        
-        // add each term and narrative
-        foreach ($list as $key => $val) {
-            $return .= (
-                $this->wiki->addToken($this->rule, array('type' => 'term_start')) .
-                trim($val[2]) .
-                $this->wiki->addToken($this->rule, array('type' => 'term_end')) .
-                $this->wiki->addToken($this->rule, array('type' => 'narr_start')) .
-                trim($val[4]) . 
-                $this->wiki->addToken($this->rule, array('type' => 'narr_end'))
-            );
-        }
-        
-        
-        // end the deflist
-        $options = array('type' => 'list_end');
-        $return .= $this->wiki->addToken($this->rule, $options);
-        
-        // done!
-        return "\n" . $return . "\n\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Delimiter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for Text_Wiki delimiter characters already in the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Delimiter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for Text_Wiki delimiter characters already in the source text.
-* 
-* This class implements a Text_Wiki_Parse to find instances of the delimiter
-* character already embedded in the source text; it extracts them and replaces
-* them with a delimited token, then renders them as the delimiter itself
-* when the target format is XHTML.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
-    
-    /**
-    * 
-    * Constructor.  Overrides the Text_Wiki_Parse constructor so that we
-    * can set the $regex property dynamically (we need to include the
-    * Text_Wiki $delim character.
-    * 
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    * 
-    * @param string $name The token name to use for this rule.
-    * 
-    */
-    
-    function Text_Wiki_Parse_delimiter(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-        $this->regex = '/' . $this->wiki->delim . '/';
-    }
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $this->wiki->addToken(
-            $this->rule,
-            array('text' => $this->wiki->delim)
-        );
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Embed.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-<?php
-
-/**
-* 
-* Embeds the results of a PHP script at render-time.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Embed.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Embeds the results of a PHP script at render-time.
-* 
-* This class implements a Text_Wiki_Parse to embed the contents of a URL
-* inside the page at render-time.  Typically used to get script output.
-* This differs from the 'include' rule, which incorporates results at
-* parse-time; 'embed' output does not get parsed by Text_Wiki, while
-* 'include' ouput does.
-*
-* This rule is inherently not secure; it allows cross-site scripting to
-* occur if the embedded output has <script> or other similar tags.  Be
-* careful.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Embed extends Text_Wiki_Parse {
-    
-    var $conf = array(
-        'base' => '/path/to/scripts/'
-    );
-    
-    var $file = null;
-
-    var $output = null;
-
-    var $vars = null;
-
-
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/(\[\[embed )(.+?)( .+?)?(\]\])/i';
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text, not including the <code></code> tags.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        // save the file location
-        $this->file = $this->getConf('base', './') . $matches[2];
-        
-        // extract attribs as variables in the local space
-        $this->vars = $this->getAttrs($matches[3]);
-        unset($this->vars['this']);
-        extract($this->vars);
-        
-        // run the script
-        ob_start();
-        include($this->file);
-        $this->output = ob_get_contents();
-        ob_end_clean();
-        
-        // done, place the script output directly in the source
-        return $this->wiki->addToken(
-            $this->rule,
-            array('text' => $this->output)
-        );
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Emphasis.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for emphasized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Emphasis.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for emphasized text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked for
-* emphasis (italics) as defined by text surrounded by two single-quotes.
-* On parsing, the text itself is left in place, but the starting and ending
-* instances of two single-quotes are replaced with tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_emphasis extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\/\/(.*?)\/\//";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the text to be
-    * emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Freelink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for wiki freelink text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Freelink.php,v 1.4 2005/10/19 23:43:53 toggg Exp $
-* 
-*/
-
-/**
-* 
-* Parses for freelinked page links.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as a
-* wiki freelink, and automatically create a link to that page.
-* 
-* A freelink is any page name not conforming to the standard
-* StudlyCapsStyle for a wiki page name.  For example, a page normally
-* named MyHomePage can be renamed and referred to as ((My Home Page)) --
-* note the spaces in the page name.  You can also make a "nice-looking"
-* link without renaming the target page; e.g., ((MyHomePage|My Home
-* Page)).  Finally, you can use named anchors on the target page:
-* ((MyHomePage|My Home Page#Section1)).
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Constructor.  We override the Text_Wiki_Parse constructor so we can
-    * explicitly comment each part of the $regex property.
-    * 
-    * @access public
-    * 
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    * 
-    */
-    
-    function Text_Wiki_Parse_Freelink(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-        
-        $this->regex =
-            '/' .                                                   // START regex
-            "\\(\\(" .                                               // double open-parens
-            "(" .                                                   // START freelink page patter
-            "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character
-            ")" .                                                   // END  freelink page pattern
-            "(" .                                                   // START display-name
-            "\|" .                                                   // a pipe to start the display name
-            "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character
-            ")?" .                                                   // END display-name pattern 0 or 1
-            "(" .                                                   // START pattern for named anchors
-            "\#" .                                                   // a hash mark
-            "[A-Za-z]" .                                           // 1 alpha
-            "[-A-Za-z0-9_:.]*" .                                   // 0 or more alpha, digit, underscore
-            ")?" .                                                   // END named anchors pattern 0 or 1
-            "()\\)\\)" .                                           // double close-parens
-            '/';                                                   // END regex
-    }
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'page' => the wiki page name (e.g., HomePage).
-    * 
-    * 'text' => alternative text to be displayed in place of the wiki
-    * page name.
-    * 
-    * 'anchor' => a named anchor on the target wiki page
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // use nice variable names
-        $page = $matches[1];
-        $text = $matches[2];
-        $anchor = $matches[3];
-        
-        // is the page given a new text appearance?
-        if (trim($text) == '') {
-            // no
-            $text = $page;
-        } else {
-            // yes, strip the leading | character
-            $text = substr($text, 1);
-        }
-        
-        // set the options
-        $options = array(
-            'page'   => $page,
-            'text'   => $text,
-            'anchor' => $anchor
-        );
-        
-        // return a token placeholder
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Function.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for an API function documentation block.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Function.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for an API function documentation block.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
-
-    var $regex = '/^(\<function\>)\n(.+)\n(\<\/function\>)(\s|$)/Umsi';
-    
-    function process(&$matches)
-    {
-        // default options
-        $opts = array(
-            'name' => null,
-            'access' => null,
-            'return' => null,
-            'params' => array(),
-            'throws' => array()
-        );
-        
-        // split apart the markup lines and loop through them
-        $lines = explode("\n", $matches[2]);
-        foreach ($lines as $line) {
-            
-            // skip blank lines
-            if (trim($line) == '') {
-                continue;
-            }
-            
-            // find the first ':' on the line; the left part is the 
-            // type, the right part is the value. skip lines without
-            // a ':' on them.
-            $pos = strpos($line, ':');
-            if ($pos === false) {
-                continue;
-            }
-            
-            // $type is the line type: name, access, return, param, throws
-            // 012345678901234
-            // name: something
-            $type = trim(substr($line, 0, $pos));
-            $val = trim(substr($line, $pos+1));
-            
-            switch($type) {
-            
-            case 'a':
-            case 'access':
-                $opts['access'] = $val;
-                break;
-                
-            case 'n':
-            case 'name':
-                $opts['name'] = $val;
-                break;
-                
-            case 'p':
-            case 'param':
-                $tmp = explode(',', $val);
-                $k = count($tmp);
-                if ($k == 1) {
-                    $opts['params'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => null,
-                        'default' => null
-                    );
-                } elseif ($k == 2) {
-                    $opts['params'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => $tmp[1],
-                        'default' => null
-                    );
-                } else {
-                    $opts['params'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => $tmp[1],
-                        'default' => $tmp[2]
-                    );
-                }
-                break;
-            
-            case 'r':
-            case 'return':
-            case 'returns':
-                $opts['return'] = $val;
-                break;
-            
-            case 't':
-            case 'throws':
-                $tmp = explode(',', $val);
-                $k = count($tmp);
-                if ($k == 1) {
-                    $opts['throws'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => null
-                    );
-                } else {
-                    $opts['throws'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => $tmp[1]
-                    );
-                }
-                break;
-        
-            default:
-                $opts[$type] = $val;
-                break;
-            
-            }
-        }
-        
-        // add the token back in place
-        return $this->wiki->addToken($this->rule, $opts) . $matches[4];
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Heading.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for heading text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Heading.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for heading text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked to
-* be a heading element, as defined by text on a line by itself prefixed
-* with a number of plus signs (+). The heading text itself is left in
-* the source, but is prefixed and suffixed with delimited tokens marking
-* the start and end of the heading.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/^(\+{1,6}) (.*)/m';
-    
-    var $conf = array(
-        'id_prefix' => 'toc'
-    );
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * heading text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the heading text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // keep a running count for header IDs.  we use this later
-        // when constructing TOC entries, etc.
-        static $id;
-        if (! isset($id)) {
-            $id = 0;
-        }
-        
-        $prefix = htmlspecialchars($this->getConf('id_prefix'));
-        
-        $start = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'start',
-                'level' => strlen($matches[1]),
-                'text' => $matches[2],
-                'id' => $prefix . $id ++
-            )
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'end',
-                'level' => strlen($matches[1])
-            )
-        );
-        
-        return $start . $matches[2] . $end . "\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Horiz.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for horizontal ruling lines.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Horiz.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for horizontal ruling lines.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked to
-* be a horizontal rule, as defined by four dashed on their own line.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/^([-]{4,})$/m';
-    
-    
-    /**
-    * 
-    * Generates a replacement token for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A token marking the horizontal rule.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $this->wiki->addToken($this->rule);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Html.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for blocks of HTML code.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Html.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for blocks of HTML code.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as
-* HTML to be redndred as-is.  The block start is marked by <html> on its
-* own line, and the block end is marked by </html> on its own line.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Html extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/^\<html\>\n(.+)\n\<\/html\>(\s|$)/Umsi';
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'text' => The text of the HTML to be rendered as-is.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text following the HTML block.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        $options = array('text' => $matches[1]);
-        return $this->wiki->addToken($this->rule, $options) . $matches[2];
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Image.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-<?php
-
-/**
-*
-* Parses for image placement.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-* @license LGPL
-*
-* @version $Id: Image.php,v 1.5 2005/09/12 11:34:44 toggg Exp $
-*
-*/
-
-/**
-*
-* Parses for image placement.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-*/
-
-class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
-
-    /**
-     * URL schemes recognized by this rule.
-     *
-     * @access public
-     * @var array
-    */
-    var $conf = array(
-        'schemes' => 'http|https|ftp|gopher|news',
-        'host_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?',
-        'path_regexp' => '(?:/[^\s"<\\\#delim#\ca-\cz]*)?'
-    );
-
-    /**
-    *
-    * The regular expression used to find source text matching this
-    * rule.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $regex = '/(\[\[image\s+)(.+?)(\]\])/i';
-
-
-    /**
-     * The regular expressions used to check ecternal urls
-     *
-     * @access public
-     * @var string
-     * @see parse()
-     */
-    var $url = '';
-
-     /**
-     * Constructor.
-     * We override the constructor to build up the url regex from config
-     *
-     * @param object &$obj the base conversion handler
-     * @return The parser object
-     * @access public
-     */
-    function Text_Wiki_Parse_Image(&$obj)
-    {
-        $default = $this->conf;
-        parent::Text_Wiki_Parse($obj);
-
-        // convert the list of recognized schemes to a regex OR,
-        $schemes = $this->getConf('schemes', $default['schemes']);
-        $this->url = str_replace( '#delim#', $this->wiki->delim,
-           '#(?:' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://'
-           . $this->getConf('host_regexp', $default['host_regexp'])
-           . $this->getConf('path_regexp', $default['path_regexp']) .'#');
-    }
-
-    /**
-    *
-    * Generates a token entry for the matched text.  Token options are:
-    *
-    * 'src' => The image source, typically a relative path name.
-    *
-    * 'opts' => Any macro options following the source.
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-
-    function process(&$matches)
-    {
-        $pos = strpos($matches[2], ' ');
-
-        if ($pos === false) {
-            $options = array(
-                'src' => $matches[2],
-                'attr' => array());
-        } else {
-            // everything after the space is attribute arguments
-            $options = array(
-                'src' => substr($matches[2], 0, $pos),
-                'attr' => $this->getAttrs(substr($matches[2], $pos+1))
-            );
-            // check the scheme case of external link
-            if (array_key_exists('link', $options['attr'])) {
-                // external url ?
-                if (($pos = strpos($options['attr']['link'], '://')) !== false) {
-                    if (!preg_match($this->url, $options['attr']['link'])) {
-                        return $matches[0];
-                    }
-                } elseif (in_array('Wikilink', $this->wiki->disable)) {
-                        return $matches[0]; // Wikilink disabled
-                }
-            }
-        }
-
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Include.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-<?php
-
-/**
-* 
-* Includes the contents of another PHP script into the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Include.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* This class implements a Text_Wiki_Parse to include the results of a
-* script directly into the source at parse-time; thus, the output of the
-* script will be parsed by Text_Wiki.  This differs from the 'embed'
-* rule, which incorporates the results at render-time, meaning that the
-* 'embed' content is not parsed by Text_Wiki.
-*
-* DANGER!
-* 
-* This rule is inherently not secure; it allows cross-site scripting to
-* occur if the embedded output has <script> or other similar tags.  Be
-* careful.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
-    
-    var $conf = array(
-        'base' => '/path/to/scripts/'
-    );
-    
-    var $file = null;
-    
-    var $output = null;
-    
-    var $vars = null;
-
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/(\[\[include )(.+?)( .+?)?(\]\])/i';
-    
-    
-    /**
-    * 
-    * Includes the results of the script directly into the source; the output
-    * will subsequently be parsed by the remaining Text_Wiki rules.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return The results of the included script.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // save the file location
-        $this->file = $this->getConf('base', './') . $matches[2];
-
-        // extract attribs as variables in the local space
-        $this->vars = $this->getAttrs($matches[3]);
-        unset($this->vars['this']);
-        extract($this->vars);
-
-        // run the script
-        ob_start();
-        include($this->file);
-        $this->output = ob_get_contents();
-        ob_end_clean();
-    
-        // done, place the script output directly in the source
-        return $this->output;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Interwiki.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for interwiki links.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Interwiki.php,v 1.4 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for interwiki links.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as
-* an Interwiki link.  See the regex for a detailed explanation of the
-* text matching procedure; e.g., "InterWikiName:PageName".
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
-    
-    // double-colons wont trip up now
-    var $regex = '([A-Za-z0-9_]+):((?!:)[A-Za-z0-9_\/=&~#.:;-]+)';
-    
-    
-    /**
-    * 
-    * Parser.  We override the standard parser so we can
-    * find both described interwiki links and standalone links.
-    * 
-    * @access public
-    * 
-    * @return void
-    * 
-    */
-    
-    function parse()
-    {
-        // described interwiki links
-        $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processDescr'),
-            $this->wiki->source
-        );
-        
-        // standalone interwiki links
-        $tmp_regex = '/' . $this->regex . '/';
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-       
-    }
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched standalone interwiki text.
-    * Token options are:
-    * 
-    * 'site' => The key name for the Text_Wiki interwiki array map,
-    * usually the name of the interwiki site.
-    * 
-    * 'page' => The page on the target interwiki to link to.
-    * 
-    * 'text' => The text to display as the link.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $options = array(
-            'site' => $matches[1],
-            'page' => $matches[2],
-            'text' => $matches[0]
-        );
-        
-        return $this->wiki->addToken($this->rule, $options);
-    }
-    
-    
-    /**
-    * 
-    * Generates a replacement for described interwiki links. Token
-    * options are:
-    * 
-    * 'site' => The key name for the Text_Wiki interwiki array map,
-    * usually the name of the interwiki site.
-    * 
-    * 'page' => The page on the target interwiki to link to.
-    * 
-    * 'text' => The text to display as the link.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-    
-    function processDescr(&$matches)
-    {
-        $options = array(
-            'site' => $matches[1],
-            'page' => $matches[2],
-            'text' => $matches[3]
-        );
-        
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Italic.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for italic text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Italic.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for italic text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked for
-* emphasis (italics) as defined by text surrounded by two single-quotes.
-* On parsing, the text itself is left in place, but the starting and ending
-* instances of two single-quotes are replaced with tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Italic extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/''(()|[^'].*)''/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the text to be
-    * emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/List.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,248 +0,0 @@
-<?php
-
-/**
-*
-* Parses for bulleted and numbered lists.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-* @license LGPL
-*
-* @version $Id: List.php,v 1.7 2005/11/06 20:44:09 toggg Exp $
-*
-*/
-
-/**
-*
-* Parses for bulleted and numbered lists.
-*
-* This class implements a Text_Wiki_Parse to find source text marked as
-* a bulleted or numbered list.  In short, if a line starts with '* ' then
-* it is a bullet list item; if a line starts with '# ' then it is a
-* number list item.  Spaces in front of the * or # indicate an indented
-* sub-list.  The list items must be on sequential lines, and may be
-* separated by blank lines to improve readability.  Using a non-* non-#
-* non-whitespace character at the beginning of a line ends the list.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-*/
-
-class Text_Wiki_Parse_List extends Text_Wiki_Parse {
-
-
-    /**
-    *
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    * @see parse()
-    *
-    */
-
-    var $regex = '/^((\*|#) .*\n)(?!\2 |(?: {1,}((?:\*|#) |\n)))/Usm';
-
-
-    /**
-    *
-    * Generates a replacement for the matched text.  Token options are:
-    *
-    * 'type' =>
-    *     'bullet_start' : the start of a bullet list
-    *     'bullet_end'   : the end of a bullet list
-    *     'number_start' : the start of a number list
-    *     'number_end'   : the end of a number list
-    *     'item_start'   : the start of item text (bullet or number)
-    *     'item_end'     : the end of item text (bullet or number)
-    *     'unknown'      : unknown type of list or item
-    *
-    * 'level' => the indent level (0 for the first level, 1 for the
-    * second, etc)
-    *
-    * 'count' => the list item number at this level. not needed for
-    * xhtml, but very useful for PDF and RTF.
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * list text and list elements.
-    *
-    */
-
-    function process(&$matches)
-    {
-        // the replacement text we will return
-        $return = '';
-
-        // the list of post-processing matches
-        $list = array();
-
-        // a stack of list-start and list-end types; we keep this
-        // so that we know what kind of list we're working with
-        // (bullet or number) and what indent level we're at.
-        $stack = array();
-
-        // the item count is the number of list items for any
-        // given list-type on the stack
-        $itemcount = array();
-
-        // have we processed the very first list item?
-        $pastFirst = false;
-
-        // populate $list with this set of matches. $matches[1] is the
-        // text matched as a list set by parse().
-        preg_match_all(
-            '=^( {0,})(\*|#) (.*)$=Ums',
-            $matches[1],
-            $list,
-            PREG_SET_ORDER
-        );
-
-        // loop through each list-item element.
-        foreach ($list as $key => $val) {
-
-            // $val[0] is the full matched list-item line
-            // $val[1] is the number of initial spaces (indent level)
-            // $val[2] is the list item type (* or #)
-            // $val[3] is the list item text
-
-            // how many levels are we indented? (1 means the "root"
-            // list level, no indenting.)
-            $level = strlen($val[1]) + 1;
-
-            // get the list item type
-            if ($val[2] == '*') {
-                $type = 'bullet';
-            } elseif ($val[2] == '#') {
-                $type = 'number';
-            } else {
-                $type = 'unknown';
-            }
-
-            // get the text of the list item
-            $text = $val[3];
-
-            // add a level to the list?
-            if ($level > count($stack)) {
-
-                // the current indent level is greater than the
-                // number of stack elements, so we must be starting
-                // a new list.  push the new list type onto the
-                // stack...
-                array_push($stack, $type);
-
-                // ...and add a list-start token to the return.
-                $return .= $this->wiki->addToken(
-                    $this->rule,
-                    array(
-                        'type' => $type . '_list_start',
-                        'level' => $level - 1
-                    )
-                );
-            }
-
-            // remove a level from the list?
-            while (count($stack) > $level) {
-
-                // so we don't keep counting the stack, we set up a temp
-                // var for the count.  -1 becuase we're going to pop the
-                // stack in the next command.  $tmp will then equal the
-                // current level of indent.
-                $tmp = count($stack) - 1;
-
-                // as long as the stack count is greater than the
-                // current indent level, we need to end list types.
-                // continue adding end-list tokens until the stack count
-                // and the indent level are the same.
-                $return .= $this->wiki->addToken(
-                    $this->rule,
-                    array (
-                        'type' => array_pop($stack) . '_list_end',
-                        'level' => $tmp
-                    )
-                );
-
-                // reset to the current (previous) list type so that
-                // the new list item matches the proper list type.
-                $type = $stack[$tmp - 1];
-
-                // reset the item count for the popped indent level
-                unset($itemcount[$tmp + 1]);
-            }
-
-            // add to the item count for this list (taking into account
-            // which level we are at).
-            if (! isset($itemcount[$level])) {
-                // first count
-                $itemcount[$level] = 0;
-            } else {
-                // increment count
-                $itemcount[$level]++;
-            }
-
-            // is this the very first item in the list?
-            if (! $pastFirst) {
-                $first = true;
-                $pastFirst = true;
-            } else {
-                $first = false;
-            }
-
-            // create a list-item starting token.
-            $start = $this->wiki->addToken(
-                $this->rule,
-                array(
-                    'type' => $type . '_item_start',
-                    'level' => $level,
-                    'count' => $itemcount[$level],
-                    'first' => $first
-                )
-            );
-
-            // create a list-item ending token.
-            $end = $this->wiki->addToken(
-                $this->rule,
-                array(
-                    'type' => $type . '_item_end',
-                    'level' => $level,
-                    'count' => $itemcount[$level]
-                )
-            );
-
-            // add the starting token, list-item text, and ending token
-            // to the return.
-            $return .= $start . $val[3] . $end;
-        }
-
-        // the last list-item may have been indented.  go through the
-        // list-type stack and create end-list tokens until the stack
-        // is empty.
-        while (count($stack) > 0) {
-            $return .= $this->wiki->addToken(
-                $this->rule,
-                array (
-                    'type' => array_pop($stack) . '_list_end',
-                    'level' => count($stack)
-                )
-            );
-        }
-
-        // we're done!  send back the replacement text.
-        return "\n\n" . $return . "\n\n";
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Newline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for implied line breaks indicated by newlines.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Newline.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for implied line breaks indicated by newlines.
-* 
-* This class implements a Text_Wiki_Parse to mark implied line breaks in the
-* source text, usually a single carriage return in the middle of a paragraph
-* or block-quoted text.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/([^\n])\n([^\n])/m';
-    
-    
-    /**
-    * 
-    * Generates a replacement token for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A delimited token to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $matches[1] .
-            $this->wiki->addToken($this->rule) .
-            $matches[2];
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Paragraph.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for paragraph blocks.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Paragraph.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for paragraph blocks.
-* 
-* This class implements a Text_Wiki rule to find sections of the source
-* text that are paragraphs.  A para is any line not starting with a token
-* delimiter, followed by two newlines.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = "/^.*?\n\n/m";
-    
-    var $conf = array(
-        'skip' => array(
-            'blockquote', // are we sure about this one?
-            'code',
-            'heading',
-            'horiz',
-            'deflist',
-            'table',
-            'list',
-            'toc'
-        )
-    );
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'start' => The starting point of the paragraph.
-    * 
-    * 'end' => The ending point of the paragraph.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $delim = $this->wiki->delim;
-        
-        // was anything there?
-        if (trim($matches[0]) == '') {
-            return '';
-        }
-        
-        // does the match start with a delimiter?
-        if (substr($matches[0], 0, 1) != $delim) { 
-            // no.
-            
-            $start = $this->wiki->addToken(
-                $this->rule, array('type' => 'start')
-            );
-            
-            $end = $this->wiki->addToken(
-                $this->rule, array('type' => 'end')
-            );
-            
-            return $start . trim($matches[0]) . $end;
-        }
-        
-        // the line starts with a delimiter.  read in the delimited
-        // token number, check the token, and see if we should
-        // skip it.
-        
-        // loop starting at the second character (we already know
-        // the first is a delimiter) until we find another
-        // delimiter; the text between them is a token key number.
-        $key = '';
-        $len = strlen($matches[0]);
-        for ($i = 1; $i < $len; $i++) {
-            $char = $matches[0]{$i};
-            if ($char == $delim) {
-                break;
-            } else {
-                $key .= $char;
-            }
-        }
-        
-        // look at the token and see if it's skippable (if we skip,
-        // it will not be marked as a paragraph)
-        $token_type = strtolower($this->wiki->tokens[$key][0]);
-        $skip = $this->getConf('skip', array());
-        
-        if (in_array($token_type, $skip)) {
-            // this type of token should not have paragraphs applied to it.
-            // return the entire matched text.
-            return $matches[0];
-        } else {
-            
-            $start = $this->wiki->addToken(
-                $this->rule, array('type' => 'start')
-            );
-            
-            $end = $this->wiki->addToken(
-                $this->rule, array('type' => 'end')
-            );
-            
-            return $start . trim($matches[0]) . $end;
-        }
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Phplookup.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<?php
-
-/**
-* 
-* Find source text marked for lookup in the PHP online manual.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Phplookup.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Find source text marked for lookup in the PHP online manual.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Phplookup extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\[\[php (.+?)\]\]/";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * teletype text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the teletype text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        return $this->wiki->addToken(
-            $this->rule, array('text' => $matches[1])
-        );
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Prefilter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-<?php
-
-/**
-* 
-* "Pre-filter" the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Prefilter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* "Pre-filter" the source text.
-* 
-* Convert DOS and Mac line endings to Unix, concat lines ending in a
-* backslash \ with the next line, convert tabs to 4-spaces, add newlines
-* to the top and end of the source text, compress 3 or more newlines to
-* 2 newlines.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Simple parsing method.
-    *
-    * @access public
-    * 
-    */
-    
-    function parse()
-    {
-        // convert DOS line endings
-        $this->wiki->source = str_replace("\r\n", "\n",
-            $this->wiki->source);
-        
-        // convert Macintosh line endings
-        $this->wiki->source = str_replace("\r", "\n",
-            $this->wiki->source);
-        
-        // concat lines ending in a backslash
-        $this->wiki->source = str_replace("\\\n", "",
-            $this->wiki->source);
-        
-        // convert tabs to four-spaces
-        $this->wiki->source = str_replace("\t", "    ",
-            $this->wiki->source);
-           
-        // add extra newlines at the top and end; this
-        // seems to help many rules.
-        $this->wiki->source = "\n" . $this->wiki->source . "\n\n";
-        
-        // finally, compress all instances of 3 or more newlines
-        // down to two newlines.
-        $find = "/\n{3,}/m";
-        $replace = "\n\n";
-        $this->wiki->source = preg_replace($find, $replace,
-            $this->wiki->source);
-    }
-
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Raw.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for text marked as "raw" (i.e., to be rendered as-is).
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Raw.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for text marked as "raw" (i.e., to be rendered as-is).
-* 
-* This class implements a Text_Wiki rule to find sections of the source
-* text that are not to be processed by Text_Wiki.  These blocks of "raw"
-* text will be rendered as they were found.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Raw extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = "/``(.*)``/U";
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $options = array('text' => $matches[1]);
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Revise.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for text marked as revised (insert/delete).
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Revise.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for text marked as revised (insert/delete).
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\@\@({*?.*}*?)\@\@/U";
-    
-    
-    /**
-    * 
-    * Config options.
-    * 
-    * @access public
-    * 
-    * @var array
-    *
-    */
-    
-    var $conf = array(
-        'delmark' => '---',
-        'insmark' => '+++'
-    );
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * inserted text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the teletype text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $output = '';
-        $src = $matches[1];
-        $delmark = $this->getConf('delmark'); // ---
-        $insmark = $this->getConf('insmark'); // +++
-        
-        // '---' must be before '+++' (if they both appear)
-        $del = strpos($src, $delmark);
-        $ins = strpos($src, $insmark);
-        
-        // if neither is found, return right away
-        if ($del === false && $ins === false) {
-            return $matches[0];
-        }
-        
-        // handle text to be deleted
-        if ($del !== false) {
-            
-            // move forward to the end of the deletion mark
-            $del += strlen($delmark);
-            
-            if ($ins === false) {
-                // there is no insertion text following
-                $text = substr($src, $del);
-            } else {
-                // there is insertion text following,
-                // mitigate the length
-                $text = substr($src, $del, $ins - $del);
-            }
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'del_start')
-            );
-            
-            $output .= $text;
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'del_end')
-            );
-        }
-        
-        // handle text to be inserted
-        if ($ins !== false) {
-            
-            // move forward to the end of the insert mark
-            $ins += strlen($insmark);
-            $text = substr($src, $ins);
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'ins_start')
-            );
-            
-            $output .= $text;
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'ins_end')
-            );
-        }
-        
-        return $output;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Smiley.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Default: Parses for smileys / emoticons tags
- *
- * This class implements a Text_Wiki_Rule to find source text marked as
- * smileys defined by symbols as ':)' , ':-)' or ':smile:'
- * The symbol is replaced with a token.
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Smiley.php,v 1.6 2005/10/04 08:17:51 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Smiley rule parser class for Default.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki_Parse::Text_Wiki_Parse()
- */
-class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
-
-    /**
-     * Configuration keys for this rule
-     * 'smileys' => array Smileys recognized by this rule, symbols key definitions:
-     *              'symbol' => array ( 'name', 'description' [, 'variante', ...] ) as
-     *                  ':)'  => array('smile', 'Smile'),
-     *                  ':D'  => array('biggrin', 'Very Happy',':grin:'),
-     *              the eventual elements after symbol and description are variantes
-     *
-     * 'auto_nose' => boolean enabling the auto nose feature:
-     *                auto build a variante for 2 chars symbols by inserting a '-' as ':)' <=> ':-)'
-     *
-     * @access public
-     * @var array 'config-key' => mixed config-value
-     */
-    var $conf = array(
-        'smileys' => array(
-            ':D'        => array('biggrin', 'Very Happy', ':grin:'),
-            ':)'        => array('smile', 'Smile', '(:'),
-            ':('        => array('sad', 'Sad', '):'),
-            ':o'        => array('surprised', 'Surprised', ':eek:', 'o:'),
-            ':shock:'   => array('eek', 'Shocked'),
-            ':?'        => array('confused', 'Confused', ':???:'),
-            '8)'        => array('cool', 'Cool', '(8'),
-            ':lol:'     => array('lol', 'Laughing'),
-            ':x'        => array('mad', 'Mad'),
-            ':P'        => array('razz', 'Razz'),
-            ':oops:'    => array('redface', 'Embarassed'),
-            ':cry:'     => array('cry', 'Crying or Very sad'),
-            ':evil:'    => array('evil', 'Evil or Very Mad'),
-            ':twisted:' => array('twisted', 'Twisted Evil'),
-            ':roll:'    => array('rolleyes', 'Rolling Eyes'),
-            ';)'        => array('wink', 'Wink', '(;'),
-            ':!:'       => array('exclaim', 'Exclamation'),
-            ':?:'       => array('question', 'Question'),
-            ':idea:'    => array('idea', 'Idea'),
-            ':arrow:'   => array('arrow', 'Arrow'),
-            ':|'        => array('neutral', 'Neutral', '|:'),
-            ':mrgreen:' => array('mrgreen', 'Mr. Green'),
-        ),
-        'auto_nose' => true
-    );
-
-    /**
-     * Definition array of smileys, variantes references their model
-     * 'symbol' => array ( 'name', 'description')
-     *
-     * @access private
-     * @var array 'config-key' => mixed config-value
-     */
-    var $_smileys = array();
-
-     /**
-     * Constructor.
-     * We override the constructor to build up the regex from config
-     *
-     * @param object &$obj the base conversion handler
-     * @return The parser object
-     * @access public
-     */
-    function Text_Wiki_Parse_Smiley(&$obj)
-    {
-        $default = $this->conf;
-        parent::Text_Wiki_Parse($obj);
-
-        // read the list of smileys to sort out variantes and :xxx: while building the regexp
-        $this->_smileys = $this->getConf('smileys', $default['smileys']);
-        $autoNose = $this->getConf('auto_nose', $default['auto_nose']);
-        $reg1 = $reg2 = '';
-        $sep1 = ':(?:';
-        $sep2 = '';
-        foreach ($this->_smileys as $smiley => $def) {
-            for ($i = 1; $i < count($def); $i++) {
-                if ($i > 1) {
-                    $cur = $def[$i];
-                    $this->_smileys[$cur] = &$this->_smileys[$smiley];
-                } else {
-                    $cur = $smiley;
-                }
-                $len = strlen($cur);
-                if (($cur{0} == ':') && ($len > 2) && ($cur{$len - 1} == ':')) {
-                    $reg1 .= $sep1 . preg_quote(substr($cur, 1, -1), '#');
-                    $sep1 = '|';
-                    continue;
-                }
-                if ($autoNose && ($len === 2)) {
-                    $variante = $cur{0} . '-' . $cur{1};
-                    $this->_smileys[$variante] = &$this->_smileys[$smiley];
-                    $cur = preg_quote($cur{0}, '#') . '-?' . preg_quote($cur{1}, '#');
-                } else {
-                    $cur = preg_quote($cur, '#');
-                }
-                $reg2 .= $sep2 . $cur;
-                $sep2 = '|';
-            }
-        }
-        $delim = '[\n\r\s' . $this->wiki->delim . '$^]';
-        $this->regex = '#(?<=' . $delim .
-             ')(' . ($reg1 ? $reg1 . '):' . ($reg2 ? '|' : '') : '') . $reg2 .
-             ')(?=' . $delim . ')#i';
-    }
-
-    /**
-     * Generates a replacement token for the matched text.  Token options are:
-     *     'symbol' => the original marker
-     *     'name' => the name of the smiley
-     *     'desc' => the description of the smiley
-     *
-     * @param array &$matches The array of matches from parse().
-     * @return string Delimited token representing the smiley
-     * @access public
-     */
-    function process(&$matches)
-    {
-        // tokenize
-        return $this->wiki->addToken($this->rule,
-            array(
-                'symbol' => $matches[1],
-                'name'   => $this->_smileys[$matches[1]][0],
-                'desc'   => $this->_smileys[$matches[1]][1]
-            ));
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Default/Strong.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for strongly-emphasized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Strong.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-
-/**
-* 
-* Parses for strongly-emphasized text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked for
-* strong emphasis (bold) as defined by text surrounded by three
-* single-quotes. On parsing, the text itself is left in place, but the
-* starting and ending instances of three single-quotes are replaced with
-* tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Strong extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/\*\*(.*?)\*\*/";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Subscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for subscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Subscript.php,v 1.1 2005/02/24 17:24:56 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for subscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/,,(()|.*),,/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Superscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for superscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Superscript.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for superscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/\^\^(()|.*)\^\^/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Table.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for table markup.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Table.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for table markup.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as a
-* set of table rows, where a line start and ends with double-pipes (||)
-* and uses double-pipes to separate table cells.  The rows must be on
-* sequential lines (no blank lines between them) -- a blank line
-* indicates the beginning of a new table.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/\n((\|\|).*)(\n)(?!(\|\|))/Us';
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.
-    * 
-    * Token options are:
-    * 
-    * 'type' =>
-    *     'table_start' : the start of a bullet list
-    *     'table_end'   : the end of a bullet list
-    *     'row_start' : the start of a number list
-    *     'row_end'   : the end of a number list
-    *     'cell_start'   : the start of item text (bullet or number)
-    *     'cell_end'     : the end of item text (bullet or number)
-    * 
-    * 'cols' => the number of columns in the table (for 'table_start')
-    * 
-    * 'rows' => the number of rows in the table (for 'table_start')
-    * 
-    * 'span' => column span (for 'cell_start')
-    * 
-    * 'attr' => column attribute flag (for 'cell_start')
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * table elements and cell text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // our eventual return value
-        $return = '';
-        
-        // the number of columns in the table
-        $num_cols = 0;
-        
-        // the number of rows in the table
-        $num_rows = 0;
-        
-        // rows are separated by newlines in the matched text
-        $rows = explode("\n", $matches[1]);
-        
-        // loop through each row
-        foreach ($rows as $row) {
-            
-            // increase the row count
-            $num_rows ++;
-            
-            // start a new row
-            $return .= $this->wiki->addToken(
-                $this->rule,
-                array('type' => 'row_start')
-            );
-            
-            // cells are separated by double-pipes
-            $cell = explode("||", $row);
-            
-            // get the number of cells (columns) in this row
-            $last = count($cell) - 1;
-            
-            // is this more than the current column count?
-            // (we decrease by 1 because we never use cell zero)
-            if ($last - 1 > $num_cols) {
-                // increase the column count
-                $num_cols = $last - 1;
-            }
-            
-            // by default, cells span only one column (their own)
-            $span = 1;
-            
-            // ignore cell zero, and ignore the "last" cell; cell zero
-            // is before the first double-pipe, and the "last" cell is
-            // after the last double-pipe. both are always empty.
-            for ($i = 1; $i < $last; $i ++) {
-                
-                // if there is no content at all, then it's an instance
-                // of two sets of || next to each other, indicating a
-                // span.
-                if ($cell[$i] == '') {
-                    
-                    // add to the span and loop to the next cell
-                    $span += 1;
-                    continue;
-                    
-                } else {
-                    
-                    // this cell has content.
-                    
-                    // find any special "attr"ibute cell markers
-                    if (substr($cell[$i], 0, 2) == '> ') {
-                        // right-align
-                        $attr = 'right';
-                        $cell[$i] = substr($cell[$i], 2);
-                    } elseif (substr($cell[$i], 0, 2) == '= ') {
-                        // center-align
-                        $attr = 'center';
-                        $cell[$i] = substr($cell[$i], 2);
-                    } elseif (substr($cell[$i], 0, 2) == '< ') {
-                        // left-align
-                        $attr = 'left';
-                        $cell[$i] = substr($cell[$i], 2);
-                    } elseif (substr($cell[$i], 0, 2) == '~ ') {
-                        $attr = 'header';
-                        $cell[$i] = substr($cell[$i], 2);
-                    } else {
-                        $attr = null;
-                    }
-                    
-                    // start a new cell...
-                    $return .= $this->wiki->addToken(
-                        $this->rule, 
-                        array (
-                            'type' => 'cell_start',
-                            'attr' => $attr,
-                            'span' => $span
-                        )
-                    );
-                    
-                    // ...add the content...
-                    $return .= trim($cell[$i]);
-                    
-                    // ...and end the cell.
-                    $return .= $this->wiki->addToken(
-                        $this->rule, 
-                        array (
-                            'type' => 'cell_end',
-                            'attr' => $attr,
-                            'span' => $span
-                        )
-                    );
-                    
-                    // reset the span.
-                    $span = 1;
-                }
-                    
-            }
-            
-            // end the row
-            $return .= $this->wiki->addToken(
-                $this->rule,
-                array('type' => 'row_end')
-            );
-            
-        }
-        
-        // wrap the return value in start and end tokens 
-        $return =
-            $this->wiki->addToken(
-                $this->rule,
-                array(
-                    'type' => 'table_start',
-                    'rows' => $num_rows,
-                    'cols' => $num_cols
-                )
-            )
-            . $return .
-            $this->wiki->addToken(
-                $this->rule,
-                array(
-                    'type' => 'table_end'
-                )
-            );
-        
-        // we're done!
-        return "\n$return\n\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Tighten.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<?php
-
-/**
-* 
-* The rule removes all remaining newlines.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Tighten.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-
-/**
-* 
-* The rule removes all remaining newlines.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Tighten extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Apply tightening directly to the source text.
-    *
-    * @access public
-    * 
-    */
-    
-    function parse()
-    {
-        $this->wiki->source = str_replace("\n", '',
-            $this->wiki->source);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Toc.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-<?php
-
-/**
-* 
-* Looks through parsed text and builds a table of contents.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Toc.php,v 1.4 2005/05/28 21:33:02 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Looks through parsed text and builds a table of contents.
-* 
-* This class implements a Text_Wiki_Parse to find all heading tokens and
-* build a table of contents.  The [[toc]] tag gets replaced with a list
-* of all the level-2 through level-6 headings.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-
-class Text_Wiki_Parse_Toc extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\n\[\[toc( .*)?\]\]\n/m";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.
-    *  
-    * Token options are:
-    * 
-    * 'type' => ['list_start'|'list_end'|'item_start'|'item_end'|'target']
-    *
-    * 'level' => The heading level (1-6).
-    *
-    * 'count' => Which entry number this is in the list.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A token indicating the TOC collection point.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $count = 0;
-        
-        if (isset($matches[1])) {
-            $attr = $this->getAttrs(trim($matches[1]));
-        } else {
-            $attr = array();
-        }
-        
-        $output = $this->wiki->addToken(
-            $this->rule,
-            array(
-                'type' => 'list_start',
-                'level' => 0,
-                'attr' => $attr
-            )
-        );
-        
-        foreach ($this->wiki->getTokens('Heading') as $key => $val) {
-            
-            if ($val[1]['type'] != 'start') {
-                continue;
-            }
-            
-            $options = array(
-                'type'  => 'item_start',
-                'id'    => $val[1]['id'],
-                'level' => $val[1]['level'],
-                'count' => $count ++
-            );
-            
-            $output .= $this->wiki->addToken($this->rule, $options);
-            
-            $output .= $val[1]['text'];
-            
-            $output .= $this->wiki->addToken(
-                $this->rule,
-                array(
-                    'type' => 'item_end',
-                    'level' => $val[1]['level']
-                )
-            );
-        }
-        
-        $output .= $this->wiki->addToken(
-            $this->rule, array(
-                'type' => 'list_end',
-                'level' => 0
-            )
-        );
-        
-        return "\n$output\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Tt.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-<?php
-
-/**
-* 
-* Find source text marked for teletype (monospace).
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Tt.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Find source text marked for teletype (monospace).
-* 
-* Defined by text surrounded by two curly braces. On parsing, the text
-* itself is left in place, but the starting and ending instances of
-* curly braces are replaced with tokens.
-* 
-* Token options are:
-* 
-* 'type' => ['start'|'end'] The starting or ending point of the
-* teletype text.  The text itself is left in the source.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Tt extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/{{({*?.*}*?)}}/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text. 
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the teletype text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Underline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for bold text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Underline.php,v 1.1 2005/07/10 20:40:20 justinpatrin Exp $
-* 
-*/
-
-/**
-* 
-* Parses for bold text.
-* 
-* This class implements a Text_Wiki_Rule to find source text marked for
-* strong emphasis (bold) as defined by text surrounded by three
-* single-quotes. On parsing, the text itself is left in place, but the
-* starting and ending instances of three single-quotes are replaced with
-* tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Underline extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/__(()|[^_].*)__/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
-        $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Url.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-<?php
-
-/**
-* 
-* Parse for URLS in the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Url.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parse for URLS in the source text.
-* 
-* Various URL markings are supported: inline (the URL by itself),
-* numbered or footnote reference (where the URL is enclosed in square
-* brackets), and named reference (where the URL is enclosed in square
-* brackets and has a name included inside the brackets).  E.g.:
-*
-* inline    -- http://example.com
-* numbered  -- [http://example.com]
-* described -- [http://example.com Example Description]
-*
-* When rendering a URL token, this will convert URLs pointing to a .gif,
-* .jpg, or .png image into an inline <img /> tag (for the 'xhtml'
-* format).
-*
-* Token options are:
-* 
-* 'type' => ['inline'|'footnote'|'descr'] the type of URL
-* 
-* 'href' => the URL link href portion
-* 
-* 'text' => the displayed text of the URL link
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Keeps a running count of numbered-reference URLs.
-    * 
-    * @access public
-    * 
-    * @var int
-    * 
-    */
-    
-    var $footnoteCount = 0;
-    
-    
-    /**
-    * 
-    * URL schemes recognized by this rule.
-    * 
-    * @access public
-    * 
-    * @var array
-    * 
-    */
-    
-    var $conf = array(
-        'schemes' => array(
-            'http://',
-            'https://',
-            'ftp://',
-            'gopher://',
-            'news://',
-            'mailto:'
-        )
-    );
-    
-    
-    /**
-    * 
-    * Constructor.
-    * 
-    * We override the constructor so we can comment the regex nicely.
-    * 
-    * @access public
-    * 
-    */
-    
-    function Text_Wiki_Parse_Url(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-        
-        // convert the list of recognized schemes to a regex-safe string,
-        // where the pattern delim is a slash
-        $tmp = array();
-        $list = $this->getConf('schemes', array());
-        foreach ($list as $val) {
-            $tmp[] = preg_quote($val, '/');
-        }
-        $schemes = implode('|', $tmp);
-        
-        // build the regex
-        $this->regex =
-            "($schemes)" . // allowed schemes
-            "(" . // start pattern
-            "[^ \\/".'"'."\'{$this->wiki->delim}]*\\/" . // no spaces, backslashes, slashes, double-quotes, single quotes, or delimiters;
-            ")*" . // end pattern
-            "[^ \\t\\n\\/".'"'."\'{$this->wiki->delim}]*" .
-            "[A-Za-z0-9\\/?=&~_]";
-    }
-    
-    
-    /**
-    * 
-    * Find three different kinds of URLs in the source text.
-    *
-    * @access public
-    * 
-    */
-    
-    function parse()
-    {
-        // -------------------------------------------------------------
-        // 
-        // Described-reference (named) URLs.
-        // 
-        
-        // the regular expression for this kind of URL
-        $tmp_regex = '/\[(' . $this->regex . ') ([^\]]+)\]/';
-        
-        // use a custom callback processing method to generate
-        // the replacement text for matches.
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processDescr'),
-            $this->wiki->source
-        );
-        
-        
-        // -------------------------------------------------------------
-        // 
-        // Numbered-reference (footnote-style) URLs.
-        // 
-        
-        // the regular expression for this kind of URL
-        $tmp_regex = '/\[(' . $this->regex . ')\]/U';
-        
-        // use a custom callback processing method to generate
-        // the replacement text for matches.
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processFootnote'),
-            $this->wiki->source
-        );
-        
-        
-        // -------------------------------------------------------------
-        // 
-        // Normal inline URLs.
-        // 
-        
-        // the regular expression for this kind of URL
-        
-        $tmp_regex = '/(^|[^A-Za-z])(' . $this->regex . ')(.*?)/';
-        
-        // use the standard callback for inline URLs
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-    }
-    
-    
-    /**
-    * 
-    * Process inline URLs.
-    * 
-    * @param array &$matches
-    * 
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    * 
-    * @return string The processed text replacement.
-    * 
-    */ 
-    
-    function process(&$matches)
-    {
-        // set options
-        $options = array(
-            'type' => 'inline',
-            'href' => $matches[2],
-            'text' => $matches[2]
-        );
-        
-        // tokenize
-        return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[5];
-    }
-    
-    
-    /**
-    * 
-    * Process numbered (footnote) URLs.
-    * 
-    * Token options are:
-    * @param array &$matches
-    * 
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    * 
-    * @return string The processed text replacement.
-    * 
-    */ 
-    
-    function processFootnote(&$matches)
-    {
-        // keep a running count for footnotes 
-        $this->footnoteCount++;
-        
-        // set options
-        $options = array(
-            'type' => 'footnote',
-            'href' => $matches[1],
-            'text' => $this->footnoteCount
-        );
-        
-        // tokenize
-        return $this->wiki->addToken($this->rule, $options);
-    }
-    
-    
-    /**
-    * 
-    * Process described-reference (named-reference) URLs.
-    * 
-    * Token options are:
-    *     'type' => ['inline'|'footnote'|'descr'] the type of URL
-    *     'href' => the URL link href portion
-    *     'text' => the displayed text of the URL link
-    * 
-    * @param array &$matches
-    * 
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    * 
-    * @return string The processed text replacement.
-    * 
-    */ 
-    
-    function processDescr(&$matches)
-    {
-        // set options
-        $options = array(
-            'type' => 'descr',
-            'href' => $matches[1],
-            'text' => $matches[4]
-        );
-        
-        // tokenize
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Default/Wikilink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,197 +0,0 @@
-<?php
-
-/**
-*
-* Parse for links to wiki pages.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-* @license LGPL
-*
-* @version $Id: Wikilink.php,v 1.5 2005/09/14 14:29:38 toggg Exp $
-*
-*/
-
-/**
-*
-* Parse for links to wiki pages.
-*
-* Wiki page names are typically in StudlyCapsStyle made of
-* WordsSmashedTogether.
-*
-* You can also create described links to pages in this style:
-* [WikiPageName nice text link to use for display]
-*
-* The token options for this rule are:
-*
-* 'page' => the wiki page name.
-*
-* 'text' => the displayed link text.
-*
-* 'anchor' => a named anchor on the target wiki page.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-*/
-
-class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
-
-    var $conf = array (
-    	'ext_chars' => false
-    );
-
-    /**
-    *
-    * Constructor.
-    *
-    * We override the Text_Wiki_Parse constructor so we can
-    * explicitly comment each part of the $regex property.
-    *
-    * @access public
-    *
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    *
-    */
-
-    function Text_Wiki_Parse_Wikilink(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-
-        if ($this->getConf('ext_chars')) {
-        	// use an extended character set; this should
-        	// allow for umlauts and so on.  taken from the
-        	// Tavi project defaults.php file.
-			$upper = "A-Z\xc0-\xde";
-			$lower = "a-z0-9\xdf-\xfe";
-			$either = "A-Za-z0-9\xc0-\xfe";
-		} else {
-			// the default character set, should be fine
-			// for most purposes.
-			$upper = "A-Z";
-			$lower = "a-z0-9";
-			$either = "A-Za-z0-9";
-		}
-
-        // build the regular expression for finding WikiPage names.
-        $this->regex =
-            "(!?" .            // START WikiPage pattern (1)
-            "[$upper]" .       // 1 upper
-            "[$either]*" .     // 0+ alpha or digit
-            "[$lower]+" .      // 1+ lower or digit
-            "[$upper]" .       // 1 upper
-            "[$either]*" .     // 0+ or more alpha or digit
-            ")" .              // END WikiPage pattern (/1)
-            "((\#" .           // START Anchor pattern (2)(3)
-            "[$either]" .      // 1 alpha
-            "(" .              // start sub pattern (4)
-            "[-_$either:.]*" . // 0+ dash, alpha, digit, underscore, colon, dot
-            "[-_$either]" .    // 1 dash, alpha, digit, or underscore
-            ")?)?)";           // end subpatterns (/4)(/3)(/2)
-    }
-
-
-    /**
-    *
-    * First parses for described links, then for standalone links.
-    *
-    * @access public
-    *
-    * @return void
-    *
-    */
-
-    function parse()
-    {
-        // described wiki links
-        $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processDescr'),
-            $this->wiki->source
-        );
-
-        // standalone wiki links
-        if ($this->getConf('ext_chars')) {
-			$either = "A-Za-z0-9\xc0-\xfe";
-		} else {
-			$either = "A-Za-z0-9";
-		}
-
-        $tmp_regex = "/(^|[^{$either}\-_]){$this->regex}/";
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-    }
-
-
-    /**
-    *
-    * Generate a replacement for described links.
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-
-    function processDescr(&$matches)
-    {
-        // set the options
-        $options = array(
-            'page'   => $matches[1],
-            'text'   => $matches[5],
-            'anchor' => $matches[3]
-        );
-
-        // create and return the replacement token and preceding text
-        return $this->wiki->addToken($this->rule, $options); // . $matches[7];
-    }
-
-
-    /**
-    *
-    * Generate a replacement for standalone links.
-    *
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text prior to the match.
-    *
-    */
-
-    function process(&$matches)
-    {
-        // when prefixed with !, it's explicitly not a wiki link.
-        // return everything as it was.
-        if ($matches[2]{0} == '!') {
-            return $matches[1] . substr($matches[2], 1) . $matches[3];
-        }
-
-        // set the options
-        $options = array(
-            'page' => $matches[2],
-            'text' => $matches[2] . $matches[3],
-            'anchor' => $matches[3]
-        );
-
-        // create and return the replacement token and preceding text
-        return $matches[1] . $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Anchor.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for anchor targets.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Manuel Holtgrewe <purestorm at ggnore dot net>
-*
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Anchor.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* This class implements a Text_Wiki_Parse to add an anchor target name
-* in the wiki page.
-*
-* @author Manuel Holtgrewe <purestorm at ggnore dot net>
-*
-* @author Paul M. Jones <pmjones at ciaweb dot net>
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-*/
-
-class Text_Wiki_Parse_Anchor extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.  Looks like a macro: [[# anchor_name]]
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/(\[\[# )([-_A-Za-z0-9.]+?)( .+)?(\]\])/i';
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text, not including the <code></code> tags.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches) {
-    
-        $name = $matches[2];
-        $text = $matches[3];
-        
-        $start = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'start', 'name' => $name)
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'end', 'name' => $name)
-        );
-        
-        // done, place the script output directly in the source
-        return $start . trim($text) . $end;
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Blockquote.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-<?php
-
-/**
-* 
-* Parse for block-quoted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Blockquote.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parse for block-quoted text.
-* 
-* Find source text marked as a blockquote, identified by any number of
-* greater-than signs '>' at the start of the line, followed by a space,
-* and then the quote text; each '>' indicates an additional level of
-* quoting.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Blockquote extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Regex for parsing the source text.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/\n((\>).*\n)(?!(\>))/Us';
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.
-    * 
-    * Token options are:
-    * 
-    * 'type' =>
-    *     'start' : the start of a blockquote
-    *     'end'   : the end of a blockquote
-    *
-    * 'level' => the indent level (0 for the first level, 1 for the
-    * second, etc)
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * list text and list elements.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // the replacement text we will return to parse()
-        $return = '';
-        
-        // the list of post-processing matches
-        $list = array();
-        
-        // $matches[1] is the text matched as a list set by parse();
-        // create an array called $list that contains a new set of
-        // matches for the various list-item elements.
-        preg_match_all(
-            '=^(\>+) (.*\n)=Ums',
-            $matches[1],
-            $list,
-            PREG_SET_ORDER
-        );
-        
-        // a stack of starts and ends; we keep this so that we know what
-        // indent level we're at.
-        $stack = array();
-        
-        // loop through each list-item element.
-        foreach ($list as $key => $val) {
-            
-            // $val[0] is the full matched list-item line
-            // $val[1] is the number of initial '>' chars (indent level)
-            // $val[2] is the quote text
-            
-            // we number levels starting at 1, not zero
-            $level = strlen($val[1]);
-            
-            // get the text of the line
-            $text = $val[2];
-            
-            // add a level to the list?
-            while ($level > count($stack)) {
-                
-                // the current indent level is greater than the number
-                // of stack elements, so we must be starting a new
-                // level.  push the new level onto the stack with a 
-                // dummy value (boolean true)...
-                array_push($stack, true);
-                
-                $return .= "\n";
-                
-                // ...and add a start token to the return.
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array(
-                        'type' => 'start',
-                        'level' => $level - 1
-                    )
-                );
-                
-                $return .= "\n\n";
-            }
-            
-            // remove a level?
-            while (count($stack) > $level) {
-                
-                // as long as the stack count is greater than the
-                // current indent level, we need to end list types.
-                // continue adding end-list tokens until the stack count
-                // and the indent level are the same.
-                array_pop($stack);
-                
-                $return .= "\n\n";
-                
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array (
-                        'type' => 'end',
-                        'level' => count($stack)
-                    )
-                );
-                
-                $return .= "\n";
-            }
-            
-            // add the line text.
-            $return .= $text;
-        }
-        
-        // the last line may have been indented.  go through the stack
-        // and create end-tokens until the stack is empty.
-        $return .= "\n";
-        
-        while (count($stack) > 0) {
-            array_pop($stack);
-            $return .= $this->wiki->addToken(
-                $this->rule, 
-                array (
-                    'type' => 'end',
-                    'level' => count($stack)
-                )
-            );
-        }
-        
-        // we're done!  send back the replacement text.
-        return "\n$return\n\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Bold.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for bold text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Bold.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for bold text.
-* 
-* This class implements a Text_Wiki_Rule to find source text marked for
-* strong emphasis (bold) as defined by text surrounded by three
-* single-quotes. On parsing, the text itself is left in place, but the
-* starting and ending instances of three single-quotes are replaced with
-* tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Bold extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/'''(()|[^'].*)'''/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
-        $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Break.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for explicit line breaks.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Break.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for explicit line breaks.
-* 
-* This class implements a Text_Wiki_Parse to mark forced line breaks in the
-* source text.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Break extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/ _\n/';
-    
-    
-    /**
-    * 
-    * Generates a replacement token for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A delimited token to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $this->wiki->addToken($this->rule);
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Center.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for centered lines of text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Center.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for centered lines of text.
-* 
-* This class implements a Text_Wiki_Parse to find lines marked for centering.
-* The line must start with "= " (i.e., an equal-sign followed by a space).
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Center extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/\n\= (.*?)\n/';
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule,
-            array('type' => 'end')
-        );
-        
-        return "\n" . $start . $matches[1] . $end . "\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Code.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for text marked as a code example block.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Code.php,v 1.10 2006/02/21 14:33:53 toggg Exp $
-* 
-*/
-
-/**
-* 
-* Parses for text marked as a code example block.
-* 
-* This class implements a Text_Wiki_Parse to find sections marked as code
-* examples.  Blocks are marked as the string <code> on a line by itself,
-* followed by the inline code example, and terminated with the string
-* </code> on a line by itself.  The code example is run through the
-* native PHP highlight_string() function to colorize it, then surrounded
-* with <pre>...</pre> tags when rendered as XHTML.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Code extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-/*    var $regex = '/^(\<code( .+)?\>)\n(.+)\n(\<\/code\>)(\s|$)/Umsi';*/
-    var $regex = ';^<code(\s[^>]*)?>((?:(?R)|.)*?)\n</code>(\s|$);msi';
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text, not including the <code></code> tags.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // are there additional attribute arguments?
-        $args = trim($matches[1]);
-        
-        if ($args == '') {
-            $options = array(
-                'text' => $matches[2],
-                'attr' => array('type' => '')
-            );
-        } else {
-        	// get the attributes...
-        	$attr = $this->getAttrs($args);
-        	
-        	// ... and make sure we have a 'type'
-        	if (! isset($attr['type'])) {
-        		$attr['type'] = '';
-        	}
-        	
-        	// retain the options
-            $options = array(
-                'text' => $matches[2],
-                'attr' => $attr
-            );
-        }
-        
-        return $this->wiki->addToken($this->rule, $options) . $matches[3];
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Colortext.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for colorized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Colortext.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for colorized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Colortext extends Text_Wiki_Parse {
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\#\#(.+?)\|(.+?)\#\#/";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * 'color' => the color indicator
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the text to be
-    * emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'start',
-                'color' => $matches[1]
-            )
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'end',
-                'color' => $matches[1]
-            )
-        );
-        
-        return $start . $matches[2] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Deflist.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,277 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
-* 
-* Mediawiki: Parse for definition lists.
-* 
-* @category Text
-* @package Text_Wiki
-* @author Justin Patrin <papercrane@reversefold.com>
-* @author Paul M. Jones <pmjones@php.net>
-* @author Moritz Venn <ritzmo@php.net>
-* @license LGPL
-* @version $Id: Deflist.php,v 1.1 2006/03/29 18:41:43 ritzmo Exp $
-* 
-*/
-
-/**
-* 
-* Parses for definition lists.
-*
-* This class implements a Text_Wiki_Parse to find source text marked as a
-* definition list.
-* If a line starts with ';' or ':' it is considered a part of a definition
-* list. ';' indicates the term to be defined and ':' indicates its definition.
-* As in Mediawiki we also allow definition lists to only consist of one
-* item-type.
-*
-* @category Text
-* @package Text_Wiki
-* 
-* @author Justin Patrin <papercrane@reversefold.com>
-* @author Paul M. Jones <pmjones@php.net>
-* @author Moritz Venn <ritzmo@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Deflist extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-
-    var $regex = '/\n((?:\;|\:)+.*?\n(?!(?:\;|\:)+))/s';
- 
-   /**
-    *
-    * Generates a replacement for the matched text.  Token options are:
-    *
-    * 'type' =>
-    *     'list_start'    : the start of a definition list
-    *     'list_end'      : the end of a definition list
-    *     'term_start'    : the start of a definition term
-    *     'term_end'      : the end of a definition term
-    *     'narr_start'    : the start of definition narrative
-    *     'narr_end'      : the end of definition narrative
-    *     'unknown'       : unknown type of definition portion
-    *
-    * 'level' => the indent level (0 for the first level, 1 for the
-    * second, etc)
-    *
-    * 'count' => the list item number at this level. not needed for
-    * xhtml, but very useful for PDF and RTF.
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * list text and list elements.
-    *
-    */ 
-    function process(&$matches)
-    {
-        // the replacement text we will return
-        $return = '';
-        
-        // the list of post-processing matches
-        $list = array();
-        
-        // a stack of list-start and list-end types; we keep this
-        // so that we know what kind of list we're working with
-        // (bullet or number) and what indent level we're at.
-        $stack = array();
-        
-        // the item count is the number of list items for any
-        // given list-type on the stack
-        $itemcount = array();
-        
-        // have we processed the very first list item?
-        $pastFirst = false;
-        
-        // populate $list with this set of matches. $matches[1] is the
-        // text matched as a list set by parse().
-        preg_match_all(
-            '/^((;|:)+)(.*?)$/ms',
-            $matches[1],
-            $list,
-            PREG_SET_ORDER
-        );
-
-	// loop through each list-item element.
-        foreach ($list as $key => $val) {
-            // $val[0] is the full matched list-item line
-            // $val[1] is the type (* or #)
-            // $val[2] is the level (number)
-            // $val[3] is the list item text
-            
-            // how many levels are we indented? (1 means the "root"
-            // list level, no indenting.)
-            $level = strlen($val[1]);
-            
-            // get the list item type
-            if ($val[2] == ';') {
-                $type = 'term';
-            } elseif ($val[2] == ':') {
-                $type = 'narr';
-            } else {
-                $type = 'unknown';
-            }
-            
-            // get the text of the list item
-            $text = $val[3];
-
-            // add a level to the list?
-            if ($level > count($stack)) {
-
-                // the current indent level is greater than the
-                // number of stack elements, so we must be starting
-                // a new list.  push the new list type onto the
-                // stack...
-                array_push($stack, $type);
-
-		// The new list has to be opened in an item (use current type)
-		if ($level > 1) {
-		$return .= $this->wiki->addToken(
-		    $this->rule,
-		    array(
-		        'type' => $type . '_start',
-		        'level' => $level - 1
-                    )
-                );
-		}
-		// ...and add a list-start token to the return.
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array(
-                        'type' => 'list_start',
-                        'level' => $level - 1
-                    )
-                );
-            }
-
-	    // remove a level from the list?
-	    while (count($stack) > $level) {
-                // so we don't keep counting the stack, we set up a temp
-                // var for the count.  -1 becuase we're going to pop the
-                // stack in the next command.  $tmp will then equal the
-                // current level of indent.
-                $tmp = count($stack) - 1;
-                
-                // as long as the stack count is greater than the
-                // current indent level, we need to end list types. 
-                // continue adding end-list tokens until the stack count
-                // and the indent level are the same.
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array (
-                        'type' => 'list_end',
-                        'level' => $tmp
-                    )
-                );
-
-                array_pop($stack);
-
-		// reset to the current (previous) list type so that
-                // the new list item matches the proper list type.
-		$type = $stack[$tmp - 1];
-
-		// Close the previously opened List item
-		$return .= $this->wiki->addToken(
-                    $this->rule,
-                    array (
-                        'type' => $type . '_end',
-                        'level' => $tmp
-                    )
-                );
-                
-                // reset the item count for the popped indent level
-                unset($itemcount[$tmp + 1]);
-            }
-            
-            // add to the item count for this list (taking into account
-            // which level we are at).
-            if (! isset($itemcount[$level])) {
-                // first count
-                $itemcount[$level] = 0;
-            } else {
-                // increment count
-                $itemcount[$level]++;
-            }
-            
-            // is this the very first item in the list?
-            if (! $pastFirst) {
-                $first = true;
-                $pastFirst = true;
-            } else {
-                $first = false;
-            }
-            
-            // create a list-item starting token.
-            $start = $this->wiki->addToken(
-                $this->rule, 
-                array(
-                    'type' => $type . '_start',
-                    'level' => $level,
-                    'count' => $itemcount[$level],
-                    'first' => $first
-                )
-            );
-            
-            // create a list-item ending token.
-            $end = $this->wiki->addToken(
-                $this->rule, 
-                array(
-                    'type' => $type . '_end',
-                    'level' => $level,
-                    'count' => $itemcount[$level]
-                )
-            );
-            
-            // add the starting token, list-item text, and ending token
-            // to the return.
-            $return .= $start . $text . $end;
-        }
-        
-        // the last list-item may have been indented.  go through the
-        // list-type stack and create end-list tokens until the stack
-	// is empty.
-	$level = count($stack);
-	while ($level > 0) {
-	    array_pop($stack);
-            $return .= $this->wiki->addToken(
-                $this->rule, 
-                array (
-                    'type' => 'list_end',
-                    'level' => $level - 1
-                )
-            );
-
-            // if we are higher than level 1 we need to close fake items
-            if ($level > 1) {
-		$return .= $this->wiki->addToken(
-                $this->rule,
-                array (
-                    'type' => $stack[$level - 2] . '_end',
-                    'level' => $level - 2
-                )
-                );
-	    }
-	    $level = count($stack);
-	}
-        
-        // we're done!  send back the replacement text.
-        return "\n" . $return . "\n\n";
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Delimiter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for Text_Wiki delimiter characters already in the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Delimiter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for Text_Wiki delimiter characters already in the source text.
-* 
-* This class implements a Text_Wiki_Parse to find instances of the delimiter
-* character already embedded in the source text; it extracts them and replaces
-* them with a delimited token, then renders them as the delimiter itself
-* when the target format is XHTML.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Delimiter extends Text_Wiki_Parse {
-    
-    /**
-    * 
-    * Constructor.  Overrides the Text_Wiki_Parse constructor so that we
-    * can set the $regex property dynamically (we need to include the
-    * Text_Wiki $delim character.
-    * 
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    * 
-    * @param string $name The token name to use for this rule.
-    * 
-    */
-    
-    function Text_Wiki_Parse_delimiter(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-        $this->regex = '/' . $this->wiki->delim . '/';
-    }
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $this->wiki->addToken(
-            $this->rule,
-            array('text' => $this->wiki->delim)
-        );
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Embed.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-<?php
-
-/**
-* 
-* Embeds the results of a PHP script at render-time.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Embed.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Embeds the results of a PHP script at render-time.
-* 
-* This class implements a Text_Wiki_Parse to embed the contents of a URL
-* inside the page at render-time.  Typically used to get script output.
-* This differs from the 'include' rule, which incorporates results at
-* parse-time; 'embed' output does not get parsed by Text_Wiki, while
-* 'include' ouput does.
-*
-* This rule is inherently not secure; it allows cross-site scripting to
-* occur if the embedded output has <script> or other similar tags.  Be
-* careful.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Embed extends Text_Wiki_Parse {
-    
-    var $conf = array(
-        'base' => '/path/to/scripts/'
-    );
-    
-    var $file = null;
-
-    var $output = null;
-
-    var $vars = null;
-
-
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/(\[\[embed )(.+?)( .+?)?(\]\])/i';
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text, not including the <code></code> tags.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        // save the file location
-        $this->file = $this->getConf('base', './') . $matches[2];
-        
-        // extract attribs as variables in the local space
-        $this->vars = $this->getAttrs($matches[3]);
-        unset($this->vars['this']);
-        extract($this->vars);
-        
-        // run the script
-        ob_start();
-        include($this->file);
-        $this->output = ob_get_contents();
-        ob_end_clean();
-        
-        // done, place the script output directly in the source
-        return $this->wiki->addToken(
-            $this->rule,
-            array('text' => $this->output)
-        );
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Emphasis.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Mediawiki: Parses for emphazised text.
- *
- * Text_Wiki rule parser to find source text emphazised
- * as defined by text surrounded by repeated single quotes  ''...'' and more
- * Translated are ''emphasis'' , '''strong''' or '''''both''''' ...
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @author     Paul M. Jones <pmjones@php.net>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Emphasis.php,v 1.4 2006/02/15 12:27:40 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Emphazised text rule parser class for Mediawiki. Makes Emphasis, Strong or both
- * This class implements a Text_Wiki_Parse to find source text marked for
- * emphasis, stronger and very as defined by text surrounded by 2,3 or 5 single-quotes.
- * On parsing, the text itself is left in place, but the starting and ending
- * instances of the single-quotes are replaced with tokens.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki_Parse::Text_Wiki_Parse()
- */
-class Text_Wiki_Parse_Emphasis extends Text_Wiki_Parse {
-
-    /**
-     * The regular expression used to parse the source text and find
-     * matches conforming to this rule.  Used by the parse() method.
-     * We match '' , ''' or ''''' embeded texts
-     *
-     * @access public
-     * @var string
-     * @see Text_Wiki_Parse::parse()
-     */
-    var $regex = "/(?<!')'('{1,4})(.*?)\\1'(?!')/";
-
-    /**
-     * Generates a replacement for the matched text.  Token options are:
-     * - 'type' => ['start'|'end'] The starting or ending point of the emphasized text.
-     * Generated tokens are Emphasis (this rule), Strong or Emphasis / Strong
-     * The text itself is left in the source but may content bested blocks
-     *
-     * @access public
-     * @param array &$matches The array of matches from parse().
-     * @return string Delimited by start/end tokens to be used as
-     * placeholder in the source text surrounding the text to be emphasized.
-     */
-    function process(&$matches)
-    {
-        $embeded = $matches[2];
-        switch (strlen($matches[1])) {
-            case 1:
-                $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
-                $end   = $this->wiki->addToken($this->rule, array('type' => 'end'));
-            break;
-            case 3:
-                $embeded = "'" . $embeded . "'";
-            case 2:
-                $start = $this->wiki->addToken('Strong',    array('type' => 'start'));
-                $end   = $this->wiki->addToken('Strong',    array('type' => 'end'));
-            break;
-            case 4:
-                $start = $this->wiki->addToken($this->rule, array('type' => 'start'))
-                       . $this->wiki->addToken('Strong',    array('type' => 'start'));
-                $end   = $this->wiki->addToken('Strong',    array('type' => 'end'))
-                       . $this->wiki->addToken($this->rule, array('type' => 'end'));
-            break;
-        }
-        return $start . $embeded . $end;
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Freelink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for wiki freelink text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Freelink.php,v 1.4 2005/10/19 23:43:53 toggg Exp $
-* 
-*/
-
-/**
-* 
-* Parses for freelinked page links.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as a
-* wiki freelink, and automatically create a link to that page.
-* 
-* A freelink is any page name not conforming to the standard
-* StudlyCapsStyle for a wiki page name.  For example, a page normally
-* named MyHomePage can be renamed and referred to as ((My Home Page)) --
-* note the spaces in the page name.  You can also make a "nice-looking"
-* link without renaming the target page; e.g., ((MyHomePage|My Home
-* Page)).  Finally, you can use named anchors on the target page:
-* ((MyHomePage|My Home Page#Section1)).
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Freelink extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Constructor.  We override the Text_Wiki_Parse constructor so we can
-    * explicitly comment each part of the $regex property.
-    * 
-    * @access public
-    * 
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    * 
-    */
-    
-    function Text_Wiki_Parse_Freelink(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-        
-        $this->regex =
-            '/' .                                                   // START regex
-            "\\(\\(" .                                               // double open-parens
-            "(" .                                                   // START freelink page patter
-            "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character
-            ")" .                                                   // END  freelink page pattern
-            "(" .                                                   // START display-name
-            "\|" .                                                   // a pipe to start the display name
-            "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&\xc0-\xff]+" . // 1 or more of just about any character
-            ")?" .                                                   // END display-name pattern 0 or 1
-            "(" .                                                   // START pattern for named anchors
-            "\#" .                                                   // a hash mark
-            "[A-Za-z]" .                                           // 1 alpha
-            "[-A-Za-z0-9_:.]*" .                                   // 0 or more alpha, digit, underscore
-            ")?" .                                                   // END named anchors pattern 0 or 1
-            "()\\)\\)" .                                           // double close-parens
-            '/';                                                   // END regex
-    }
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'page' => the wiki page name (e.g., HomePage).
-    * 
-    * 'text' => alternative text to be displayed in place of the wiki
-    * page name.
-    * 
-    * 'anchor' => a named anchor on the target wiki page
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // use nice variable names
-        $page = $matches[1];
-        $text = $matches[2];
-        $anchor = $matches[3];
-        
-        // is the page given a new text appearance?
-        if (trim($text) == '') {
-            // no
-            $text = $page;
-        } else {
-            // yes, strip the leading | character
-            $text = substr($text, 1);
-        }
-        
-        // set the options
-        $options = array(
-            'page'   => $page,
-            'text'   => $text,
-            'anchor' => $anchor
-        );
-        
-        // return a token placeholder
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Function.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for an API function documentation block.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Function.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for an API function documentation block.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Function extends Text_Wiki_Parse {
-
-    var $regex = '/^(\<function\>)\n(.+)\n(\<\/function\>)(\s|$)/Umsi';
-    
-    function process(&$matches)
-    {
-        // default options
-        $opts = array(
-            'name' => null,
-            'access' => null,
-            'return' => null,
-            'params' => array(),
-            'throws' => array()
-        );
-        
-        // split apart the markup lines and loop through them
-        $lines = explode("\n", $matches[2]);
-        foreach ($lines as $line) {
-            
-            // skip blank lines
-            if (trim($line) == '') {
-                continue;
-            }
-            
-            // find the first ':' on the line; the left part is the 
-            // type, the right part is the value. skip lines without
-            // a ':' on them.
-            $pos = strpos($line, ':');
-            if ($pos === false) {
-                continue;
-            }
-            
-            // $type is the line type: name, access, return, param, throws
-            // 012345678901234
-            // name: something
-            $type = trim(substr($line, 0, $pos));
-            $val = trim(substr($line, $pos+1));
-            
-            switch($type) {
-            
-            case 'a':
-            case 'access':
-                $opts['access'] = $val;
-                break;
-                
-            case 'n':
-            case 'name':
-                $opts['name'] = $val;
-                break;
-                
-            case 'p':
-            case 'param':
-                $tmp = explode(',', $val);
-                $k = count($tmp);
-                if ($k == 1) {
-                    $opts['params'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => null,
-                        'default' => null
-                    );
-                } elseif ($k == 2) {
-                    $opts['params'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => $tmp[1],
-                        'default' => null
-                    );
-                } else {
-                    $opts['params'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => $tmp[1],
-                        'default' => $tmp[2]
-                    );
-                }
-                break;
-            
-            case 'r':
-            case 'return':
-            case 'returns':
-                $opts['return'] = $val;
-                break;
-            
-            case 't':
-            case 'throws':
-                $tmp = explode(',', $val);
-                $k = count($tmp);
-                if ($k == 1) {
-                    $opts['throws'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => null
-                    );
-                } else {
-                    $opts['throws'][] = array(
-                        'type' => $tmp[0],
-                        'descr' => $tmp[1]
-                    );
-                }
-                break;
-        
-            default:
-                $opts[$type] = $val;
-                break;
-            
-            }
-        }
-        
-        // add the token back in place
-        return $this->wiki->addToken($this->rule, $opts) . $matches[4];
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Heading.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for heading text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @author Moritz Venn <moritz.venn@freaque.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Heading.php,v 1.3 2006/02/03 19:47:02 toggg Exp $
-* 
-*/
-
-/**
-* 
-* Parses for heading text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked to
-* be a heading element, as defined by text on a line by itself prefixed
-* with a number of plus signs (+). The heading text itself is left in
-* the source, but is prefixed and suffixed with delimited tokens marking
-* the start and end of the heading.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Moritz Venn <moritz.venn@freaque.net>
-* 
-*/
-
-class Text_Wiki_Parse_Heading extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/^(={2,6})(.*?)\1(?:[\t ]|$)/m';
-    
-    var $conf = array(
-        'id_prefix' => 'toc'
-    );
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * heading text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the heading text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // keep a running count for header IDs.  we use this later
-        // when constructing TOC entries, etc.
-        static $id;
-        if (! isset($id)) {
-            $id = 0;
-        }
-        
-        $prefix = htmlspecialchars($this->getConf('id_prefix'));
-        
-        $start = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'start',
-                'level' => strlen($matches[1]),
-                'text' => trim($matches[2]),
-                'id' => $prefix . $id ++
-            )
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, 
-            array(
-                'type' => 'end',
-                'level' => strlen($matches[1])
-            )
-        );
-        
-        return $start . trim($matches[2]) . $end . "\n";
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Horiz.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for horizontal ruling lines.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Horiz.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for horizontal ruling lines.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked to
-* be a horizontal rule, as defined by four dashed on their own line.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Horiz extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/^([-]{4,})$/m';
-    
-    
-    /**
-    * 
-    * Generates a replacement token for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A token marking the horizontal rule.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $this->wiki->addToken($this->rule);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Html.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for blocks of HTML code.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Html.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for blocks of HTML code.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as
-* HTML to be redndred as-is.  The block start is marked by <html> on its
-* own line, and the block end is marked by </html> on its own line.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Html extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/^\<html\>\n(.+)\n\<\/html\>(\s|$)/Umsi';
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'text' => The text of the HTML to be rendered as-is.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text following the HTML block.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        $options = array('text' => $matches[1]);
-        return $this->wiki->addToken($this->rule, $options) . $matches[2];
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Image.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-<?php
-
-/**
-*
-* Parses for image placement.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-* @license LGPL
-*
-* @version $Id: Image.php,v 1.5 2005/09/12 11:34:44 toggg Exp $
-*
-*/
-
-/**
-*
-* Parses for image placement.
-*
-* @category Text
-*
-* @package Text_Wiki
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-*/
-
-class Text_Wiki_Parse_Image extends Text_Wiki_Parse {
-
-    /**
-     * URL schemes recognized by this rule.
-     *
-     * @access public
-     * @var array
-    */
-    var $conf = array(
-        'schemes' => 'http|https|ftp|gopher|news',
-        'host_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?',
-        'path_regexp' => '(?:/[^\s"<\\\#delim#\ca-\cz]*)?'
-    );
-
-    /**
-    *
-    * The regular expression used to find source text matching this
-    * rule.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $regex = '/(\[\[image\s+)(.+?)(\]\])/i';
-
-
-    /**
-     * The regular expressions used to check ecternal urls
-     *
-     * @access public
-     * @var string
-     * @see parse()
-     */
-    var $url = '';
-
-    /**
-     * Constructor.
-     * We override the constructor to build up the url regex from config
-     *
-     * @param object &$obj the base conversion handler
-     * @return The parser object
-     * @access public
-     */
-    function Text_Wiki_Parse_Image(&$obj)
-    {
-        $default = $this->conf;
-        parent::Text_Wiki_Parse($obj);
-
-        // convert the list of recognized schemes to a regex OR,
-        $schemes = $this->getConf('schemes', $default['schemes']);
-        $this->url = str_replace( '#delim#', $this->wiki->delim,
-           '#(?:' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://'
-           . $this->getConf('host_regexp', $default['host_regexp'])
-           . $this->getConf('path_regexp', $default['path_regexp']) .'#');
-    }
-
-    /**
-    *
-    * Generates a token entry for the matched text.  Token options are:
-    *
-    * 'src' => The image source, typically a relative path name.
-    *
-    * 'opts' => Any macro options following the source.
-    *
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-
-    function process(&$matches)
-    {
-        $pos = strpos($matches[2], ' ');
-
-        if ($pos === false) {
-            $options = array(
-                'src' => $matches[2],
-                'attr' => array());
-        } else {
-            // everything after the space is attribute arguments
-            $options = array(
-                'src' => substr($matches[2], 0, $pos),
-                'attr' => $this->getAttrs(substr($matches[2], $pos+1))
-            );
-            // check the scheme case of external link
-            if (array_key_exists('link', $options['attr'])) {
-                // external url ?
-                if (($pos = strpos($options['attr']['link'], '://')) !== false) {
-                    if (!preg_match($this->url, $options['attr']['link'])) {
-                        return $matches[0];
-                    }
-                } elseif (in_array('Wikilink', $this->wiki->disable)) {
-                        return $matches[0]; // Wikilink disabled
-                }
-            }
-        }
-
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Include.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-<?php
-
-/**
-* 
-* Includes the contents of another PHP script into the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Include.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* This class implements a Text_Wiki_Parse to include the results of a
-* script directly into the source at parse-time; thus, the output of the
-* script will be parsed by Text_Wiki.  This differs from the 'embed'
-* rule, which incorporates the results at render-time, meaning that the
-* 'embed' content is not parsed by Text_Wiki.
-*
-* DANGER!
-* 
-* This rule is inherently not secure; it allows cross-site scripting to
-* occur if the embedded output has <script> or other similar tags.  Be
-* careful.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Include extends Text_Wiki_Parse {
-    
-    var $conf = array(
-        'base' => '/path/to/scripts/'
-    );
-    
-    var $file = null;
-    
-    var $output = null;
-    
-    var $vars = null;
-
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = '/(\[\[include )(.+?)( .+?)?(\]\])/i';
-    
-    
-    /**
-    * 
-    * Includes the results of the script directly into the source; the output
-    * will subsequently be parsed by the remaining Text_Wiki rules.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return The results of the included script.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // save the file location
-        $this->file = $this->getConf('base', './') . $matches[2];
-
-        // extract attribs as variables in the local space
-        $this->vars = $this->getAttrs($matches[3]);
-        unset($this->vars['this']);
-        extract($this->vars);
-
-        // run the script
-        ob_start();
-        include($this->file);
-        $this->output = ob_get_contents();
-        ob_end_clean();
-    
-        // done, place the script output directly in the source
-        return $this->output;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Interwiki.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for interwiki links.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Interwiki.php,v 1.4 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for interwiki links.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as
-* an Interwiki link.  See the regex for a detailed explanation of the
-* text matching procedure; e.g., "InterWikiName:PageName".
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Interwiki extends Text_Wiki_Parse {
-    
-    // double-colons wont trip up now
-    var $regex = '([A-Za-z0-9_]+):((?!:)[A-Za-z0-9_\/=&~#.:;-]+)';
-    
-    
-    /**
-    * 
-    * Parser.  We override the standard parser so we can
-    * find both described interwiki links and standalone links.
-    * 
-    * @access public
-    * 
-    * @return void
-    * 
-    */
-    
-    function parse()
-    {
-        // described interwiki links
-        $tmp_regex = '/\[' . $this->regex . ' (.+?)\]/';
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processDescr'),
-            $this->wiki->source
-        );
-        
-        // standalone interwiki links
-        $tmp_regex = '/' . $this->regex . '/';
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-       
-    }
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched standalone interwiki text.
-    * Token options are:
-    * 
-    * 'site' => The key name for the Text_Wiki interwiki array map,
-    * usually the name of the interwiki site.
-    * 
-    * 'page' => The page on the target interwiki to link to.
-    * 
-    * 'text' => The text to display as the link.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $options = array(
-            'site' => $matches[1],
-            'page' => $matches[2],
-            'text' => $matches[0]
-        );
-        
-        return $this->wiki->addToken($this->rule, $options);
-    }
-    
-    
-    /**
-    * 
-    * Generates a replacement for described interwiki links. Token
-    * options are:
-    * 
-    * 'site' => The key name for the Text_Wiki interwiki array map,
-    * usually the name of the interwiki site.
-    * 
-    * 'page' => The page on the target interwiki to link to.
-    * 
-    * 'text' => The text to display as the link.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token to be used as a placeholder in
-    * the source text, plus any text priot to the match.
-    *
-    */
-    
-    function processDescr(&$matches)
-    {
-        $options = array(
-            'site' => $matches[1],
-            'page' => $matches[2],
-            'text' => $matches[3]
-        );
-        
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Italic.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for italic text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Italic.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for italic text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked for
-* emphasis (italics) as defined by text surrounded by two single-quotes.
-* On parsing, the text itself is left in place, but the starting and ending
-* instances of two single-quotes are replaced with tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Italic extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/''(()|[^'].*)''/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the text to be
-    * emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/List.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for bulleted and numbered lists.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Justin Patrin <papercrane@reversefold.com>
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: List.php,v 1.1 2006/03/28 04:46:09 ritzmo Exp $
-* 
-*/
-
-/**
-* 
-* Parses for bulleted and numbered lists.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked as
-* a bulleted or numbered list.  In short, if a line starts with '* ' then
-* it is a bullet list item; if a line starts with '# ' then it is a 
-* number list item.  Spaces in front of the * or # indicate an indented
-* sub-list.  The list items must be on sequential lines, and may be 
-* separated by blank lines to improve readability.  Using a non-* non-#
-* non-whitespace character at the beginning of a line ends the list.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Justin Patrin <papercrane@reversefold.com>
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_List extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-
-    //TODO: add text continuations (any number of + signs) and expandable areas (- after *s ot #s)
-    
-    var $regex = '/\n((?:\*|#)+.*?\n(?!(?:\*|#)+))/s';
-
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' =>
-    *     'bullet_start' : the start of a bullet list
-    *     'bullet_end'   : the end of a bullet list
-    *     'number_start' : the start of a number list
-    *     'number_end'   : the end of a number list
-    *     'item_start'   : the start of item text (bullet or number)
-    *     'item_end'     : the end of item text (bullet or number)
-    *     'unknown'      : unknown type of list or item
-    *
-    * 'level' => the indent level (0 for the first level, 1 for the
-    * second, etc)
-    *
-    * 'count' => the list item number at this level. not needed for
-    * xhtml, but very useful for PDF and RTF.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A series of text and delimited tokens marking the different
-    * list text and list elements.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        // the replacement text we will return
-        $return = '';
-        
-        // the list of post-processing matches
-        $list = array();
-        
-        // a stack of list-start and list-end types; we keep this
-        // so that we know what kind of list we're working with
-        // (bullet or number) and what indent level we're at.
-        $stack = array();
-        
-        // the item count is the number of list items for any
-        // given list-type on the stack
-        $itemcount = array();
-        
-        // have we processed the very first list item?
-        $pastFirst = false;
-        
-        // populate $list with this set of matches. $matches[1] is the
-        // text matched as a list set by parse().
-        preg_match_all(
-            '/^((\*|#)+)(.*?)$/ms',
-            $matches[1],
-            $list,
-            PREG_SET_ORDER
-        );
-        
-        // loop through each list-item element.
-        foreach ($list as $key => $val) {
-            // $val[0] is the full matched list-item line
-            // $val[1] is the type (* or #)
-            // $val[2] is the level (number)
-            // $val[3] is the list item text
-            
-            // how many levels are we indented? (1 means the "root"
-            // list level, no indenting.)
-            $level = strlen($val[1]);
-            
-            // get the list item type
-            if ($val[2] == '*') {
-                $type = 'bullet';
-            } elseif ($val[2] == '#') {
-                $type = 'number';
-            } else {
-                $type = 'unknown';
-            }
-            
-            // get the text of the list item
-            $text = $val[3];
-
-            // add a level to the list?
-            if ($level > count($stack)) {
-                
-                // the current indent level is greater than the
-                // number of stack elements, so we must be starting
-                // a new list.  push the new list type onto the
-                // stack...
-                array_push($stack, $type);
-                
-                // ...and add a list-start token to the return.
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array(
-                        'type' => $type . '_list_start',
-                        'level' => $level - 1
-                    )
-                );
-            }
-            
-            // remove a level from the list?
-            while (count($stack) > $level) {
-                
-                // so we don't keep counting the stack, we set up a temp
-                // var for the count.  -1 becuase we're going to pop the
-                // stack in the next command.  $tmp will then equal the
-                // current level of indent.
-                $tmp = count($stack) - 1;
-                
-                // as long as the stack count is greater than the
-                // current indent level, we need to end list types. 
-                // continue adding end-list tokens until the stack count
-                // and the indent level are the same.
-                $return .= $this->wiki->addToken(
-                    $this->rule, 
-                    array (
-                        'type' => array_pop($stack) . '_list_end',
-                        'level' => $tmp
-                    )
-                );
-                
-                // reset to the current (previous) list type so that
-                // the new list item matches the proper list type.
-                $type = $stack[$tmp - 1];
-                
-                // reset the item count for the popped indent level
-                unset($itemcount[$tmp + 1]);
-            }
-            
-            // add to the item count for this list (taking into account
-            // which level we are at).
-            if (! isset($itemcount[$level])) {
-                // first count
-                $itemcount[$level] = 0;
-            } else {
-                // increment count
-                $itemcount[$level]++;
-            }
-            
-            // is this the very first item in the list?
-            if (! $pastFirst) {
-                $first = true;
-                $pastFirst = true;
-            } else {
-                $first = false;
-            }
-            
-            // create a list-item starting token.
-            $start = $this->wiki->addToken(
-                $this->rule, 
-                array(
-                    'type' => $type . '_item_start',
-                    'level' => $level,
-                    'count' => $itemcount[$level],
-                    'first' => $first
-                )
-            );
-            
-            // create a list-item ending token.
-            $end = $this->wiki->addToken(
-                $this->rule, 
-                array(
-                    'type' => $type . '_item_end',
-                    'level' => $level,
-                    'count' => $itemcount[$level]
-                )
-            );
-            
-            // add the starting token, list-item text, and ending token
-            // to the return.
-            $return .= $start . $text . $end;
-        }
-        
-        // the last list-item may have been indented.  go through the
-        // list-type stack and create end-list tokens until the stack
-        // is empty.
-        while (count($stack) > 0) {
-            $return .= $this->wiki->addToken(
-                $this->rule, 
-                array (
-                    'type' => array_pop($stack) . '_list_end',
-                    'level' => count($stack)
-                )
-            );
-        }
-        
-        // we're done!  send back the replacement text.
-        return "\n" . $return . "\n\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Newline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for implied line breaks indicated by newlines.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Newline.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for implied line breaks indicated by newlines.
-* 
-* This class implements a Text_Wiki_Parse to mark implied line breaks in the
-* source text, usually a single carriage return in the middle of a paragraph
-* or block-quoted text.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Newline extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = '/([^\n])\n([^\n])/m';
-    
-    
-    /**
-    * 
-    * Generates a replacement token for the matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A delimited token to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {    
-        return $matches[1] .
-            $this->wiki->addToken($this->rule) .
-            $matches[2];
-    }
-    
-    /**
-    *
-    * Abstrct method to parse source text for matches.
-    *
-    * Applies the rule's regular expression to the source text, passes
-    * every match to the process() method, and replaces the matched text
-    * with the results of the processing.
-    *
-    * @access public
-    *
-    * @see Text_Wiki_Parse::process()
-    *
-    */
-
-    function parse()
-    {
-        $source =& $this->wiki->source;
-        
-        // This regex attempts to find HTML tags that can be safely compacted together without formatting loss
-        // The idea is to make it easier for the HTML parser to find litewiki elements
-        //$source = preg_replace('/<\/([a-z0-9:-]+?)>([\s]*[\n]+[\s]+|[\s]+[\n]+[\s]*|[\n]+)<([a-z0-9:-]+)(.*?)>/i', '</\\1><\\3\\4>', $source);
-        $source = wikiformat_process_block($source);
-        
-        $rand_key = md5( str_rot13(strval(dechex(time()))) . microtime() . strval(mt_rand()) );
-        preg_match_all('/<(litewiki|pre)([^>]*?)>(.*?)<\/\\1>/is', $this->wiki->source, $matches);
-        
-        $poslist = array();
-        
-        foreach ( $matches[0] as $i => $match )
-        {
-            $source = str_replace($match, "{LITEWIKI:$i:$rand_key}", $source);
-        }
-        
-        $this->wiki->source = preg_replace_callback(
-            $this->regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-        
-        foreach ( $matches[3] as $i => $match )
-        {
-            $source = str_replace("{LITEWIKI:$i:$rand_key}", $match, $source);
-        }
-        
-        // die('<pre>'.htmlspecialchars($source).'</pre>');
-        
-        unset($matches, $source, $rand_key);
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Paragraph.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for paragraph blocks.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Paragraph.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for paragraph blocks.
-* 
-* This class implements a Text_Wiki rule to find sections of the source
-* text that are paragraphs.  A para is any line not starting with a token
-* delimiter, followed by two newlines.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Paragraph extends Text_Wiki_Parse {
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = "/^.*?\n\n/m";
-    
-    var $conf = array(
-        'skip' => array(
-            'blockquote', // are we sure about this one?
-            'code',
-            'heading',
-            'horiz',
-            'deflist',
-            'table',
-            'list',
-            'toc',
-            'pre'
-        )
-    );
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'start' => The starting point of the paragraph.
-    * 
-    * 'end' => The ending point of the paragraph.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $delim = $this->wiki->delim;
-        
-        // was anything there?
-        if (trim($matches[0]) == '') {
-            return '';
-        }
-        
-        // does the match start with a delimiter?
-        if (substr($matches[0], 0, 1) != $delim) { 
-            // no.
-            
-            $start = $this->wiki->addToken(
-                $this->rule, array('type' => 'start')
-            );
-            
-            $end = $this->wiki->addToken(
-                $this->rule, array('type' => 'end')
-            );
-            
-            return $start . trim($matches[0]) . $end;
-        }
-        
-        // the line starts with a delimiter.  read in the delimited
-        // token number, check the token, and see if we should
-        // skip it.
-        
-        // loop starting at the second character (we already know
-        // the first is a delimiter) until we find another
-        // delimiter; the text between them is a token key number.
-        $key = '';
-        $len = strlen($matches[0]);
-        for ($i = 1; $i < $len; $i++) {
-            $char = $matches[0]{$i};
-            if ($char == $delim) {
-                break;
-            } else {
-                $key .= $char;
-            }
-        }
-        
-        // look at the token and see if it's skippable (if we skip,
-        // it will not be marked as a paragraph)
-        $token_type = strtolower($this->wiki->tokens[$key][0]);
-        $skip = $this->getConf('skip', array());
-        
-        if (in_array($token_type, $skip)) {
-            // this type of token should not have paragraphs applied to it.
-            // return the entire matched text.
-            return $matches[0];
-        } else {
-            
-            $start = $this->wiki->addToken(
-                $this->rule, array('type' => 'start')
-            );
-            
-            $end = $this->wiki->addToken(
-                $this->rule, array('type' => 'end')
-            );
-            
-            return $start . trim($matches[0]) . $end;
-        }
-    }
-    
-    /**
-    *
-    * Abstrct method to parse source text for matches.
-    *
-    * Applies the rule's regular expression to the source text, passes
-    * every match to the process() method, and replaces the matched text
-    * with the results of the processing.
-    *
-    * @access public
-    *
-    * @see Text_Wiki_Parse::process()
-    *
-    */
-
-    function parse()
-    {
-        $source =& $this->wiki->source;
-        $source = wikiformat_process_block($source);
-        
-        $source = preg_replace('/<litewiki>(.*?)<\/litewiki>([\s]+?|$)/is', '<litewiki>\\1\\2</litewiki>', $source);
-        
-        // die('<pre>' . htmlspecialchars($source) . '</pre>');
-        
-        $this->wiki->source = preg_replace_callback(
-            $this->regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-        
-        $source = preg_replace('/<litewiki>(.*?)<\/litewiki>/is', '\\1', $source);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Phplookup.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<?php
-
-/**
-* 
-* Find source text marked for lookup in the PHP online manual.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Phplookup.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Find source text marked for lookup in the PHP online manual.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Phplookup extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\[\[php (.+?)\]\]/";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * teletype text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the teletype text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        return $this->wiki->addToken(
-            $this->rule, array('text' => $matches[1])
-        );
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Prefilter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-<?php
-
-/**
-* 
-* "Pre-filter" the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Prefilter.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* "Pre-filter" the source text.
-* 
-* Convert DOS and Mac line endings to Unix, concat lines ending in a
-* backslash \ with the next line, convert tabs to 4-spaces, add newlines
-* to the top and end of the source text, compress 3 or more newlines to
-* 2 newlines.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Prefilter extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Simple parsing method.
-    *
-    * @access public
-    * 
-    */
-    
-    function parse()
-    {
-        // convert DOS line endings
-        $this->wiki->source = str_replace("\r\n", "\n",
-            $this->wiki->source);
-        
-        // convert Macintosh line endings
-        $this->wiki->source = str_replace("\r", "\n",
-            $this->wiki->source);
-        
-        // concat lines ending in a backslash
-        $this->wiki->source = str_replace("\\\n", "",
-            $this->wiki->source);
-        
-        // convert tabs to four-spaces
-        $this->wiki->source = str_replace("\t", "    ",
-            $this->wiki->source);
-           
-        // add extra newlines at the top and end; this
-        // seems to help many rules.
-        $this->wiki->source = "\n" . $this->wiki->source . "\n\n";
-        
-        // finally, compress all instances of 3 or more newlines
-        // down to two newlines.
-        $find = "/\n{3,}/m";
-        $replace = "\n\n";
-        $this->wiki->source = preg_replace($find, $replace,
-            $this->wiki->source);
-    }
-
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Raw.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for text marked as "raw" (i.e., to be rendered as-is).
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Raw.php,v 1.2 2006/02/15 10:20:08 toggg Exp $
-* 
-*/
-
-/**
-* 
-* Parses for text marked as "raw" (i.e., to be rendered as-is).
-* 
-* This class implements a Text_Wiki rule to find sections of the source
-* text that are not to be processed by Text_Wiki.  These blocks of "raw"
-* text will be rendered as they were found.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Raw extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to find source text matching this
-    * rule.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    */
-    
-    var $regex = "/<nowiki>(.*)<\/nowiki>/Ums";
-    
-    
-    /**
-    * 
-    * Generates a token entry for the matched text.  Token options are:
-    * 
-    * 'text' => The full matched text.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A delimited token number to be used as a placeholder in
-    * the source text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $options = array('text' => $matches[1]);
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Revise.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for text marked as revised (insert/delete).
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Revise.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for text marked as revised (insert/delete).
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Revise extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\@\@({*?.*}*?)\@\@/U";
-    
-    
-    /**
-    * 
-    * Config options.
-    * 
-    * @access public
-    * 
-    * @var array
-    *
-    */
-    
-    var $conf = array(
-        'delmark' => '---',
-        'insmark' => '+++'
-    );
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * inserted text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the teletype text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $output = '';
-        $src = $matches[1];
-        $delmark = $this->getConf('delmark'); // ---
-        $insmark = $this->getConf('insmark'); // +++
-        
-        // '---' must be before '+++' (if they both appear)
-        $del = strpos($src, $delmark);
-        $ins = strpos($src, $insmark);
-        
-        // if neither is found, return right away
-        if ($del === false && $ins === false) {
-            return $matches[0];
-        }
-        
-        // handle text to be deleted
-        if ($del !== false) {
-            
-            // move forward to the end of the deletion mark
-            $del += strlen($delmark);
-            
-            if ($ins === false) {
-                // there is no insertion text following
-                $text = substr($src, $del);
-            } else {
-                // there is insertion text following,
-                // mitigate the length
-                $text = substr($src, $del, $ins - $del);
-            }
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'del_start')
-            );
-            
-            $output .= $text;
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'del_end')
-            );
-        }
-        
-        // handle text to be inserted
-        if ($ins !== false) {
-            
-            // move forward to the end of the insert mark
-            $ins += strlen($insmark);
-            $text = substr($src, $ins);
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'ins_start')
-            );
-            
-            $output .= $text;
-            
-            $output .= $this->wiki->addToken(
-                $this->rule, array('type' => 'ins_end')
-            );
-        }
-        
-        return $output;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Smiley.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Default: Parses for smileys / emoticons tags
- *
- * This class implements a Text_Wiki_Rule to find source text marked as
- * smileys defined by symbols as ':)' , ':-)' or ':smile:'
- * The symbol is replaced with a token.
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Smiley.php,v 1.6 2005/10/04 08:17:51 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Smiley rule parser class for Default.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki_Parse::Text_Wiki_Parse()
- */
-class Text_Wiki_Parse_Smiley extends Text_Wiki_Parse {
-
-    /**
-     * Configuration keys for this rule
-     * 'smileys' => array Smileys recognized by this rule, symbols key definitions:
-     *              'symbol' => array ( 'name', 'description' [, 'variante', ...] ) as
-     *                  ':)'  => array('smile', 'Smile'),
-     *                  ':D'  => array('biggrin', 'Very Happy',':grin:'),
-     *              the eventual elements after symbol and description are variantes
-     *
-     * 'auto_nose' => boolean enabling the auto nose feature:
-     *                auto build a variante for 2 chars symbols by inserting a '-' as ':)' <=> ':-)'
-     *
-     * @access public
-     * @var array 'config-key' => mixed config-value
-     */
-    var $conf = array(
-        'smileys' => array(
-            ':D'        => array('biggrin', 'Very Happy', ':grin:'),
-            ':)'        => array('smile', 'Smile', '(:'),
-            ':('        => array('sad', 'Sad', '):'),
-            ':o'        => array('surprised', 'Surprised', ':eek:', 'o:'),
-            ':shock:'   => array('eek', 'Shocked'),
-            ':?'        => array('confused', 'Confused', ':???:'),
-            '8)'        => array('cool', 'Cool', '(8'),
-            ':lol:'     => array('lol', 'Laughing'),
-            ':x'        => array('mad', 'Mad'),
-            ':P'        => array('razz', 'Razz'),
-            ':oops:'    => array('redface', 'Embarassed'),
-            ':cry:'     => array('cry', 'Crying or Very sad'),
-            ':evil:'    => array('evil', 'Evil or Very Mad'),
-            ':twisted:' => array('twisted', 'Twisted Evil'),
-            ':roll:'    => array('rolleyes', 'Rolling Eyes'),
-            ';)'        => array('wink', 'Wink', '(;'),
-            ':!:'       => array('exclaim', 'Exclamation'),
-            ':?:'       => array('question', 'Question'),
-            ':idea:'    => array('idea', 'Idea'),
-            ':arrow:'   => array('arrow', 'Arrow'),
-            ':|'        => array('neutral', 'Neutral', '|:'),
-            ':mrgreen:' => array('mrgreen', 'Mr. Green'),
-        ),
-        'auto_nose' => true
-    );
-
-    /**
-     * Definition array of smileys, variantes references their model
-     * 'symbol' => array ( 'name', 'description')
-     *
-     * @access private
-     * @var array 'config-key' => mixed config-value
-     */
-    var $_smileys = array();
-
-     /**
-     * Constructor.
-     * We override the constructor to build up the regex from config
-     *
-     * @param object &$obj the base conversion handler
-     * @return The parser object
-     * @access public
-     */
-    function Text_Wiki_Parse_Smiley(&$obj)
-    {
-        $default = $this->conf;
-        parent::Text_Wiki_Parse($obj);
-
-        // read the list of smileys to sort out variantes and :xxx: while building the regexp
-        $this->_smileys = $this->getConf('smileys', $default['smileys']);
-        $autoNose = $this->getConf('auto_nose', $default['auto_nose']);
-        $reg1 = $reg2 = '';
-        $sep1 = ':(?:';
-        $sep2 = '';
-        foreach ($this->_smileys as $smiley => $def) {
-            for ($i = 1; $i < count($def); $i++) {
-                if ($i > 1) {
-                    $cur = $def[$i];
-                    $this->_smileys[$cur] = &$this->_smileys[$smiley];
-                } else {
-                    $cur = $smiley;
-                }
-                $len = strlen($cur);
-                if (($cur{0} == ':') && ($len > 2) && ($cur{$len - 1} == ':')) {
-                    $reg1 .= $sep1 . preg_quote(substr($cur, 1, -1), '#');
-                    $sep1 = '|';
-                    continue;
-                }
-                if ($autoNose && ($len === 2)) {
-                    $variante = $cur{0} . '-' . $cur{1};
-                    $this->_smileys[$variante] = &$this->_smileys[$smiley];
-                    $cur = preg_quote($cur{0}, '#') . '-?' . preg_quote($cur{1}, '#');
-                } else {
-                    $cur = preg_quote($cur, '#');
-                }
-                $reg2 .= $sep2 . $cur;
-                $sep2 = '|';
-            }
-        }
-        $delim = '[\n\r\s' . $this->wiki->delim . '$^]';
-        $this->regex = '#(?<=' . $delim .
-             ')(' . ($reg1 ? $reg1 . '):' . ($reg2 ? '|' : '') : '') . $reg2 .
-             ')(?=' . $delim . ')#i';
-    }
-
-    /**
-     * Generates a replacement token for the matched text.  Token options are:
-     *     'symbol' => the original marker
-     *     'name' => the name of the smiley
-     *     'desc' => the description of the smiley
-     *
-     * @param array &$matches The array of matches from parse().
-     * @return string Delimited token representing the smiley
-     * @access public
-     */
-    function process(&$matches)
-    {
-        // tokenize
-        return $this->wiki->addToken($this->rule,
-            array(
-                'symbol' => $matches[1],
-                'name'   => $this->_smileys[$matches[1]][0],
-                'desc'   => $this->_smileys[$matches[1]][1]
-            ));
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Strong.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for strongly-emphasized text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Strong.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-
-/**
-* 
-* Parses for strongly-emphasized text.
-* 
-* This class implements a Text_Wiki_Parse to find source text marked for
-* strong emphasis (bold) as defined by text surrounded by three
-* single-quotes. On parsing, the text itself is left in place, but the
-* starting and ending instances of three single-quotes are replaced with
-* tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Strong extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/\*\*(.*?)\*\*/";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Subscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for subscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Subscript.php,v 1.1 2005/02/24 17:24:56 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for subscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Subscript extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/,,(()|.*),,/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Superscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for superscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Superscript.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Parses for superscripted text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Superscript extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/\^\^(()|.*)\^\^/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Table.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,286 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Mediawiki: Parses for tables.
- *
- * This class implements a Text_Wiki_Rule to find tables in pipe syntax
- * {| ... |- ... | ... |}
- * On parsing, the text itself is left in place, but the starting and ending
- * tags for table, rows and cells are replaced with tokens. (nested tables enabled)
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Table.php,v 1.7 2005/12/06 15:54:56 ritzmo Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Table rule parser class for Mediawiki.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki_Parse::Text_Wiki_Parse()
- */
-class Text_Wiki_Parse_Table extends Text_Wiki_Parse {
-
-    /**
-     * The regular expression used to parse the source text and find
-     * matches conforming to this rule.  Used by the parse() method.
-     *
-     * @access public
-     * @var string
-     * @see parse()
-     */
-    var $regex = '#^\{\|(.*?)(?:^\|\+(.*?))?(^(?:((?R))|.)*?)^\|}#msi';
-
-    /**
-     * The regular expression used in second stage to find table's rows
-     * used by process() to call back processRows()
-     *
-     * @access public
-     * @var string
-     * @see process()
-     * @see processRows()
-     */
-    var $regexRows = '#(?:^(\||!)-|\G)(.*?)^(.*?)(?=^(?:\|-|!-|\z))#msi';
-
-    /**
-     * The regular expression used in third stage to find rows's cells
-     * used by processRows() to call back processCells()
-     *
-     * @access public
-     * @var string
-     * @see process()
-     * @see processCells()
-     */
-    var $regexCells =
-    '#((?:^\||^!|\|\||!!|\G))(?:([^|\n]*?) \|(?!\|))?(.+?)(?=^\||^!|\|\||!!|\z)#msi';
-
-    /**
-     * The current table nesting depth, starts by zero
-     *
-     * @access private
-     * @var int
-     */
-    var $_level = 0;
-
-    /**
-     * The count of rows for this level
-     *
-     * @access private
-     * @var array of int
-     */
-    var $_countRows = array();
-
-    /**
-     * The max count of cells for this level
-     *
-     * @access private
-     * @var array of int
-     */
-    var $_maxCells = array();
-
-    /**
-     * The count of cells for each row
-     *
-     * @access private
-     * @var array of int
-     */
-    var $_countCells = array();
-
-    /**
-     * The count of spanned cells from previous rowspans for each column
-     *
-     * @access private
-     * @var array of int
-     */
-    var $_spanCells = array();
-
-    /**
-     * Generates a replacement for the matched text. Returned token options are:
-     * 'type' =>
-     *     'table_start'   : the start of a bullet list
-     *     'table_end'     : the end of a bullet list
-     *     'row_start'     : the start of a number list
-     *     'row_end'       : the end of a number list
-     *     'cell_start'    : the start of item text (bullet or number)
-     *     'cell_end'      : the end of item text (bullet or number)
-     *     'caption_start' : the start of associated caption
-     *     'caption_end'   : the end of associated caption
-     *
-     * 'level' => the table nesting level (starting zero) ('table_start')
-     *
-     * 'rows' => the number of rows in the table ('table_start')
-     *
-     * 'cols' => the number of columns in the table or rows
-     *           ('table_start' and 'row_start')
-     *
-     * 'span' => column span ('cell_start')
-     *
-     * 'row_span' => row span ('cell_start')
-     *
-     * 'attr' => header optional attribute flag ('row_start' or 'cell_start')
-     *
-     * 'format' => table, row or cell optional styling ('xxx_start')
-     *
-     * @param array &$matches The array of matches from parse().
-     * @return string the original text with tags replaced by delimited tokens
-     * which point to the the token array containing their type and definition
-     * @access public
-     */
-    function process(&$matches)
-    {
-        if (array_key_exists(4, $matches)) {
-            $this->_level++;
-            $expsub = preg_replace_callback(
-                $this->regex,
-                array(&$this, 'process'),
-                $matches[3]
-            );
-            $this->_level--;
-        } else {
-            $expsub = $matches[3];
-        }
-        $this->_countRows[$this->_level] = $this->_maxCells[$this->_level] = 0;
-        $this->_countCells[$this->_level] = $this->_spanCells[$this->_level] = array();
-        $sub = preg_replace_callback(
-            $this->regexRows,
-            array(&$this, 'processRows'),
-            $expsub
-        );
-        $param = array(
-                'type'  => 'table_start',
-                'level' => $this->_level,
-                'rows' => $this->_countRows[$this->_level],
-                'cols' => $this->_maxCells[$this->_level]
-        );
-        if ($format = trim($matches[1])) {
-            $param['format'] = $format;
-        }
-        $ret = $this->wiki->addToken($this->rule, $param );
-        if ($matches[2]) {
-            $ret .= $this->wiki->addToken($this->rule, array(
-                'type'  => 'caption_start',
-                'level' => $this->_level ) ) . $matches[2] .
-                    $this->wiki->addToken($this->rule, array(
-                'type'  => 'caption_end',
-                'level' => $this->_level ) );
-        }
-        $param['type'] = 'table_end';
-        return $ret . $sub . $this->wiki->addToken($this->rule, $param );
-    }
-
-    /**
-     * Generates a replacement for the matched rows. Token options are:
-     * 'type' =>
-     *     'row_start'   : the start of a row
-     *     'row_end'     : the end of a row
-     *
-     * 'order' => the row order in the table
-     *
-     * 'cols' => the count of cells in the row
-     *
-     * 'attr' => header optional attribute flag
-     *
-     * 'format' => row optional styling
-     *
-     * @param array &$matches The array of matches from process() callback.
-     * @return string 2 delimited tokens pointing the row params
-     * and containing the cells-parsed block of text between the tags
-     * @access public
-     */
-    function processRows(&$matches)
-    {
-        $this->_countCells[$this->_level][$this->_countRows[$this->_level]] = 0;
-        $sub = preg_replace_callback(
-            $this->regexCells,
-            array(&$this, 'processCells'),
-            $matches[3]
-        );
-        $param = array(
-                'type'  => 'row_start',
-                'order' => $this->_countRows[$this->_level],
-                'cols' => $this->_countCells[$this->_level][$this->_countRows[$this->_level]++]
-        );
-        if ($matches[1] == '!') {
-            $param['attr'] = 'header';
-        }
-        if ($format = trim($matches[2])) {
-            $param['format'] = $format;
-        }
-        if ($this->_maxCells[$this->_level] < $param['cols']) {
-            $this->_maxCells[$this->_level] = $param['cols'];
-        }
-        $ret = $this->wiki->addToken($this->rule, $param );
-        $param['type'] = 'row_end';
-        return $ret . $sub . $this->wiki->addToken($this->rule, $param );
-    }
-
-    /**
-     * Generates a replacement for the matched cells. Token options are:
-     * 'type' =>
-     *     'cell_start'   : the start of a row
-     *     'cell_end'     : the end of a row
-     *
-     * 'order' => the cell order in the row
-     *
-     * 'cols' => the count of cells in the row
-     *
-     * 'span' => column span
-     *
-     * 'row_span' => row span
-     *
-     * 'attr' => header optional attribute flag
-     *
-     * 'format' => cell optional styling
-     *
-     * @param array &$matches The array of matches from processRows() callback.
-     * @return string 2 delimited tokens pointing the cell params
-     * and containing the block of text between the tags
-     * @access public
-     */
-    function processCells(&$matches)
-    {
-        $order = & $this->_countCells[$this->_level][$this->_countRows[$this->_level]];
-        while (isset($this->_spanCells[$this->_level][$order])) {
-            if (--$this->_spanCells[$this->_level][$order] < 2) {
-                unset($this->_spanCells[$this->_level][$order]);
-            }
-            $order++;
-        }
-        $param = array(
-                'type'  => 'cell_start',
-                'attr'  => $matches[1] && ($matches[1]{0} == '!') ? 'header': null,
-                'span'  => 1,
-                'rowspan'  => 1,
-                'order' => $order
-        );
-        if ($format = trim($matches[2])) {
-            if (preg_match('#(.*)colspan=("|\')?(\d+)(?(2)\2)(.*)#i', $format, $pieces)) {
-                $param['span'] = (int)$pieces[3];
-                $format = $pieces[1] . $pieces[4];
-            }
-            if (preg_match('#(.*)rowspan=("|\')?(\d+)(?(2)\2)(.*)#i', $format, $pieces)) {
-                $this->_spanCells[$this->_level][$order] =
-                                    $param['rowspan'] = (int)$pieces[3];
-                $format = $pieces[1] . $pieces[4];
-            }
-            $param['format'] = $format;
-        }
-        $this->_countCells[$this->_level][$this->_countRows[$this->_level]] += $param['span'];
-        $ret = $this->wiki->addToken($this->rule, $param);
-        $param['type'] = 'cell_end';
-        return $ret . $matches[3] . $this->wiki->addToken($this->rule, $param );
-    }
-}
-?>
--- a/includes/wikiengine/Parse/Mediawiki/Tighten.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<?php
-
-/**
-* 
-* The rule removes all remaining newlines.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Tighten.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-
-/**
-* 
-* The rule removes all remaining newlines.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Tighten extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Apply tightening directly to the source text.
-    *
-    * @access public
-    * 
-    */
-    
-    function parse()
-    {
-        $this->wiki->source = str_replace("\n", '',
-            $this->wiki->source);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Toc.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-<?php
-
-/**
-* 
-* Looks through parsed text and builds a table of contents.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Toc.php,v 1.4 2005/05/28 21:33:02 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Looks through parsed text and builds a table of contents.
-* 
-* This class implements a Text_Wiki_Parse to find all heading tokens and
-* build a table of contents.  The [[toc]] tag gets replaced with a list
-* of all the level-2 through level-6 headings.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-
-class Text_Wiki_Parse_Toc extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/\n\[\[toc( .*)?\]\]\n/m";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.
-    *  
-    * Token options are:
-    * 
-    * 'type' => ['list_start'|'list_end'|'item_start'|'item_end'|'target']
-    *
-    * 'level' => The heading level (1-6).
-    *
-    * 'count' => Which entry number this is in the list.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A token indicating the TOC collection point.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $count = 0;
-        
-        if (isset($matches[1])) {
-            $attr = $this->getAttrs(trim($matches[1]));
-        } else {
-            $attr = array();
-        }
-        
-        $output = $this->wiki->addToken(
-            $this->rule,
-            array(
-                'type' => 'list_start',
-                'level' => 0,
-                'attr' => $attr
-            )
-        );
-        
-        foreach ($this->wiki->getTokens('Heading') as $key => $val) {
-            
-            if ($val[1]['type'] != 'start') {
-                continue;
-            }
-            
-            $options = array(
-                'type'  => 'item_start',
-                'id'    => $val[1]['id'],
-                'level' => $val[1]['level'],
-                'count' => $count ++
-            );
-            
-            $output .= $this->wiki->addToken($this->rule, $options);
-            
-            $output .= $val[1]['text'];
-            
-            $output .= $this->wiki->addToken(
-                $this->rule,
-                array(
-                    'type' => 'item_end',
-                    'level' => $val[1]['level']
-                )
-            );
-        }
-        
-        $output .= $this->wiki->addToken(
-            $this->rule, array(
-                'type' => 'list_end',
-                'level' => 0
-            )
-        );
-        
-        return "\n$output\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Tt.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-<?php
-
-/**
-* 
-* Find source text marked for teletype (monospace).
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Tt.php,v 1.3 2005/02/23 17:38:29 pmjones Exp $
-* 
-*/
-
-/**
-* 
-* Find source text marked for teletype (monospace).
-* 
-* Defined by text surrounded by two curly braces. On parsing, the text
-* itself is left in place, but the starting and ending instances of
-* curly braces are replaced with tokens.
-* 
-* Token options are:
-* 
-* 'type' => ['start'|'end'] The starting or ending point of the
-* teletype text.  The text itself is left in the source.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Tt extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex = "/{{({*?.*}*?)}}/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text. 
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return string A pair of delimited tokens to be used as a
-    * placeholder in the source text surrounding the teletype text.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken(
-            $this->rule, array('type' => 'start')
-        );
-        
-        $end = $this->wiki->addToken(
-            $this->rule, array('type' => 'end')
-        );
-        
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Underline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-
-/**
-* 
-* Parses for bold text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Underline.php,v 1.1 2005/07/10 20:40:20 justinpatrin Exp $
-* 
-*/
-
-/**
-* 
-* Parses for bold text.
-* 
-* This class implements a Text_Wiki_Rule to find source text marked for
-* strong emphasis (bold) as defined by text surrounded by three
-* single-quotes. On parsing, the text itself is left in place, but the
-* starting and ending instances of three single-quotes are replaced with
-* tokens.
-*
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-*/
-
-class Text_Wiki_Parse_Underline extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * The regular expression used to parse the source text and find
-    * matches conforming to this rule.  Used by the parse() method.
-    * 
-    * @access public
-    * 
-    * @var string
-    * 
-    * @see parse()
-    * 
-    */
-    
-    var $regex =  "/__(()|[^_].*)__/U";
-    
-    
-    /**
-    * 
-    * Generates a replacement for the matched text.  Token options are:
-    * 
-    * 'type' => ['start'|'end'] The starting or ending point of the
-    * emphasized text.  The text itself is left in the source.
-    * 
-    * @access public
-    *
-    * @param array &$matches The array of matches from parse().
-    *
-    * @return A pair of delimited tokens to be used as a placeholder in
-    * the source text surrounding the text to be emphasized.
-    *
-    */
-    
-    function process(&$matches)
-    {
-        $start = $this->wiki->addToken($this->rule, array('type' => 'start'));
-        $end = $this->wiki->addToken($this->rule, array('type' => 'end'));
-        return $start . $matches[1] . $end;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Url.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,355 +0,0 @@
-<?php
-
-/**
-* 
-* Parse for URLS in the source text.
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @author Moritz Venn <moritz.venn@freaque.net>
-* 
-* @license LGPL
-* 
-* @version $Id: Url.php,v 1.1 2005/12/06 15:54:56 ritzmo Exp $
-* 
-*/
-
-/**
-* 
-* Parse for URLS in the source text.
-* 
-* Various URL markings are supported: inline (the URL by itself),
-* inline (where the URL is enclosed in square brackets), and named
-* reference (where the URL is enclosed in square brackets and has a
-* name included inside the brackets).  E.g.:
-*
-* inline      -- http://example.com
-* undescribed -- [http://example.com]
-* described   -- [http://example.com Example Description]
-* described   -- [http://www.example.com|Example Description]
-*
-* When rendering a URL token, this will convert URLs pointing to a .gif,
-* .jpg, or .png image into an inline <img /> tag (for the 'xhtml'
-* format).
-*
-* Token options are:
-* 
-* 'type' => ['inline'|'footnote'|'descr'] the type of URL
-* 
-* 'href' => the URL link href portion
-* 
-* 'text' => the displayed text of the URL link
-* 
-* @category Text
-* 
-* @package Text_Wiki
-* 
-* @author Paul M. Jones <pmjones@php.net>
-* 
-* @author Moritz Venn <moritz.venn@freaque.net>
-* 
-*/
-
-class Text_Wiki_Parse_Url extends Text_Wiki_Parse {
-    
-    
-    /**
-    * 
-    * Keeps a running count of numbered-reference URLs.
-    * 
-    * @access public
-    * 
-    * @var int
-    * 
-    */
-    
-    var $footnoteCount = 0;
-    
-    
-    /**
-    * 
-    * URL schemes recognized by this rule.
-    * 
-    * @access public
-    * 
-    * @var array
-    * 
-    */
-    
-    var $conf = array(
-        'schemes' => array(
-            'http://',
-            'https://',
-            'ftp://',
-            'gopher://',
-            'news://',
-            'mailto:',
-            'irc://'
-        )
-    );
-    
-    
-    /**
-    * 
-    * Constructor.
-    * 
-    * We override the constructor so we can comment the regex nicely.
-    * 
-    * @access public
-    * 
-    */
-    
-    function Text_Wiki_Parse_Url(&$obj)
-    {
-        parent::Text_Wiki_Parse($obj);
-        
-        // convert the list of recognized schemes to a regex-safe string,
-        // where the pattern delim is a slash
-        $tmp = array();
-        $list = $this->getConf('schemes', array());
-        foreach ($list as $val) {
-            $tmp[] = preg_quote($val, '/');
-        }
-        $schemes = implode('|', $tmp);
-        
-        // build the regex
-        $this->regex =
-            "($schemes)" . // allowed schemes
-            "(" . // start pattern
-            "[^ \\/\"\'{$this->wiki->delim}]*\\/" . // no spaces, backslashes, slashes, double-quotes, single quotes, or delimiters;
-            ")*" . // end pattern
-            "[^ \\t\\n\\/\"\'{$this->wiki->delim}]*" .
-            "[A-Za-z0-9\\/?=&~_]";
-            // fix for jEdit syntax highlighting bug: \"
-    }
-    
-    
-    /**
-    * 
-    * Find three different kinds of URLs in the source text.
-    *
-    * @access public
-    * 
-    */
-    
-    function parse()
-    {
-        // -------------------------------------------------------------
-        // 
-        // Described-reference (named) URLs.
-        // 
-
-        // the regular expression for this kind of URL
-        $tmp_regex = '/\[(' . $this->regex . ')[ |]([^\]]+)\]/';
-
-        // use a custom callback processing method to generate
-        // the replacement text for matches.
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processDescr'),
-            $this->wiki->source
-        );
-
-        
-        // -------------------------------------------------------------
-        // 
-        // Unnamed-reference ('Ordinary'-style) URLs.
-        // 
-        
-        // the regular expression for this kind of URL
-        $tmp_regex = '/\[(' . $this->regex . ')\]/U';
-        
-        // use a custom callback processing method to generate
-        // the replacement text for matches.
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            //array(&$this, 'processFootnote'),
-            array(&$this, 'processOrdinary'),
-            $this->wiki->source
-        );
-        
-        
-        // -------------------------------------------------------------
-        // 
-        // Normal inline URLs.
-        // 
-        
-        /*
-        
-        ## DISABLED FOR ENANO
-        ## This messes up HTML links.
-        
-        // the regular expression for this kind of URL
-        
-        $tmp_regex = '/(^|[^A-Za-z])(' . $this->regex . ')(.*?)/';
-        
-        // use the standard callback for inline URLs
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'process'),
-            $this->wiki->source
-        );
-
-        //$tmp_regex = '/(^|[^A-Za-z])([a-zA-Z])(.*?)/';
-        $tmp_regex = '/(^|\s)([a-zA-Z0-9\-]+\.[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+)($|\s)/';
-        
-        // use the standard callback for inline URLs
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processWithoutProtocol'),
-            $this->wiki->source
-        );
-
-        $tmp_regex = '/(^|\s|'.$this->wiki->delim.')<([a-zA-Z0-9\-\.%_\+\!\*\'\(\)\,]+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)+)>(\s|'.$this->wiki->delim.'|$)/';
-        
-        // use the standard callback for inline URLs
-        $this->wiki->source = preg_replace_callback(
-            $tmp_regex,
-            array(&$this, 'processInlineEmail'),
-            $this->wiki->source
-        );
-        */
-    }
-    
-    
-    /**
-    * 
-    * Process inline URLs.
-    * 
-    * @param array &$matches
-    * 
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    * 
-    * @return string The processed text replacement.
-    * 
-    */ 
-    
-    function process(&$matches)
-    {
-        // set options
-        $options = array(
-            'type' => 'inline',
-            'href' => $matches[2],
-            'text' => $matches[2]
-        );
-        
-        // tokenize
-        return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[5];
-    }
-
-    function processWithoutProtocol(&$matches)
-    {
-        // set options
-        $options = array(
-            'type' => 'inline',
-            'href' => 'http://'.$matches[2],
-            'text' => $matches[2]
-        );
-        
-        // tokenize
-        return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[4];
-    }
-
-    function processInlineEmail(&$matches)
-    {
-        // set options
-        $options = array(
-            'type' => 'inline',
-            'href' => 'mailto://'.$matches[2],
-            'text' => $matches[2]
-        );
-        
-        // tokenize
-        return $matches[1] . $this->wiki->addToken($this->rule, $options) . $matches[4];
-    }    
-    
-    /**
-    * 
-    * Process numbered (footnote) URLs.
-    * 
-    * Token options are:
-    * @param array &$matches
-    * 
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    * 
-    * @return string The processed text replacement.
-    * 
-    */ 
-    
-    function processFootnote(&$matches)
-    {
-        // keep a running count for footnotes 
-        $this->footnoteCount++;
-        
-        // set options
-        $options = array(
-            'type' => 'footnote',
-            'href' => $matches[1],
-            'text' => $this->footnoteCount
-        );
-        
-        // tokenize
-        return $this->wiki->addToken($this->rule, $options);
-    }
-    
-     function processOrdinary(&$matches)
-    {
-    	// keep a running count for footnotes 
-        $this->footnoteCount++;
-        
-        // set options
-        $options = array(
-            'type' => 'descr',
-            'href' => $matches[1],
-            'text' => $matches[1]
-        );
-        
-        // tokenize
-        return $this->wiki->addToken($this->rule, $options);
-    }
-    
-    
-    /**
-    * 
-    * Process described-reference (named-reference) URLs.
-    * 
-    * Token options are:
-    *     'type' => ['inline'|'footnote'|'descr'] the type of URL
-    *     'href' => the URL link href portion
-    *     'text' => the displayed text of the URL link
-    * 
-    * @param array &$matches
-    * 
-    * @param array $matches An array of matches from the parse() method
-    * as generated by preg_replace_callback.  $matches[0] is the full
-    * matched string, $matches[1] is the first matched pattern,
-    * $matches[2] is the second matched pattern, and so on.
-    * 
-    * @return string The processed text replacement.
-    * 
-    */ 
-    
-    function processDescr(&$matches)
-    {
-        // set options
-        $options = array(
-            'type' => 'descr',
-            'href' => $matches[1],
-            'text' => $matches[4]
-        );
-
-        // tokenize
-        return $this->wiki->addToken($this->rule, $options);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Parse/Mediawiki/Wikilink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Mediawiki: Parses for links to (inter)wiki pages or images.
- *
- * Text_Wiki rule parser to find links, it groups the 3 rules:
- * # Wikilink: links to internal Wiki pages
- * # Interwiki: links to external Wiki pages (sister projects, interlangage)
- * # Image: Images
- * as defined by text surrounded by double brackets [[]]
- * Translated are the link itself, the section (anchor) and alternate text
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @author     Paul M. Jones <pmjones@php.net>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Wikilink.php,v 1.7 2006/02/25 13:34:50 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Wikilink, Interwiki and Image rules parser class for Mediawiki.
- * This class implements a Text_Wiki_Parse to find links marked
- * in source by text surrounded by 2 opening/closing brackets as 
- * [[Wiki page name#Section|Alternate text]]
- * On parsing, the link is replaced with a token.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki_Parse::Text_Wiki_Parse()
- */
-class Text_Wiki_Parse_Wikilink extends Text_Wiki_Parse {
-
-    /**
-     * Configuration for this rule (Wikilink)
-     *
-     * @access public
-     * @var array
-    */
-    var $conf = array(
-        'spaceUnderscore' => true,
-        'project' => array('demo', 'd'),
-        'url' => 'http://example.com/en/page=%s',
-        'langage' => 'en'
-    );
-
-    /**
-     * Configuration for the Image rule
-     *
-     * @access public
-     * @var array
-    */
-    var $imageConf = array(
-        'prefix' => array('Image', 'image')
-    );
-
-    /**
-     * Configuration for the Interwiki rule
-     *
-     * @access public
-     * @var array
-    */
-    var $interwikiConf = array(
-        'sites' => array(
-            'manual' => 'http://www.php.net/manual/en/%s',
-            'pear'   => 'http://pear.php.net/package/%s',
-            'bugs'   => 'http://pear.php.net/package/%s/bugs'
-        ),
-        'interlangage' => array('en', 'de', 'fr')
-    );
-
-    /**
-     * The regular expression used to parse the source text and find
-     * matches conforming to this rule.  Used by the parse() method.
-     *
-     * @access public
-     * @var string
-     * @see Text_Wiki_Parse::parse()
-     */
-    var $regex = '/(?<!\[)\[\[(?!\[)\s*(:?)((?:[^:]+:)+)?([^:]+)(?:#(.*))?\s*(?:\|(((?R))|.*))?]]/msU';
-
-     /**
-     * Constructor.
-     * We override the constructor to get Image and Interwiki config
-     *
-     * @param object &$obj the base conversion handler
-     * @return The parser object
-     * @access public
-     */
-    function Text_Wiki_Parse_Wikilink(&$obj)
-    {
-        $default = $this->conf;
-        parent::Text_Wiki_Parse($obj);
-        
-        if ( defined('IN_ENANO_INSTALL') )
-        {
-          // This doesn't really matter in the installer
-          $this->imageConf = array(
-            'prefix' => array(':File:')
-            );
-        }
-        else
-        {
-          global $paths;
-          $this->imageConf = array(
-            'prefix' => array(':' . $paths->nslist['File'])
-            );
-        }
-
-        // override config options for image if specified
-        if (in_array('Image', $this->wiki->disable)) {
-            $this->imageConf['prefix'] = array();
-        } else {
-            if (isset($this->wiki->parseConf['Image']) &&
-                is_array($this->wiki->parseConf['Image'])) {
-                $this->imageConf = array_merge(
-                    $this->imageConf,
-                    $this->wiki->parseConf['Image']
-                );
-            }
-        }
-
-        // override config options for interwiki if specified
-        if (in_array('Interwiki', $this->wiki->disable)) {
-            $this->interwikiConf['sites'] = array();
-            $this->interwikiConf['interlangage'] = array();
-        } else {
-            if (isset($this->wiki->parseConf['Interwiki']) &&
-                is_array($this->wiki->parseConf['Interwiki'])) {
-                $this->interwikiConf = array_merge(
-                    $this->interwikiConf,
-                    $this->wiki->parseConf['Interwiki']
-                );
-            }
-            if (empty($this->conf['langage'])) {
-                $this->interwikiConf['interlangage'] = array();
-            }
-        }
-        // convert the list of recognized schemes to a regex OR,
-/*        $schemes = $this->getConf('schemes', $default['schemes']);
-        $this->url = str_replace( '#delim#', $this->wiki->delim,
-           '#(?:' . (is_array($schemes) ? implode('|', $schemes) : $schemes) . ')://'
-           . $this->getConf('host_regexp', $default['host_regexp'])
-           . $this->getConf('path_regexp', $default['path_regexp']) .'#'); */
-    }
-
-    /**
-     * Generates a replacement for the matched text.  Token options are:
-     * - 'page' => the name of the target wiki page
-     * -'anchor' => the optional section in it
-     * - 'text' => the optional alternate link text
-     *
-     * @access public
-     * @param array &$matches The array of matches from parse().
-     * @return string token to be used as replacement 
-     */
-    function process(&$matches)
-    {
-        // Starting colon ?
-        $colon = !empty($matches[1]);
-        $auto = $interlang = $interwiki = $image = $site = '';
-        // Prefix ?
-        if (!empty($matches[2])) {
-            $prefix = explode(':', substr($matches[2], 0, -1));
-            $count = count($prefix);
-            $i = -1;
-            // Autolink
-            if (isset($this->conf['project']) &&
-                    in_array(trim($prefix[0]), $this->conf['project'])) {
-                $auto = trim($prefix[0]);
-                unset($prefix[0]);
-                $i = 0;
-            }
-            while (++$i < $count) {
-                $prefix[$i] = trim($prefix[$i]);
-                // interlangage
-                if (!$interlang &&
-                    in_array($prefix[$i], $this->interwikiConf['interlangage'])) {
-                    $interlang = $prefix[$i];
-                    unset($prefix[$i]);
-                    continue;
-                }
-                // image
-                if (!$image && in_array($prefix[$i], $this->imageConf['prefix'])) {
-                    $image = $prefix[$i];
-                    unset($prefix[$i]);
-                    break;
-                }
-                // interwiki
-                if (isset($this->interwikiConf['sites'][$prefix[$i]])) {
-                    $interwiki = $this->interwikiConf['sites'][$prefix[$i]];
-                    $site = $prefix[$i];
-                    unset($prefix[$i]);
-                }
-                break;
-            }
-            if ($prefix) {
-                $matches[3] = implode(':', $prefix) . ':' . $matches[3];
-            }
-        }
-        $text = empty($matches[5]) ? $matches[3] : $matches[5];
-        $matches[3] = trim($matches[3]);
-        $matches[4] = empty($matches[4]) ? '' : trim($matches[4]);
-        if ($this->conf['spaceUnderscore']) {
-            $matches[3] = preg_replace('/\s+/', '_', $matches[3]);
-            $matches[4] = preg_replace('/\s+/', '_', $matches[4]);
-        }
-        if ($image) {
-            return $this->image($matches[3] . (empty($matches[4]) ? '' : '#' . $matches[4]),
-                                $text, $interlang, $colon);
-        }
-        if (!$interwiki && $interlang && isset($this->conf['url'])) {
-            if ($interlang == $this->conf['langage']) {
-                $interlang = '';
-            } else {
-                $interwiki = $this->conf['url'];
-                $site = isset($this->conf['project']) ? $this->conf['project'][0] : '';
-            }
-        }
-        if ($interwiki) {
-            return $this->interwiki($site, $interwiki,
-                $matches[3] . (empty($matches[4]) ? '' : '#' . $matches[4]),
-                $text, $interlang, $colon);
-        }
-        if ($interlang) {
-            $matches[3] = $interlang . ':' . $matches[3];
-            $text = (empty($matches[5]) ? $interlang . ':' : '') . $text;
-        }
-        // set the options
-        $options = array(
-            'page'   => $matches[3],
-            'anchor' => (empty($matches[4]) ? '' : $matches[4]),
-            'text'   => $text
-        );
-
-        // create and return the replacement token
-        return $this->wiki->addToken($this->rule, $options);
-    }
-
-    /**
-     * Generates an image token.  Token options are:
-     * - 'src' => the name of the image file
-     * - 'attr' => an array of attributes for the image:
-     * | - 'alt' => the optional alternate image text
-     * | - 'align => 'left', 'center' or 'right'
-     *
-     * @access public
-     * @param array &$matches The array of matches from parse().
-     * @return string token to be used as replacement 
-     */
-    function image($name, $text, $interlang, $colon)
-    {
-        $attr = array('alt' => '');
-        // scan text for supplementary attibutes
-        if (strpos($text, '|') !== false) {
-            $splits = explode('|', $text);
-            $sep = '';
-            foreach ($splits as $split) {
-                switch (strtolower($split)) {
-                    case 'left': case 'center': case 'right':
-                        $attr['align'] = strtolower($split);
-                        break;
-                    default:
-                        $attr['alt'] .= $sep . $split;
-                        $sep = '|';
-                }
-            }
-        } else {
-            $attr['alt'] = $text;
-        }
-        $options = array(
-            'src' => ($interlang ? $interlang . ':' : '') . $name,
-            'attr' => $attr);
-
-        // create and return the replacement token
-        return $this->wiki->addToken('Image', $options);
-    }
-
-    /**
-     * Generates an interwiki token.  Token options are:
-     * - 'page' => the name of the target wiki page
-     * - 'site' => the key for external site
-     * - 'url'  => the full target url
-     * - 'text' => the optional alternate link text
-     *
-     * @access public
-     * @param array &$matches The array of matches from parse().
-     * @return string token to be used as replacement 
-     */
-    function interwiki($site, $interwiki, $page, $text, $interlang, $colon)
-    {
-        if ($interlang) {
-            $interwiki = preg_replace('/\b' . $this->conf['langage'] . '\b/i',
-                            $interlang, $interwiki);
-        }
-        // set the options
-        $options = array(
-            'page' => $page,
-            'site' => $site,
-            'url'  => sprintf($interwiki, $page),
-            'text' => $text
-        );
-
-        // create and return the replacement token
-        return $this->wiki->addToken('Interwiki', $options);
-    }
-}
-?>
--- a/includes/wikiengine/Render.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Base rendering class for parsed and tokenized text.
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Render.php,v 1.9 2006/02/17 05:42:55 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Base rendering class for parsed and tokenized text.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render {
-
-
-    /**
-    *
-    * Configuration options for this render rule.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $conf = array();
-
-
-    /**
-    *
-    * The name of this rule's format.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $format = null;
-
-
-    /**
-    *
-    * The name of this rule's token array elements.
-    *
-    * @access public
-    *
-    * @var string
-    *
-    */
-
-    var $rule = null;
-
-
-    /**
-    *
-    * A reference to the calling Text_Wiki object.
-    *
-    * This is needed so that each rule has access to the same source
-    * text, token set, URLs, interwiki maps, page names, etc.
-    *
-    * @access public
-    *
-    * @var object
-    */
-
-    var $wiki = null;
-
-
-    /**
-    *
-    * Constructor for this render format or rule.
-    *
-    * @access public
-    *
-    * @param object &$obj The calling "parent" Text_Wiki object.
-    *
-    */
-
-    function Text_Wiki_Render(&$obj)
-    {
-        // keep a reference to the calling Text_Wiki object
-        $this->wiki =& $obj;
-
-        // get the config-key-name for this object,
-        // strip the Text_Wiki_Render_ part
-        //           01234567890123456
-        $tmp = get_class($this);
-        $tmp = substr($tmp, 17);
-
-        // split into pieces at the _ mark.
-        // first part is format, second part is rule.
-        $part   = explode('_', $tmp);
-        $this->format = isset($part[0]) ? ucwords(strtolower($part[0])) : null;
-        $this->rule   = isset($part[1]) ? ucwords(strtolower($part[1])) : null;
-
-        // is there a format but no rule?
-        // then this is the "main" render object, with
-        // pre() and post() methods.
-        if ($this->format && ! $this->rule &&
-            isset($this->wiki->formatConf[$this->format]) &&
-            is_array($this->wiki->formatConf[$this->format])) {
-
-            // this is a format render object
-            $this->conf = array_merge(
-                $this->conf,
-                $this->wiki->formatConf[$this->format]
-            );
-
-        }
-
-        // is there a format and a rule?
-        if ($this->format && $this->rule &&
-            isset($this->wiki->renderConf[$this->format][$this->rule]) &&
-            is_array($this->wiki->renderConf[$this->format][$this->rule])) {
-
-            // this is a rule render object
-            $this->conf = array_merge(
-                $this->conf,
-                $this->wiki->renderConf[$this->format][$this->rule]
-            );
-        }
-    }
-
-
-    /**
-    *
-    * Simple method to safely get configuration key values.
-    *
-    * @access public
-    *
-    * @param string $key The configuration key.
-    *
-    * @param mixed $default If the key does not exist, return this value
-    * instead.
-    *
-    * @return mixed The configuration key value (if it exists) or the
-    * default value (if not).
-    *
-    */
-
-    function getConf($key, $default = null)
-    {
-        if (isset($this->conf[$key])) {
-            return $this->conf[$key];
-        } else {
-            return $default;
-        }
-    }
-
-
-    /**
-    *
-    * Simple method to wrap a configuration in an sprintf() format.
-    *
-    * @access public
-    *
-    * @param string $key The configuration key.
-    *
-    * @param string $format The sprintf() format string.
-    *
-    * @return mixed The formatted configuration key value (if it exists)
-    * or null (if it does not).
-    *
-    */
-
-    function formatConf($format, $key)
-    {
-        if (isset($this->conf[$key])) {
-            return sprintf($format, $this->conf[$key]);
-        } else {
-            return null;
-        }
-    }
-
-    /**
-    * Default method to render url
-    *
-    * @access public
-    * @param string $urlChunk a part of an url to render
-    * @return rendered url
-    *
-    */
-
-    function urlEncode($urlChunk)
-    {
-        return rawurlencode($urlChunk);
-    }
-
-    /**
-    * Default method to render text (htmlspecialchars)
-    *
-    * @access public
-    * @param string $text the text to render
-    * @return rendered text
-    *
-    */
-
-    function textEncode($text)
-    {
-        return htmlspecialchars($text);
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain extends Text_Wiki_Render {
-    
-    function pre()
-    {
-        return;
-    }
-    
-    function post()
-    {
-        return;
-    }
-    
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Anchor.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-/**
-* 
-* This class renders an anchor target name in XHTML.
-*
-* @author Manuel Holtgrewe <purestorm at ggnore dot net>
-*
-* @author Paul M. Jones <pmjones at ciaweb dot net>
-*
-* @package Text_Wiki
-*
-*/
-
-class Text_Wiki_Render_Plain_Anchor extends Text_Wiki_Render {
-    
-    function token($options)
-    {
-        return $options['name'];
-    }
-}
-
-?>
--- a/includes/wikiengine/Render/Plain/Blockquote.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Blockquote extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        $type = $options['type'];
-        $level = $options['level'];
-    
-        // set up indenting so that the results look nice; we do this
-        // in two steps to avoid str_pad mathematics.  ;-)
-        $pad = str_pad('', $level + 1, "\t");
-        $pad = str_replace("\t", '    ', $pad);
-        
-        // starting
-        if ($type == 'start') {
-            return "\n$pad";
-        }
-        
-        // ending
-        if ($type == 'end') {
-            return "\n$pad";
-        }
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Bold.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Bold extends Text_Wiki_Render {
-
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Box.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Box rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Box.php,v 1.1 2005/08/15 09:50:57 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a box drawn in Plain.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_Box extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Break.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Break extends Text_Wiki_Render {
-
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return "\n";
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Center.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Center extends Text_Wiki_Render {
-
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Code.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Code extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return "\n" . $options['text'] . "\n\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Colortext.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Colortext extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Deflist.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Deflist extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        $type = $options['type'];
-        $pad = "    ";
-        
-        switch ($type) {
-        
-        case 'list_start':
-            return "\n";
-            break;
-        
-        case 'list_end':
-            return "\n\n";
-            break;
-        
-        case 'term_start':
-        
-            // done!
-            return $pad;
-            break;
-        
-        case 'term_end':
-            return "\n";
-            break;
-        
-        case 'narr_start':
-        
-            // done!
-            return $pad . $pad;
-            break;
-        
-        case 'narr_end':
-            return "\n";
-            break;
-        
-        default:
-            return '';
-        
-        }
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Delimiter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Delimiter extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Embed.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Embed extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return strip_tags($options['text']);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Emphasis.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Emphasis extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Font.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * BBCode: extra Font rules renderer to size the text
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Font.php,v 1.1 2005/08/06 11:35:32 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Font rule render class (used for BBCode)
- * 
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki::Text_Wiki_Render()
- */
-class Text_Wiki_Render_Plain_Font extends Text_Wiki_Render {
-    
-    /**
-      * Renders a token into text matching the requested format.
-      * process the font size option 
-      *
-      * @access public
-      * @param array $options The "options" portion of the token (second element).
-      * @return string The text rendered from the token options.
-      */
-    function token($options)
-    {
-        return;
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Freelink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Freelink extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Function.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?php
-
-// $Id: Function.php,v 1.3 2004/10/08 17:46:47 pmjones Exp $
-
-class Text_Wiki_Render_Plain_Function extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        extract($options); // access, return, name, params, throws
-        
-        $output = "$access $return $name ( ";
-        
-        foreach ($params as $key => $val) {
-            $output .= "{$val['type']} {$val['descr']} {$val['default']} ";
-        }
-        
-        $output .= ') ';
-        
-        foreach ($throws as $key => $val) {
-            $output .= "{$val['type']} {$val['descr']} ";
-        }
-        
-        return $output;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Heading.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Heading extends Text_Wiki_Render {
-    
-    function token($options)
-    {
-        if ($options['type'] == 'end') {
-            return "\n\n";
-        } else {
-            return "\n";
-        }
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Horiz.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Horiz extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return "\n";
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Html.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Html extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return strip_tags($options['text']);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Image.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-<?php
-class Text_Wiki_Render_Plain_Image extends Text_Wiki_Render {
-
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Include.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?php
-class Text_Wiki_Render_Plain_Include extends Text_Wiki_Render {    
-    function token()
-    {
-        return '';
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Interwiki.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Interwiki extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        if (isset($options['url'])) {
-            // calculated by the parser (e.g. Mediawiki)
-            $href = $options['url'];
-        } else {
-            $href = $options['site'] . ':' . $options['page'];
-        }
-        return $options['text'] . ' (' . $href . ')';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Italic.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Italic extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/List.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-<?php
-
-
-class Text_Wiki_Render_Plain_List extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * This rendering method is syntactically and semantically compliant
-    * with XHTML 1.1 in that sub-lists are part of the previous list item.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        // make nice variables (type, level, count)
-        extract($options);
-        
-        // set up indenting so that the results look nice; we do this
-        // in two steps to avoid str_pad mathematics.  ;-)
-        $pad = str_pad('', $level, "\t");
-        $pad = str_replace("\t", '    ', $pad);
-                
-        switch ($type) {
-        
-        case 'bullet_list_start':
-            break;
-        
-        case 'bullet_list_end':
-            if ($level == 0) {
-                return "\n\n";
-            }
-            break;
-        
-        case 'number_list_start':
-            break;
-        
-        case 'number_list_end':
-            if ($level == 0) {
-                return "\n\n";
-            }
-            break;
-        
-        case 'bullet_item_start':
-        case 'number_item_start':
-            return "\n$pad";
-            break;
-        
-        case 'bullet_item_end':
-        case 'number_item_end':
-        default:
-            // ignore item endings and all other types.
-            // item endings are taken care of by the other types
-            // depending on their place in the list.
-            return;
-            break;
-        }
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Newline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Newline extends Text_Wiki_Render {
-    
-    
-    function token($options)
-    {
-        return "\n";
-    }
-}
-
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Page.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Page rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Page.php,v 1.1 2005/08/15 15:27:19 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders page markers in Plain.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_Page extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return "\x0C";
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Paragraph.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Paragraph extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        extract($options); //type
-        
-        if ($type == 'start') {
-            return '';
-        }
-        
-        if ($type == 'end') {
-            return "\n\n";
-        }
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Phplookup.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Phplookup extends Text_Wiki_Render {
-    
-    var $conf = array('target' => '_blank');
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return trim($options['text']);
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Plugin.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Plugin rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Plugin.php,v 1.1 2005/08/17 09:16:36 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders wiki plugins in Plain. (empty)
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_Plugin extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    * Plugins produce wiki markup so are processed by parsing, no tokens produced
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Prefilter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?php
-
-/*
- * Enano project note: this skeleton class was rewritten due to a licensing issue.
- */
-
-/**
-* 
-* This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so
-* that line endings are consistently \n, lines ending in a backslash \
-* are concatenated with the next line, and tabs are converted to spaces.
-*
-* @author Paul M. Jones <pmjones@php.net>
-*
-* @package Text_Wiki
-*
-*/
-
-class Text_Wiki_Render_Plain_Prefilter  extends Text_Wiki_Render
-{
-  function token()
-  {
-    return '';
-  }
-}
--- a/includes/wikiengine/Render/Plain/Preformatted.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Preformatted rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Preformatted.php,v 1.1 2005/08/15 06:15:41 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders preformated text in Plain.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_Preformatted extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Raw.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Raw extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Revise.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Revise extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Smiley.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Smiley rule Plain renderer
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Smiley.php,v 1.2 2005/08/10 11:42:08 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Smiley rule Plain render class
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki::Text_Wiki_Render()
- */
-class Text_Wiki_Render_Plain_Smiley extends Text_Wiki_Render {
-
-    /**
-      * Renders a token into text matching the requested format.
-      * process the Smileys
-      *
-      * @access public
-      * @param array $options The "options" portion of the token (second element).
-      * @return string The text rendered from the token options.
-      */
-    function token($options)
-    {
-        return $options['symbol'];
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Specialchar.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Specialchar rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Specialchar.php,v 1.1 2005/08/15 11:10:38 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders special characters in Plain.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_SpecialChar extends Text_Wiki_Render {
-
-    var $types = array('~bs~' => '\\',
-                       '~hs~' => ' ',
-                       '~amp~' => '&',
-                       '~ldq~' => '"',
-                       '~rdq~' => '"',
-                       '~lsq~' => "'",
-                       '~rsq~' => "'",
-                       '~c~' => '©',
-                       '~--~' => '-',
-                       '" -- "' => '-',
-                       '&quot; -- &quot;' => '-',
-                       '~lt~' => '<',
-                       '~gt~' => '>');
-
-    function token($options)
-    {
-        if (isset($this->types[$options['char']])) {
-            return $this->types[$options['char']];
-        } else {
-            return $options['char'];
-        }
-    }
-}
-
-?>
--- a/includes/wikiengine/Render/Plain/Strong.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Strong extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Subscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Subscript rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Subscript.php,v 1.1 2005/08/15 10:09:06 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders subscript text in Plain.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_Subscript extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Superscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Superscript extends Text_Wiki_Render {
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Table.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Table extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        // make nice variable names (type, attr, span)
-        extract($options);
-
-        $pad = '    ';
-
-        switch ($type) {
-
-        case 'table_start':
-            return;
-            break;
-
-        case 'table_end':
-            return;
-            break;
-
-        case 'caption_start':
-            return;
-            break;
-
-        case 'caption_end':
-            return "\n";
-            break;
-
-        case 'row_start':
-            return;
-            break;
-
-        case 'row_end':
-            return " ||\n";
-            break;
-
-        case 'cell_start':
-            return " || ";
-            break;
-
-        case 'cell_end':
-            return;
-            break;
-
-        default:
-            return '';
-
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Tighten.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?php
-class Text_Wiki_Render_Plain_Tighten extends Text_Wiki_Render {
-    
-    
-    function token()
-    {
-        return '';
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Titlebar.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Titlebar rule end renderer for Plain
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Titlebar.php,v 1.1 2005/08/15 11:36:55 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a title bar in Plain.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Plain_Titlebar extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            return '***** ';
-        }
-
-        if ($options['type'] == 'end') {
-            return " *****\n";
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Plain/Toc.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Toc extends Text_Wiki_Render {
-    
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        // type, count, level
-        extract($options);
-        
-        if ($type == 'item_start') {
-            
-            // build some indenting spaces for the text
-            $indent = ($level - 2) * 4;
-            $pad = str_pad('', $indent);
-            return $pad;
-        }
-        
-        if ($type == 'item_end') {
-            return "\n";
-        }
-    }
-
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Tt.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_tt extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Underline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Underline extends Text_Wiki_Render {
-
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Url.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-<?php
-
-
-class Text_Wiki_Render_Plain_Url extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into text matching the requested format.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Plain/Wikilink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<?php
-
-class Text_Wiki_Render_Plain_Wikilink extends Text_Wiki_Render {
-    
-    
-    /**
-    * 
-    * Renders a token into plain text.
-    * 
-    * @access public
-    * 
-    * @param array $options The "options" portion of the token (second
-    * element).
-    * 
-    * @return string The text rendered from the token options.
-    * 
-    */
-    
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
\ No newline at end of file
--- a/includes/wikiengine/Render/Xhtml.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Format class for the Xhtml rendering
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Xhtml.php,v 1.9 2006/02/10 22:31:50 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Format class for the Xhtml rendering
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml extends Text_Wiki_Render {
-
-    var $conf = array(
-    	'translate' => HTML_ENTITIES,
-    	'quotes'    => ENT_COMPAT,
-    	'charset'   => 'ISO-8859-1'
-    );
-
-    function pre()
-    {
-        $this->wiki->source = $this->textEncode($this->wiki->source);
-    }
-
-    function post()
-    {
-        return;
-    }
-
-
-    /**
-    * Method to render text
-    *
-    * @access public
-    * @param string $text the text to render
-    * @return rendered text
-    *
-    */
-
-    function textEncode($text)
-    {
-        // attempt to translate HTML entities in the source.
-        // get the config options.
-        $type = $this->getConf('translate', HTML_ENTITIES);
-        $quotes = $this->getConf('quotes', ENT_COMPAT);
-        $charset = $this->getConf('charset', 'ISO-8859-1');
-
-        // have to check null and false because HTML_ENTITIES is a zero
-        if ($type === HTML_ENTITIES) {
-          /*
-
-            // keep a copy of the translated version of the delimiter
-            // so we can convert it back.
-            $new_delim = htmlentities($this->wiki->delim, $quotes, $charset);
-            
-            // convert the entities.  we silence the call here so that
-            // errors about charsets don't pop up, per counsel from
-            // Jan at Horde.  (http://pear.php.net/bugs/bug.php?id=4474)
-            $text = @htmlentities(
-              $text,
-              $quotes,
-              $charset
-            );
-            
-            // Mod for Enano: undo any HTML cleaning - we will take care of this ourselves
-            $text = str_replace(Array('&lt;', '&gt;', '&quot;', '&amp;', '&#039;'),
-                                Array('<',    '>',    '"',      '&',     "'"     ),
-                                $text);
-            
-            // re-convert the delimiter
-            $text = str_replace(
-              $new_delim, $this->wiki->delim, $text
-            );
-          */
-
-        } elseif ($type === HTML_SPECIALCHARS) {
-    
-          // keep a copy of the translated version of the delimiter
-          // so we can convert it back.
-          $new_delim = htmlspecialchars($this->wiki->delim, $quotes,
-              $charset);
-    
-          // convert the entities.  we silence the call here so that
-          // errors about charsets don't pop up, per counsel from
-          // Jan at Horde.  (http://pear.php.net/bugs/bug.php?id=4474)
-          $text = @htmlspecialchars(
-            $text,
-            $quotes,
-            $charset
-          );
-    
-          // re-convert the delimiter
-          $text = str_replace(
-            $new_delim, $this->wiki->delim, $text
-          );
-        }
-        return $text;
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Anchor.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Anchor rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Anchor.php,v 1.10 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders an anchor target name in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Anchor extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    function token($options)
-    {
-        extract($options); // $type, $name
-
-        if ($type == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            $format = "<a$css id=\"%s\">";
-            return sprintf($format, $this->textEncode($name));
-        }
-
-        if ($type == 'end') {
-            return '</a>';
-        }
-    }
-}
-
-?>
--- a/includes/wikiengine/Render/Xhtml/Blockquote.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Blockquote rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Blockquote.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a blockquote in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Blockquote extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $type = $options['type'];
-        $level = $options['level'];
-
-        // set up indenting so that the results look nice; we do this
-        // in two steps to avoid str_pad mathematics.  ;-)
-        $pad = str_pad('', $level, "\t");
-        $pad = str_replace("\t", '    ', $pad);
-
-        // pick the css type
-        $css = $this->formatConf(' class="%s"', 'css');
-
-        // starting
-        if ($type == 'start') {
-            return "$pad<blockquote$css>";
-        }
-
-        // ending
-        if ($type == 'end') {
-            return $pad . "</blockquote>\n";
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Bold.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Bold rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Bold.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders bold text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Bold extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<b$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</b>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Box.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Box rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Box.php,v 1.2 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a box drawn in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Box extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<div class='simplebox'$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</div>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Break.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Break rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Break.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders line breaks in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Break extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $css = $this->formatConf(' class="%s"', 'css');
-        return "<br$css />\n";
-    }
-}
-
-?>
--- a/includes/wikiengine/Render/Xhtml/Center.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Center rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Center.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders centered content in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Center extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            return '<div style="text-align: center;">';
-        }
-
-        if ($options['type'] == 'end') {
-            return '</div>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Code.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Code rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Code.php,v 1.13 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders code blocks in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css'      => null, // class for <pre>
-        'css_code' => null, // class for generic <code>
-        'css_php'  => null, // class for PHP <code>
-        'css_html' => null, // class for HTML <code>
-        'css_filename' => null // class for optional filename <div>
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $text = $options['text'];
-        $attr = $options['attr'];
-        $type = strtolower($attr['type']);
-
-        $css      = $this->formatConf(' class="%s"', 'css');
-        $css_code = $this->formatConf(' class="%s"', 'css_code');
-        $css_php  = $this->formatConf(' class="%s"', 'css_php');
-        $css_html = $this->formatConf(' class="%s"', 'css_html');
-        $css_filename = $this->formatConf(' class="%s"', 'css_filename');
-
-        if ($type == 'php') {
-            if (substr($options['text'], 0, 5) != '<?php') {
-                // PHP code example:
-                // add the PHP tags
-                $text = "<?php\n" . $options['text'] . "\n?>"; // <?php
-            }
-
-            // convert tabs to four spaces
-            $text = str_replace("\t", "    ", $text);
-
-            // colorize the code block (also converts HTML entities and adds
-            // <code>...</code> tags)
-            ob_start();
-            highlight_string($text);
-            $text = ob_get_contents();
-            ob_end_clean();
-
-            // replace <br /> tags with simple newlines.
-            // replace non-breaking space with simple spaces.
-            // translate HTML <font> and color to XHTML <span> and style.
-            // courtesy of research by A. Kalin :-).
-            $map = array(
-                '<br />'  => "\n",
-                '&nbsp;'  => ' ',
-                '<font'   => '<span',
-                '</font>' => '</span>',
-                'color="' => 'style="color:'
-            );
-            $text = strtr($text, $map);
-
-            // get rid of the last newline inside the code block
-            // (becuase higlight_string puts one there)
-            if (substr($text, -8) == "\n</code>") {
-                $text = substr($text, 0, -8) . "</code>";
-            }
-
-            // replace all <code> tags with classed tags
-            if ($css_php) {
-                $text = str_replace('<code>', "<code$css_php>", $text);
-            }
-
-            // done
-            $text = "<pre$css>$text</pre>";
-
-        } elseif ($type == 'html' || $type == 'xhtml') {
-
-            // HTML code example:
-            // add <html> opening and closing tags,
-            // convert tabs to four spaces,
-            // convert entities.
-            $text = str_replace("\t", "    ", $text);
-            $text = "<html>\n$text\n</html>";
-            $text = $this->textEncode($text);
-            $text = "<pre$css><code$css_html>$text</code></pre>";
-
-        } else {
-            // generic code example:
-            // convert tabs to four spaces,
-            // convert entities.
-            $text = str_replace("\t", "    ", $text);
-            $text = $this->textEncode($text);
-            $text = "<pre$css><code$css_code>$text</code></pre>";
-        }
-
-        if ($css_filename && isset($attr['filename'])) {
-            $text = "<div$css_filename>" .
-                $attr['filename'] . '</div>' . $text;
-        }
-
-        return "\n$text\n\n";
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Colortext.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Colortext rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Colortext.php,v 1.6 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders colored text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Colortext extends Text_Wiki_Render {
-
-    var $colors = array(
-        'aqua',
-        'black',
-        'blue',
-        'fuchsia',
-        'gray',
-        'green',
-        'lime',
-        'maroon',
-        'navy',
-        'olive',
-        'purple',
-        'red',
-        'silver',
-        'teal',
-        'white',
-        'yellow'
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $type = $options['type'];
-        $color = $options['color'];
-
-        if (! in_array($color, $this->colors) && $color{0} != '#') {
-            $color = '#' . $color;
-        }
-
-        if ($type == 'start') {
-            return "<span style=\"color: $color;\">";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</span>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Deflist.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Deflist rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Deflist.php,v 1.8 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders definition lists in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Deflist extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css_dl' => null,
-        'css_dt' => null,
-        'css_dd' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $type = $options['type'];
-        $pad = "    ";
-
-        switch ($type) {
-
-        case 'list_start':
-            $css = $this->formatConf(' class="%s"', 'css_dl');
-            return "<dl$css>\n";
-            break;
-
-        case 'list_end':
-            return "</dl>\n\n";
-            break;
-
-        case 'term_start':
-            $css = $this->formatConf(' class="%s"', 'css_dt');
-            return $pad . "<dt$css>";
-            break;
-
-        case 'term_end':
-            return "</dt>\n";
-            break;
-
-        case 'narr_start':
-            $css = $this->formatConf(' class="%s"', 'css_dd');
-            return $pad . $pad . "<dd$css>";
-            break;
-
-        case 'narr_end':
-            return "</dd>\n";
-            break;
-
-        default:
-            return '';
-
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Delimiter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Delimiter rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Delimiter.php,v 1.5 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class set back the replaced delimiters in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Delimiter extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Embed.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Embed rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Embed.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class replaces the embedded php output in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Embed extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Emphasis.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Emphasis rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Emphasis.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders emphasized text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Emphasis extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<em$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</em>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Font.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * BBCode: extra Font rules renderer to size the text
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Font.php,v 1.1 2005/08/06 11:36:45 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Font rule render class (used for BBCode)
- * 
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki::Text_Wiki_Render()
- */
-class Text_Wiki_Render_Xhtml_Font extends Text_Wiki_Render {
-    
-/*    var $size = array(
-        'xx-small',
-        'x-small',
-        'small',
-        'medium',
-        'large',
-        'x-large',
-        'xx-large',
-        'larger',
-        'smaller'
-    );
-    var $units = array(
-        'em',
-        'ex',
-        'px',
-        'in',
-        'cm',
-        'mm',
-        'pt',
-        'pc'
-    );
-*/    
-    
-    /**
-      * Renders a token into text matching the requested format.
-      * process the font size option 
-      *
-      * @access public
-      * @param array $options The "options" portion of the token (second element).
-      * @return string The text rendered from the token options.
-      */
-    function token($options)
-    {
-        if ($options['type'] == 'end') {
-            return '</span>';
-        }
-        if ($options['type'] != 'start') {
-            return '';
-        }
-
-        $ret = '<span style="';
-        if (isset($options['size'])) {
-            $size = trim($options['size']);
-            if (is_numeric($size)) {
-                $size .= 'px';
-            }
-            $ret .= "font-size: $size;";
-        }
-        
-        return $ret.'">';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Freelink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Freelink rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Freelink.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * The wikilink render class.
- */
-require_once 'Text/Wiki/Render/Xhtml/Wikilink.php';
-
-/**
- * This class renders free links in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Freelink extends Text_Wiki_Render_Xhtml_Wikilink {
-    // renders identically to wikilinks, only the parsing is different :-)
-}
-
-?>
--- a/includes/wikiengine/Render/Xhtml/Function.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Function rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Function.php,v 1.5 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a function description in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Function extends Text_Wiki_Render {
-
-    var $conf = array(
-    	// list separator for params and throws
-        'list_sep' => ', ',
-
-        // the "main" format string
-        'format_main' => '%access %return <b>%name</b> ( %params ) %throws',
-
-        // the looped format string for required params
-        'format_param' => '%type <i>%descr</i>',
-
-        // the looped format string for params with default values
-        'format_paramd' => '[%type <i>%descr</i> default %default]',
-
-        // the looped format string for throws
-        'format_throws' => '<b>throws</b> %type <i>%descr</i>'
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        extract($options); // name, access, return, params, throws
-
-        // build the baseline output
-        $output = $this->conf['format_main'];
-        $output = str_replace('%access', $this->textEncode($access), $output);
-        $output = str_replace('%return', $this->textEncode($return), $output);
-        $output = str_replace('%name', $this->textEncode($name), $output);
-
-        // build the set of params
-        $list = array();
-        foreach ($params as $key => $val) {
-
-            // is there a default value?
-            if ($val['default']) {
-                $tmp = $this->conf['format_paramd'];
-            } else {
-                $tmp = $this->conf['format_param'];
-            }
-
-            // add the param elements
-            $tmp = str_replace('%type', $this->textEncode($val['type']), $tmp);
-            $tmp = str_replace('%descr', $this->textEncode($val['descr']), $tmp);
-            $tmp = str_replace('%default', $this->textEncode($val['default']), $tmp);
-            $list[] = $tmp;
-        }
-
-        // insert params into output
-        $tmp = implode($this->conf['list_sep'], $list);
-        $output = str_replace('%params', $tmp, $output);
-
-        // build the set of throws
-        $list = array();
-        foreach ($throws as $key => $val) {
-               $tmp = $this->conf['format_throws'];
-            $tmp = str_replace('%type', $this->textEncode($val['type']), $tmp);
-            $tmp = str_replace('%descr', $this->textEncode($val['descr']), $tmp);
-            $list[] = $tmp;
-        }
-
-        // insert throws into output
-        $tmp = implode($this->conf['list_sep'], $list);
-        $output = str_replace('%throws', $tmp, $output);
-
-        // close the div and return the output
-        $output .= '</div>';
-        return "\n$output\n\n";
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Heading.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Heading rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Heading.php,v 1.10 2005/09/18 13:39:39 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders headings in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Heading extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css_h1' => null,
-        'css_h2' => null,
-        'css_h3' => null,
-        'css_h4' => null,
-        'css_h5' => null,
-        'css_h6' => null
-    );
-
-    function token($options)
-    {
-    	$collapse = null;
-        static $jsOutput = false;
-        // get nice variable names (id, type, level)
-        extract($options);
-
-        switch($type) {
-        case 'start':
-            $css = $this->formatConf(' class="%s"', "css_h$level");
-            return '
-<h'.$level.$css.' id="'.$id.'"'.($collapse !== null ? ' onclick="hideTOC(\''.$id.'\');"' : '').'>';
-
-        case 'end':
-            return '</h'.$level.'>
-'.($collapse !== null ? '<a id="'.$id.'__link" href="javascript:void();" onclick="hideTOC(\''.$id.'\')">['.($collapse ? '+' : '-').']</a>
-' : '');
-        case 'startContent':
-            if ($collapse !== null) {
-                if ($jsOutput) {
-                    $js = '';
-                } else {
-                    $js = '
-<script language="javascript">
-function hideTOC(id) {
-    div = document.getElementById(id+"__content");
-    link = document.getElementById(id+"__link");
-    if (div.style.display == "none") {
-        div.style.display = "";
-        link.innerHTML = "[-]";
-    } else {
-        div.style.display = "none";
-        link.innerHTML = "[+]";
-    }
-}
-</script>
-';
-                }
-            } else {
-                $js = '';
-            }
-            return  $js.'
-<div style="'.($collapse === true ? 'display: none; ' : '').'padding: 0px; margin: 0px; border: none;" id="'.$id.'__content">
-';
-        case 'endContent':
-            return '
-</div>
-';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Horiz.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Horiz rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Horiz.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders an horizontal bar in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Horiz extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $css = $this->formatConf(' class="%s"', 'css');
-        return "<hr$css />\n";
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Html.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Html rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Html.php,v 1.5 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders preformated html in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Html extends Text_Wiki_Render {
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Image.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Image rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Image.php,v 1.16 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class inserts an image in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Image extends Text_Wiki_Render {
-
-    var $conf = array(
-        'base' => '/',
-        'url_base' => null,
-        'css'  => null,
-        'css_link' => null
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        // note the image source
-        $src = $options['src'];
-
-        // is the source a local file or URL?
-        if (strpos($src, '://') === false) {
-            // the source refers to a local file.
-            // add the URL base to it.
-            $src = $this->getConf('base', '/') . $src;
-        }
-
-        // stephane@metacites.net
-        // is the image clickable?
-        if (isset($options['attr']['link'])) {
-            // yes, the image is clickable.
-            // are we linked to a URL or a wiki page?
-            if (strpos($options['attr']['link'], '://')) {
-                // it's a URL, prefix the URL base
-                $href = $this->getConf('url_base') . $options['attr']['link'];
-            } else {
-                // it's a WikiPage; assume it exists.
-                /** @todo This needs to honor sprintf wikilinks (pmjones) */
-                /** @todo This needs to honor interwiki (pmjones) */
-                /** @todo This needs to honor freelinks (pmjones) */
-                $href = $this->wiki->getRenderConf('xhtml', 'wikilink', 'view_url') .
-                    $options['attr']['link'];
-            }
-        } else {
-            // image is not clickable.
-            $href = null;
-        }
-        // unset so it won't show up as an attribute
-        unset($options['attr']['link']);
-
-        // stephane@metacites.net -- 25/07/2004
-        // we make up an align="center" value for the <img> tag.
-        if (isset($options['attr']['align']) &&
-            $options['attr']['align'] == 'center') {
-
-            // unset so it won't show up as an attribute
-            unset($options['attr']['align']);
-
-            // make sure we have a style attribute
-            if (! isset($options['attr']['style'])) {
-                // no style, set up a blank one
-                $options['attr']['style'] = '';
-            } else {
-                // style exists, add a space
-                $options['attr']['style'] .= ' ';
-            }
-
-            // add a "center" style to the existing style.
-            $options['attr']['style'] .=
-                'display: block; margin-left: auto; margin-right: auto;';
-        }
-
-        // stephane@metacites.net -- 25/07/2004
-        // try to guess width and height
-        if (! isset($options['attr']['width']) &&
-            ! isset($options['attr']['height'])) {
-
-            // does the source refer to a local file or a URL?
-            if (strpos($src,'://')) {
-                // is a URL link
-                $imageFile = $src;
-            } elseif ($src[0] == '.') {
-            	// reg at dav-muz dot net -- 2005-03-07
-				// is a local file on relative path.
-				$imageFile = $src; # ...don't do anything because it's perfect!
-			} else {
-                // is a local file on absolute path.
-                $imageFile = $_SERVER['DOCUMENT_ROOT'] . $src;
-            }
-
-            // attempt to get the image size
-            $imageSize = @getimagesize($imageFile);
-
-            if (is_array($imageSize)) {
-                $options['attr']['width'] = $imageSize[0];
-                $options['attr']['height'] = $imageSize[1];
-            }
-
-        }
-
-        // start the HTML output
-        $output = '<img src="' . $this->textEncode($src) . '"';
-
-        // get the CSS class but don't add it yet
-        $css = $this->formatConf(' class="%s"', 'css');
-
-        // add the attributes to the output, and be sure to
-        // track whether or not we find an "alt" attribute
-        $alt = false;
-        foreach ($options['attr'] as $key => $val) {
-
-            // track the 'alt' attribute
-            if (strtolower($key) == 'alt') {
-                $alt = true;
-            }
-
-            // the 'class' attribute overrides the CSS class conf
-            if (strtolower($key) == 'class') {
-                $css = null;
-            }
-
-            $key = $this->textEncode($key);
-            $val = $this->textEncode($val);
-            $output .= " $key=\"$val\"";
-        }
-
-        // always add an "alt" attribute per Stephane Solliec
-        if (! $alt) {
-            $alt = $this->textEncode(basename($options['src']));
-            $output .= " alt=\"$alt\"";
-        }
-
-        // end the image tag with the automatic CSS class (if any)
-        $output .= "$css />";
-
-        // was the image clickable?
-        if ($href) {
-            // yes, add the href and return
-            $href = $this->textEncode($href);
-            $css = $this->formatConf(' class="%s"', 'css_link');
-            $output = "<a$css href=\"$href\">$output</a>";
-        }
-
-        return $output;
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Include.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Include rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Include.php,v 1.6 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders included maekup in XHTML. (empty)
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Include extends Text_Wiki_Render {
-    function token()
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Interwiki.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Interwiki rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Interwiki.php,v 1.14 2006/02/25 05:03:13 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders inter wikis links in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Interwiki extends Text_Wiki_Render {
-
-    var $conf = array(
-        'sites' => array(
-            'MeatBall' => 'http://www.usemod.com/cgi-bin/mb.pl?%s',
-            'Advogato' => 'http://advogato.org/%s',
-            'Wiki'       => 'http://c2.com/cgi/wiki?%s'
-        ),
-        'target' => '_blank',
-        'css' => null
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $text = $options['text'];
-        if (isset($options['url'])) {
-            // calculated by the parser (e.g. Mediawiki)
-            $href = $options['url'];
-        } else {
-            $site = $options['site'];
-            // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces)
-            $page = $this->urlEncode($options['page']);
-
-            if (isset($this->conf['sites'][$site])) {
-                $href = $this->conf['sites'][$site];
-            } else {
-                return $text;
-            }
-
-            // old form where page is at end,
-            // or new form with %s placeholder for sprintf()?
-            if (strpos($href, '%s') === false) {
-                // use the old form
-                $href = $href . $page;
-            } else {
-                // use the new form
-                $href = sprintf($href, $page);
-            }
-        }
-
-        // allow for alternative targets
-        $target = $this->getConf('target');
-
-        // build base link
-        $css = $this->formatConf(' class="%s"', 'css');
-        $text = $this->textEncode($text);
-        $output = "<a$css href=\"$href\"";
-
-        // are we targeting a specific window?
-        if ($target) {
-            // this is XHTML compliant, suggested by Aaron Kalin.
-            // code tip is actually from youngpup.net, and it
-            // uses the $target as the new window name.
-            $target = $this->textEncode($target);
-            $output .= " onclick=\"window.open(this.href, '$target');";
-            $output .= " return false;\"";
-        }
-
-        $output .= ">$text</a>";
-
-        return $output;
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Italic.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Italic rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Italic.php,v 1.7 2005/07/30 08:03:28 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders italic text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Italic extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<i$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</i>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/List.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,172 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * List rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: List.php,v 1.9 2005/11/06 10:38:22 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders bullet and ordered lists in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_List extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css_ol' => null,
-        'css_ol_li' => null,
-        'css_ul' => null,
-        'css_ul_li' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * This rendering method is syntactically and semantically compliant
-    * with XHTML 1.1 in that sub-lists are part of the previous list item.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        // make nice variables (type, level, count)
-        extract($options);
-
-        // set up indenting so that the results look nice; we do this
-        // in two steps to avoid str_pad mathematics.  ;-)
-        $pad = str_pad('', $level, "\t");
-        $pad = str_replace("\t", '    ', $pad);
-
-        switch ($type) {
-
-        case 'bullet_list_start':
-
-            // build the base HTML
-            $css = $this->formatConf(' class="%s"', 'css_ul');
-            $html = "<ul$css>";
-
-            /*
-            // if this is the opening block for the list,
-            // put an extra newline in front of it so the
-            // output looks nice.
-            if ($level == 0) {
-                $html = "\n$html";
-            }
-            */
-
-            // done!
-            return $html;
-            break;
-
-        case 'bullet_list_end':
-
-            // build the base HTML
-            $html = "</li>\n$pad</ul>";
-
-            // if this is the closing block for the list,
-            // put extra newlines after it so the output
-            // looks nice.
-            if ($level == 0) {
-                $html .= "\n\n";
-            }
-
-            // done!
-            return $html;
-            break;
-
-        case 'number_list_start':
-            if (isset($format)) {
-                $format = ' type="' . $format . '"';
-            } else  {
-                $format = '';
-            }
-            // build the base HTML
-            $css = $this->formatConf(' class="%s"', 'css_ol');
-            $html = "<ol{$format}{$css}>";
-
-            /*
-            // if this is the opening block for the list,
-            // put an extra newline in front of it so the
-            // output looks nice.
-            if ($level == 0) {
-                $html = "\n$html";
-            }
-            */
-
-            // done!
-            return $html;
-            break;
-
-        case 'number_list_end':
-
-            // build the base HTML
-            $html = "</li>\n$pad</ol>";
-
-            // if this is the closing block for the list,
-            // put extra newlines after it so the output
-            // looks nice.
-            if ($level == 0) {
-                $html .= "\n\n";
-            }
-
-            // done!
-            return $html;
-            break;
-
-        case 'bullet_item_start':
-        case 'number_item_start':
-
-            // pick the proper CSS class
-            if ($type == 'bullet_item_start') {
-                $css = $this->formatConf(' class="%s"', 'css_ul_li');
-            } else {
-                $css = $this->formatConf(' class="%s"', 'css_ol_li');
-            }
-
-            // build the base HTML
-            $html = "\n$pad<li$css>";
-
-            // for the very first item in the list, do nothing.
-            // but for additional items, be sure to close the
-            // previous item.
-            if ($count > 0) {
-                $html = "</li>$html";
-            }
-
-            // done!
-            return $html;
-            break;
-
-        case 'bullet_item_end':
-        case 'number_item_end':
-        default:
-            // ignore item endings and all other types.
-            // item endings are taken care of by the other types
-            // depending on their place in the list.
-            return '';
-            break;
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Newline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Newline rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Newline.php,v 1.5 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders new lines in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Newline extends Text_Wiki_Render {
-
-
-    function token($options)
-    {
-        return "<br />\n";
-    }
-}
-
-?>
--- a/includes/wikiengine/Render/Xhtml/Page.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Page rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Page.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders page markers in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Page extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return 'PAGE MARKER HERE*&^%$#^$%*PAGEMARKERHERE';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Paragraph.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Paragraph rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Paragraph.php,v 1.7 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders paragraphs in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Paragraph extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        extract($options); //type
-
-        if ($type == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<p$css>";
-        }
-
-        if ($type == 'end') {
-            return "</p>\n\n";
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Phplookup.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Phplookup rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Phplookup.php,v 1.11 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a link to php functions description in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Phplookup extends Text_Wiki_Render {
-
-    var $conf = array(
-        'target' => '_blank',
-        'css' => null
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        $text = trim($options['text']);
-        $css = $this->formatConf(' class="%s"', 'css');
-
-        // start the html
-        $output = "<a$css";
-
-        // are we targeting another window?
-        $target = $this->getConf('target', '');
-        if ($target) {
-            // use a "popup" window.  this is XHTML compliant, suggested by
-            // Aaron Kalin.  uses the $target as the new window name.
-            $target = $this->textEncode($target);
-            $output .= " onclick=\"window.open(this.href, '$target');";
-            $output .= " return false;\"";
-        }
-
-        // take off the final parens for functions
-        if (substr($text, -2) == '()') {
-            $q = substr($text, 0, -2);
-        } else {
-            $q = $text;
-        }
-
-        // toggg 2006/02/05 page name must be url encoded (e.g. may contain spaces)
-        $q = $this->urlEncode($q);
-        $text = $this->textEncode($text);
-
-        // finish and return
-        $output .= " href=\"http://php.net/$q\">$text</a>";
-        return $output;
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Plugin.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Plugin rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Plugin.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders wiki plugins in XHTML. (empty)
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Plugin extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    * Plugins produce wiki markup so are processed by parsing, no tokens produced
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Prefilter.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Prefilter rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Prefilter.php,v 1.7 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class implements a Text_Wiki_Render_Xhtml to "pre-filter" source text so
- * that line endings are consistently \n, lines ending in a backslash \
- * are concatenated with the next line, and tabs are converted to spaces.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Prefilter extends Text_Wiki_Render {
-    function token()
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Preformatted.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Preformatted rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Preformatted.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders preformated text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Preformatted extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return '<pre>'.$options['text'].'</pre>';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Raw.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Raw rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Raw.php,v 1.5 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders not processed blocks in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Raw extends Text_Wiki_Render {
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        return $options['text'];
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Revise.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Revise rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Revise.php,v 1.7 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders revision marks in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Revise extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css_ins' => null,
-        'css_del' => null
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'del_start') {
-            $css = $this->formatConf(' class="%s"', 'css_del');
-            return "<del$css>";
-        }
-
-        if ($options['type'] == 'del_end') {
-            return "</del>";
-        }
-
-        if ($options['type'] == 'ins_start') {
-            $css = $this->formatConf(' class="%s"', 'css_ins');
-            return "<ins$css>";
-        }
-
-        if ($options['type'] == 'ins_end') {
-            return "</ins>";
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Smiley.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Smiley rule Xhtml renderer
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Smiley.php,v 1.2 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * Smiley rule Xhtml render class
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Bertrand Gugger <bertrand@toggg.com>
- * @copyright  2005 bertrand Gugger
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- * @see        Text_Wiki::Text_Wiki_Render()
- */
-class Text_Wiki_Render_Xhtml_Smiley extends Text_Wiki_Render {
-
-    /**
-     * Configuration keys for this rule
-     * 'prefix' => the path to smileys images inclusive file name prefix,
-     *             starts with '/' ==> abolute reference
-     *             if no file names prefix but some folder, terminates with '/'
-     * 'extension' => the file extension (inclusive '.'), e.g. :
-     *       if prefix 'smileys/icon_' and extension '.gif'
-     *       ':)' whose name is 'smile' will give relative file 'smileys/icon_smile.gif'
-     *       if prefix '/image/smileys/' and extension '.png': absolute '/image/smileys/smile.gif'
-     * 'css' => optional style applied to smileys
-     *
-     * @access public
-     * @var array 'config-key' => mixed config-value
-     */
-    var $conf = array(
-        'prefix' => 'images/smiles/icon_',
-        'extension' => '.gif',
-        'css' => null
-    );
-
-    /**
-      * Renders a token into text matching the requested format.
-      * process the Smileys
-      *
-      * @access public
-      * @param array $options The "options" portion of the token (second element).
-      * @return string The text rendered from the token options.
-      */
-    function token($options)
-    {
-        $imageFile = $this->getConf('prefix') . $options['name'] . $this->getConf('extension');
-
-        // attempt to get the image size
-        $imageSize = @getimagesize($imageFile);
-
-        // return the HTML output
-        return '<img src="' . $this->textEncode($imageFile) . '"' .
-            (is_array($imageSize) ?
-                ' width="' . $imageSize[0] . '" height="' . $imageSize[1] .'"' : '') .
-            ' alt="' . $options['desc'] . '"' .
-            $this->formatConf(' class="%s"', 'css') . ' />';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Specialchar.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Specialchar rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Specialchar.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders special characters in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_SpecialChar extends Text_Wiki_Render {
-
-    var $types = array('~bs~' => '&#92;',
-                       '~hs~' => '&nbsp;',
-                       '~amp~' => '&amp;',
-                       '~ldq~' => '&ldquo;',
-                       '~rdq~' => '&rdquo;',
-                       '~lsq~' => '&lsquo;',
-                       '~rsq~' => '&rsquo;',
-                       '~c~' => '&copy;',
-                       '~--~' => '&mdash;',
-                       '" -- "' => '&mdash;',
-                       '&quot; -- &quot;' => '&mdash;',
-                       '~lt~' => '&lt;',
-                       '~gt~' => '&gt;');
-
-    function token($options)
-    {
-        if (isset($this->types[$options['char']])) {
-            return $this->types[$options['char']];
-        } else {
-            return '&#'.substr($options['char'], 1, -1).';';
-        }
-    }
-}
-
-?>
--- a/includes/wikiengine/Render/Xhtml/Strong.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Strong rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Strong.php,v 1.7 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders text marked as strong in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Strong extends Text_Wiki_Render {
-
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<strong$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</strong>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Subscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Subscript rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Subscript.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders subscript text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Subscript extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<sub$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</sub>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Superscript.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Superscript rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Superscript.php,v 1.7 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders superscript text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Superscript extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<sup$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</sup>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Table.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Table rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Table.php,v 1.12 2005/12/06 15:29:29 ritzmo Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders tables in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Table extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css_table' => null,
-        'css_caption' => null,
-        'css_tr' => null,
-        'css_th' => null,
-        'css_td' => null
-    );
-
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        // make nice variable names (type, attr, span)
-        $span = $rowspan = 1;
-        extract($options);
-
-        // free format
-        $format = isset($format) ? ' '. $format : '';
-
-        $pad = '    ';
-
-        switch ($type) {
-
-        case 'table_start':
-            $css = $this->formatConf(' class="%s"', 'css_table');
-            return "\n\n<table$css$format>\n";
-            break;
-
-        case 'table_end':
-            return "</table>\n\n";
-            break;
-
-        case 'caption_start':
-            $css = $this->formatConf(' class="%s"', 'css_caption');
-            return "<caption$css$format>\n";
-            break;
-
-        case 'caption_end':
-            return "</caption>\n";
-            break;
-
-        case 'row_start':
-            $css = $this->formatConf(' class="%s"', 'css_tr');
-            return "$pad<tr$css$format>\n";
-            break;
-
-        case 'row_end':
-            return "$pad</tr>\n";
-            break;
-
-        case 'cell_start':
-
-            // base html
-            $html = $pad . $pad;
-
-            // is this a TH or TD cell?
-            if ($attr == 'header') {
-                // start a header cell
-                $css = $this->formatConf(' class="%s"', 'css_th');
-                $html .= "<th$css";
-            } else {
-                // start a normal cell
-                $css = $this->formatConf(' class="%s"', 'css_td');
-                $html .= "<td$css";
-            }
-
-            // add the column span
-            if ($span > 1) {
-                $html .= " colspan=\"$span\"";
-            }
-
-            // add the row span
-            if ($rowspan > 1) {
-                $html .= " rowspan=\"$rowspan\"";
-            }
-
-            // add alignment
-            if ($attr != 'header' && $attr != '') {
-                $html .= " style=\"text-align: $attr;\"";
-            }
-
-            // done!
-            $html .= "$format>";
-            return $html;
-            break;
-
-        case 'cell_end':
-            if ($attr == 'header') {
-                return "</th>\n";
-            } else {
-                return "</td>\n";
-            }
-            break;
-
-        default:
-            return '';
-
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Tighten.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Tighten rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Tighten.php,v 1.6 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class makes the tightening in XHTML. (empty)
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Tighten extends Text_Wiki_Render {
-
-
-    function token()
-    {
-        return '';
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Titlebar.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Titlebar rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Titlebar.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders a title bar in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Titlebar extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => 'titlebar'
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<div$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</div>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Toc.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Toc rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Toc.php,v 1.9 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class inserts a table of content in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Toc extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css_list' => null,
-        'css_item' => null,
-        'title' => '<strong>Table of Contents</strong>',
-        'div_id' => 'toc',
-        'collapse' => true
-    );
-
-    var $min = 2;
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        // type, id, level, count, attr
-        extract($options);
-
-        switch ($type) {
-
-        case 'list_start':
-
-            $css = $this->getConf('css_list');
-            $html = '';
-
-            // collapse div within a table?
-            if ($this->getConf('collapse')) {
-                $html .= '<table border="0" cellspacing="0" cellpadding="0">';
-                $html .= "<tr><td>\n";
-            }
-
-            // add the div, class, and id
-            $html .= '<div';
-            if ($css) {
-                $html .= " class=\"$css\"";
-            }
-
-            $div_id = $this->getConf('div_id');
-            if ($div_id) {
-                $html .= " id=\"$div_id\"";
-            }
-
-            // add the title, and done
-            $html .= '>';
-            $html .= $this->getConf('title');
-            return $html;
-            break;
-
-        case 'list_end':
-        	if ($this->getConf('collapse')) {
-        	    return "\n</div>\n</td></tr></table>\n\n";
-        	} else {
-                return "\n</div>\n\n";
-            }
-            break;
-
-        case 'item_start':
-            $html = "\n\t<div";
-
-            $css = $this->getConf('css_item');
-            if ($css) {
-                $html .= " class=\"$css\"";
-            }
-
-            $pad = ($level - $this->min);
-            $html .= " style=\"margin-left: {$pad}em;\">";
-
-            $html .= "<a href=\"#$id\">";
-            return $html;
-            break;
-
-        case 'item_end':
-            return "</a></div>";
-            break;
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Tt.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Tt rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Tt.php,v 1.7 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders monospaced text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Tt extends Text_Wiki_Render {
-
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<tt$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</tt>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Underline.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Underline rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Underline.php,v 1.2 2005/07/30 08:03:29 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders underlined text in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Underline extends Text_Wiki_Render {
-
-    var $conf = array(
-        'css' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-        if ($options['type'] == 'start') {
-            $css = $this->formatConf(' class="%s"', 'css');
-            return "<u$css>";
-        }
-
-        if ($options['type'] == 'end') {
-            return '</u>';
-        }
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Url.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Url rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Url.php,v 1.13 2006/02/10 23:07:03 toggg Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders URL links in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Url extends Text_Wiki_Render {
-
-
-    var $conf = array(
-        'target' => '_blank',
-        'images' => true,
-        'img_ext' => array('jpg', 'jpeg', 'gif', 'png'),
-        'css_inline' => null,
-        'css_footnote' => null,
-        'css_descr' => null,
-        'css_img' => null
-    );
-
-    /**
-    *
-    * Renders a token into text matching the requested format.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-      global $email;
-        // create local variables from the options array (text,
-        // href, type)
-        extract($options);
-        
-        $quote = '"';
-
-        // find the rightmost dot and determine the filename
-        // extension.
-        $pos = strrpos($href, '.');
-        $ext = strtolower(substr($href, $pos + 1));
-        
-        if(substr($href, 0, 7) == 'mailto:')
-        {
-          $a = substr($href, 7);
-          $code = $email->encryptEmail($a, '', '', $text);
-          return $code;
-        }
-        
-        $href = $this->textEncode($href);
-
-        // does the filename extension indicate an image file?
-        if ($this->getConf('images') &&
-            in_array($ext, $this->getConf('img_ext', array()))) {
-
-            // create alt text for the image
-            if (! isset($text) || $text == '') {
-                $text = basename($href);
-                $text = $this->textEncode($text);
-            }
-
-            // generate an image tag
-            $css = $this->formatConf(' class="%s"', 'css_img');
-            $output = "<img$css src={$quote}$href{$quote} alt={$quote}$text{$quote} />";
-
-        } else {
-          
-            // should we build a target clause?
-            if ($href{0} == '#' ||
-            	strtolower(substr($href, 0, 7)) == 'mailto:') {
-            	// targets not allowed for on-page anchors
-            	// and mailto: links.
-                $target = '';
-            } else {
-				// allow targets on non-anchor non-mailto links
-                $target = $this->getConf('target');
-            }
-
-            // generate a regular link (not an image)
-            // $text = $this->textEncode($text);
-            $css = $this->formatConf(' class="%s"', "css_$type");
-            $output = "<a$css href={$quote}$href{$quote}";
-            
-            // hackish fix for the "external" image in Oxygen [added for Enano]
-            if ( preg_match('/<(.+?)>/is', $text) )
-            {
-              $output .= ' style="background-image: none; padding-right: 0;"';
-            }
-
-            if ($target) {
-                // use a "popup" window.  this is XHTML compliant, suggested by
-                // Aaron Kalin.  uses the $target as the new window name.
-                $target = $this->textEncode($target);
-                $output .= " onclick={$quote}window.open(this.href, '$target');";
-                $output .= " return false;{$quote}";
-            }
-
-            // finish up output
-            $output .= " rel=".'"'."nofollow".'"'.">$text</a>";
-
-            // make numbered references look like footnotes when no
-            // CSS class specified, make them superscript by default
-            if ($type == 'footnote' && ! $css) {
-                $output = '<sup>' . $output . '</sup>';
-            }
-        }
-
-        return $output;
-    }
-}
-?>
--- a/includes/wikiengine/Render/Xhtml/Wikilink.php	Sun Jun 21 00:16:21 2009 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-<?php
-// vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
-/**
- * Wikilink rule end renderer for Xhtml
- *
- * PHP versions 4 and 5
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    CVS: $Id: Wikilink.php,v 1.17 2006/02/28 03:15:09 justinpatrin Exp $
- * @link       http://pear.php.net/package/Text_Wiki
- */
-
-/**
- * This class renders wiki links in XHTML.
- *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
- * @version    Release: @package_version@
- * @link       http://pear.php.net/package/Text_Wiki
- */
-class Text_Wiki_Render_Xhtml_Wikilink extends Text_Wiki_Render {
-
-  var $conf;
-  
-  function Text_Wiki_Render_Xhtml_Wikilink() {
-    $_utemp = contentPath.'%s';
-    $this->conf = array(
-        'pages' => array(), // set to null or false to turn off page checks
-        'view_url' => $_utemp,
-        'new_url'  => $_utemp,
-        'new_text' => ' [x]',
-        'new_text_pos' => false, // 'before', 'after', or null/false
-        'css' => null,
-        'css_new' => null,
-        'exists_callback' => 'isPage' // call_user_func() callback
-    );
-  }
-
-    /**
-    *
-    * Renders a token into XHTML.
-    *
-    * @access public
-    *
-    * @param array $options The "options" portion of the token (second
-    * element).
-    *
-    * @return string The text rendered from the token options.
-    *
-    */
-
-    function token($options)
-    {
-      ##
-      ## THIS IS NOT WHAT YOU ARE LOOKING FOR!!
-      ## All of this code is deprecated. Patch RenderMan::parse_internal_links() instead!
-      ##
-      
-        global $session;
-        if ( $session->sid_super )
-        {
-          $as = htmlspecialchars(urlSeparator) . 'auth='.$session->sid_super;
-        }
-        else
-        {
-          $as = '';
-        }
-        // make nice variable names (page, anchor, text)
-        extract($options);
-
-        // is there a "page existence" callback?
-        // we need to access it directly instead of through
-        // getConf() because we'll need a reference (for
-        // object instance method callbacks).
-        if (isset($this->conf['exists_callback'])) {
-            $callback =& $this->conf['exists_callback'];
-        } else {
-        	$callback = false;
-        }
-        
-        $page = sanitize_page_id( $page );
-
-        if ($callback) {
-            // use the callback function
-            $exists = call_user_func($callback, $page);
-        } else {
-            // no callback, go to the naive page array.
-            $list = $this->getConf('pages');
-            if (is_array($list)) {
-                // yes, check against the page list
-                $exists = in_array($page, $list);
-            } else {
-                // no, assume it exists
-                $exists = true;
-            }
-        }
-
-        // convert *after* checking against page names so as not to mess
-        // up what the user typed and what we're checking.
-        //$page = $this->urlEncode($page);
-        $anchor = $this->urlEncode($anchor);
-        // $text = $this->textEncode($text);
-        
-        // hackish fix for the "external" image in Oxygen [added for Enano]
-        if ( preg_match('/<(.+?)>/is', $text) )
-        {
-          $nobg = ' style="background-image: none; padding-right: 0;"';
-        }
-        else
-        {
-          $nobg = '';
-        }
-        
-        // does the page exist?
-        if ($exists) {
-
-            // PAGE EXISTS.
-
-            // link to the page view, but we have to build
-            // the HREF.  we support both the old form where
-            // the page always comes at the end, and the new
-            // form that uses %s for sprintf()
-            $href = makeUrl($page, false, true);
-            
-            // get the CSS class and generate output
-            $css = $this->formatConf(' class="%s"', 'css');
-
-            $start = '<a'.$css.' href="'.$href.$as.'"'.$nobg.'>';
-            $end = '</a>';
-        } else {
-
-            // PAGE DOES NOT EXIST.
-
-            // link to the page view, but we have to build
-            // the HREF.  we support both the old form where
-            // the page always comes at the end, and the new
-            // form that uses %s for sprintf()
-            $href = makeUrl($page, false, true);
-
-            // get the CSS class and generate output
-            $css = $this->formatConf(' class="%s"', 'css');
-
-            $start = '<a'.$css.' href="'.$href.'"'.$nobg.' class="wikilink-nonexistent">';
-            $end = '</a>';
-        }
-        if (!strlen($text)) {
-            $start .= $this->textEncode($options['page']);
-        }
-        if (isset($type)) {
-            switch ($type) {
-            case 'start':
-                $output = $start;
-                break;
-            case 'end':
-                $output = $end;
-                break;
-            }
-        } else {
-            $output = $start.$text.$end;
-        }
-        return $output;
-    }
-}
-?>
--- a/includes/wikiengine/Tables.php	Sun Jun 21 00:16:21 2009 -0400
+++ b/includes/wikiengine/Tables.php	Sun Jun 21 00:20:32 2009 -0400
@@ -12,1016 +12,168 @@
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
  *
  * This script contains code originally found in MediaWiki (http://www.mediawiki.org). MediaWiki is also licensed under
- * the GPLv2; see the file GPL included with this package for details.
+ * the GPLv2 or later; see the file GPL included with this package for details.
  *
  * We're using the MW parser because the Text_Wiki version simply refused to work under PHP 5.2.0. Porting this was
  * _not_ easy. <leaves to get cup of coffee>
  */
 
-  global $mStripState, $wgRandomKey;
-  $mStripState = Array();
-  
-  $attrib = '[a-zA-Z0-9]';
-  $space = '[\x09\x0a\x0d\x20]';
+global $mStripState, $wgRandomKey;
+$mStripState = Array();
+
+/**
+ * emulate mediawiki parser, including stripping, etc.
+ *
+ * @param string $text the text to parse
+ * @return string
+ * @access public
+ */
+ 
+function process_tables( $text )
+{
+  // include some globals, do some parser stuff that would normally be done in the parent parser function
+  global $mStripState;
+  $x =& $mStripState;
   
-  define( 'MW_CHAR_REFS_REGEX',
-	'/&([A-Za-z0-9]+);
-	 |&\#([0-9]+);
-	 |&\#x([0-9A-Za-z]+);
-	 |&\#X([0-9A-Za-z]+);
-	 |(&)/x' );
+  // parse the text
+  $text = doTableStuff($text);
+
+  return $text;
+}
+
+/**
+ * parse the wiki syntax used to render tables
+ *
+ * @param string $t the text to parse
+ * @return string
+ * @access private
+ */
+function doTableStuff( $t ) {
   
-  define( 'MW_ATTRIBS_REGEX',
-    "/(?:^|$space)($attrib+)
-      ($space*=$space*
-      (?:
-       # The attribute value: quoted or alone
-        ".'"'."([^<".'"'."]*)".'"'."
-       | '([^<']*)'
-       |  ([a-zA-Z0-9!#$%&()*,\\-.\\/:;<>?@[\\]^_`{|}~]+)
-       |  (\#[0-9a-fA-F]+) # Technically wrong, but lots of
-                 # colors are specified like this.
-                 # We'll be normalizing it.
-      )
-       )?(?=$space|\$)/sx" );
-  
-  /**
-   * emulate mediawiki parser, including stripping, etc.
-   *
-   * @param string $text the text to parse
-   * @return string
-   * @access public
-   */
-   
-  function process_tables( $text )
+  $t = explode ( "\n" , $t ) ;
+  $td = array () ; # Is currently a td tag open?
+  $ltd = array () ; # Was it TD or TH?
+  $tr = array () ; # Is currently a tr tag open?
+  $ltr = array () ; # tr attributes
+  $has_opened_tr = array(); # Did this table open a <tr> element?
+  $indent_level = 0; # indent level of the table
+  foreach ( $t AS $k => $x )
   {
-    // include some globals, do some parser stuff that would normally be done in the parent parser function
-    global $mStripState;
-    $x =& $mStripState;
-		//$text = mwStrip( $text, $x );
-    
-    // parse the text
-    $text = doTableStuff($text);
-    
-    // Unstrip it
-    // $text = unstrip( $text, $mStripState );
-    // $text = unstripNoWiki( $text, $mStripState );
-    //die('<pre>'.print_r($mStripState, true).'</pre>');
-    return $text;
+    $x = trim ( $x ) ;
+    $fc = substr ( $x , 0 , 1 ) ;
+    if ( preg_match( '/^(:*)\{\|(.*)$/', $x, $matches ) ) {
+      $indent_level = strlen( $matches[1] );
+
+      $attributes = unstripForHTML( $matches[2] );
+
+      $t[$k] = str_repeat( '<dl><dd>', $indent_level ) .
+        '<_paragraph_bypass><table' . fixTagAttributes( $attributes, 'table' ) . '>' ;
+      array_push ( $td , false ) ;
+      array_push ( $ltd , '' ) ;
+      array_push ( $tr , false ) ;
+      array_push ( $ltr , '' ) ;
+      array_push ( $has_opened_tr, false );
+    }
+    else if ( count ( $td ) == 0 ) { } # Don't do any of the following
+    else if ( '|}' == substr ( $x , 0 , 2 ) ) {
+      $z = "</table></_paragraph_bypass>" . substr ( $x , 2);
+      $l = array_pop ( $ltd ) ;
+      if ( !array_pop ( $has_opened_tr ) ) $z = "<tr><td></td></tr>" . $z ;
+      if ( array_pop ( $tr ) ) $z = '</tr>' . $z ;
+      if ( array_pop ( $td ) ) $z = '</'.$l.'>' . $z ;
+      array_pop ( $ltr ) ;
+      $t[$k] = $z . str_repeat( '</dd></dl>', $indent_level );
+    }
+    else if ( '|-' == substr ( $x , 0 , 2 ) ) { # Allows for |---------------
+      $x = substr ( $x , 1 ) ;
+      while ( $x != '' && substr ( $x , 0 , 1 ) == '-' ) $x = substr ( $x , 1 ) ;
+      $z = '' ;
+      $l = array_pop ( $ltd ) ;
+      array_pop ( $has_opened_tr );
+      array_push ( $has_opened_tr , true ) ;
+      if ( array_pop ( $tr ) ) $z = '</tr>' . $z ;
+      if ( array_pop ( $td ) ) $z = '</'.$l.'>' . $z ;
+      array_pop ( $ltr ) ;
+      $t[$k] = $z ;
+      array_push ( $tr , false ) ;
+      array_push ( $td , false ) ;
+      array_push ( $ltd , '' ) ;
+      $attributes = unstripForHTML( $x );
+      array_push ( $ltr , fixTagAttributes( $attributes, 'tr' ) ) ;
+    }
+    else if ( '|' == $fc || '!' == $fc || '|+' == substr ( $x , 0 , 2 ) ) { # Caption
+      # $x is a table row
+      if ( '|+' == substr ( $x , 0 , 2 ) ) {
+        $fc = '+' ;
+        $x = substr ( $x , 1 ) ;
+      }
+      $after = substr ( $x , 1 ) ;
+      if ( $fc == '!' ) $after = str_replace ( '!!' , '||' , $after ) ;
+
+      // Split up multiple cells on the same line.
+      // FIXME: This can result in improper nesting of tags processed
+      // by earlier parser steps, but should avoid splitting up eg
+      // attribute values containing literal "||".
+      $after = wfExplodeMarkup( '||', $after );
+
+      $t[$k] = '' ;
+
+      # Loop through each table cell
+      foreach ( $after AS $theline )
+      {
+        $z = '' ;
+        if ( $fc != '+' )
+        {
+          $tra = array_pop ( $ltr ) ;
+          if ( !array_pop ( $tr ) ) $z = '<tr'.$tra.">\n" ;
+          array_push ( $tr , true ) ;
+          array_push ( $ltr , '' ) ;
+          array_pop ( $has_opened_tr );
+          array_push ( $has_opened_tr , true ) ;
+        }
+
+        $l = array_pop ( $ltd ) ;
+        if ( array_pop ( $td ) ) $z = '</'.$l.'>' . $z ;
+        if ( $fc == '|' ) $l = 'td' ;
+        else if ( $fc == '!' ) $l = 'th' ;
+        else if ( $fc == '+' ) $l = 'caption' ;
+        else $l = '' ;
+        array_push ( $ltd , $l ) ;
+
+        # Cell parameters
+        $y = explode ( '|' , $theline , 2 ) ;
+        # Note that a '|' inside an invalid link should not
+        # be mistaken as delimiting cell parameters
+        if ( strpos( $y[0], '[[' ) !== false ) {
+          $y = array ($theline);
+        }
+        if ( count ( $y ) == 1 )
+          $y = "{$z}<{$l}>{$y[0]}" ;
+        else {
+          $attributes = unstripForHTML( $y[0] );
+          $y = "{$z}<{$l}".fixTagAttributes($attributes, $l).">{$y[1]}" ;
+        }
+        $t[$k] .= $y ;
+        array_push ( $td , true ) ;
+      }
+    }
   }
 
-  /**
-	 * parse the wiki syntax used to render tables
-	 *
-   * @param string $t the text to parse
-   * @return string
-	 * @access private
-	 */
-	function doTableStuff( $t ) {
-    
-		$t = explode ( "\n" , $t ) ;
-		$td = array () ; # Is currently a td tag open?
-		$ltd = array () ; # Was it TD or TH?
-		$tr = array () ; # Is currently a tr tag open?
-		$ltr = array () ; # tr attributes
-		$has_opened_tr = array(); # Did this table open a <tr> element?
-		$indent_level = 0; # indent level of the table
-		foreach ( $t AS $k => $x )
-		{
-			$x = trim ( $x ) ;
-			$fc = substr ( $x , 0 , 1 ) ;
-			if ( preg_match( '/^(:*)\{\|(.*)$/', $x, $matches ) ) {
-				$indent_level = strlen( $matches[1] );
-
-				$attributes = unstripForHTML( $matches[2] );
-
-				$t[$k] = str_repeat( '<dl><dd>', $indent_level ) .
-					'<nowiki><table' . fixTagAttributes( $attributes, 'table' ) . '></nowiki>' ;
-				array_push ( $td , false ) ;
-				array_push ( $ltd , '' ) ;
-				array_push ( $tr , false ) ;
-				array_push ( $ltr , '' ) ;
-				array_push ( $has_opened_tr, false );
-			}
-			else if ( count ( $td ) == 0 ) { } # Don't do any of the following
-			else if ( '|}' == substr ( $x , 0 , 2 ) ) {
-				$z = "<nowiki></table></nowiki>" . substr ( $x , 2);
-				$l = array_pop ( $ltd ) ;
-				if ( !array_pop ( $has_opened_tr ) ) $z = "<nowiki><tr><td></td></tr></nowiki>" . $z ;
-				if ( array_pop ( $tr ) ) $z = '<nowiki></tr></nowiki>' . $z ;
-				if ( array_pop ( $td ) ) $z = '<nowiki></'.$l.'></nowiki>' . $z ;
-				array_pop ( $ltr ) ;
-				$t[$k] = $z . str_repeat( '<nowiki></dd></dl></nowiki>', $indent_level );
-			}
-			else if ( '|-' == substr ( $x , 0 , 2 ) ) { # Allows for |---------------
-				$x = substr ( $x , 1 ) ;
-				while ( $x != '' && substr ( $x , 0 , 1 ) == '-' ) $x = substr ( $x , 1 ) ;
-				$z = '' ;
-				$l = array_pop ( $ltd ) ;
-				array_pop ( $has_opened_tr );
-				array_push ( $has_opened_tr , true ) ;
-				if ( array_pop ( $tr ) ) $z = '<nowiki></tr></nowiki>' . $z ;
-				if ( array_pop ( $td ) ) $z = '<nowiki></'.$l.'></nowiki>' . $z ;
-				array_pop ( $ltr ) ;
-				$t[$k] = $z ;
-				array_push ( $tr , false ) ;
-				array_push ( $td , false ) ;
-				array_push ( $ltd , '' ) ;
-				$attributes = unstripForHTML( $x );
-				array_push ( $ltr , fixTagAttributes( $attributes, 'tr' ) ) ;
-			}
-			else if ( '|' == $fc || '!' == $fc || '|+' == substr ( $x , 0 , 2 ) ) { # Caption
-				# $x is a table row
-				if ( '|+' == substr ( $x , 0 , 2 ) ) {
-					$fc = '+' ;
-					$x = substr ( $x , 1 ) ;
-				}
-				$after = substr ( $x , 1 ) ;
-				if ( $fc == '!' ) $after = str_replace ( '!!' , '||' , $after ) ;
-
-				// Split up multiple cells on the same line.
-				// FIXME: This can result in improper nesting of tags processed
-				// by earlier parser steps, but should avoid splitting up eg
-				// attribute values containing literal "||".
-				$after = wfExplodeMarkup( '||', $after );
-
-				$t[$k] = '' ;
-
-				# Loop through each table cell
-				foreach ( $after AS $theline )
-				{
-					$z = '' ;
-					if ( $fc != '+' )
-					{
-						$tra = array_pop ( $ltr ) ;
-						if ( !array_pop ( $tr ) ) $z = '<nowiki><tr'.$tra."></nowiki>\n" ;
-						array_push ( $tr , true ) ;
-						array_push ( $ltr , '' ) ;
-						array_pop ( $has_opened_tr );
-						array_push ( $has_opened_tr , true ) ;
-					}
-
-					$l = array_pop ( $ltd ) ;
-					if ( array_pop ( $td ) ) $z = '<nowiki></'.$l.'></nowiki>' . $z ;
-					if ( $fc == '|' ) $l = 'td' ;
-					else if ( $fc == '!' ) $l = 'th' ;
-					else if ( $fc == '+' ) $l = 'caption' ;
-					else $l = '' ;
-					array_push ( $ltd , $l ) ;
-
-					# Cell parameters
-					$y = explode ( '|' , $theline , 2 ) ;
-					# Note that a '|' inside an invalid link should not
-					# be mistaken as delimiting cell parameters
-					if ( strpos( $y[0], '[[' ) !== false ) {
-						$y = array ($theline);
-					}
-					if ( count ( $y ) == 1 )
-						$y = "{$z}<nowiki><{$l}></nowiki>{$y[0]}" ;
-					else {
-						$attributes = unstripForHTML( $y[0] );
-						$y = "{$z}<nowiki><{$l}".fixTagAttributes($attributes, $l)."></nowiki>{$y[1]}" ;
-					}
-					$t[$k] .= $y ;
-					array_push ( $td , true ) ;
-				}
-			}
-		}
-
-		# Closing open td, tr && table
-		while ( count ( $td ) > 0 )
-		{
-			$l = array_pop ( $ltd ) ;
-			if ( array_pop ( $td ) ) $t[] = '<nowiki></td></nowiki>' ;
-			if ( array_pop ( $tr ) ) $t[] = '<nowiki></tr></nowiki>' ;
-			if ( !array_pop ( $has_opened_tr ) ) $t[] = "<nowiki><tr><td></td></tr></nowiki>" ;
-			$t[] = '<nowiki></table></nowiki>' ;
-		}
-
-		$t = implode ( "\n" , $t ) ;
-    
-		# special case: don't return empty table
-		if($t == "<nowiki><table></nowiki>\n<nowiki><tr><td></td></tr></nowiki>\n<nowiki></table></nowiki>")
-			$t = '';
-		return $t ;
-	}
-  
-  /**
-	 * Take a tag soup fragment listing an HTML element's attributes
-	 * and normalize it to well-formed XML, discarding unwanted attributes.
-	 * Output is safe for further wikitext processing, with escaping of
-	 * values that could trigger problems.
-	 *
-	 * - Normalizes attribute names to lowercase
-	 * - Discards attributes not on a whitelist for the given element
-	 * - Turns broken or invalid entities into plaintext
-	 * - Double-quotes all attribute values
-	 * - Attributes without values are given the name as attribute
-	 * - Double attributes are discarded
-	 * - Unsafe style attributes are discarded
-	 * - Prepends space if there are attributes.
-	 *
-	 * @param string $text
-	 * @param string $element
-	 * @return string
-	 */
-	function fixTagAttributes( $text, $element ) {
-		if( trim( $text ) == '' ) {
-			return '';
-		}
-		
-		$stripped = validateTagAttributes(
-			decodeTagAttributes( $text ), $element );
-		
-		$attribs = array();
-		foreach( $stripped as $attribute => $value ) {
-			$encAttribute = htmlspecialchars( $attribute );
-			$encValue = safeEncodeAttribute( $value );
-			
-			$attribs[] = "$encAttribute=".'"'."$encValue".'"'.""; // "
-		}
-		return count( $attribs ) ? ' ' . implode( ' ', $attribs ) : '';
-	}
-  
-  /**
-	 * Encode an attribute value for HTML tags, with extra armoring
-	 * against further wiki processing.
-	 * @param $text
-	 * @return HTML-encoded text fragment
-	 */
-	function safeEncodeAttribute( $text ) {
-		$encValue= encodeAttribute( $text );
-		
-		# Templates and links may be expanded in later parsing,
-		# creating invalid or dangerous output. Suppress this.
-		$encValue = strtr( $encValue, array(
-			'<'    => '&lt;',   // This should never happen,
-			'>'    => '&gt;',   // we've received invalid input
-			'"'    => '&quot;', // which should have been escaped.
-			'{'    => '&#123;',
-			'['    => '&#91;',
-			"''"   => '&#39;&#39;',
-			'ISBN' => '&#73;SBN',
-			'RFC'  => '&#82;FC',
-			'PMID' => '&#80;MID',
-			'|'    => '&#124;',
-			'__'   => '&#95;_',
-		) );
-
-		return $encValue;
-	}
-  
-  /**
-	 * Encode an attribute value for HTML output.
-	 * @param $text
-	 * @return HTML-encoded text fragment
-	 */
-	function encodeAttribute( $text ) {
-    
-    // In Enano 1.0.3, added this cheapo hack to keep ampersands
-    // from being double-sanitized. Thanks to markybob from #deluge.
-    
-    // htmlspecialchars() the "manual" way
-    $encValue = strtr( $text, array(
-      '&amp;'  => '&',
-      '&quot;' => '"',
-      '&lt;'   => '<',
-      '&gt;'   => '>',
-      '&#039;' => "'"
-    ) );
-    
-    $encValue = strtr( $text, array(
-      '&' => '&amp;',
-      '"' => '&quot;',
-      '<' => '&lt;',
-      '>' => '&gt;',
-      "'" => '&#039;'
-    ) );
-    
-		
-		// Whitespace is normalized during attribute decoding,
-		// so if we've been passed non-spaces we must encode them
-		// ahead of time or they won't be preserved.
-		$encValue = strtr( $encValue, array(
-			"\n" => '&#10;',
-			"\r" => '&#13;',
-			"\t" => '&#9;',
-		) );
-		
-		return $encValue;
-	}
-  
-  function unstripForHTML( $text ) {
-    global $mStripState;
-		$text = unstrip( $text, $mStripState );
-		$text = unstripNoWiki( $text, $mStripState );
-		return $text;
-	}
-  
-  /**
-	 * Always call this after unstrip() to preserve the order
-	 *
-	 * @private
-	 */
-	function unstripNoWiki( $text, &$state ) {
-		if ( !isset( $state['nowiki'] ) ) {
-			return $text;
-		}
-
-		# TODO: good candidate for FSS
-		$text = strtr( $text, $state['nowiki'] );
-		
-		return $text;
-	}
-  
-  /**
-	 * Take an array of attribute names and values and normalize or discard
-	 * illegal values for the given element type.
-	 *
-	 * - Discards attributes not on a whitelist for the given element
-	 * - Unsafe style attributes are discarded
-	 *
-	 * @param array $attribs
-	 * @param string $element
-	 * @return array
-	 *
-	 * @todo Check for legal values where the DTD limits things.
-	 * @todo Check for unique id attribute :P
-	 */
-	function validateTagAttributes( $attribs, $element ) {
-		$whitelist = array_flip( attributeWhitelist( $element ) );
-		$out = array();
-		foreach( $attribs as $attribute => $value ) {
-			if( !isset( $whitelist[$attribute] ) ) {
-				continue;
-			}
-			# Strip javascript "expression" from stylesheets.
-			# http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp
-			if( $attribute == 'style' ) {
-				$value = checkCss( $value );
-				if( $value === false ) {
-					# haxx0r
-					continue;
-				}
-			}
-
-			if ( $attribute === 'id' )
-				$value = escapeId( $value );
-
-			// If this attribute was previously set, override it.
-			// Output should only have one attribute of each name.
-			$out[$attribute] = $value;
-		}
-		return $out;
-	}
-  
-  /**
-	 * Pick apart some CSS and check it for forbidden or unsafe structures.
-	 * Returns a sanitized string, or false if it was just too evil.
-	 *
-	 * Currently URL references, 'expression', 'tps' are forbidden.
-	 *
-	 * @param string $value
-	 * @return mixed
-	 */
-	function checkCss( $value ) {
-		$stripped = decodeCharReferences( $value );
-
-		// Remove any comments; IE gets token splitting wrong
-		$stripped = preg_replace( '!/\\*.*?\\*/!S', '', $stripped );
-		$value = $stripped;
-
-		// ... and continue checks
-		$stripped = preg_replace( '!\\\\([0-9A-Fa-f]{1,6})[ \\n\\r\\t\\f]?!e',
-			'codepointToUtf8(hexdec("$1"))', $stripped );
-		$stripped = str_replace( '\\', '', $stripped );
-		if( preg_match( '/(expression|tps*:\/\/|url\\s*\().*/is',
-				$stripped ) ) {
-			# haxx0r
-			return false;
-		}
-		
-		return $value;
-	}
-  
-  /**
-	 * Decode any character references, numeric or named entities,
-	 * in the text and return a UTF-8 string.
-	 *
-	 * @param string $text
-	 * @return string
-	 * @access public
-	 * @static
-	 */
-	function decodeCharReferences( $text ) {
-		return preg_replace_callback(
-			MW_CHAR_REFS_REGEX,
-			'decodeCharReferencesCallback',
-			$text );
-	}
-  
-  /**
-	 * Fetch the whitelist of acceptable attributes for a given
-	 * element name.
-	 *
-	 * @param string $element
-	 * @return array
-	 */
-	function attributeWhitelist( $element ) {
-		static $list;
-		if( !isset( $list ) ) {
-			$list = setupAttributeWhitelist();
-		}
-		return isset( $list[$element] )
-			? $list[$element]
-			: array();
-	}
-  
-  /**
-	 * @todo Document it a bit
-	 * @return array
-	 */
-	function setupAttributeWhitelist() {
-    global $db, $session, $paths, $template, $plugins;
-		$common = array( 'id', 'class', 'lang', 'dir', 'title', 'style' );
-		$block = array_merge( $common, array( 'align' ) );
-		$tablealign = array( 'align', 'char', 'charoff', 'valign' );
-		$tablecell = array( 'abbr',
-		                    'axis',
-		                    'headers',
-		                    'scope',
-		                    'rowspan',
-		                    'colspan',
-		                    'nowrap', # deprecated
-		                    'width',  # deprecated
-		                    'height', # deprecated
-		                    'bgcolor' # deprecated
-		                    );
-
-		# Numbers refer to sections in HTML 4.01 standard describing the element.
-		# See: http://www.w3.org/TR/html4/
-		$whitelist = array (
-			# 7.5.4
-			'div'        => $block,
-			'center'     => $common, # deprecated
-			'span'       => $block, # ??
-
-			# 7.5.5
-			'h1'         => $block,
-			'h2'         => $block,
-			'h3'         => $block,
-			'h4'         => $block,
-			'h5'         => $block,
-			'h6'         => $block,
-
-			# 7.5.6
-			# address
-
-			# 8.2.4
-			# bdo
-
-			# 9.2.1
-			'em'         => $common,
-			'strong'     => $common,
-			'cite'       => $common,
-			# dfn
-			'code'       => $common,
-			# samp
-			# kbd
-			'var'        => $common,
-			# abbr
-			# acronym
-
-			# 9.2.2
-			'blockquote' => array_merge( $common, array( 'cite' ) ),
-			# q
-
-			# 9.2.3
-			'sub'        => $common,
-			'sup'        => $common,
-
-			# 9.3.1
-			'p'          => $block,
-
-			# 9.3.2
-			'br'         => array( 'id', 'class', 'title', 'style', 'clear' ),
-
-			# 9.3.4
-			'pre'        => array_merge( $common, array( 'width' ) ),
-
-			# 9.4
-			'ins'        => array_merge( $common, array( 'cite', 'datetime' ) ),
-			'del'        => array_merge( $common, array( 'cite', 'datetime' ) ),
-
-			# 10.2
-			'ul'         => array_merge( $common, array( 'type' ) ),
-			'ol'         => array_merge( $common, array( 'type', 'start' ) ),
-			'li'         => array_merge( $common, array( 'type', 'value' ) ),
-
-			# 10.3
-			'dl'         => $common,
-			'dd'         => $common,
-			'dt'         => $common,
-
-			# 11.2.1
-			'table'      => array_merge( $common,
-								array( 'summary', 'width', 'border', 'frame',
-										'rules', 'cellspacing', 'cellpadding',
-										'align', 'bgcolor',
-								) ),
-
-			# 11.2.2
-			'caption'    => array_merge( $common, array( 'align' ) ),
+  # Closing open td, tr && table
+  while ( count ( $td ) > 0 )
+  {
+    $l = array_pop ( $ltd ) ;
+    if ( array_pop ( $td ) ) $t[] = '</td>' ;
+    if ( array_pop ( $tr ) ) $t[] = '</tr>' ;
+    if ( !array_pop ( $has_opened_tr ) ) $t[] = "<tr><td></td></tr>" ;
+    $t[] = '</table></_paragraph_bypass>' ;
+  }
 
-			# 11.2.3
-			'thead'      => array_merge( $common, $tablealign ),
-			'tfoot'      => array_merge( $common, $tablealign ),
-			'tbody'      => array_merge( $common, $tablealign ),
-
-			# 11.2.4
-			'colgroup'   => array_merge( $common, array( 'span', 'width' ), $tablealign ),
-			'col'        => array_merge( $common, array( 'span', 'width' ), $tablealign ),
-
-			# 11.2.5
-			'tr'         => array_merge( $common, array( 'bgcolor' ), $tablealign ),
-
-			# 11.2.6
-			'td'         => array_merge( $common, $tablecell, $tablealign ),
-			'th'         => array_merge( $common, $tablecell, $tablealign ),
-      
-      # 12.2
-      # added by dan
-      'a'          => array_merge( $common, array( 'href', 'name' ) ),
-      
-      # 13.2
-      # added by dan
-      'img'        => array_merge( $common, array( 'src', 'width', 'height', 'alt' ) ),
-
-			# 15.2.1
-			'tt'         => $common,
-			'b'          => $common,
-			'i'          => $common,
-			'big'        => $common,
-			'small'      => $common,
-			'strike'     => $common,
-			's'          => $common,
-			'u'          => $common,
-
-			# 15.2.2
-			'font'       => array_merge( $common, array( 'size', 'color', 'face' ) ),
-			# basefont
-
-			# 15.3
-			'hr'         => array_merge( $common, array( 'noshade', 'size', 'width' ) ),
-
-			# XHTML Ruby annotation text module, simple ruby only.
-			# http://www.w3c.org/TR/ruby/
-			'ruby'       => $common,
-			# rbc
-			# rtc
-			'rb'         => $common,
-			'rt'         => $common, #array_merge( $common, array( 'rbspan' ) ),
-			'rp'         => $common,
-      
-      # For compatibility with the XHTML parser.
-      'nowiki'     => array(),
-      'noinclude'  => array(),
-      'nodisplay'  => array(),
-      'lang'       => array('code'),
-      
-      # XHTML stuff
-      'acronym'    => $common
-			);
-    
-    // custom tags can be added by plugins
-    $code = $plugins->setHook('html_attribute_whitelist');
-    foreach ( $code as $cmd )
-    {
-      eval($cmd);
-    }
-    
-		return $whitelist;
-	}
-  
-  /**
-	 * Given a value escape it so that it can be used in an id attribute and
-	 * return it, this does not validate the value however (see first link)
-	 *
-	 * @link http://www.w3.org/TR/html401/types.html#type-name Valid characters
-	 *                                                          in the id and
-	 *                                                          name attributes
-	 * @link http://www.w3.org/TR/html401/struct/links.html#h-12.2.3 Anchors with the id attribute
-	 *
-	 * @bug 4461
-	 *
-	 * @static
-	 *
-	 * @param string $id
-	 * @return string
-	 */
-	function escapeId( $id ) {
-		static $replace = array(
-			'%3A' => ':',
-			'%' => '.'
-		);
-
-		$id = urlencode( decodeCharReferences( strtr( $id, ' ', '_' ) ) );
-
-		return str_replace( array_keys( $replace ), array_values( $replace ), $id );
-	}
-  
-  /**
-   * More or less "markup-safe" explode()
-   * Ignores any instances of the separator inside <...>
-   * @param string $separator
-   * @param string $text
-   * @return array
-   */
-  function wfExplodeMarkup( $separator, $text ) {
-    $placeholder = "\x00";
-    
-    // Just in case...
-    $text = str_replace( $placeholder, '', $text );
-    
-    // Trim stuff
-    $replacer = new ReplacerCallback( $separator, $placeholder );
-    $cleaned = preg_replace_callback( '/(<.*?>)/', array( $replacer, 'go' ), $text );
-    
-    $items = explode( $separator, $cleaned );
-    foreach( $items as $i => $str ) {
-      $items[$i] = str_replace( $placeholder, $separator, $str );
-    }
-    
-    return $items;
-  }
-  
-  class ReplacerCallback {
-    function ReplacerCallback( $from, $to ) {
-      $this->from = $from;
-      $this->to = $to;
-    }
-    
-    function go( $matches ) {
-      return str_replace( $this->from, $this->to, $matches[1] );
-    }
-  }
-  
-  /**
-	 * Return an associative array of attribute names and values from
-	 * a partial tag string. Attribute names are forces to lowercase,
-	 * character references are decoded to UTF-8 text.
-	 *
-	 * @param string
-	 * @return array
-	 */
-	function decodeTagAttributes( $text ) {
-		$attribs = array();
-
-		if( trim( $text ) == '' ) {
-			return $attribs;
-		}
-
-		$pairs = array();
-		if( !preg_match_all(
-			MW_ATTRIBS_REGEX,
-			$text,
-			$pairs,
-			PREG_SET_ORDER ) ) {
-			return $attribs;
-		}
-
-		foreach( $pairs as $set ) {
-			$attribute = strtolower( $set[1] );
-			$value = getTagAttributeCallback( $set );
-			
-			// Normalize whitespace
-			$value = preg_replace( '/[\t\r\n ]+/', ' ', $value );
-			$value = trim( $value );
-			
-			// Decode character references
-			$attribs[$attribute] = decodeCharReferences( $value );
-		}
-		return $attribs;
-	}
-  
-  /**
-	 * Pick the appropriate attribute value from a match set from the
-	 * MW_ATTRIBS_REGEX matches.
-	 *
-	 * @param array $set
-	 * @return string
-	 * @access private
-	 */
-	function getTagAttributeCallback( $set ) {
-		if( isset( $set[6] ) ) {
-			# Illegal #XXXXXX color with no quotes.
-			return $set[6];
-		} elseif( isset( $set[5] ) ) {
-			# No quotes.
-			return $set[5];
-		} elseif( isset( $set[4] ) ) {
-			# Single-quoted
-			return $set[4];
-		} elseif( isset( $set[3] ) ) {
-			# Double-quoted
-			return $set[3];
-		} elseif( !isset( $set[2] ) ) {
-			# In XHTML, attributes must have a value.
-			# For 'reduced' form, return explicitly the attribute name here.
-			return $set[1];
-		} else {
-			die_friendly('Parser error', "<p>Tag conditions not met. This should never happen and is a bug.</p>" );
-		}
-	}
+  $t = implode ( "\n" , $t ) ;
   
-  /**
-	 * Strips and renders nowiki, pre, math, hiero
-	 * If $render is set, performs necessary rendering operations on plugins
-	 * Returns the text, and fills an array with data needed in unstrip()
-	 * If the $state is already a valid strip state, it adds to the state
-	 *
-	 * @param bool $stripcomments when set, HTML comments <!-- like this -->
-	 *  will be stripped in addition to other tags. This is important
-	 *  for section editing, where these comments cause confusion when
-	 *  counting the sections in the wikisource
-	 * 
-	 * @param array dontstrip contains tags which should not be stripped;
-	 *  used to prevent stipping of <gallery> when saving (fixes bug 2700)
-	 *
-	 * @access private
-	 */
-	function mwStrip( $text, &$state, $stripcomments = false , $dontstrip = array () ) {
-    global $wgRandomKey;
-		$render = true;
-
-		$wgRandomKey = "\x07UNIQ" . dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff));
-    $uniq_prefix =& $wgRandomKey;
-		$commentState = array();
-		
-		$elements = array( 'nowiki', 'gallery' );
-		
-    # Removing $dontstrip tags from $elements list (currently only 'gallery', fixing bug 2700)
-		foreach ( $elements AS $k => $v ) {
-			if ( !in_array ( $v , $dontstrip ) ) continue;
-			unset ( $elements[$k] );
-		}
-		
-		$matches = array();
-		$text = extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
-
-		foreach( $matches as $marker => $data ) {
-			list( $element, $content, $params, $tag ) = $data;
-			if( $render ) {
-				$tagName = strtolower( $element );
-				switch( $tagName ) {
-				case '!--':
-					// Comment
-					if( substr( $tag, -3 ) == '-->' ) {
-						$output = $tag;
-					} else {
-						// Unclosed comment in input.
-						// Close it so later stripping can remove it
-						$output = "$tag-->";
-					}
-					break;
-				case 'html':
-					if( $wgRawHtml ) {
-						$output = $content;
-						break;
-					}
-					// Shouldn't happen otherwise. :)
-				case 'nowiki':
-					$output = wfEscapeHTMLTagsOnly( $content );
-					break;
-				default:
-				}
-			} else {
-				// Just stripping tags; keep the source
-				$output = $tag;
-			}
-
-			// Unstrip the output, because unstrip() is no longer recursive so 
-			// it won't do it itself
-			$output = unstrip( $output, $state );
-
-			if( !$stripcomments && $element == '!--' ) {
-				$commentState[$marker] = $output;
-			} elseif ( $element == 'html' || $element == 'nowiki' ) {
-				$state['nowiki'][$marker] = $output;
-			} else {
-				$state['general'][$marker] = $output;
-			}
-		}
-
-		# Unstrip comments unless explicitly told otherwise.
-		# (The comments are always stripped prior to this point, so as to
-		# not invoke any extension tags / parser hooks contained within
-		# a comment.)
-		if ( !$stripcomments ) {
-			// Put them all back and forget them
-			$text = strtr( $text, $commentState );
-		}
-
-		return $text;
-	}
-  
-  /**
-	 * Replaces all occurrences of HTML-style comments and the given tags
-	 * in the text with a random marker and returns teh next text. The output
-	 * parameter $matches will be an associative array filled with data in
-	 * the form:
-	 *   'UNIQ-xxxxx' => array(
-	 *     'element',
-	 *     'tag content',
-	 *     array( 'param' => 'x' ),
-	 *     '<element param="x">tag content</element>' ) )
-	 *
-	 * @param $elements list of element names. Comments are always extracted.
-	 * @param $text Source text string.
-	 * @param $uniq_prefix
-	 *
-	 * @access private
-	 * @static
-	 */
-	function extractTagsAndParams($elements, $text, &$matches, $uniq_prefix = ''){
-		static $n = 1;
-		$stripped = '';
-		$matches = array();
-
-		$taglist = implode( '|', $elements );
-		$start = "/<($taglist)(\\s+[^>]*?|\\s*?)(\/?>)|<(!--)/i";
-
-		while ( '' != $text ) {
-			$p = preg_split( $start, $text, 2, PREG_SPLIT_DELIM_CAPTURE );
-			$stripped .= $p[0];
-			if( count( $p ) < 5 ) {
-				break;
-			}
-			if( count( $p ) > 5 ) {
-				// comment
-				$element    = $p[4];
-				$attributes = '';
-				$close      = '';
-				$inside     = $p[5];
-			} else {
-				// tag
-				$element    = $p[1];
-				$attributes = $p[2];
-				$close      = $p[3];
-				$inside     = $p[4];
-			}
-
-			$marker = "$uniq_prefix-$element-" . sprintf('%08X', $n++) . '-QINU';
-			$stripped .= $marker;
-
-			if ( $close === '/>' ) {
-				// Empty element tag, <tag />
-				$content = null;
-				$text = $inside;
-				$tail = null;
-			} else {
-				if( $element == '!--' ) {
-					$end = '/(-->)/';
-				} else {
-					$end = "/(<\\/$element\\s*>)/i";
-				}
-				$q = preg_split( $end, $inside, 2, PREG_SPLIT_DELIM_CAPTURE );
-				$content = $q[0];
-				if( count( $q ) < 3 ) {
-					# No end tag -- let it run out to the end of the text.
-					$tail = '';
-					$text = '';
-				} else {
-					$tail = $q[1];
-					$text = $q[2];
-				}
-			}
-			
-			$matches[$marker] = array( $element,
-				$content,
-				decodeTagAttributes( $attributes ),
-				"<$element$attributes$close$content$tail" );
-		}
-		return $stripped;
-	}
-  
-  /**
-   * Escape html tags
-   * Basically replacing " > and < with HTML entities ( &quot;, &gt;, &lt;)
-   *
-   * @param $in String: text that might contain HTML tags.
-   * @return string Escaped string
-   */
-  function wfEscapeHTMLTagsOnly( $in ) {
-    return str_replace(
-      array( '"', '>', '<' ),
-      array( '&quot;', '&gt;', '&lt;' ),
-      $in );
-  }
-  
-  /**
-	 * Restores pre, math, and other extensions removed by strip()
-	 *
-	 * always call unstripNoWiki() after this one
-	 * @private
-	 */
-	function unstrip( $text, &$state ) {
-		if ( !isset( $state['general'] ) ) {
-			return $text;
-		}
-
-		# TODO: good candidate for FSS
-		$text = strtr( $text, $state['general'] );
-    
-		return $text;
-	}
-  
-  /**
-	 * Return UTF-8 string for a codepoint if that is a valid
-	 * character reference, otherwise U+FFFD REPLACEMENT CHARACTER.
-	 * @param int $codepoint
-	 * @return string
-	 * @private
-	 */
-	function decodeChar( $codepoint ) {
-		if( validateCodepoint( $codepoint ) ) {
-			return codepointToUtf8( $codepoint );
-		} else {
-			return UTF8_REPLACEMENT;
-		}
-	}
-
-	/**
-	 * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD,
-	 * return the UTF-8 encoding of that character. Otherwise, returns
-	 * pseudo-entity source (eg &foo;)
-	 *
-	 * @param string $name
-	 * @return string
-	 */
-	function decodeEntity( $name ) {
-		global $wgHtmlEntities;
-		if( isset( $wgHtmlEntities[$name] ) ) {
-			return codepointToUtf8( $wgHtmlEntities[$name] );
-		} else {
-			return "&$name;";
-		}
-	}
-  
-  /**
-	 * Returns true if a given Unicode codepoint is a valid character in XML.
-	 * @param int $codepoint
-	 * @return bool
-	 */
-	function validateCodepoint( $codepoint ) {
-		return ($codepoint ==    0x09)
-			|| ($codepoint ==    0x0a)
-			|| ($codepoint ==    0x0d)
-			|| ($codepoint >=    0x20 && $codepoint <=   0xd7ff)
-			|| ($codepoint >=  0xe000 && $codepoint <=   0xfffd)
-			|| ($codepoint >= 0x10000 && $codepoint <= 0x10ffff);
-	}
-  
-/**
- * Return UTF-8 sequence for a given Unicode code point.
- * May die if fed out of range data.
- *
- * @param $codepoint Integer:
- * @return String
- * @public
- */
-function codepointToUtf8( $codepoint ) {
-	if($codepoint <		0x80) return chr($codepoint);
-	if($codepoint <    0x800) return chr($codepoint >>	6 & 0x3f | 0xc0) .
-									 chr($codepoint		  & 0x3f | 0x80);
-	if($codepoint <  0x10000) return chr($codepoint >> 12 & 0x0f | 0xe0) .
-									 chr($codepoint >>	6 & 0x3f | 0x80) .
-									 chr($codepoint		  & 0x3f | 0x80);
-	if($codepoint < 0x110000) return chr($codepoint >> 18 & 0x07 | 0xf0) .
-									 chr($codepoint >> 12 & 0x3f | 0x80) .
-									 chr($codepoint >>	6 & 0x3f | 0x80) .
-									 chr($codepoint		  & 0x3f | 0x80);
-
-	echo "Asked for code outside of range ($codepoint)\n";
-	die( -1 );
+  # special case: don't return empty table
+  if($t == "<table>\n<tr><td></td></tr>\n</table>")
+    $t = '';
+  return $t ;
 }
 
-  /**
-	 * @param string $matches
-	 * @return string
-	 */
-	function decodeCharReferencesCallback( $matches ) {
-		if( $matches[1] != '' ) {
-			return decodeEntity( $matches[1] );
-		} elseif( $matches[2] != '' ) {
-			return  decodeChar( intval( $matches[2] ) );
-		} elseif( $matches[3] != ''  ) {
-			return  decodeChar( hexdec( $matches[3] ) );
-		} elseif( $matches[4] != '' ) {
-			return  decodeChar( hexdec( $matches[4] ) );
-		}
-		# Last case should be an ampersand by itself
-		return $matches[0];
-	}
-  
-?>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/wikiengine/TagSanitizer.php	Sun Jun 21 00:20:32 2009 -0400
@@ -0,0 +1,859 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.6 (Caoineag beta 1)
+ * Copyright (C) 2006-2008 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ *
+ * This script contains code originally found in MediaWiki (http://www.mediawiki.org). MediaWiki is also licensed under
+ * the GPLv2 or later; see the file GPL included with this package for details.
+ */
+
+$attrib = '[a-zA-Z0-9]';
+$space = '[\x09\x0a\x0d\x20]';
+
+define( 'MW_CHAR_REFS_REGEX',
+'/&([A-Za-z0-9]+);
+ |&\#([0-9]+);
+ |&\#x([0-9A-Za-z]+);
+ |&\#X([0-9A-Za-z]+);
+ |(&)/x' );
+
+define( 'MW_ATTRIBS_REGEX',
+  "/(?:^|$space)($attrib+)
+    ($space*=$space*
+    (?:
+     # The attribute value: quoted or alone
+      ".'"'."([^<".'"'."]*)".'"'."
+     | '([^<']*)'
+     |  ([a-zA-Z0-9!#$%&()*,\\-.\\/:;<>?@[\\]^_`{|}~]+)
+     |  (\#[0-9a-fA-F]+) # Technically wrong, but lots of
+               # colors are specified like this.
+               # We'll be normalizing it.
+    )
+     )?(?=$space|\$)/sx" );
+
+/**
+ * Take a tag soup fragment listing an HTML element's attributes
+ * and normalize it to well-formed XML, discarding unwanted attributes.
+ * Output is safe for further wikitext processing, with escaping of
+ * values that could trigger problems.
+ *
+ * - Normalizes attribute names to lowercase
+ * - Discards attributes not on a whitelist for the given element
+ * - Turns broken or invalid entities into plaintext
+ * - Double-quotes all attribute values
+ * - Attributes without values are given the name as attribute
+ * - Double attributes are discarded
+ * - Unsafe style attributes are discarded
+ * - Prepends space if there are attributes.
+ *
+ * @param string $text
+ * @param string $element
+ * @return string
+ */
+function fixTagAttributes( $text, $element ) {
+  if( trim( $text ) == '' ) {
+    return '';
+  }
+  
+  $stripped = validateTagAttributes(
+    decodeTagAttributes( $text ), $element );
+  
+  $attribs = array();
+  foreach( $stripped as $attribute => $value ) {
+    $encAttribute = htmlspecialchars( $attribute );
+    $encValue = safeEncodeAttribute( $value );
+    
+    $attribs[] = "$encAttribute=".'"'."$encValue".'"'.""; // "
+  }
+  return count( $attribs ) ? ' ' . implode( ' ', $attribs ) : '';
+}
+
+/**
+ * Encode an attribute value for HTML tags, with extra armoring
+ * against further wiki processing.
+ * @param $text
+ * @return HTML-encoded text fragment
+ */
+function safeEncodeAttribute( $text ) {
+  $encValue= encodeAttribute( $text );
+  
+  # Templates and links may be expanded in later parsing,
+  # creating invalid or dangerous output. Suppress this.
+  $encValue = strtr( $encValue, array(
+    '<'    => '&lt;',   // This should never happen,
+    '>'    => '&gt;',   // we've received invalid input
+    '"'    => '&quot;', // which should have been escaped.
+    '{'    => '&#123;',
+    '['    => '&#91;',
+    "''"   => '&#39;&#39;',
+    'ISBN' => '&#73;SBN',
+    'RFC'  => '&#82;FC',
+    'PMID' => '&#80;MID',
+    '|'    => '&#124;',
+    '__'   => '&#95;_',
+  ) );
+
+  return $encValue;
+}
+
+/**
+ * Encode an attribute value for HTML output.
+ * @param $text
+ * @return HTML-encoded text fragment
+ */
+function encodeAttribute( $text ) {
+  
+  // In Enano 1.0.3, added this cheapo hack to keep ampersands
+  // from being double-sanitized. Thanks to markybob from #deluge.
+  
+  // htmlspecialchars() the "manual" way
+  $encValue = strtr( $text, array(
+    '&amp;'  => '&',
+    '&quot;' => '"',
+    '&lt;'   => '<',
+    '&gt;'   => '>',
+    '&#039;' => "'"
+  ) );
+  
+  $encValue = strtr( $text, array(
+    '&' => '&amp;',
+    '"' => '&quot;',
+    '<' => '&lt;',
+    '>' => '&gt;',
+    "'" => '&#039;'
+  ) );
+  
+  
+  // Whitespace is normalized during attribute decoding,
+  // so if we've been passed non-spaces we must encode them
+  // ahead of time or they won't be preserved.
+  $encValue = strtr( $encValue, array(
+    "\n" => '&#10;',
+    "\r" => '&#13;',
+    "\t" => '&#9;',
+  ) );
+  
+  return $encValue;
+}
+
+function unstripForHTML( $text ) {
+  global $mStripState;
+  $text = unstrip( $text, $mStripState );
+  $text = unstripNoWiki( $text, $mStripState );
+  return $text;
+}
+
+/**
+ * Always call this after unstrip() to preserve the order
+ *
+ * @private
+ */
+function unstripNoWiki( $text, &$state ) {
+  if ( !isset( $state['nowiki'] ) ) {
+    return $text;
+  }
+
+  # TODO: good candidate for FSS
+  $text = strtr( $text, $state['nowiki'] );
+  
+  return $text;
+}
+
+/**
+ * Take an array of attribute names and values and normalize or discard
+ * illegal values for the given element type.
+ *
+ * - Discards attributes not on a whitelist for the given element
+ * - Unsafe style attributes are discarded
+ *
+ * @param array $attribs
+ * @param string $element
+ * @return array
+ *
+ * @todo Check for legal values where the DTD limits things.
+ * @todo Check for unique id attribute :P
+ */
+function validateTagAttributes( $attribs, $element ) {
+  $whitelist = array_flip( attributeWhitelist( $element ) );
+  $out = array();
+  foreach( $attribs as $attribute => $value ) {
+    if( !isset( $whitelist[$attribute] ) ) {
+      continue;
+    }
+    # Strip javascript "expression" from stylesheets.
+    # http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp
+    if( $attribute == 'style' ) {
+      $value = checkCss( $value );
+      if( $value === false ) {
+        # haxx0r
+        continue;
+      }
+    }
+
+    if ( $attribute === 'id' )
+      $value = escapeId( $value );
+
+    // If this attribute was previously set, override it.
+    // Output should only have one attribute of each name.
+    $out[$attribute] = $value;
+  }
+  return $out;
+}
+
+/**
+ * Pick apart some CSS and check it for forbidden or unsafe structures.
+ * Returns a sanitized string, or false if it was just too evil.
+ *
+ * Currently URL references, 'expression', 'tps' are forbidden.
+ *
+ * @param string $value
+ * @return mixed
+ */
+function checkCss( $value ) {
+  $stripped = decodeCharReferences( $value );
+
+  // Remove any comments; IE gets token splitting wrong
+  $stripped = preg_replace( '!/\\*.*?\\*/!S', '', $stripped );
+  $value = $stripped;
+
+  // ... and continue checks
+  $stripped = preg_replace( '!\\\\([0-9A-Fa-f]{1,6})[ \\n\\r\\t\\f]?!e',
+    'codepointToUtf8(hexdec("$1"))', $stripped );
+  $stripped = str_replace( '\\', '', $stripped );
+  if( preg_match( '/(expression|tps*:\/\/|url\\s*\().*/is',
+      $stripped ) ) {
+    # haxx0r
+    return false;
+  }
+  
+  return $value;
+}
+
+/**
+ * Decode any character references, numeric or named entities,
+ * in the text and return a UTF-8 string.
+ *
+ * @param string $text
+ * @return string
+ * @access public
+ * @static
+ */
+function decodeCharReferences( $text ) {
+  return preg_replace_callback(
+    MW_CHAR_REFS_REGEX,
+    'decodeCharReferencesCallback',
+    $text );
+}
+
+/**
+ * Fetch the whitelist of acceptable attributes for a given
+ * element name.
+ *
+ * @param string $element
+ * @return array
+ */
+function attributeWhitelist( $element ) {
+  static $list;
+  if( !isset( $list ) ) {
+    $list = setupAttributeWhitelist();
+  }
+  return isset( $list[$element] )
+    ? $list[$element]
+    : array();
+}
+
+/**
+ * @todo Document it a bit
+ * @return array
+ */
+function setupAttributeWhitelist() {
+  global $db, $session, $paths, $template, $plugins;
+  $common = array( 'id', 'class', 'lang', 'dir', 'title', 'style' );
+  $block = array_merge( $common, array( 'align' ) );
+  $tablealign = array( 'align', 'char', 'charoff', 'valign' );
+  $tablecell = array( 'abbr',
+                      'axis',
+                      'headers',
+                      'scope',
+                      'rowspan',
+                      'colspan',
+                      'nowrap', # deprecated
+                      'width',  # deprecated
+                      'height', # deprecated
+                      'bgcolor' # deprecated
+                      );
+
+  # Numbers refer to sections in HTML 4.01 standard describing the element.
+  # See: http://www.w3.org/TR/html4/
+  $whitelist = array (
+    # 7.5.4
+    'div'        => $block,
+    'center'     => $common, # deprecated
+    'span'       => $block, # ??
+
+    # 7.5.5
+    'h1'         => $block,
+    'h2'         => $block,
+    'h3'         => $block,
+    'h4'         => $block,
+    'h5'         => $block,
+    'h6'         => $block,
+
+    # 7.5.6
+    # address
+
+    # 8.2.4
+    # bdo
+
+    # 9.2.1
+    'em'         => $common,
+    'strong'     => $common,
+    'cite'       => $common,
+    # dfn
+    'code'       => $common,
+    # samp
+    # kbd
+    'var'        => $common,
+    # abbr
+    # acronym
+
+    # 9.2.2
+    'blockquote' => array_merge( $common, array( 'cite' ) ),
+    # q
+
+    # 9.2.3
+    'sub'        => $common,
+    'sup'        => $common,
+
+    # 9.3.1
+    'p'          => $block,
+
+    # 9.3.2
+    'br'         => array( 'id', 'class', 'title', 'style', 'clear' ),
+
+    # 9.3.4
+    'pre'        => array_merge( $common, array( 'width' ) ),
+
+    # 9.4
+    'ins'        => array_merge( $common, array( 'cite', 'datetime' ) ),
+    'del'        => array_merge( $common, array( 'cite', 'datetime' ) ),
+
+    # 10.2
+    'ul'         => array_merge( $common, array( 'type' ) ),
+    'ol'         => array_merge( $common, array( 'type', 'start' ) ),
+    'li'         => array_merge( $common, array( 'type', 'value' ) ),
+
+    # 10.3
+    'dl'         => $common,
+    'dd'         => $common,
+    'dt'         => $common,
+
+    # 11.2.1
+    'table'      => array_merge( $common,
+              array( 'summary', 'width', 'border', 'frame',
+                  'rules', 'cellspacing', 'cellpadding',
+                  'align', 'bgcolor',
+              ) ),
+
+    # 11.2.2
+    'caption'    => array_merge( $common, array( 'align' ) ),
+
+    # 11.2.3
+    'thead'      => array_merge( $common, $tablealign ),
+    'tfoot'      => array_merge( $common, $tablealign ),
+    'tbody'      => array_merge( $common, $tablealign ),
+
+    # 11.2.4
+    'colgroup'   => array_merge( $common, array( 'span', 'width' ), $tablealign ),
+    'col'        => array_merge( $common, array( 'span', 'width' ), $tablealign ),
+
+    # 11.2.5
+    'tr'         => array_merge( $common, array( 'bgcolor' ), $tablealign ),
+
+    # 11.2.6
+    'td'         => array_merge( $common, $tablecell, $tablealign ),
+    'th'         => array_merge( $common, $tablecell, $tablealign ),
+    
+    # 12.2
+    # added by dan
+    'a'          => array_merge( $common, array( 'href', 'name' ) ),
+    
+    # 13.2
+    # added by dan
+    'img'        => array_merge( $common, array( 'src', 'width', 'height', 'alt' ) ),
+
+    # 15.2.1
+    'tt'         => $common,
+    'b'          => $common,
+    'i'          => $common,
+    'big'        => $common,
+    'small'      => $common,
+    'strike'     => $common,
+    's'          => $common,
+    'u'          => $common,
+
+    # 15.2.2
+    'font'       => array_merge( $common, array( 'size', 'color', 'face' ) ),
+    # basefont
+
+    # 15.3
+    'hr'         => array_merge( $common, array( 'noshade', 'size', 'width' ) ),
+
+    # XHTML Ruby annotation text module, simple ruby only.
+    # http://www.w3c.org/TR/ruby/
+    'ruby'       => $common,
+    # rbc
+    # rtc
+    'rb'         => $common,
+    'rt'         => $common, #array_merge( $common, array( 'rbspan' ) ),
+    'rp'         => $common,
+    
+    # For compatibility with the XHTML parser.
+    'nowiki'     => array(),
+    'noinclude'  => array(),
+    'nodisplay'  => array(),
+    'lang'       => array('code'),
+    
+    # XHTML stuff
+    'acronym'    => $common
+    );
+  
+  // custom tags can be added by plugins
+  $code = $plugins->setHook('html_attribute_whitelist');
+  foreach ( $code as $cmd )
+  {
+    eval($cmd);
+  }
+  
+  return $whitelist;
+}
+
+/**
+ * Given a value escape it so that it can be used in an id attribute and
+ * return it, this does not validate the value however (see first link)
+ *
+ * @link http://www.w3.org/TR/html401/types.html#type-name Valid characters
+ *                                                          in the id and
+ *                                                          name attributes
+ * @link http://www.w3.org/TR/html401/struct/links.html#h-12.2.3 Anchors with the id attribute
+ *
+ * @bug 4461
+ *
+ * @static
+ *
+ * @param string $id
+ * @return string
+ */
+function escapeId( $id ) {
+  static $replace = array(
+    '%3A' => ':',
+    '%' => '.'
+  );
+
+  $id = urlencode( decodeCharReferences( strtr( $id, ' ', '_' ) ) );
+
+  return str_replace( array_keys( $replace ), array_values( $replace ), $id );
+}
+
+/**
+ * More or less "markup-safe" explode()
+ * Ignores any instances of the separator inside <...>
+ * @param string $separator
+ * @param string $text
+ * @return array
+ */
+function wfExplodeMarkup( $separator, $text ) {
+  $placeholder = "\x00";
+  
+  // Just in case...
+  $text = str_replace( $placeholder, '', $text );
+  
+  // Trim stuff
+  $replacer = new ReplacerCallback( $separator, $placeholder );
+  $cleaned = preg_replace_callback( '/(<.*?>)/', array( $replacer, 'go' ), $text );
+  
+  $items = explode( $separator, $cleaned );
+  foreach( $items as $i => $str ) {
+    $items[$i] = str_replace( $placeholder, $separator, $str );
+  }
+  
+  return $items;
+}
+
+class ReplacerCallback {
+  function ReplacerCallback( $from, $to ) {
+    $this->from = $from;
+    $this->to = $to;
+  }
+  
+  function go( $matches ) {
+    return str_replace( $this->from, $this->to, $matches[1] );
+  }
+}
+
+/**
+ * Return an associative array of attribute names and values from
+ * a partial tag string. Attribute names are forces to lowercase,
+ * character references are decoded to UTF-8 text.
+ *
+ * @param string
+ * @return array
+ */
+function decodeTagAttributes( $text ) {
+  $attribs = array();
+
+  if( trim( $text ) == '' ) {
+    return $attribs;
+  }
+
+  $pairs = array();
+  if( !preg_match_all(
+    MW_ATTRIBS_REGEX,
+    $text,
+    $pairs,
+    PREG_SET_ORDER ) ) {
+    return $attribs;
+  }
+
+  foreach( $pairs as $set ) {
+    $attribute = strtolower( $set[1] );
+    $value = getTagAttributeCallback( $set );
+    
+    // Normalize whitespace
+    $value = preg_replace( '/[\t\r\n ]+/', ' ', $value );
+    $value = trim( $value );
+    
+    // Decode character references
+    $attribs[$attribute] = decodeCharReferences( $value );
+  }
+  return $attribs;
+}
+
+/**
+ * Pick the appropriate attribute value from a match set from the
+ * MW_ATTRIBS_REGEX matches.
+ *
+ * @param array $set
+ * @return string
+ * @access private
+ */
+function getTagAttributeCallback( $set ) {
+  if( isset( $set[6] ) ) {
+    # Illegal #XXXXXX color with no quotes.
+    return $set[6];
+  } elseif( isset( $set[5] ) ) {
+    # No quotes.
+    return $set[5];
+  } elseif( isset( $set[4] ) ) {
+    # Single-quoted
+    return $set[4];
+  } elseif( isset( $set[3] ) ) {
+    # Double-quoted
+    return $set[3];
+  } elseif( !isset( $set[2] ) ) {
+    # In XHTML, attributes must have a value.
+    # For 'reduced' form, return explicitly the attribute name here.
+    return $set[1];
+  } else {
+    die_friendly('Parser error', "<p>Tag conditions not met. This should never happen and is a bug.</p>" );
+  }
+}
+
+/**
+ * Strips and renders nowiki, pre, math, hiero
+ * If $render is set, performs necessary rendering operations on plugins
+ * Returns the text, and fills an array with data needed in unstrip()
+ * If the $state is already a valid strip state, it adds to the state
+ *
+ * @param bool $stripcomments when set, HTML comments <!-- like this -->
+ *  will be stripped in addition to other tags. This is important
+ *  for section editing, where these comments cause confusion when
+ *  counting the sections in the wikisource
+ * 
+ * @param array dontstrip contains tags which should not be stripped;
+ *  used to prevent stipping of <gallery> when saving (fixes bug 2700)
+ *
+ * @access private
+ */
+function mwStrip( $text, &$state, $stripcomments = false , $dontstrip = array () ) {
+  global $wgRandomKey;
+  $render = true;
+
+  $wgRandomKey = "\x07UNIQ" . dechex(mt_rand(0, 0x7fffffff)) . dechex(mt_rand(0, 0x7fffffff));
+  $uniq_prefix =& $wgRandomKey;
+  $commentState = array();
+  
+  $elements = array( 'nowiki', 'gallery' );
+  
+  # Removing $dontstrip tags from $elements list (currently only 'gallery', fixing bug 2700)
+  foreach ( $elements AS $k => $v ) {
+    if ( !in_array ( $v , $dontstrip ) ) continue;
+    unset ( $elements[$k] );
+  }
+  
+  $matches = array();
+  $text = extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
+
+  foreach( $matches as $marker => $data ) {
+    list( $element, $content, $params, $tag ) = $data;
+    if( $render ) {
+      $tagName = strtolower( $element );
+      switch( $tagName ) {
+      case '!--':
+        // Comment
+        if( substr( $tag, -3 ) == '-->' ) {
+          $output = $tag;
+        } else {
+          // Unclosed comment in input.
+          // Close it so later stripping can remove it
+          $output = "$tag-->";
+        }
+        break;
+      case 'html':
+        if( $wgRawHtml ) {
+          $output = $content;
+          break;
+        }
+        // Shouldn't happen otherwise. :)
+      case 'nowiki':
+        $output = wfEscapeHTMLTagsOnly( $content );
+        break;
+      default:
+      }
+    } else {
+      // Just stripping tags; keep the source
+      $output = $tag;
+    }
+
+    // Unstrip the output, because unstrip() is no longer recursive so 
+    // it won't do it itself
+    $output = unstrip( $output, $state );
+
+    if( !$stripcomments && $element == '!--' ) {
+      $commentState[$marker] = $output;
+    } elseif ( $element == 'html' || $element == 'nowiki' ) {
+      $state['nowiki'][$marker] = $output;
+    } else {
+      $state['general'][$marker] = $output;
+    }
+  }
+
+  # Unstrip comments unless explicitly told otherwise.
+  # (The comments are always stripped prior to this point, so as to
+  # not invoke any extension tags / parser hooks contained within
+  # a comment.)
+  if ( !$stripcomments ) {
+    // Put them all back and forget them
+    $text = strtr( $text, $commentState );
+  }
+
+  return $text;
+}
+
+/**
+ * Replaces all occurrences of HTML-style comments and the given tags
+ * in the text with a random marker and returns teh next text. The output
+ * parameter $matches will be an associative array filled with data in
+ * the form:
+ *   'UNIQ-xxxxx' => array(
+ *     'element',
+ *     'tag content',
+ *     array( 'param' => 'x' ),
+ *     '<element param="x">tag content</element>' ) )
+ *
+ * @param $elements list of element names. Comments are always extracted.
+ * @param $text Source text string.
+ * @param $uniq_prefix
+ *
+ * @access private
+ * @static
+ */
+function extractTagsAndParams($elements, $text, &$matches, $uniq_prefix = ''){
+  static $n = 1;
+  $stripped = '';
+  $matches = array();
+
+  $taglist = implode( '|', $elements );
+  $start = "/<($taglist)(\\s+[^>]*?|\\s*?)(\/?>)|<(!--)/i";
+
+  while ( '' != $text ) {
+    $p = preg_split( $start, $text, 2, PREG_SPLIT_DELIM_CAPTURE );
+    $stripped .= $p[0];
+    if( count( $p ) < 5 ) {
+      break;
+    }
+    if( count( $p ) > 5 ) {
+      // comment
+      $element    = $p[4];
+      $attributes = '';
+      $close      = '';
+      $inside     = $p[5];
+    } else {
+      // tag
+      $element    = $p[1];
+      $attributes = $p[2];
+      $close      = $p[3];
+      $inside     = $p[4];
+    }
+
+    $marker = "$uniq_prefix-$element-" . sprintf('%08X', $n++) . '-QINU';
+    $stripped .= $marker;
+
+    if ( $close === '/>' ) {
+      // Empty element tag, <tag />
+      $content = null;
+      $text = $inside;
+      $tail = null;
+    } else {
+      if( $element == '!--' ) {
+        $end = '/(-->)/';
+      } else {
+        $end = "/(<\\/$element\\s*>)/i";
+      }
+      $q = preg_split( $end, $inside, 2, PREG_SPLIT_DELIM_CAPTURE );
+      $content = $q[0];
+      if( count( $q ) < 3 ) {
+        # No end tag -- let it run out to the end of the text.
+        $tail = '';
+        $text = '';
+      } else {
+        $tail = $q[1];
+        $text = $q[2];
+      }
+    }
+    
+    $matches[$marker] = array( $element,
+      $content,
+      decodeTagAttributes( $attributes ),
+      "<$element$attributes$close$content$tail" );
+  }
+  return $stripped;
+}
+
+/**
+ * Escape html tags
+ * Basically replacing " > and < with HTML entities ( &quot;, &gt;, &lt;)
+ *
+ * @param $in String: text that might contain HTML tags.
+ * @return string Escaped string
+ */
+function wfEscapeHTMLTagsOnly( $in ) {
+  return str_replace(
+    array( '"', '>', '<' ),
+    array( '&quot;', '&gt;', '&lt;' ),
+    $in );
+}
+
+/**
+ * Restores pre, math, and other extensions removed by strip()
+ *
+ * always call unstripNoWiki() after this one
+ * @private
+ */
+function unstrip( $text, &$state ) {
+  if ( !isset( $state['general'] ) ) {
+    return $text;
+  }
+
+  # TODO: good candidate for FSS
+  $text = strtr( $text, $state['general'] );
+  
+  return $text;
+}
+
+/**
+ * Return UTF-8 string for a codepoint if that is a valid
+ * character reference, otherwise U+FFFD REPLACEMENT CHARACTER.
+ * @param int $codepoint
+ * @return string
+ * @private
+ */
+function decodeChar( $codepoint ) {
+  if( validateCodepoint( $codepoint ) ) {
+    return codepointToUtf8( $codepoint );
+  } else {
+    return UTF8_REPLACEMENT;
+  }
+}
+
+/**
+ * If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD,
+ * return the UTF-8 encoding of that character. Otherwise, returns
+ * pseudo-entity source (eg &foo;)
+ *
+ * @param string $name
+ * @return string
+ */
+function decodeEntity( $name ) {
+  global $wgHtmlEntities;
+  if( isset( $wgHtmlEntities[$name] ) ) {
+    return codepointToUtf8( $wgHtmlEntities[$name] );
+  } else {
+    return "&$name;";
+  }
+}
+
+/**
+ * Returns true if a given Unicode codepoint is a valid character in XML.
+ * @param int $codepoint
+ * @return bool
+ */
+function validateCodepoint( $codepoint ) {
+  return ($codepoint ==    0x09)
+    || ($codepoint ==    0x0a)
+    || ($codepoint ==    0x0d)
+    || ($codepoint >=    0x20 && $codepoint <=   0xd7ff)
+    || ($codepoint >=  0xe000 && $codepoint <=   0xfffd)
+    || ($codepoint >= 0x10000 && $codepoint <= 0x10ffff);
+}
+  
+/**
+ * Return UTF-8 sequence for a given Unicode code point.
+ * May die if fed out of range data.
+ *
+ * @param $codepoint Integer:
+ * @return String
+ * @public
+ */
+function codepointToUtf8( $codepoint ) {
+	if($codepoint <		0x80) return chr($codepoint);
+	if($codepoint <    0x800) return chr($codepoint >>	6 & 0x3f | 0xc0) .
+									 chr($codepoint		  & 0x3f | 0x80);
+	if($codepoint <  0x10000) return chr($codepoint >> 12 & 0x0f | 0xe0) .
+									 chr($codepoint >>	6 & 0x3f | 0x80) .
+									 chr($codepoint		  & 0x3f | 0x80);
+	if($codepoint < 0x110000) return chr($codepoint >> 18 & 0x07 | 0xf0) .
+									 chr($codepoint >> 12 & 0x3f | 0x80) .
+									 chr($codepoint >>	6 & 0x3f | 0x80) .
+									 chr($codepoint		  & 0x3f | 0x80);
+
+	echo "Asked for code outside of range ($codepoint)\n";
+	die( -1 );
+}
+
+/**
+ * @param string $matches
+ * @return string
+ */
+function decodeCharReferencesCallback( $matches ) {
+  if( $matches[1] != '' ) {
+    return decodeEntity( $matches[1] );
+  } elseif( $matches[2] != '' ) {
+    return  decodeChar( intval( $matches[2] ) );
+  } elseif( $matches[3] != ''  ) {
+    return  decodeChar( hexdec( $matches[3] ) );
+  } elseif( $matches[4] != '' ) {
+    return  decodeChar( hexdec( $matches[4] ) );
+  }
+  # Last case should be an ampersand by itself
+  return $matches[0];
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/wikiengine/parse_mediawiki.php	Sun Jun 21 00:20:32 2009 -0400
@@ -0,0 +1,202 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.6 (Caoineag beta 1)
+ * Copyright (C) 2006-2008 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+class Carpenter_Parse_MediaWiki
+{
+  public $rules = array(
+    'bold'   => "/'''(.+?)'''/",
+    'italic' => "/''(.+?)''/",
+    'underline' => '/__(.+?)__/',
+    'externalwithtext' => '#\[((?:https?|irc|ftp)://.+?) (.+?)\]#',
+    'externalnotext' => '#\[((?:https?|irc|ftp)://.+?)\]#'
+  );
+  
+  public function lang(&$text)
+  {
+    global $lang;
+    
+    preg_match_all('/<lang (?:code|id)="([a-z0-9_-]+)">([\w\W]+?)<\/lang>/', $text, $langmatch);
+    foreach ( $langmatch[0] as $i => $match )
+    {
+      if ( $langmatch[1][$i] == $lang->lang_code )
+      {
+        $text = str_replace_once($match, $langmatch[2][$i], $text);
+      }
+      else
+      {
+        $text = str_replace_once($match, '', $text);
+      }
+    }
+    
+    return array();
+  }
+  
+  public function templates(&$text)
+  {
+    $template_regex = "/\{\{(.+)((\n|\|[ ]*([A-z0-9]+)[ ]*=[ ]*(.+))*)\}\}/isU";
+    $i = 0;
+    while ( preg_match($template_regex, $text) )
+    {
+      $i++;
+      if ( $i == 5 )
+        break;
+      $text = RenderMan::include_templates($text);
+    }
+    
+    return array();
+  }
+  
+  public function heading(&$text)
+  {
+    if ( !preg_match_all('/^(={1,6}) *(.+?) *\\1$/m', $text, $results) )
+      return array();
+    
+    $headings = array();
+    foreach ( $results[0] as $i => $match )
+    {
+      $headings[] = array(
+          'level' => strlen($results[1][$i]),
+          'text' => $results[2][$i]
+        );
+    }
+    
+    $text = Carpenter::tokenize($text, $results[0]);
+    
+    return $headings;
+  }
+  
+  public function multilist(&$text)
+  {
+    // Match entire lists
+    $regex = '/^
+                ([:#\*])+     # Initial list delimiter
+                [ ]*
+                .+?
+                (?:
+                  \r?\n
+                  (?:\\1|[ ]{2,})
+                  [ ]*
+                  .+?)*
+                $/mx';
+    
+    if ( !preg_match_all($regex, $text, $lists) )
+      return array();
+    
+    $types = array(
+        '*' => 'unordered',
+        '#' => 'ordered',
+        ':' => 'indent'
+      );
+    
+    $pieces = array();
+    foreach ( $lists[0] as $i => $list )
+    {
+      $token = $lists[1][$i];
+      $piece = array(
+          'type' => $types[$token],
+          'items' => array()
+        );
+      
+      // convert windows newlines to unix
+      $list = str_replace("\r\n", "\n", $list);
+      $items_pre = explode("\n", $list);
+      $items = array();
+      // first pass, go through and combine items that are newlined
+      foreach ( $items_pre as $item )
+      {
+        if ( substr($item, 0, 1) == $token )
+        {
+          $items[] = $item;
+        }
+        else
+        {
+          // it's a continuation of the previous LI. Don't need to worry about
+          // undefined indices here since the regex should filter out all invalid
+          // markup. Just append this line to the previous.
+          $items[ count($items) - 1 ] .= "\n" . trim($item);
+        }
+      }
+      
+      // second pass, separate items and tokens
+      unset($items_pre);
+      foreach ( $items as $item )
+      {
+        // get the depth
+        list($itemtoken) = explode(' ', $item);
+        // get the text
+        $itemtext = trim(substr($item, strlen($itemtoken)));
+        $piece['items'][] = array(
+            // depth starts at 1
+            'depth' => strlen($itemtoken),
+            'text' => $itemtext
+          );
+      }
+      
+      $pieces[] = $piece;
+    }
+    
+    $text = Carpenter::tokenize($text, $lists[0]);
+    
+    return $pieces;
+  }
+  
+  public function paragraph(&$text)
+  {
+    // This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags
+    // to prevent the paragraph parser from interfering with pretty HTML generated elsewhere.
+    RenderMan::tag_strip('_paragraph_bypass', $text, $_nw);
+    
+    // The trick with paragraphs is to not turn things into them when a block level element already wraps the block of text.
+    // First we need a list of block level elements (http://htmlhelp.com/reference/html40/block.html)
+    $blocklevel = 'address|blockquote|center|div|dl|fieldset|form|h1|h2|h3|h4|h5|h6|hr|ol|p|pre|table|ul';
+    
+    $regex = "/^(
+                (?:(?!(?:\\n|[ ]*<(?:{$blocklevel}))))    # condition for starting paragraph: not a newline character or block level element
+                .+?                                       # body text
+                (?:
+                  \\n                                     # additional lines in the para
+                  (?:(?!(?:\\n|[ ]*<(?:{$blocklevel}))))  # make sure of only one newline in a row, and no block level elements
+                  .*?
+                )*
+              )$
+              /mx";
+    
+    if ( !preg_match_all($regex, $text, $matches) )
+      return array();
+    
+    // Debugging :)
+    // die('<pre>' . htmlspecialchars(print_r($matches, true)) . '</pre>');
+    
+    // restore stripped
+    RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw);
+    
+    // tokenize
+    $text = Carpenter::tokenize($text, $matches[0]);
+    
+    return $matches[0];
+  }
+}
+
+function parser_mediawiki_xhtml_image($text)
+{
+  $text = RenderMan::process_image_tags($text, $taglist);
+  $text = RenderMan::process_imgtags_stage2($text, $taglist);
+  return $text;
+}
+
+function parser_mediawiki_xhtml_tables($text)
+{
+  return process_tables($text);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/includes/wikiengine/render_xhtml.php	Sun Jun 21 00:20:32 2009 -0400
@@ -0,0 +1,133 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.1.6 (Caoineag beta 1)
+ * Copyright (C) 2006-2008 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+class Carpenter_Render_Xhtml
+{
+  public $rules = array(
+    'lang'   => '',
+    'templates' => '',
+    'bold'   => '<strong>\\1</strong>',
+    'italic' => '<em>\\1</em>',
+    'underline' => '<span style="text-decoration: underline;">\\1</span>',
+    'externalwithtext' => '<a href="\\1" onclick="window.open(this.href); return false;">\\2</a>',
+    'externalnotext' => '<a href="\\1" onclick="window.open(this.href); return false;">\\1</a>',
+  );
+  
+  public function heading($text, $pieces)
+  {
+    static $tocid = -1;
+    foreach ( $pieces as $i => $piece )
+    {
+      $tocid++;
+      $tag = '<h' . $piece['level'] . ' id="toc' . $tocid . '">';
+      $tag .= trim($piece['text']);
+      $tag .= '</h' . $piece['level'] . '>';
+      
+      $text = str_replace(Carpenter::generate_token($i), $tag, $text);
+    }
+    
+    return $text;
+  }
+  
+  public function multilist($text, $pieces)
+  {
+    foreach ( $pieces as $i => $piece )
+    {
+      switch($piece['type'])
+      {
+        case 'unordered':
+        default:
+          $btag = 'ul';
+          $itag = 'li';
+          break;
+        case 'ordered':
+          $btag = 'ol';
+          $itag = 'li';
+          break;
+        case 'indent':
+          $btag = 'dl';
+          $itag = 'dd';
+          break;
+      }
+      $list = "<$btag><_paragraph_bypass>\n";
+      $spacing = '';
+      $depth = 1;
+      foreach ( $piece['items'] as $j => $item )
+      {
+        // most of this just goes into pretty formatting.
+        // everything else goes into meeting the PITA requirement that if you're going
+        // another level deep, HTML requires the next level to be INSIDE of the <dd>/<li> tag.
+        $itemdepth = $item['depth'];
+        if ( $itemdepth > $depth )
+        {
+          while ( $depth < $itemdepth )
+          {
+            $spacing .= '    ';
+            $list .= "{$spacing}<$btag>\n";
+            $depth++;
+          }
+        }
+        else if ( $itemdepth < $depth )
+        {
+          while ( $depth > $itemdepth )
+          {
+            $list .= "{$spacing}</$btag>\n";
+            $spacing = substr($spacing, 4);
+            $list .= "{$spacing}</$itag>\n";
+            $spacing = substr($spacing, 4);
+            $depth--;
+          }
+        }
+        $list .= "{$spacing}    <$itag>" . nl2br($item['text']);
+        if ( ( isset($piece['items'][ ++$j ]) && $piece['items'][ $j ]['depth'] <= $itemdepth ) || !isset($piece['items'][ $j ]) ) 
+        {
+          $list .= "</$itag>\n";
+        }
+        else
+        {
+          $list .= "\n";
+          $spacing .= "    ";
+        }
+      }
+      while ( $depth > 1 )
+      {
+        $list .= "{$spacing}</$btag>\n";
+        $spacing = substr($spacing, 4);
+        $list .= "{$spacing}</$itag>\n";
+        $spacing = substr($spacing, 4);
+        $depth--;
+      }
+      $list .= "</_paragraph_bypass></$btag>\n";
+      $text = str_replace(Carpenter::generate_token($i), $list, $text);
+    }
+    return $text;
+  }
+  
+  public function paragraph($text, $pieces)
+  {
+    foreach ( $pieces as $i => $piece )
+    {
+      $text = str_replace(Carpenter::generate_token($i), '<p>' . nl2br($piece) . '</p>', $text);
+    }
+    
+    return $text;
+  }
+}
+
+// Alias internal link parsing to RenderMan's method
+function parser_mediawiki_xhtml_internallink($text)
+{
+  return RenderMan::parse_internal_links($text);
+}
+
--- a/includes/wikiformat.php	Sun Jun 21 00:16:21 2009 -0400
+++ b/includes/wikiformat.php	Sun Jun 21 00:20:32 2009 -0400
@@ -13,633 +13,312 @@
  */
 
 /**
- * Parse structured wiki text and render into arbitrary formats such as XHTML.
- *
- * PHP versions 4 and 5
+ * Framework for parsing and rendering various formats. In Enano by default, this is MediaWiki-style wikitext being
+ * rendered to XHTML, but this framework allows other formats to be supported as well.
  *
- * @category   Text
- * @package    Text_Wiki
- * @author     Paul M. Jones <pmjones@php.net>
- * @license    http://www.gnu.org/licenses/lgpl.html
- * @version    CVS: $Id: Wiki.php,v 1.44 2006/03/02 04:04:59 justinpatrin Exp $
- * @link       http://wiki.ciaweb.net/yawiki/index.php?area=Text_Wiki
- *
- * This code was modified for use in Enano. The Text_Wiki engine is licensed
- * under the GNU Lesser General Public License; see
- * http://www.gnu.org/licenses/lgpl.html for details.
- *
+ * @package Enano
+ * @subpackage Content
+ * @author Dan Fuhry <dan@enanocms.org>
+ * @copyright (C) 2009 Enano CMS Project
+ * @license GNU General Public License, version 2 or later <http://www.gnu.org/licenses/gpl-2.0.html>
  */
 
-require_once ENANO_ROOT.'/includes/wikiengine/Parse.php';
-require_once ENANO_ROOT.'/includes/wikiengine/Render.php';
-
-class Text_Wiki {
-
-  var $rules = array(
-        'Prefilter',
-        'Delimiter',
-        'Code',
-        'Function',
-        'Html',
-        'Raw',
-        'Include',
-        'Embed',
-        'Anchor',
-        'Heading',
-        'Toc',
-        'Horiz',
-        'Break',
-        'Blockquote',
-        'List',
-        'Deflist',
-        'Table',
-        'Image',
-        'Phplookup',
-        'Center',
-        'Newline',
-        'Paragraph',
-        'Url',
-        'Freelink',
-        'Interwiki',
-        'Wikilink',
-        'Colortext',
-        'Strong',
-        'Bold',
-        'Emphasis',
-        'Italic',
-        'Underline',
-        'Tt',
-        'Superscript',
-        'Subscript',
-        'Revise',
-        'Tighten'
+class Carpenter
+{
+  /**
+   * Parser token
+   * @const string
+   */
+  
+  const PARSER_TOKEN = "\xFF";
+  
+  /**
+   * Parsing engine
+   * @var string
+   */
+  
+  private $parser = 'mediawiki';
+  
+  /**
+   * Rendering engine
+   * @var string
+   */
+  
+  private $renderer = 'xhtml';
+  
+  /**
+   * Rendering flags
+   */
+  
+  public $flags = RENDER_WIKI_DEFAULT;
+  
+  /**
+   * List of rendering rules
+   * @var array
+   */
+  
+  private $rules = array(
+      'lang',
+      'templates',
+      'tables',
+      'heading',
+      // note: can't be named list ("list" is a PHP language construct)
+      'multilist',
+      'bold',
+      'italic',
+      'underline',
+      'externalwithtext',
+      'externalnotext',
+      'image',
+      'internallink',
+      'paragraph'
     );
-
-    var $disable = array(
-        'Html',
-        'Include',
-        'Embed',
-        'Tighten',
-        'Image',
-        'Wikilink'
-    );
-
-    var $parseConf = array();
-
-    var $renderConf = array(
-        'Docbook' => array(),
-        'Latex' => array(),
-        'Pdf' => array(),
-        'Plain' => array(),
-        'Rtf' => array(),
-        'Xhtml' => array()
-    );
-
-    var $formatConf = array(
-        'Docbook' => array(),
-        'Latex' => array(),
-        'Pdf' => array(),
-        'Plain' => array(),
-        'Rtf' => array(),
-        'Xhtml' => array()
-    );
-    var $delim = "\xFF";
-    var $tokens = array();
-    var $_countRulesTokens = array();
-    var $source = '';
-    var $parseObj = array();
-    var $renderObj = array();
-    var $formatObj = array();
-    var $path = array(
-        'parse' => array(),
-        'render' => array()
-    );
-    var $_dirSep = DIRECTORY_SEPARATOR;
-    function Text_Wiki($rules = null)
+  
+  /**
+   * List of render hooks
+   * @var array
+   */
+  
+  private $hooks = array();
+  
+  /* private $rules = array('prefilter', 'delimiter', 'code', 'function', 'html', 'raw', 'include', 'embed', 'anchor',
+           'heading', 'toc', 'horiz', 'break', 'blockquote', 'list', 'deflist', 'table', 'image',
+           'phplookup', 'center', 'newline', 'paragraph', 'url', 'freelink', 'interwiki',
+           'wikilink', 'colortext', 'strong', 'bold', 'emphasis', 'italic', 'underline', 'tt',
+           'superscript', 'subscript', 'revise', 'tighten'); */
+  
+  /**
+   * Render the text!
+   * @param string Text to render
+   * @return string
+   */
+  
+  public function render($text)
+  {
+    $parser_class = "Carpenter_Parse_" . ucwords($this->parser);
+    $renderer_class = "Carpenter_Render_" . ucwords($this->renderer);
+    
+    // include files, if we haven't already
+    if ( !class_exists($parser_class) )
+    {
+      require_once( ENANO_ROOT . "/includes/wikiengine/parse_{$this->parser}.php");
+    }
+    
+    if ( !class_exists($renderer_class) )
     {
-        if (is_array($rules)) {
-            $this->rules = $rules;
+      require_once( ENANO_ROOT . "/includes/wikiengine/render_{$this->renderer}.php");
+    }
+    
+    $parser = new $parser_class;
+    $renderer = new $renderer_class;
+    
+    // run prehooks
+    foreach ( $this->hooks as $hook )
+    {
+      if ( $hook['when'] === PO_FIRST )
+      {
+        $text = call_user_func($hook['callback'], $text);
+        if ( !is_string($text) || empty($text) )
+        {
+          trigger_error("Hook returned empty/invalid text: " . print_r($hook['callback'], true), E_USER_WARNING);
+          // *sigh*
+          $text = '';
         }
-        
-        global $plugins;
-        // This code can be run from the installer, so in some cases $plugins
-        // isn't initted. (Bug in 1.1.2, fixed for 1.1.3)
-        if ( is_object($plugins) )
+      }
+    }
+    
+    // perform render
+    foreach ( $this->rules as $rule )
+    {
+      // run prehooks
+      foreach ( $this->hooks as $hook )
+      {
+        if ( $hook['when'] === PO_BEFORE && $hook['rule'] === $rule )
         {
-          $code = $plugins->setHook('text_wiki_construct');
-          foreach ( $code as $cmd )
+          $text = call_user_func($hook['callback'], $text);
+          if ( !is_string($text) || empty($text) )
           {
-              eval($cmd);
+            trigger_error("Hook returned empty/invalid text: " . print_r($hook['callback'], true), E_USER_WARNING);
+            // *sigh*
+            $text = '';
           }
         }
-
-        $this->addPath(
-            'parse',
-            $this->fixPath(ENANO_ROOT) . 'includes/wikiengine/Parse/Default/'
-        );
-        $this->addPath(
-            'render',
-            $this->fixPath(ENANO_ROOT) . 'includes/wikiengine/Render/'
-        );
-
-    }
-
-    public static function singleton($parser = 'Default', $rules = null)
-    {
-        static $only = array();
-        if (!isset($only[$parser])) {
-            $ret = Text_Wiki::factory($parser, $rules);
-            if (!$ret) {
-                return $ret;
-            }
-            $only[$parser] =& $ret;
-        }
-        return $only[$parser];
-    }
-
-    public static function factory($parser = 'Default', $rules = null)
-    {
-        $d=getcwd();
-        chdir(ENANO_ROOT);
-        
-        $class = 'Text_Wiki_' . $parser;
-        $c2 = $parser;
-        $file = ENANO_ROOT . '/includes/wikiengine/' . str_replace('_', '/', $c2).'.php';
-        if (!class_exists($class)) {
-            $fp = @fopen($file, 'r', true);
-            if ($fp === false) {
-                die_semicritical('Wiki formatting engine error', '<p>Could not find file '.$file.' in include_path</p>');
-            }
-            fclose($fp);
-            include_once($file);
-            if (!class_exists($class)) {
-                die_semicritical('Wiki formatting engine error', '<p>Class '.$class.' does not exist after including '.$file.'</p>');
-            }
-        }
-        
-        chdir($d);
-
-        $obj = new $class($rules);
-        return $obj;
-    }
-
-    function setParseConf($rule, $arg1, $arg2 = null)
-    {
-        $rule = ucwords(strtolower($rule));
-
-        if (! isset($this->parseConf[$rule])) {
-            $this->parseConf[$rule] = array();
-        }
-
-                                if (is_array($arg1)) {
-            $this->parseConf[$rule] = $arg1;
-        } else {
-            $this->parseConf[$rule][$arg1] = $arg2;
-        }
-    }
-
-    function getParseConf($rule, $key = null)
-    {
-        $rule = ucwords(strtolower($rule));
-
-                if (! isset($this->parseConf[$rule])) {
-            return null;
-        }
-
-                if (is_null($key)) {
-            return $this->parseConf[$rule];
-        }
-
-                if (isset($this->parseConf[$rule][$key])) {
-                        return $this->parseConf[$rule][$key];
-        } else {
-                        return null;
-        }
-    }
-
-    function setRenderConf($format, $rule, $arg1, $arg2 = null)
-    {
-        $format = ucwords(strtolower($format));
-        $rule = ucwords(strtolower($rule));
-
-        if (! isset($this->renderConf[$format])) {
-            $this->renderConf[$format] = array();
-        }
-
-        if (! isset($this->renderConf[$format][$rule])) {
-            $this->renderConf[$format][$rule] = array();
-        }
-
-                                if (is_array($arg1)) {
-            $this->renderConf[$format][$rule] = $arg1;
-        } else {
-            $this->renderConf[$format][$rule][$arg1] = $arg2;
-        }
-    }
-
-    function getRenderConf($format, $rule, $key = null)
-    {
-        $format = ucwords(strtolower($format));
-        $rule = ucwords(strtolower($rule));
-
-        if (! isset($this->renderConf[$format]) ||
-            ! isset($this->renderConf[$format][$rule])) {
-          return null;
-        }
-
-        if (is_null($key)) {
-          return $this->renderConf[$format][$rule];
-        }
-
-        if (isset($this->renderConf[$format][$rule][$key])) {
-          return $this->renderConf[$format][$rule][$key];
-        } else {
-          return null;
-        }
-
-    }
-
-    function setFormatConf($format, $arg1, $arg2 = null)
-    {
-      if (! is_array($this->formatConf[$format])) {
-        $this->formatConf[$format] = array();
       }
-
-      if (is_array($arg1)) {
-        $this->formatConf[$format] = $arg1;
-      } else {
-        $this->formatConf[$format][$arg1] = $arg2;
-      }
-    }
-
-    function getFormatConf($format, $key = null)
-    {
-      if (! isset($this->formatConf[$format])) {
-        return null;
-      }
-
-      if (is_null($key)) {
-        return $this->formatConf[$format];
-      }
-
-      if (isset($this->formatConf[$format][$key])) {
-        return $this->formatConf[$format][$key];
-      } else {
-        return null;
-      }
-    }
-
-    function insertRule($name, $tgt = null)
-    {
-      $name = ucwords(strtolower($name));
-      if (! is_null($tgt)) {
-        $tgt = ucwords(strtolower($tgt));
-      }
-      if (in_array($name, $this->rules)) {
-        return null;
-      }
-
-      if (! is_null($tgt) && $tgt != '' &&
-        ! in_array($tgt, $this->rules)) {
-        return false;
-      }
-
-      if (is_null($tgt)) {
-        $this->rules[] = $name;
-        return true;
-      }
-
-      if ($tgt == '') {
-        array_unshift($this->rules, $name);
-        return true;
-      }
-
-      $tmp = $this->rules;
-      $this->rules = array();
-
-      foreach ($tmp as $val) {
-        $this->rules[] = $val;
-        if ($val == $tgt) {
-          $this->rules[] = $name;
-        }
-      }
-
-      return true;
-    }
-
-    function deleteRule($name)
-    {
-      $name = ucwords(strtolower($name));
-      $key = array_search($name, $this->rules);
-      if ($key !== false) {
-        unset($this->rules[$key]);
-      }
-    }
-
-    function changeRule($old, $new)
-    {
-      $old = ucwords(strtolower($old));
-      $new = ucwords(strtolower($new));
-      $key = array_search($old, $this->rules);
-      if ($key !== false) {
-        $this->deleteRule($new);
-        $this->rules[$key] = $new;
-      }
-    }
-
-    function enableRule($name)
-    {
-      $name = ucwords(strtolower($name));
-      $key = array_search($name, $this->disable);
-      if ($key !== false) {
-        unset($this->disable[$key]);
-      }
-    }
-
-    function disableRule($name)
-    {
-      $name = ucwords(strtolower($name));
-      $key = array_search($name, $this->disable);
-      if ($key === false) {
-        $this->disable[] = $name;
-      }
-    }
-
-    function transform($text, $format = 'Xhtml')
-    {
-      $this->parse($text);
-      return $this->render($format);
-    }
-
-    function parse($text)
-    {
-      $this->source = $text;
-
-      $this->tokens = array();
-      $this->_countRulesTokens = array();
-
-      foreach ($this->rules as $name) {
-        if (! in_array($name, $this->disable)) {
-          $this->loadParseObj($name);
-
-          if (is_object($this->parseObj[$name])) {
-            $this->parseObj[$name]->parse();
+      
+      // execute rule
+      $text = $this->perform_render_step($text, $rule, $parser, $renderer);
+      
+      // run posthooks
+      foreach ( $this->hooks as $hook )
+      {
+        if ( $hook['when'] === PO_AFTER && $hook['rule'] === $rule )
+        {
+          $text = call_user_func($hook['callback'], $text);
+          if ( !is_string($text) || empty($text) )
+          {
+            trigger_error("Hook returned empty/invalid text: " . print_r($hook['callback'], true), E_USER_WARNING);
+            // *sigh*
+            $text = '';
           }
-          // For debugging
-          // echo('<p>' . $name . ':</p><pre>'.htmlspecialchars($this->source).'</pre>');
         }
       }
     }
-
-    function render($format = 'Xhtml')
+    
+    // run posthooks
+    foreach ( $this->hooks as $hook )
     {
-      $format = ucwords(strtolower($format));
-
-      $output = '';
-
-      $in_delim = false;
-
-      $key = '';
-
-      $result = $this->loadFormatObj($format);
-      if ($this->isError($result)) {
-        return $result;
-      }
-      
-      if (is_object($this->formatObj[$format])) {
-        $output .= $this->formatObj[$format]->pre();
-      }
-
-      foreach (array_keys($this->_countRulesTokens) as $rule) {
-        $this->loadRenderObj($format, $rule);
-      }
-      
-      $k = strlen($this->source);
-      for ($i = 0; $i < $k; $i++) {
-
-        $char = $this->source{$i};
-
-        if ($in_delim) {
-
-          if ($char == $this->delim) {
-
-            $key = (int)$key;
-            $rule = $this->tokens[$key][0];
-            $opts = $this->tokens[$key][1];
-            $output .= $this->renderObj[$rule]->token($opts);
-            $in_delim = false;
-
-          } else {
-
-            $key .= $char;
-
-          }
-
-        } else {
-
-          if ($char == $this->delim) {
-            $key = '';
-            $in_delim = true;
-          } else {
-            $output .= $char;
-          }
+      if ( $hook['when'] === PO_LAST )
+      {
+        $text = call_user_func($hook['callback'], $text);
+        if ( !is_string($text) || empty($text) )
+        {
+          trigger_error("Hook returned empty/invalid text: " . print_r($hook['callback'], true), E_USER_WARNING);
+          // *sigh*
+          $text = '';
         }
       }
-
-      if (is_object($this->formatObj[$format])) {
-        $output .= $this->formatObj[$format]->post();
-      }
-
-      return $output;
     }
-
-    function getSource()
-    {
-      return $this->source;
-    }
-
-    function getTokens($rules = null)
-    {
-        if (is_null($rules)) {
-            return $this->tokens;
-        } else {
-            settype($rules, 'array');
-            $result = array();
-            foreach ($this->tokens as $key => $val) {
-                if (in_array($val[0], $rules)) {
-                    $result[$key] = $val;
-                }
-            }
-            return $result;
-        }
-    }
-
-    function addToken($rule, $options = array(), $id_only = false)
+    
+    return (( defined('ENANO_DEBUG') && isset($_GET['parserdebug']) ) ? '<pre>' . htmlspecialchars($text) . '</pre>' : $text) . "\n\n";
+  }
+  
+  /**
+   * Performs a step in the rendering process.
+   * @param string Text to render
+   * @param string Rule to execute
+   * @param object Parser instance
+   * @param object Renderer instance
+   * @return string
+   * @access private
+   */
+  
+  private function perform_render_step($text, $rule, $parser, $renderer)
+  {
+    // First look for a direct function
+    if ( function_exists("parser_{$this->parser}_{$this->renderer}_{$rule}") )
     {
-                                static $id;
-        if (! isset($id)) {
-            $id = 0;
-        } else {
-            $id ++;
-        }
-
-                settype($options, 'array');
-
-                $this->tokens[$id] = array(
-            0 => $rule,
-            1 => $options
-        );
-        if (!isset($this->_countRulesTokens[$rule])) {
-            $this->_countRulesTokens[$rule] = 1;
-        } else {
-            ++$this->_countRulesTokens[$rule];
-        }
-
-                if ($id_only) {
-                        return $id;
-        } else {
-                        return $this->delim . $id . $this->delim;
-        }
+      return call_user_func("parser_{$this->parser}_{$this->renderer}_{$rule}", $text, $this->flags);
     }
-
-    function setToken($id, $rule, $options = array())
+    
+    // We don't have that, so start looking for other ways or means of doing this
+    if ( method_exists($parser, $rule) && method_exists($renderer, $rule) )
+    {
+      // Both the parser and render have callbacks they want to use.
+      $pieces = $parser->$rule($text);
+      $text = call_user_func(array($renderer, $rule), $text, $pieces);
+    }
+    else if ( method_exists($parser, $rule) && !method_exists($renderer, $rule) && isset($renderer->rules[$rule]) )
     {
-        $oldRule = $this->tokens[$id][0];
-                $this->tokens[$id] = array(
-            0 => $rule,
-            1 => $options
-        );
-        if ($rule != $oldRule) {
-            if (!($this->_countRulesTokens[$oldRule]--)) {
-                unset($this->_countRulesTokens[$oldRule]);
-            }
-            if (!isset($this->_countRulesTokens[$rule])) {
-                $this->_countRulesTokens[$rule] = 1;
-            } else {
-                ++$this->_countRulesTokens[$rule];
-            }
-        }
+      // The parser has a callback, but the renderer does not
+      $pieces = $parser->$rule($text);
+      $text = $this->generic_render($text, $pieces, $renderer->rules[$rule]);
     }
-
-    function loadParseObj($rule)
+    else if ( !method_exists($parser, $rule) && isset($parser->rules[$rule]) && method_exists($renderer, $rule) )
     {
-        $rule = ucwords(strtolower($rule));
-        $file = $rule . '.php';
-        $class = "Text_Wiki_Parse_$rule";
-
-        if (! class_exists($class)) {
-            $loc = $this->findFile('parse', $file);
-            if ($loc) {
-                                include_once $loc;
-            } else {
-                                $this->parseObj[$rule] = null;
-                                return $this->error(
-                    "Parse rule '$rule' not found"
-                );
-            }
-        }
-
-        $this->parseObj[$rule] = new $class($this);
-
+      // The parser has no callback, but the renderer does
+      $text = preg_replace_callback($parser->rules[$rule], array($renderer, $rule), $text);
+    }
+    else if ( isset($parser->rules[$rule]) && isset($renderer->rules[$rule]) )
+    {
+      // This is a straight-up regex only rule
+      $text = preg_replace($parser->rules[$rule], $renderer->rules[$rule], $text);
+    }
+    else
+    {
+      // Either the renderer or parser does not support this rule, ignore it
     }
-
-    function loadRenderObj($format, $rule)
-    {
-        $format = ucwords(strtolower($format));
-        $rule = ucwords(strtolower($rule));
-        $file = "$format/$rule.php";
-        $class = "Text_Wiki_Render_$format" . "_$rule";
-
-        if (! class_exists($class)) {
-                        $loc = $this->findFile('render', $file);
-            if ($loc) {
-                                include_once $loc;
-            } else {
-                return $this->error(
-                    "Render rule '$rule' in format '$format' not found"
-                );
-            }
-        }
-
-        $this->renderObj[$rule] = new $class($this);
-    }
-
-    function loadFormatObj($format)
-    {
-        $format = ucwords(strtolower($format));
-        $file = $format . '.php';
-        $class = "Text_Wiki_Render_$format";
-
-        if (! class_exists($class)) {
-            $loc = $this->findFile('render', $file);
-            if ($loc) {
-                include_once $loc;
-            } else {
-                return $this->error(
-                    "Rendering format class '$class' not found"
-                );
-            }
-        }
-
-        $this->formatObj[$format] = new $class($this);
-    }
-
-    function addPath($type, $dir)
+    
+    return $text;
+  }
+  
+  /**
+   * Generic renderer
+   * @access protected
+   */
+  
+  protected function generic_render($text, $pieces, $rule)
+  {
+    foreach ( $pieces as $i => $piece )
     {
-        $dir = $this->fixPath($dir);
-        if (! isset($this->path[$type])) {
-            $this->path[$type] = array($dir);
-        } else {
-            array_unshift($this->path[$type], $dir);
+      $replacement = $rule;
+      
+      // if the piece is an array, replace $1, $2, etc. in the rule with each value in the piece
+      if ( is_array($piece) )
+      {
+        $j = 0;
+        foreach ( $piece as $part )
+        {
+          $j++;
+          $replacement = str_replace(array("\\$j", "\${$j}"), $part, $replacement);
         }
+      }
+      // else, just replace \\1 or $1 in the rule with the piece
+      else
+      {
+        $replacement = str_replace(array("\\1", "\$1"), $piece, $replacement);
+      }
+      
+      $text = str_replace(self::generate_token($i), $replacement, $text);
     }
-
-    function getPath($type = null)
-    {
-        if (is_null($type)) {
-            return $this->path;
-        } elseif (! isset($this->path[$type])) {
-            return array();
-        } else {
-            return $this->path[$type];
-        }
-    }
-
-    function findFile($type, $file)
+    
+    return $text;
+  }
+  
+  /**
+   * Add a hook into the parser.
+   * @param callback Function to call
+   * @param int PO_* constant
+   * @param string If PO_{BEFORE,AFTER} used, rule
+   */
+  
+  public function hook($callback, $when, $rule = false)
+  {
+    if ( !is_int($when) )
+      return null;
+    if ( ($when == PO_BEFORE || $when == PO_AFTER) && !is_string($rule) )
+      return null;
+    if ( ( is_string($callback) && !function_exists($callback) ) || ( is_array($callback) && !method_exists($callback[0], $callback[1]) ) || ( !is_string($callback) && !is_array($callback) ) )
     {
-      $set = $this->getPath($type);
-
-      foreach ($set as $path) {
-            $fullname = $path . $file;
-            if (file_exists($fullname) && is_readable($fullname)) {
-                return $fullname;
-            }
-        }
-
-      return false;
+      trigger_error("Attempt to hook with undefined function/method " . print_r($callback, true), E_USER_ERROR);
+      return null;
     }
-
-    function fixPath($path)
+    
+    $this->hooks[] = array(
+        'callback' => $callback,
+        'when'     => $when,
+        'rule'     => $rule
+      );
+  }
+  
+  /**
+   * Generate a token
+   * @param int Token index
+   * @return string
+   * @static
+   */
+  
+  public static function generate_token($i)
+  {
+    return self::PARSER_TOKEN . $i . self::PARSER_TOKEN;
+  }
+  
+  /**
+   * Tokenize string
+   * @param string
+   * @param array Matches
+   * @return string
+   * @static
+   */
+  
+  public static function tokenize($text, $matches)
+  {
+    $matches = array_values($matches);
+    foreach ( $matches as $i => $match )
     {
-        $len = strlen($this->_dirSep);
-
-        if (! empty($path) &&
-            substr($path, -1 * $len, $len) != $this->_dirSep)    {
-            return $path . $this->_dirSep;
-        } else {
-            return $path;
-        }
+      $text = str_replace_once($match, self::generate_token($i), $text);
     }
-
-    function &error($message)
-    {
-        die($message);
-    }
-
-    function isError(&$obj)
-    {
-        return ( @get_class($obj) == 'PEAR_Error' );
-    }
+    
+    return $text;
+  }
 }
 
-?>