Ejemplo n.º 1
0
 /**
  * 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 &#252;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);
 }
Ejemplo n.º 2
0
/**
 * Shortcut for xml::encode()
 */
function xml($text)
{
    return xml::encode($text);
}
Ejemplo n.º 3
0
 public function testEncodeDecode()
 {
     $expected = 'S&#252;per &#214;nenc&#339;ded &#223;tring';
     $this->assertEquals($expected, xml::encode($this->string));
     $this->assertEquals($this->string, xml::decode($expected));
 }