Example #1
0
<?php

/*
* BtiTracker v1.5.1 is a php tracker system for BitTorrent, easy to setup and configure.
* This tracker is a frontend for DeHackEd's tracker, aka phpBTTracker (now heavely modified). 
* Updated and Maintained by Yupy.
* Copyright (C) 2004-2015 Btiteam.org
*/
require_once CLASS_PATH . 'class.String.php';
require_once CLASS_PATH . 'class.Memcached.php';
utf8::init();
class utf8
{
    const TRANSKEY = 'utf8::utf8_win_iso::translation_table';
    const NBSP = " ";
    // &nbsp; # Non-Breaking Space
    const TRIM_CHARLIST = ".. ..  ..� �� ";
    private static $trans_table = array();
    private static $utf8validator = false;
    public static function init()
    {
        self::$utf8validator = (bool) extension_loaded('utf8validator');
        mb_internal_encoding('UTF-8');
        mb_language('uni');
        mb_regex_encoding('UTF-8');
        mb_detect_order(array('UTF-8', 'ISO-8859-1'));
        mb_substitute_character(0xfffd);
        MCached::connect();
        $trans = MCached::get(self::TRANSKEY);
        if ($trans === MCached::NO_RESULT) {
            $win = "€" . implode('', range("‚", "Œ")) . "Ž" . implode('', range("‘", "œ")) . implode('', range("ž", "ÿ"));