Sahana Browser Capabilities

Introduction

Sahana uses PHP Browser Capabilities Library found at http://garetjax.info/projects/browscap/#download.

How it works

This library will automatically download the browscaps.ini file from the internet (If file is not found under /www/tmp/bcaps_cache/) and cache it to the same location. The class will then work on the cached file.

Known Issues.

There is a short delay the first time the file is downloaded (if it is not available locally or an updated version is available online).

Usage

In order to use the browser capabilities library it needs to be included.

    global $global;
    include_once ($global['approot']."inc/browser_caps.inc");

This will create a browser capabilities object and store it under the key 'bcaps' in $global.

    $global['bcaps'] // The browser capabilities object will be stored here.

The following shows the fields of the browser capabilities object. ref: http://garetjax.info/projects/browscap/#example

stdClass Object
(
    [browser_name] => Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.11) Gecko/20071204 Ubuntu/7.10 (gutsy) Firefox/2.0.0.11
    [browser_name_regex] => ^mozilla/5\.0 \(x11; .*; .*linux.*; .*; rv\:1\.8.*\) gecko/.* firefox/2\.0.*$
    [browser_name_pattern] => Mozilla/5.0 (X11; *; *Linux*; *; rv:1.8*) Gecko/* Firefox/2.0*
    [Parent] => Firefox 2.0
    [Platform] => Linux
    [Browser] => Firefox
    [Version] => 2.0
    [MajorVer] => 2
    [Frames] => 1
    [IFrames] => 1
    [Tables] => 1
    [Cookies] => 1
    [JavaApplets] => 1
    [JavaScript] => 1
    [CSS] => 2
    [CssVersion] => 2
    [supportsCSS] => 1
    [MinorVer] => 0
    [Alpha] => 
    [Beta] => 
    [Win16] => 
    [Win32] => 
    [Win64] => 
    [BackgroundSounds] => 
    [AuthenticodeUpdate] => 
    [CDF] => 
    [VBScript] => 
    [ActiveXControls] => 
    [Stripper] => 
    [isBanned] => 
    [WAP] => 
    [isMobileDevice] => 
    [isSyndicationReader] => 
    [Crawler] => 
    [AOL] => 
    [aolVersion] => 0
    [netCLR] => 
    [ClrVersion] => 0
)

Navigation
QR Code
QR Code dev:browsercaps (generated for current page)