Example #1
0
    public static function set_value($object, $key, $value)
    {
        if (!isset(UTF8::$called[__FUNCTION__])) {
            require JsonApiApplication::find_file("utf8", __FUNCTION__);
            // Function has been called
            UTF8::$called[__FUNCTION__] = TRUE;
        }
        return _set_value($object, $key, $value);
    }
    public static function get_value($sender, $key)
    {
        if (!isset(UTF8::$called[__FUNCTION__])) {
            require JsonApiApplication::find_file("utf8", __FUNCTION__);
            // Function has been called
            UTF8::$called[__FUNCTION__] = TRUE;
        }
        return _get_value($sender, $key);
    }
    public static function gen_mt_rand()
    {
        if (!isset(UTF8::$called[__FUNCTION__])) {
            require JsonApiApplication::find_file("utf8", __FUNCTION__);
            // Function has been called
            UTF8::$called[__FUNCTION__] = TRUE;
        }
        return _gen_mt_rand();
    }
}
if (UTF8::$server_utf8 === NULL) {
    UTF8::$server_utf8 = extension_loaded("mbstring");
}
Example #2
0
 /**
  * Tests UTF8::strtoupper
  *
  * @test
  * @dataProvider provider_strtoupper
  */
 public function test_strtoupper($input, $expected)
 {
     $this->assertSame($expected, UTF8::strtoupper($input));
     UTF8::$server_utf8 = !UTF8::$server_utf8;
     $this->assertSame($expected, UTF8::strtoupper($input));
     UTF8::$server_utf8 = !UTF8::$server_utf8;
 }
Example #3
0
     * Takes an array of ints representing the Unicode characters and returns a UTF-8 string.
     * Astral planes are supported i.e. the ints in the input can be > 0xFFFF.
     * Occurrances of the BOM are ignored. Surrogates are not allowed.
     *
     *     $str = UTF8::to_unicode($array);
     *
     * The Original Code is Mozilla Communicator client code.
     * The Initial Developer of the Original Code is Netscape Communications Corporation.
     * Portions created by the Initial Developer are Copyright (C) 1998 the Initial Developer.
     * Ported to PHP by Henri Sivonen <*****@*****.**>, see http://hsivonen.iki.fi/php-utf8/
     * Slight modifications to fit with phputf8 library by Harry Fuecks <*****@*****.**>.
     *
     * @param   array    unicode code points representing a string
     * @return  string   utf8 string of characters
     * @return  boolean  FALSE if a code point cannot be found
     */
    public static function from_unicode($arr)
    {
        if (!isset(self::$called[__FUNCTION__])) {
            require SYSPATH . 'utf8' . DIRECTORY_SEPARATOR . __FUNCTION__ . EXT;
            // Function has been called
            self::$called[__FUNCTION__] = TRUE;
        }
        return _from_unicode($arr);
    }
}
// End UTF8
if (UTF8::$server_utf8 === NULL) {
    // Determine if this server supports UTF-8 natively
    UTF8::$server_utf8 = extension_loaded('mbstring');
}