API15:JInstallerLanguage/install
From Joomla! Documentation
Description
Custom install method
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
install()
Returns
boolean True on success
Defined in
libraries/joomla/installer/adapters/language.php
Importing
jimport( 'joomla.installer.adapters.language' );
Source Body
function install()
{
$manifest =& $this->parent->getManifest();
$this->manifest =& $manifest->document;
$root =& $manifest->document;
// Get the client application target
if ($root->attributes('client') == 'both')
{
$siteElement =& $root->getElementByPath('site');
$element =& $siteElement->getElementByPath('files');
if (!$this->_install('site', JPATH_SITE, 0, $element)) {
return false;
}
$adminElement =& $root->getElementByPath('administration');
$element =& $adminElement->getElementByPath('files');
if (!$this->_install('administrator', JPATH_ADMINISTRATOR, 1, $element)) {
return false;
}
return true;
}
elseif ($cname = $root->attributes('client'))
{
// Attempt to map the client to a base path
jimport('joomla.application.helper');
$client =& JApplicationHelper::getClientInfo($cname, true);
if ($client === null) {
$this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$cname.']');
return false;
}
$basePath = $client->path;
$clientId = $client->id;
$element =& $root->getElementByPath('files');
return $this->_install($cname, $basePath, $clientId, $element);
}
else
{
// No client attribute was found so we assume the site as the client
$cname = 'site';
$basePath = JPATH_SITE;
$clientId = 0;
$element =& $root->getElementByPath('files');
return $this->_install($cname, $basePath, $clientId, $element);
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples