summaryrefslogtreecommitdiffstats
path: root/code/links.inc.php
blob: 39a1ae281e113bb85d1881ab7ff1fb95e33162e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?PHP
  if(!defined('LINKS_INC')) {
    define('LINKS_INC', 1);
    
    class Links {
      function GetNeonLink($page) {
      	if($GLOBALS['pages']->HasAccess($page))
          return 'index.php?page=' . $page;
        return '';
      }
      
      function GetExternalLink($link) {
      	return $link;
      }
      
      function GetMailtoLink($address) {
      	return 'mailto:' . $address;
      }
      
      function ParseNavLink($link) {
      	if(!$link) return '';
      	
      	switch($link[0]) {
      	  case ':':
      	    return $this->GetNeonLink(substr($link, 1));
      	  case '@':
      	    return $this->GetMailtoLink(substr($link, 1));
      	  case '!':
      	    return '';
      	  default:
      	    return $this->GetExternalLink($link);
      	}
      }
    }
    
    $links = new Links;
  }
?>