public static function insert($string, array $data, array $options = array()) {
        $options = $options + array(
            'before' => '{',
            'after' => '}',
            'escape' => true
        );

        foreach ($data as $key => $value) {
            $string = str_replace($options['before'] . $key . $options['after'], $value, $string);
        }

        if ($options['escape']) {
            $string = Sanitize::escape($string);
        }

        return $string;
    }
public static function insert($string, array $data, array $options = array()) {
        $options = $options + array(
            'before' => '{',
            'after' => '}',
            'escape' => true
        );

        foreach ($data as $key => $value) {
            $string = str_replace($options['before'] . $key . $options['after'], $value, $string);
        }

        if ($options['escape']) {
            $string = Sanitize::escape($string);
        }

        return $string;
    }
public static function insert ( $ string , array $ data , array $ options = array ( ) ) { $ options = $ options + array ( 'before' => '{' , 'after' => '}' , 'escape' => true ) ; foreach ( $ data as $ key => $ value ) { $ string = str_replace ( $ options [ 'before' ] . $ key . $ options [ 'after' ] , $ value , $ string ) ; } if ( $ options [ 'escape' ] ) { $ string = Sanitize :: escape ( $ string ) ; } return $ string ; }
Insert values into a string defined by an array of key tokens.

@uses Titon\Utility\Sanitize

@param string $string
@param array $data
@param array $options {
@type string $before    Opening variable delimiter
@type string $after     Closing variable delimiter
@type bool $escape      Escape the string
}
@return string
Insert values into a string defined by an array of key tokens .