Overview

Packages

  • Browser

Classes

  • Horde_Browser
  • Horde_Browser_Exception
  • Horde_Browser_Translation
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Browser

This provides capability information for the current web client.

Browser identification is performed by examining the HTTP_USER_AGENT environment variable provided by the web server.

Package: Browser
Category: Horde
License: LGPL
Author: Chuck Hagenbuch chuck@horde.org
Author: Jon Parise jon@horde.org
Located at Horde/Browser.php
Methods summary
public
# __construct( string $userAgent = null, string $accept = null )

Creates a browser instance (Constructor).

Creates a browser instance (Constructor).

Parameters

$userAgent
The browser string to parse.
$accept
The HTTP_ACCEPT settings to use.
public
# match( string $userAgent = null, string $accept = null )

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

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

Parameters

$userAgent
The browser string to parse.
$accept
The HTTP_ACCEPT settings to use.
public string
# getPlatform( )

Returns the currently matched platform.

Returns the currently matched platform.

Returns

string
The user's platform.
public
# setBrowser( string $browser )

Sets the current browser.

Sets the current browser.

Parameters

$browser
The browser to set as current.
public boolean
# isBrowser( string $browser )

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

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

Parameters

$browser
The browser to check.

Returns

boolean
Is the given browser the same as the current?
public
# setMobile( boolean $mobile )

Set this browser as a mobile device.

Set this browser as a mobile device.

Parameters

$mobile
True if the browser is a mobile device.
public boolean
# isMobile( )

Is the current browser to be a mobile device?

Is the current browser to be a mobile device?

Returns

boolean
True if we do, false if we don't.
public boolean
# isRobot( )

Is the browser a robot?

Is the browser a robot?

Returns

boolean
True if browser is a known robot.
public string
# getBrowser( )

Returns the current browser.

Returns the current browser.

Returns

string
The current browser.
public integer
# getMajor( )

Returns the current browser's major version.

Returns the current browser's major version.

Returns

integer
The current browser's major version.
public integer
# getMinor( )

Returns the current browser's minor version.

Returns the current browser's minor version.

Returns

integer
The current browser's minor version.
public string
# getVersion( )

Returns the current browser's version.

Returns the current browser's version.

Returns

string
The current browser's version.
public string
# getAgentString( )

Returns the full browser agent string.

Returns the full browser agent string.

Returns

string
The browser agent string.
public
# setQuirk( string $quirk, string $value = true )

Sets unique behavior for the current browser.

Sets unique behavior for the current browser.

Parameters

$quirk
<p>The behavior to set. Quirks: - avoid_popup_windows - break_disposition_header - break_disposition_filename - broken_multipart_form - buggy_compression - cache_same_url - cache_ssl_downloads - double_linebreak_textarea - empty_file_input_value - must_cache_forms - no_filename_spaces - no_hidden_overflow_tables - ow_gui_1.3 - png_transparency - scrollbar_in_way - scroll_tds - windowed_controls</p>
$value
Special behavior parameter.
public boolean
# hasQuirk( string $quirk )

Checks unique behavior for the current browser.

Checks unique behavior for the current browser.

Parameters

$quirk
The behavior to check.

Returns

boolean
Does the browser have the behavior set?
public string
# getQuirk( string $quirk )

Returns unique behavior for the current browser.

Returns unique behavior for the current browser.

Parameters

$quirk
The behavior to retrieve.

Returns

string
The value for the requested behavior.
public
# setFeature( string $feature, string $value = true )

Sets capabilities for the current browser.

Sets capabilities for the current browser.

Parameters

$feature
<p>The capability to set. Features: - accesskey - ajax - cite - dataurl - dom - frames - hdml - html - homepage - iframes - images - ischrome - iskonqueror - issafari - java - javascript - optgroup - rte - tables - utf - wml - xmlhttpreq</p>
$value
Special capability parameter.
public boolean
# hasFeature( string $feature )

Checks the current browser capabilities.

Checks the current browser capabilities.

Parameters

$feature
The capability to check.

Returns

boolean
Does the browser have the capability set?
public string
# getFeature( string $feature )

Returns the current browser capability.

Returns the current browser capability.

Parameters

$feature
The capability to retrieve.

Returns

string
The value of the requested capability.
public boolean
# usingSSLConnection( )

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

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

Returns

boolean
True if using SSL, false if not.
public string
# getHTTPProtocol( )

Returns the server protocol in use on the current server.

Returns the server protocol in use on the current server.

Returns

string
The HTTP server protocol version.
public string
# getIPAddress( )

Returns the IP address of the client.

Returns the IP address of the client.

Returns

string
The client IP address.
public static integer
# allowFileUploads( )

Determines if files can be uploaded to the system.

Determines if files can be uploaded to the system.

Returns

integer

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

public
# wasFileUploaded( string $field, string $name = null )

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

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

Parameters

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

Throws

Horde_Browser_Exception
public
# downloadHeaders( string $filename = 'unknown', string $cType = null, boolean $inline = false, string $cLength = null )

Returns the headers for a browser download.

Returns the headers for a browser download.

Parameters

$filename
The filename of the download.
$cType
The content-type description of the file.
$inline
True if inline, false if attachment.
$cLength
The content-length of this file.
public boolean
# isViewable( string $mimetype )

Determines if a browser can display a given MIME type.

Determines if a browser can display a given MIME type.

Parameters

$mimetype
The MIME type to check.

Returns

boolean
True if the browser can display the MIME type.
API documentation generated by ApiGen