<?php class GCLParserFunctionsExtension {
   public static function onParserSetup(&$parser) {
      $parser->setHook("boardNews", "GCLParserFunctionsExtension::boardNews");
      $parser->setHook("hideArticle", "GCLParserFunctionsExtension::hideArticle");
      $parser->setHook("showArticleLink", "GCLParserFunctionsExtension::showArticleLink");
      $parser->setFunctionHook("displayName", "GCLParserFunctionsExtension::displayName");
   }
   public static function boardNews($input, $args, $parser) {
     $parser->disableCache();
     ob_start();
     ssi_boardNews($args['board'], $args['limit'], $args['start'], $args['length']);
     return ob_get_clean();
   }
   public static function hideArticle() {
     return '<style type="text/css"> <!-- #metapod { display: none; } //--> </style>';
   }
   public static function showArticleLink($text) {
     return '<a href="#" onclick="document.getElementById(\'metapod\').style.display = true">' . htmlspecialchars($text) . '</a>';
   }
   public static function displayName(&$parser, $username) {
     $userinfo = smfapi_getUserByUsername($username);
     if(!$userinfo) {
        return "";
     }
     return $userinfo['real_name'];
   }
}
