⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 detect.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 3 页
字号:
        $os = &Net_UserAgent_Detect::_getStaticProperty('os');        foreach((array) $in_expectList as $expectOs) {            if (!empty($os[strtolower($expectOs)])) {                return $expectOs;            }        }    }    // }}}    // {{{ getOSString()    /**     * This function returns the os string corresponding to the flag.     *     * Either use the default matches or pass in an associative array of     * flags and corresponding os strings.  This function will find     * the highest version flag and return the os string corresponding     * to the appropriate flag.  Be sure to pass in the flags in ascending order     * if you want a basic matches first, followed by more detailed matches.     *     * @param  array $in_osStrings (optional) array of flags matched with os strings     *     * @access public     * @return string os string matches appropriate flag     */    function getOSString($in_osStrings = array(       'win'   => 'Microsoft Windows',       'win9x' => 'Microsoft Windows 9x',       'winme' => 'Microsoft Windows Millenium',       'win2k' => 'Microsoft Windows 2000',       'winnt' => 'Microsoft Windows NT',       'winxp' => 'Microsoft Windows XP',       'mac'   => 'Macintosh',       'unix'  => 'Linux/Unix',    ))    {        Net_UserAgent_Detect::detect();        $osString = 'Unknown';        $os = &Net_UserAgent_Detect::_getStaticProperty('os');        foreach((array) $in_osStrings as $flag => $string) {            if (!empty($os[$flag])) {                $osString = $string;            }        }        return $osString;    }    // }}}    // {{{ setQuirk()    /**     * Set a unique behavior for the current browser.     *     * Many client browsers do some really funky things, and this     * mechanism allows the coder to determine if an excepetion must     * be made with the current client.     *     * @access public     * @return void     */    function setQuirk($in_quirk, $in_hasQuirk = true)    {        $quirks = &Net_UserAgent_Detect::_getStaticProperty('quirks');        $hasQuirk = !empty($in_hasQuirk);         $quirks[strtolower($in_quirk)] = $hasQuirk;    }    // }}}    // {{{ hasQuirk()    /**     * Check a unique behavior for the current browser.     *     * Many client browsers do some really funky things, and this     * mechanism allows the coder to determine if an excepetion must     * be made with the current client.     *     * @access public     * @return bool whether or not browser has this quirk     */    function hasQuirk($in_quirk)    {        Net_UserAgent_Detect::detect();        $quirks = &Net_UserAgent_Detect::_getStaticProperty('quirks');        return !empty($quirks[strtolower($in_quirk)]);    }        // }}}    // {{{ getQuirk()    /**     * Get the unique behavior for the current browser.     *     * Many client browsers do some really funky things, and this     * mechanism allows the coder to determine if an excepetion must     * be made with the current client.     *     * @access public     * @return string value of the quirk, in this case usually a boolean     */    function getQuirk()    {        Net_UserAgent_Detect::detect();        $quirks = &Net_UserAgent_Detect::_getStaticProperty('quirks');        return isset($quirks[strtolower($in_quirks)]) ? $quirks[strtolower($in_quirks)] : null;     }    // }}}    // {{{ setFeature()    /**     * Set capabilities for the current browser.     *     * Since the capabilities of client browsers vary widly, this interface     * helps keep track of the core features of a client, such as if the client     * supports dhtml, dom, javascript, etc.     *     * @access public     * @return void     */    function setFeature($in_feature, $in_hasFeature = true)    {        $features = &Net_UserAgent_Detect::_getStaticProperty('features');        $features[strtolower($in_feature)] = $in_hasFeature;    }    // }}}    // {{{ hasFeature()    /**     * Check the capabilities for the current browser.     *     * Since the capabilities of client browsers vary widly, this interface     * helps keep track of the core features of a client, such as if the client     * supports dhtml, dom, javascript, etc.     *     * @access public     * @return bool whether or not the current client has this feature     */    function hasFeature($in_feature)    {        Net_UserAgent_Detect::detect();        $features = &Net_UserAgent_Detect::_getStaticProperty('features');        return !empty($features[strtolower($in_feature)]);    }        // }}}    // {{{ getFeature()    /**     * Get the capabilities for the current browser.     *     * Since the capabilities of client browsers vary widly, this interface     * helps keep track of the core features of a client, such as if the client     * supports dhtml, dom, javascript, etc.     *     * @access public     * @return string value of the feature requested     */    function getFeature($in_feature)    {        Net_UserAgent_Detect::detect();        $features = &Net_UserAgent_Detect::_getStaticProperty('features');        return isset($features[strtolower($in_feature)]) ? $features[strtolower($in_feature)] : null;     }    // }}}    // {{{ getAcceptType()    /**     * Retrive the accept type for the current browser.     *     * To keep track of the mime-types, languages, charsets and encodings     * that each browser accepts we use associative arrays for each type.     * This function works like getBrowser() as it takes an expect list     * and returns the first match.  For instance, to find the language     * you would pass in your allowed languages and see if any of the     * languages set in the browser match.     *     * @param  string $in_expectList values to check     * @param  string $in_type type of accept     *     * @access public     * @return string the first matched value     */    function getAcceptType($in_expectList, $in_type)    {        Net_UserAgent_Detect::detect();        $type = strtolower($in_type);        if ($type == 'mimetype' || $type == 'language' || $type == 'charset' || $type == 'encoding') {            $typeArray = &Net_UserAgent_Detect::_getStaticProperty($type);            foreach((array) $in_expectList as $match) {                if (!empty($typeArray[$match])) {                    return $match;                }            }        }        return null;    }    // }}}    // {{{ setAcceptType()    /**     * Set the accept types for the current browser.     *     * To keep track of the mime-types, languages, charsets and encodings     * that each browser accepts we use associative arrays for each type.     * This function takes and array of accepted values for the type and     * records them for retrieval.     *     * @param  array $in_values values of the accept type     * @param  string $in_type type of accept     *     * @access public     * @return void     */    function setAcceptType($in_values, $in_type)    {        $type = strtolower($in_type);        if ($type == 'mimetype' || $type == 'language' || $type == 'charset' || $type == 'encoding') {            $typeArray = &Net_UserAgent_Detect::_getStaticProperty($type);            foreach((array) $in_values as $value) {                $typeArray[$value] = true;            }        }    }    // }}}    // {{{ hasAcceptType()    /**     * Check the accept types for the current browser.     *     * To keep track of the mime-types, languages, charsets and encodings     * that each browser accepts we use associative arrays for each type.     * This function checks the array for the given type and determines if     * the browser accepts it.     *     * @param  string $in_value values to check     * @param  string $in_type type of accept     *     * @access public     * @return bool whether or not the value is accept for this type     */    function hasAcceptType($in_value, $in_type)    {        Net_UserAgent_Detect::detect();        $type = strtolower($in_type);        if ($type == 'mimetype' || $type == 'language' || $type == 'charset' || $type == 'encoding') {            $typeArray = &Net_UserAgent_Detect::_getStaticProperty($type);            return !empty($typeArray[$in_value]);        }        else {            return false;        }    }    // }}}    // {{{ getUserAgent()    /**     * Return the user agent string that is being worked on     *     * @access public     * @return string user agent     */    function getUserAgent()    {        Net_UserAgent_Detect::detect();        $userAgent = &Net_UserAgent_Detect::_getStaticProperty('userAgent');        return $userAgent;    }    // }}}    // {{{ _getStaticProperty()    /**     * Copy of getStaticProperty() from PEAR.php to avoid having to     * include PEAR.php     *     * @access private     * @param  string $var    The variable to retrieve.     * @return mixed   A reference to the variable. If not set it will be     *                 auto initialised to NULL.     */    function &_getStaticProperty($var)    {        static $properties;        return $properties[$var];    }    // }}}}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -