Example #1
0
function fs_pri_browser_string($ua, $image = false, $between = 'on')
{
    list($browser_name, $browser_code, $browser_ver, $os_name, $os_code, $os_ver, $pda_name, $pda_code, $pda_ver) = fs_pri_detect_browser($ua);
    $string = fs_pri_friendly_string($browser_name, $browser_code, $browser_ver, $os_name, $os_code, $os_ver, $pda_name, $pda_code, $pda_ver, $image, $between);
    if (!$string) {
        $string = "Unknown browser";
    }
    return $string;
}
Example #2
0
function fs_get_browser_statistics($days_ago = NULL)
{
    $results = fs_get_useragents_count($days_ago);
    if ($results !== false && count($results) > 1) {
        $total = 0;
        foreach ($results as $r) {
            $total += $r['c'];
        }
        foreach ($results as $r) {
            $ua = $r['useragent'];
            $count = $r['c'];
            $a = fs_pri_detect_browser($ua);
            $br_name = $a[0];
            $br_code = $a[1];
            $br_ver = $a[2];
            $br_img = fs_pri_get_image_url($br_code != '' ? $br_code : 'unknown', $br_name);
            fs_ensure_initialized($br[$br_code]['count']);
            fs_ensure_initialized($br[$br_code]['sublist'][$br_ver]['count']);
            $br[$br_code]['name'] = $br_name != '' ? $br_name : fs_r('Unknown');
            $br[$br_code]['image'] = $br_img;
            // browsers
            $br[$br_code]['count'] += (int) $count;
            $browser_total = $br[$br_code]['count'];
            $br[$br_code]['percent'] = (double) ($browser_total / $total) * 100;
            $br[$br_code]['sublist'][$br_ver]['count'] += (int) $count;
            $br_ver_count = $br[$br_code]['sublist'][$br_ver]['count'];
            $br[$br_code]['sublist'][$br_ver]['percent'] = (double) ($br_ver_count / $total) * 100;
            $br[$br_code]['sublist'][$br_ver]['useragent'] = $ua;
            $br[$br_code]['sublist'][$br_ver]['name'] = $br_name;
            $br[$br_code]['sublist'][$br_ver]['image'] = $br_img;
        }
        return fs_stats_sort(fs_group_others($br));
    } else {
        return null;
    }
}