/** * Converts a string to a xml-safe string * Converts it to html-safe first and then it * will replace html entities to xml entities * * <code> * * echo str::xml('some über crazy stuff'); * // output: some über crazy stuff * * </code> * * @param string $text * @param boolean $html True: convert to html first * @return string */ public static function xml($text, $html = true) { return xml::encode($text, $html); }
/** * Shortcut for xml::encode() */ function xml($text) { return xml::encode($text); }
public function testEncodeDecode() { $expected = 'Süper Önencœded ßtring'; $this->assertEquals($expected, xml::encode($this->string)); $this->assertEquals($this->string, xml::decode($expected)); }