PHP 클래스 Horde_Browser, horde

Browser identification is performed by examining the HTTP_USER_AGENT environment variable provided by the web server.
저자: Chuck Hagenbuch ([email protected])
저자: Jon Parise ([email protected])
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_accept string HTTP_ACCEPT string
$_agent string Full user agent string.
$_browser string Browser name.
$_features array Features.
$_images array This list of viewable images works for IE and Netscape/Mozilla.
$_lowerAgent string Lower-case user agent string.
$_majorVersion integer Major version number.
$_minorVersion integer Minor version number.
$_mobile boolean Is this a mobile browser?
$_mobileAgents Browsers like Mobile Safari (iPhone, iPod Touch) are much more full featured than OpenWave style browsers. This makes it dicey in some cases to treat all "mobile" browsers the same way.
$_platform string Platform the browser is running on.
$_quirks array Quirks.
$_robotAgentRegexp string Regexp for matching those robot strings.
$_robotAgents array Known robots.
$_tablet boolean Is this a tablet browser?
$_tvAgents List of televison user agents.

공개 메소드들

메소드 설명
__construct ( string $userAgent = null, string $accept = null ) Creates a browser instance (Constructor).
allowFileUploads ( ) : integer Determines if files can be uploaded to the system.
downloadHeaders ( string $filename = 'unknown', string $cType = null, boolean $inline = false, string $cLength = null ) Returns the headers for a browser download.
getAgentString ( ) : string Returns the full browser agent string.
getBrowser ( ) : string Returns the current browser.
getFeature ( string $feature ) : string Returns the current browser capability.
getHTTPProtocol ( ) : string Returns the server protocol in use on the current server.
getIPAddress ( ) : string Returns the IP address of the client.
getMajor ( ) : integer Returns the current browser's major version.
getMinor ( ) : integer Returns the current browser's minor version.
getPlatform ( ) : string Returns the currently matched platform.
getQuirk ( string $quirk ) : string Returns unique behavior for the current browser.
getVersion ( ) : string Returns the current browser's version.
hasFeature ( string $feature ) : boolean Checks the current browser capabilities.
hasQuirk ( string $quirk ) : boolean Checks unique behavior for the current browser.
isBrowser ( string $browser ) : boolean Determines if the given browser is the same as the current.
isMobile ( ) : boolean Is the current browser to be a mobile device?
isRobot ( ) : boolean Is the browser a robot?
isTablet ( ) : boolean Is the current browser a tablet device? This is not 100% reliable, as most browsers do not differentiate between smartphone and tablet versions.
isViewable ( string $mimetype ) : boolean Determines if a browser can display a given MIME type.
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.
setBrowser ( string $browser ) Sets the current browser.
setFeature ( string $feature, string $value = true ) Sets capabilities for the current browser.
setMobile ( boolean $mobile ) Set this browser as a mobile device.
setQuirk ( string $quirk, string $value = true ) Sets unique behavior for the current browser.
setTablet ( boolean $tablet ) Set this browser as a tablet device.
usingSSLConnection ( ) : boolean Determines if we are using a secure (SSL) connection.
wasFileUploaded ( string $field, string $name = null ) Determines if the file was uploaded or not. If not, will return the appropriate error message.

보호된 메소드들

메소드 설명
_setPlatform ( ) Matches the platform of the browser.

메소드 상세

__construct() 공개 메소드

Creates a browser instance (Constructor).
public __construct ( string $userAgent = null, string $accept = null )
$userAgent string The browser string to parse.
$accept string The HTTP_ACCEPT settings to use.

_setPlatform() 보호된 메소드

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.
protected _setPlatform ( )

allowFileUploads() 공개 정적인 메소드

Determines if files can be uploaded to the system.
public static allowFileUploads ( ) : integer
리턴 integer If uploads allowed, returns the maximum size of the upload in bytes. Returns 0 if uploads are not allowed.

downloadHeaders() 공개 메소드

Returns the headers for a browser download.
public downloadHeaders ( string $filename = 'unknown', string $cType = null, boolean $inline = false, string $cLength = null )
$filename string The filename of the download.
$cType string The content-type description of the file.
$inline boolean True if inline, false if attachment.
$cLength string The content-length of this file.

getAgentString() 공개 메소드

Returns the full browser agent string.
public getAgentString ( ) : string
리턴 string The browser agent string.

getBrowser() 공개 메소드

Returns the current browser.
public getBrowser ( ) : string
리턴 string The current browser.

getFeature() 공개 메소드

Returns the current browser capability.
public getFeature ( string $feature ) : string
$feature string The capability to retrieve.
리턴 string The value of the requested capability.

getHTTPProtocol() 공개 메소드

Returns the server protocol in use on the current server.
public getHTTPProtocol ( ) : string
리턴 string The HTTP server protocol version.

getIPAddress() 공개 메소드

Returns the IP address of the client.
public getIPAddress ( ) : string
리턴 string The client IP address.

getMajor() 공개 메소드

Returns the current browser's major version.
public getMajor ( ) : integer
리턴 integer The current browser's major version.

getMinor() 공개 메소드

Returns the current browser's minor version.
public getMinor ( ) : integer
리턴 integer The current browser's minor version.

getPlatform() 공개 메소드

Returns the currently matched platform.
public getPlatform ( ) : string
리턴 string The user's platform.

getQuirk() 공개 메소드

Returns unique behavior for the current browser.
public getQuirk ( string $quirk ) : string
$quirk string The behavior to retrieve.
리턴 string The value for the requested behavior.

getVersion() 공개 메소드

Returns the current browser's version.
public getVersion ( ) : string
리턴 string The current browser's version.

hasFeature() 공개 메소드

Checks the current browser capabilities.
public hasFeature ( string $feature ) : boolean
$feature string The capability to check.
리턴 boolean Does the browser have the capability set?

hasQuirk() 공개 메소드

Checks unique behavior for the current browser.
public hasQuirk ( string $quirk ) : boolean
$quirk string The behavior to check.
리턴 boolean Does the browser have the behavior set?

isBrowser() 공개 메소드

Determines if the given browser is the same as the current.
public isBrowser ( string $browser ) : boolean
$browser string The browser to check.
리턴 boolean Is the given browser the same as the current?

isMobile() 공개 메소드

Is the current browser to be a mobile device?
public isMobile ( ) : boolean
리턴 boolean True if we do, false if we don't.

isRobot() 공개 메소드

Is the browser a robot?
public isRobot ( ) : boolean
리턴 boolean True if browser is a known robot.

isTablet() 공개 메소드

Is the current browser a tablet device? This is not 100% reliable, as most browsers do not differentiate between smartphone and tablet versions.
부터: 2.1.0
public isTablet ( ) : boolean
리턴 boolean True if we do, false if we don't.

isViewable() 공개 메소드

Determines if a browser can display a given MIME type.
public isViewable ( string $mimetype ) : boolean
$mimetype string The MIME type to check.
리턴 boolean True if the browser can display the MIME type.

match() 공개 메소드

Parses the user agent string and inititializes the object with all the known features and quirks for the given browser.
public match ( string $userAgent = null, string $accept = null )
$userAgent string The browser string to parse.
$accept string The HTTP_ACCEPT settings to use.

setBrowser() 공개 메소드

Sets the current browser.
public setBrowser ( string $browser )
$browser string The browser to set as current.

setFeature() 공개 메소드

Sets capabilities for the current browser.
public setFeature ( string $feature, string $value = true )
$feature string 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
$value string Special capability parameter.

setMobile() 공개 메소드

Set this browser as a mobile device.
public setMobile ( boolean $mobile )
$mobile boolean True if the browser is a mobile device.

setQuirk() 공개 메소드

Sets unique behavior for the current browser.
public setQuirk ( string $quirk, string $value = true )
$quirk string 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
$value string Special behavior parameter.

setTablet() 공개 메소드

Set this browser as a tablet device.
부터: 2.1.0
public setTablet ( boolean $tablet )
$tablet boolean True if the browser is a tablet device.

usingSSLConnection() 공개 메소드

Determines if we are using a secure (SSL) connection.
public usingSSLConnection ( ) : boolean
리턴 boolean True if using SSL, false if not.

wasFileUploaded() 공개 메소드

Determines if the file was uploaded or not. If not, will return the appropriate error message.
public wasFileUploaded ( string $field, string $name = null )
$field string The name of the field containing the uploaded file.
$name string The file description string to use in the error message. Default: 'file'.

프로퍼티 상세

$_accept 보호되어 있는 프로퍼티

HTTP_ACCEPT string
protected string $_accept
리턴 string

$_agent 보호되어 있는 프로퍼티

Full user agent string.
protected string $_agent
리턴 string

$_browser 보호되어 있는 프로퍼티

Browser name.
protected string $_browser
리턴 string

$_features 보호되어 있는 프로퍼티

Features.
protected array $_features
리턴 array

$_images 보호되어 있는 프로퍼티

This list of viewable images works for IE and Netscape/Mozilla.
protected array $_images
리턴 array

$_lowerAgent 보호되어 있는 프로퍼티

Lower-case user agent string.
protected string $_lowerAgent
리턴 string

$_majorVersion 보호되어 있는 프로퍼티

Major version number.
protected int $_majorVersion
리턴 integer

$_minorVersion 보호되어 있는 프로퍼티

Minor version number.
protected int $_minorVersion
리턴 integer

$_mobile 보호되어 있는 프로퍼티

Is this a mobile browser?
protected bool $_mobile
리턴 boolean

$_mobileAgents 보호되어 있는 프로퍼티

Browsers like Mobile Safari (iPhone, iPod Touch) are much more full featured than OpenWave style browsers. This makes it dicey in some cases to treat all "mobile" browsers the same way.
protected $_mobileAgents

$_platform 보호되어 있는 프로퍼티

Platform the browser is running on.
protected string $_platform
리턴 string

$_quirks 보호되어 있는 프로퍼티

Quirks.
protected array $_quirks
리턴 array

$_robotAgentRegexp 보호되어 있는 프로퍼티

Regexp for matching those robot strings.
protected string $_robotAgentRegexp
리턴 string

$_robotAgents 보호되어 있는 프로퍼티

Known robots.
protected array $_robotAgents
리턴 array

$_tablet 보호되어 있는 프로퍼티

Is this a tablet browser?
protected bool $_tablet
리턴 boolean

$_tvAgents 보호되어 있는 프로퍼티

List of televison user agents.
protected $_tvAgents