* @return string
 */
function niceUA($ua, $length = 0, $highlight = false, $class = "debug-match")
{
    if ($highlight === false) {
        return htmlspecialchars(substr($ua, 0, $length == 0 ? strlen($ua) : $length));
    }
    $first = '<span class="' . $class . '">' . htmlspecialchars(substr($ua, 0, $length)) . '</span>';
    $last = htmlspecialchars(substr($ua, $length));
    return $first . $last;
}
// Include the Tera-WURFL file
require_once realpath(dirname(__FILE__) . '/TeraWurfl.php');
if (preg_match('/Debug$/', TeraWurflConfig::$DB_CONNECTOR)) {
    $debug = true;
    TeraWurflConfig::$CACHE_ENABLE = false;
} else {
    $debug = false;
    //TeraWurflConfig::$CACHE_ENABLE = true;
}
$load_class = microtime(true);
// instantiate the Tera-WURFL object
$wurflObj = new TeraWurfl();
$init_class = microtime(true);
// Get the capabilities from the object
$matched = $wurflObj->GetDeviceCapabilitiesFromAgent($_GET['force_ua']);
$end = microtime(true);
echo "Time to load TeraWurfl.php:" . ($load_class - $start) . "<br>\n";
echo "Time to initialize class:" . ($init_class - $load_class) . "<br>\n";
echo "Time to find the user agent:" . ($end - $init_class) . "<br>\n";
echo "Total:" . ($end - $start) . "<br>\n";
     * Allows you to store only the specified capabilities from the WURFL file.  By default, every capability in the WURFL is stored in the
     * database and made available to your scripts.  If you only want to know if the device is wireless or not, you can store only the 
     * is_wireless_device capability.  To disable the filter, set it to false, to enable it, you must set it to an array.  This array can
     * contain the group names (if you want to include the entire group, i.e. "product_info") and/or capability names (if you want just a
     * specific capability, i.e. "is_wireless_device").
     * 
     * Usage Example:
     * <code>
     *	public static $CAPABILITY_FILTER = array(
     *		// Complete Capability Groups
     *		"product_info",
     *	
     *		// Individual Capabilities
     *		"max_image_width",
     *		"max_image_height",
     *		"chtml_make_phone_call_string",
     *	);
     * </code>
     * @var Mixed
     */
    public static $CAPABILITY_FILTER = false;
}
global $dbname;
global $dbuser;
global $dbpass;
global $dbhost;
TeraWurflConfig::$DB_SCHEMA = $dbname;
TeraWurflConfig::$DB_HOST = $dbhost;
TeraWurflConfig::$DB_USER = $dbuser;
TeraWurflConfig::$DB_PASS = $dbpass;
 /**
  * Disables the Temp table prefix
  */
 protected function disableTempPrefix()
 {
     TeraWurflConfig::$TABLE_PREFIX = $this->table_prefix;
 }