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;
  }
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;
  }
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 ; }
XSS text filter. Returns a string that is safe to use on the page.

There are three types of variables:
%variables: stip mode of phpsec::f() is used.
!variables: escapeAll mode of phpsec::f() is used.
@variables: escape mode of phpsec::f() is used.
&variables: url mode of phpsec::f() is used.

@see phpsec::f()
@see https://phpseclib.com/manual/filter
@see http://www.faqs.org/rfcs/rfc3986

@param string $str
A string containing the 'glue' used to compose the filtered parts
from the $args array.

@param mixed $args
An associative array containing data to filter.
The array keys should be preceeded with %, ! or @ defining what filter
to apply.
XSS text filter . Returns a string that is safe to use on the page .