public function t($str, $args) {
    /* Loop trough the args and apply the filters. */
    while(list($name, $data) = each($args)) {
      $safeData = false;
      $filterType = mb_substr($name, 0, 1);
      switch($filterType) {
        case '%':
          /* %variables: HTML tags are stripped of from the string
             before it is in inserted. */
          $safeData = $this->f($data, 'strip');
          break;
        case '!':
          /* !variables: HTML and special characters are escaped from the string
             before it is used. */
          $safeData = $this->f($data, 'escapeAll');
          break;
        case '@':
          /* @variables: Only HTML is escaped from the string. Special characters
             is kept as it is. */
          $safeData = $this->f($data, 'escape');
          break;
        case '&':
          /* Encode a string according to RFC 3986 for use in a URL. */
          $safeData = $this->f($data, 'url');
          break;
        default:
          throw new \phpSec\Exception\InvalidArgumentException('Unknown variable type');
          break;
      }
      if($safeData !== false) {
        $str = str_replace($name, $safeData, $str);
      }
    }

    return $str;
  }