Horde_Browser
[ class tree: Horde_Browser ] [ index: Horde_Browser ] [ all elements ]

Class: Browser

Source Location: /modules/horde/Browser.php

Class Overview


The Browser:: class provides capability information for the current web client. Browser identification is performed by examining the HTTP_USER_AGENT environmental variable provide by the web server.


Author(s):

Variables

Methods



Class Details

[line 20]
The Browser:: class provides capability information for the current web client. Browser identification is performed by examining the HTTP_USER_AGENT environmental variable provide by the web server.

$Horde: framework/Browser/Browser.php,v 1.167 2005/03/02 16:05:15 jan Exp $

Copyright 1999-2005 Chuck Hagenbuch <chuck@horde.org> Copyright 1999-2005 Jon Parise <jon@horde.org>

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.




Tags:

author:  Jon Parise <jon@horde.org>
author:  Chuck Hagenbuch <chuck@horde.org>
since:  Horde 1.3


[ Top ]


Class Variables

$_accept =  ''

[line 62]

HTTP_ACCEPT string


Type:   string


[ Top ]

$_agent =  ''

[line 48]

Full user agent string.


Type:   string


[ Top ]

$_browser =  ''

[line 41]

Browser name.


Type:   string


[ Top ]

$_features = array(
        'html'       => true,
        'hdml'       => false,
        'wml'        => false,
        'images'     => true,
        'iframes'    => false,
        'frames'     => true,
        'tables'     => true,
        'java'       => true,
        'javascript' => true,
        'dom'        => false,
        'utf'        => false,
        'rte'        => false,
        'homepage'   => false,
        'accesskey'  => false,
        'optgroup'   => false,
        'xmlhttpreq' => false,
        'cite'       => false,
    )

[line 129]

Features.


Type:   array


[ Top ]

$_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp')

[line 179]

List of viewable image MIME subtypes.

This list of viewable images works for IE and Netscape/Mozilla.



Type:   array


[ Top ]

$_lowerAgent =  ''

[line 55]

Lower-case user agent string.


Type:   string


[ Top ]

$_majorVersion =  0

[line 27]

Major version number.


Type:   integer


[ Top ]

$_minorVersion =  0

[line 34]

Minor version number.


Type:   integer


[ Top ]

$_mobile =  false

[line 122]

Is this a mobile browser?


Type:   boolean


[ Top ]

$_platform =  ''

[line 69]

Platform the browser is running on.


Type:   string


[ Top ]

$_quirks = array(
        'avoid_popup_windows'        => false,
        'break_disposition_header'   => false,
        'break_disposition_filename' => false,
        'broken_multipart_form'      => false,
        'buggy_compression'          => false,
        'cache_same_url'             => false,
        'cache_ssl_downloads'        => false,
        'double_linebreak_textarea'  => false,
        'empty_file_input_value'     => false,
        'must_cache_forms'           => false,
        'no_filename_spaces'         => false,
        'no_hidden_overflow_tables'  => false,
        'ow_gui_1.3'                 => false,
        'png_transparency'           => false,
        'scrollbar_in_way'           => false,
        'scroll_tds'                 => false,
    )

[line 154]

Quirks


Type:   array


[ Top ]

$_robots = array(
        /* The most common ones. */
        'Googlebot',
        'msnbot',
        'Slurp',
        'Yahoo',
        /* The rest alphabetically. */
        'Arachnoidea',
        'ArchitextSpider',
        'Ask Jeeves',
        'B-l-i-t-z-Bot',
        'ConveraCrawler',
        'ExtractorPro',
        'FAST-WebCrawler',
        'FDSE robot',
        'fido',
        'geckobot',
        'Gigabot',
        'Girafabot',
        'grub-client',
        'Gulliver',
        'ia_archiver',
        'InfoSeek',
        'KIT-Fireball',
        'LEIA',
        'Lycos_Spider',
        'Mediapartners-Google',
        'MuscatFerret',
        'NaverBot',
        'polybot',
        'Pompos',
        'Scooter',
        'Teoma',
        'TurnitinBot',
        'Ultraseek',
        'ViolaBot',
        'webbandit',
        'www.almaden.ibm.com/cs/crawler',
        'ZyBorg',
    )

[line 76]

Known robots.


Type:   array


[ Top ]



Class Methods


constructor Browser [line 221]

Browser Browser( [optional $userAgent = null], [optional $accept = null])

Create a browser instance (Constructor).



Tags:

access:  public


Parameters:

optional   $userAgent   string $userAgent The browser string to parse.
optional   $accept   string $accept The HTTP_ACCEPT settings to use.

[ Top ]

method allowFileUploads [line 822]

integer allowFileUploads( )

Determine if files can be uploaded to the system.



Tags:

return:  If uploads allowed, returns the maximum size of the upload in bytes. Returns 0 if uploads are not allowed.
access:  public


[ Top ]

method downloadHeaders [line 920]

void downloadHeaders( [optional $filename = 'unknown'], [optional $cType = null], [optional $inline = false], [optional $cLength = null])

Returns the headers for a browser download.



Tags:

since:  Horde 2.2
access:  public


Parameters:

optional   $filename   string $filename The filename of the download.
optional   $cType   string $cType The content-type description of the file.
optional   $inline   boolean $inline True if inline, false if attachment.
optional   $cLength   string $cLength The content-length of this file.

[ Top ]

method escapeJSCode [line 1043]

string escapeJSCode( string $code)

Escape characters in javascript code if the browser requires it.

%23, %26, and %2B (for IE) and %27 need to be escaped or else jscript will interpret it as a single quote, pound sign, or ampersand and refuse to work.




Tags:

return:  The escaped code.
access:  public


Parameters:

string   $code   The JS code to escape.

[ Top ]

method getAgentString [line 690]

string getAgentString( )

Return the full browser agent string.



Tags:

return:  The browser agent string.
access:  public


[ Top ]

method getBrowser [line 642]

string getBrowser( )

Retrieve the current browser.



Tags:

return:  The current browser.
access:  public


[ Top ]

method getFeature [line 774]

string getFeature( string $feature)

Retreive the current browser capability.



Tags:

return:  The value of the requested capability.
access:  public


Parameters:

string   $feature   The capability to retreive.

[ Top ]

method getHTTPProtocol [line 802]

string getHTTPProtocol( )

Returns the server protocol in use on the current server.



Tags:

return:  The HTTP server protocol version.
access:  public


[ Top ]

method getIEVersion [line 1079]

mixed getIEVersion( )

Return the IE version stored in the session, if available.



Tags:

return:  The IE Version string or null if no string is stored.
access:  public


[ Top ]

method getMajor [line 654]

integer getMajor( )

Retrieve the current browser's major version.



Tags:

return:  The current browser's major version.
access:  public


[ Top ]

method getMinor [line 666]

integer getMinor( )

Retrieve the current browser's minor version.



Tags:

return:  The current browser's minor version.
access:  public


[ Top ]

method getPlatform [line 577]

string getPlatform( )

Return the currently matched platform.



Tags:

return:  The user's platform.
since:  Horde 2.2


[ Top ]

method getQuirk [line 731]

string getQuirk( string $quirk)

Retreive unique behavior for the current browser.



Tags:

return:  The value for the requested behavior.
access:  public


Parameters:

string   $quirk   The behavior to retreive.

[ Top ]

method getVersion [line 678]

string getVersion( )

Retrieve the current browser's version.



Tags:

return:  The current browser's version.
access:  public


[ Top ]

method hasFeature [line 760]

boolean hasFeature( string $feature)

Check the current browser capabilities.



Tags:

return:  Does the browser have the capability set?
access:  public


Parameters:

string   $feature   The capability to check.

[ Top ]

method hasQuirk [line 717]

boolean hasQuirk( string $quirk)

Check unique behavior for the current browser.



Tags:

return:  Does the browser have the behavior set?
access:  public


Parameters:

string   $quirk   The behavior to check.

[ Top ]

method isBrowser [line 603]

boolean isBrowser( string $browser)

Determine if the given browser is the same as the current.



Tags:

return:  Is the given browser the same as the current?
access:  public


Parameters:

string   $browser   The browser to check.

[ Top ]

method isMobile [line 613]

boolean isMobile( )

Do we consider the current browser to be a mobile device?



Tags:

return:  True if we do, false if we don't.


[ Top ]

method isRobot [line 625]

boolean isRobot( )

Determines if the browser is a robot or not.



Tags:

return:  True if browser is a known robot.
access:  public


[ Top ]

method isViewable [line 990]

boolean isViewable( string $mimetype)

Determines if a browser can display a given MIME type.



Tags:

return:  True if the browser can display the MIME type.
access:  public


Parameters:

string   $mimetype   The MIME type to check.

[ Top ]

method match [line 235]

void match( [optional $userAgent = null], [optional $accept = null])

Parses the user agent string and inititializes the object with all the known features and quirks for the given browser.



Tags:

access:  public


Parameters:

optional   $userAgent   string $userAgent The browser string to parse.
optional   $accept   string $accept The HTTP_ACCEPT settings to use.

[ Top ]

method setBrowser [line 589]

void setBrowser( string $browser)

Sets the current browser.



Tags:

access:  public


Parameters:

string   $browser   The browser to set as current.

[ Top ]

method setFeature [line 746]

void setFeature( string $feature, [optional $value = true])

Set capabilities for the current browser.



Tags:

access:  public


Parameters:

string   $feature   The capability to set.
optional   $value   string $value Special capability parameter.

[ Top ]

method setIEVersion [line 1065]

void setIEVersion( string $ver)

Set the IE version in the session.



Tags:

access:  public


Parameters:

string   $ver   The IE Version string.

[ Top ]

method setQuirk [line 703]

void setQuirk( string $quirk, [optional $value = true])

Set unique behavior for the current browser.



Tags:

access:  public


Parameters:

string   $quirk   The behavior to set.
optional   $value   string $value Special behavior parameter.

[ Top ]

method singleton [line 197]

object Browser &singleton( [optional $userAgent = null], [optional $accept = null])

Returns a reference to the global Browser object, only creating it if it doesn't already exist.

This method must be invoked as: $browser = &Browser::singleton([$userAgent[, $accept]]);




Tags:

return:  The Browser object.
access:  public


Parameters:

optional   $userAgent   string $userAgent The browser string to parse.
optional   $accept   string $accept The HTTP_ACCEPT settings to use.

[ Top ]

method usingSSLConnection [line 788]

boolean usingSSLConnection( )

Determine if we are using a secure (SSL) connection.



Tags:

return:  True if using SSL, false if not.
access:  public


[ Top ]

method wasFileUploaded [line 862]

mixed wasFileUploaded( string $field, [optional $name = null])

Determines if the file was uploaded or not. If not, will return the appropriate error message.



Tags:

return:  True on success, PEAR_Error on error.
access:  public


Parameters:

string   $field   The name of the field containing the uploaded file.
optional   $name   string $name The file description string to use in the error message. Default: 'file'.

[ Top ]

method _setPlatform [line 559]

void _setPlatform( )

Match the platform of the browser.

This is a pretty simplistic implementation, but it's intended to let us tell what line breaks to send, so it's good enough for its purpose.




Tags:

since:  Horde 2.2
access:  public


[ Top ]


Documentation generated on Thu, 12 Feb 2009 07:59:50 +0900 by phpDocumentor 1.4.2