public static function htmlEncode( $data, $valuesOnly = TRUE, $charset = NULL ) {
		if ( $charset === NULL ) {
			$charset = 'UTF-8';
		}
		$d = [];
		foreach ( $data as $key => $value ) {
			if ( ! $valuesOnly && is_string( $key ) ) {
				$key = htmlspecialchars( $key, ENT_QUOTES|ENT_SUBSTITUTE, $charset );
			}
			if ( is_string( $value ) ) {
				$d[ $key ] = htmlspecialchars( $value, ENT_QUOTES|ENT_SUBSTITUTE, $charset );
			} elseif ( is_array( $value ) ) {
				$d[ $key ] = static::htmlEncode( $value, $valuesOnly, $charset );
			} else {
				$d[ $key ] = $value;
			}
		}
		
		return $d;
	}