JVersion/getUserAgent: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Returns the user agent.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
... |
m clean up |
||
| Line 2: | Line 2: | ||
Returns the user agent. | Returns the user agent. | ||
{{Description:JVersion/getUserAgent}} | |||
{{subst:Description:JVersion/getUserAgent}} | |||
===Syntax=== | ===Syntax=== | ||
| Line 60: | Line 58: | ||
</source> | </source> | ||
{{subst:SeeAlso:JVersion/getUserAgent}} | |||
{{SeeAlso:JVersion/getUserAgent}} | |||
===Examples=== | ===Examples=== | ||
Revision as of 14:37, 24 March 2017
Description
Returns the user agent.
{{subst:Description:JVersion/getUserAgent}}
Syntax
getUserAgent($component=null, $mask=false, $add_version=true)
| Parameter Name | Default Value | Description |
|---|---|---|
| $component | null | Name of the component. |
| $mask | false | Mask as Mozilla/5.0 or not. |
| $add_version | true | Add version afterwards to component. |
Returns
string User Agent.
Defined in
libraries/joomla/version.php
Importing
jimport( 'joomla.version' );
Source Body
public function getUserAgent($component = null, $mask = false, $add_version = true)
{
if ($component === null) {
$component = 'Framework';
}
if ($add_version) {
$component .= '/'.$this->RELEASE;
}
// If masked pretend to look like Mozilla 5.0 but still identify ourselves.
if ($mask) {
return 'Mozilla/5.0 '. $this->PRODUCT .'/'. $this->RELEASE . '.'.$this->DEV_LEVEL . ($component ? ' '. $component : '');
}
else {
return $this->PRODUCT .'/'. $this->RELEASE . '.'.$this->DEV_LEVEL . ($component ? ' '. $component : '');
}
}
{{subst:SeeAlso:JVersion/getUserAgent}}
Examples
<CodeExamplesForm />