<?php

/*

lets administrators control the way self-referencing wiki page links
display -- it finds wiki words and free links referring to the current 
page name and substitutes an alternate $WikiPageExistsFmt

Copyright 2003 John Rankin john.rankin@affinity.co.nz

*/
$FmtWikiLink = 'FmtWikiLinkCheckSelf';
$WikiPageSelfRefFmt = "<b class='selfreference'>\$LinkText</b>";

function FmtWikiLinkCheckSelf($pat,$ref,$btext,$out=NULL,$pname=NULL) {
  global $WikiPageSelfRefFmt,$WikiPageExistsFmt;
  if ($GLOBALS['pagename']==FmtWikiLink($pat,$ref,$btext,'PageName',$pname)) {
      $h=$WikiPageExistsFmt;
      $WikiPageExistsFmt=$WikiPageSelfRefFmt;
      $r=FmtWikiLink($pat,$ref,$btext,$out,$pname);
      $WikiPageExistsFmt=$h;
      return $r;
  }
  return FmtWikiLink($pat,$ref,$btext,$out,$pname);
}

?>