API16

JVersion/getUserAgent

From Joomla! Documentation

< API16:JVersion

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Returns the user agent.



Syntax[edit]

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[edit]

string User Agent.

Defined in[edit]

libraries/joomla/version.php

Importing[edit]

jimport( 'joomla.version' );

Source Body[edit]

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 : '');
        }
}



Examples[edit]

Code Examples[edit]