AAAAhome/academiac/www/administrator/components/com_admirorgallery/admirorgallery.scriptfile.php 0000604 00000022033 15137335071 0027021 0 ustar 00 get("manifest");
$parent = $parent->getParent();
$source = $parent->getPath("source");
$installer = new JInstaller();
// Install plugins
foreach ($manifest->plugins->plugin as $plugin) {
$attributes = $plugin->attributes();
$plg = $source . DS . $attributes['folder'] . DS . $attributes['plugin'];
$installer->install($plg);
}
$db = JFactory::getDbo();
$tableExtensions = $db->nameQuote("#__extensions");
$columnElement = $db->nameQuote("element");
$columnType = $db->nameQuote("type");
$columnFolder = $db->nameQuote("folder");
$columnEnabled = $db->nameQuote("enabled");
// Enable plugins
$db->setQuery(
"UPDATE
$tableExtensions
SET
$columnEnabled=1
WHERE
$columnElement='admirorgallery'
AND
$columnType='plugin'
AND
$columnFolder='content'"
);
$this->gallery_install_result = $db->query();
// Enable plugins
$db->setQuery(
"UPDATE
$tableExtensions
SET
$columnEnabled=1
WHERE
$columnElement='admirorbutton'
AND
$columnType='plugin'
AND
$columnFolder='editors-xtd'"
);
$this->button_install_result = $db->query();
}
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent) {
$installer = new JInstaller();
$db = JFactory::getDbo();
$tableExtensions = $db->nameQuote("#__extensions");
$columnElement = $db->nameQuote("element");
$columnType = $db->nameQuote("type");
$columnFolder = $db->nameQuote("folder");
// Find AdmirorGallery plugin ID
$db->setQuery(
"SELECT extension_id
FROM
$tableExtensions
WHERE
$columnElement='admirorgallery'
AND
$columnType='plugin'
AND
$columnFolder='content'"
);
$admirorgallery_id = $db->loadResult();
$this->gallery_uninstall_result = $installer->uninstall('plugin', $admirorgallery_id);
// Find AdmirorButton ID
$db->setQuery(
"SELECT extension_id
FROM
$tableExtensions
WHERE
$columnElement='admirorbutton'
AND
$columnType='plugin'
AND
$columnFolder='editors-xtd'"
);
$admirorbutton_id = $db->loadResult();
$this->button_uninstall_result = $installer->uninstall('plugin', $admirorbutton_id);
$gallery_status = ($this->gallery_uninstall_result) ? JText::_('Removed') : JText::_('Error');
$button_status = ($this->button_uninstall_result) ? JText::_('Removed') : JText::_('Error');
$html = '
Admiror Gallery ' . JText::_('Uninstall') . '
| ' . JText::_('Extension') . ' |
' . JText::_('Status') . ' |
|
| Admiror Gallery ' . JText::_('Component') . ' |
' . JText::_('Removed') . ' |
| ' . JText::_('Plugin') . ' |
' . JText::_('Group') . ' |
|
| ' . ucfirst('Admiror Gallery Plugin') . ' |
' . ucfirst('content') . ' |
' . $gallery_status . ' |
| ' . ucfirst('Admiror Button') . ' |
' . ucfirst('editors-xtd') . ' |
' . $button_status . ' |
';
echo $html;
}
/**
* method to update the component
*
* @return void
*/
function update($parent) {
//On update we just call install, no special case for updating.
$this->install($parent);
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
function preflight($type, $parent) {
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent) {
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
if ($type == 'install') {
$gallery_status = ($this->gallery_install_result) ? JText::_('Installed') : JText::_('Not installed');
$button_status = ($this->button_install_result) ? JText::_('Installed') : JText::_('Not installed');
$html = 'Admiror Gallery Installation
| ' . JText::_('Extension') . ' |
' . JText::_('Status') . ' |
|
| Admiror Gallery ' . JText::_('Component') . ' |
' . JText::_('Installed') . ' |
| ' . JText::_('Plugin') . ' |
' . JText::_('Group') . ' |
|
| ' . ucfirst('Admiror Gallery Plugin') . ' |
' . ucfirst('content') . ' |
' . $gallery_status . ' |
| ' . ucfirst('Admiror Button') . ' |
' . ucfirst('editors-xtd') . ' |
' . $button_status . ' |
';
echo $html;
}
}
}