1<?php
2
3/**
4 * Miscellaneous utility values and functions for OpenID and Yadis.
5 *
6 * @package OpenID
7 * @author JanRain, Inc. <openid@janrain.com>
8 * @copyright 2005-2008 Janrain, Inc.
9 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache
10 */
11
12function Auth_Yadis_getUCSChars()
13{
14    return [
15        [0xA0, 0xD7FF],
16        [0xF900, 0xFDCF],
17        [0xFDF0, 0xFFEF],
18        [0x10000, 0x1FFFD],
19        [0x20000, 0x2FFFD],
20        [0x30000, 0x3FFFD],
21        [0x40000, 0x4FFFD],
22        [0x50000, 0x5FFFD],
23        [0x60000, 0x6FFFD],
24        [0x70000, 0x7FFFD],
25        [0x80000, 0x8FFFD],
26        [0x90000, 0x9FFFD],
27        [0xA0000, 0xAFFFD],
28        [0xB0000, 0xBFFFD],
29        [0xC0000, 0xCFFFD],
30        [0xD0000, 0xDFFFD],
31        [0xE1000, 0xEFFFD],
32    ];
33}
34
35function Auth_Yadis_getIPrivateChars()
36{
37    return [
38        [0xE000, 0xF8FF],
39        [0xF0000, 0xFFFFD],
40        [0x100000, 0x10FFFD],
41    ];
42}
43
44function Auth_Yadis_pct_escape_unicode($char_match)
45{
46    $c = $char_match[0];
47    $result = "";
48    for ($i = 0; $i < strlen($c); $i++) {
49        $result .= "%" . sprintf("%X", ord($c[$i]));
50    }
51    return $result;
52}
53
54function Auth_Yadis_startswith($s, $stuff)
55{
56    return strpos($s, $stuff) === 0;
57}
58
59