JInstallerLanguage/install: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Custom install method
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki... |
m removing red link to edit, no existant pages |
||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 74: | Line 74: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
| Line 89: | Line 89: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Revision as of 18:32, 12 May 2013
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
<CodeExamplesForm />