src/Context/DefaultRenderContext.php
/**
	 * This method can be used to transform any string into a secure version specified by the mode argument.
	 *
	 * @param string $html
	 * @param int $mode
	 */
This method can be used to transform any string into a secure version specified by the mode argument.
@param string $html
@param int $mode
This method can be used to transform any string into a secure version specified by the mode argument . @param string $html @param int $mode
public function encodeString($string, int $mode = self::ENCODE_HTML_STRING_MODE) {
    	switch ($mode) {
			case self::ENCODE_HTML_STRING_MODE: return htmlspecialchars($string);
			case self::ENCODE_BASE64_STRING_MODE: return base64_encode($string);
			case self::ENCODE_ASCII_STRING_MODE: return utf8_decode($string);
			case self::ENCODE_UTF8_STRING_MODE: return utf8_encode($string);
			case self::ENCODE_URL_STRING_MODE: return urlencode($string);
			case self::ENCODE_BASE64_JS_STRING_MODE: return "<script type='application/javascript'>document.write(atob('" . base64_encode($string) . "'));</script>";
			default:
				return $string;
		}
	}
public function encodeString ( $ string , int $ mode = self :: ENCODE_HTML_STRING_MODE ) { switch ( $ mode ) { case self :: ENCODE_HTML_STRING_MODE : return htmlspecialchars ( $ string ) ; case self :: ENCODE_BASE64_STRING_MODE : return base64_encode ( $ string ) ; case self :: ENCODE_ASCII_STRING_MODE : return utf8_decode ( $ string ) ; case self :: ENCODE_UTF8_STRING_MODE : return utf8_encode ( $ string ) ; case self :: ENCODE_URL_STRING_MODE : return urlencode ( $ string ) ; case self :: ENCODE_BASE64_JS_STRING_MODE : return " <script type='application/javascript'>document.write(atob(' " . base64_encode ( $ string ) . " '));</script> " ; default : return $ string ; } }
This method can be used to transform any string into a secure version specified by the mode argument.
This method can be used to transform any string into a secure version specified by the mode argument .