function Services_Yadis_toIRINormal($xri) { if (!Services_Yadis_startswith($xri, 'xri://')) { $xri = 'xri://' . $xri; } return Services_Yadis_escapeForIRI($xri); }
function runTest() { // no escapes $this->assertEquals('@example/foo/(@bar)', Services_Yadis_escapeForIRI('@example/foo/(@bar)')); // escape slashes $this->assertEquals('@example/foo/(@bar%2Fbaz)', Services_Yadis_escapeForIRI('@example/foo/(@bar/baz)')); $this->assertEquals('@example/foo/(@bar%2Fbaz)/(+a%2Fb)', Services_Yadis_escapeForIRI('@example/foo/(@bar/baz)/(+a/b)')); // escape query ? and fragment $this->assertEquals('@example/foo/(@baz%3Fp=q%23r)?i=j#k', Services_Yadis_escapeForIRI('@example/foo/(@baz?p=q#r)?i=j#k')); }