コード例 #1
0
ファイル: BBCodeLibrary.php プロジェクト: vanilla/nbbc
 /**
  * Format a [wiki] tag by producing an <a>...</a> element.
  *
  * @param BBCode $bbcode The {@link BBCode} object doing the parsing.
  * @param int $action The current action being performed on the tag.
  * @param string $name The name of the tag.
  * @param string $default The default value passed to the tag in the form: `[tag=default]`.
  * @param array $params All of the parameters passed to the tag.
  * @param string $content The content of the tag. Only available when {@link $action} is **BBCODE_OUTPUT**.
  * @return string Returns a link to the wiki.
  */
 public function doWiki(BBCode $bbcode, $action, $name, $default, $params, $content)
 {
     $name = $bbcode->wikify($default);
     if ($action == BBCode::BBCODE_CHECK) {
         return strlen($name) > 0;
     }
     if (isset($params['title']) && strlen(trim($params['title']))) {
         $title = trim($params['title']);
     } else {
         $title = trim($default);
     }
     $wikiURL = $bbcode->getWikiURL();
     return $bbcode->fillTemplate($bbcode->getWikiURLTemplate(), array("wikiURL" => $wikiURL, "name" => $name, "title" => $title));
 }