summaryrefslogtreecommitdiffstats
path: root/code/subst.inc.php
blob: 9696ec947bf56aadd95e8d688daebf03b9740bb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<?PHP
  $GLOBALS['messages'] = array();
  
  if($GLOBALS['config']['language'] != 'en') @include('lang/' . $GLOBALS['config']['language'] . '.inc.php');
  
  function Subst($data) {
    $subst = array_map(create_function('$key', 'return \'(\\{\\{\' . $key . \'\\}\\})\';'), array_keys($GLOBALS['messages']));
    
    $data = preg_replace($subst, $GLOBALS['messages'], $data);
    
    return preg_replace('({{(.+?)}})', '$1', $data);
  }
?>