/** * Get the component information. * * @param string $option Option name * * @return object */ public function getComponent($option) { $this->loadExtensionLanguage($option, $option); $this->loadExtensionLanguage($option, $option . '.sys'); $component = JComponentHelper::getComponent($option); $component->option = $option; $component->xml = RComponentHelper::getComponentManifestFile($option); return $component; }
/** * Method to get all extensions that are using redCORE * * @return array Array of extensions */ public static function getExtensionsRedcore() { if (empty($loadedRedcoreExtensions)) { /** @var RedcoreModelConfig $model */ $model = RModelAdmin::getAdminInstance('Config', array(), 'com_redcore'); self::$loadedRedcoreExtensions = RComponentHelper::getRedcoreComponents(); foreach (self::$loadedRedcoreExtensions as $componentKey => $componentName) { self::$loadedRedcoreExtensions[$componentKey] = $model->getComponent($componentName); } } return self::$loadedRedcoreExtensions; }
/** * Display method * * @param string $tpl The template name * * @return void */ public function display($tpl = null) { /** @var RedcoreModelConfig $model */ $model = $this->getModel('Config'); $option = JFactory::getApplication()->input->getString('component', 'com_redcore'); $lang = JFactory::getLanguage(); // Load component language files $lang->load($option, JPATH_ADMINISTRATOR, 'en-GB', false, false) || $lang->load($option, JPATH_ADMINISTRATOR . '/components/' . $option, 'en-GB', false, false); $this->form = $model->getForm(); $this->component = $model->getComponent($option); $this->return = JFactory::getApplication()->input->get('return', '', 'Base64'); $this->componentTitle = RText::getTranslationIfExists($this->component->xml->name, '', ''); $this->contentElements = $model->loadContentElements($option); $this->missingContentElements = $model->loadMissingContentElements($option, $this->contentElements); RLayoutHelper::$defaultBasePath = JPATH_ADMINISTRATOR . '/components/' . $option . '/layouts'; $extensionXml = RComponentHelper::getComponentManifestFile($option); if (isset($extensionXml->redcore)) { $attributes = $extensionXml->redcore->attributes(); if (!empty($attributes['defaultFramework'])) { RHtmlMedia::setFramework((string) $attributes['defaultFramework']); } } parent::display($tpl); }
$displayJoomlaMenu = false; $displayBackToJoomla = true; $displayComponentVersion = false; if (isset($data['display_joomla_menu'])) { $displayJoomlaMenu = (bool) $data['display_joomla_menu']; } if (isset($data['display_back_to_joomla'])) { $displayBackToJoomla = (bool) $data['display_back_to_joomla']; } if ($displayJoomlaMenu) { JLoader::import('joomla.application.module.helper'); $modules = JModuleHelper::getModules('menu'); } if (isset($data['display_component_version'])) { $displayComponentVersion = (bool) $data['display_component_version']; $xml = RComponentHelper::getComponentManifestFile($option); $componentName = JText::_($xml->name); $version = (string) $xml->version; } if (!empty($data['logoutReturnUri'])) { $logoutReturnUri = base64_encode($data['logoutReturnUri']); } else { $logoutReturnUri = base64_encode('index.php'); } ?> <script type="text/javascript"> jQuery(document).ready(function () { setInterval(function () { updateDateTime(); }, 1000); });
/** * Method to display component info * * @param JInstallerAdapter $parent Class calling this method * @param string $message Message to apply to the Component info layout * * @return void */ public function displayComponentInfo($parent, $message = '') { $this->loadRedcoreLibrary(); if ($this->showComponentInfo) { if (method_exists('RComponentHelper', 'displayComponentInfo')) { $manifest = $this->getManifest($parent); echo RComponentHelper::displayComponentInfo((string) $manifest->name, $message); } } }
/** * Prevents uninstalling redcore component if some components using it are still installed. * * @param object $parent class calling this method * * @return void * * @throws RuntimeException */ private function preventUninstallRedcore($parent) { require_once JPATH_LIBRARIES . '/redcore/bootstrap.php'; // Avoid uninstalling redcore if there is a component using it $manifest = $this->getManifest($parent); $isRedcore = 'COM_REDCORE' === (string) $manifest->name; if ($isRedcore) { if ($components = RComponentHelper::getRedcoreComponents()) { $app = JFactory::getApplication(); $message = sprintf("Cannot uninstall redCORE because the following components are using it: <br /> [%s]", implode(",<br /> ", $components)); $app->enqueueMessage($message, 'error'); $app->redirect('index.php?option=com_installer&view=manage'); } } }
<?php /** * @package Redcore.Admin * @subpackage Views * * @copyright Copyright (C) 2008 - 2015 redCOMPONENT.com. All rights reserved. * @license GNU General Public License version 2 or later, see LICENSE. */ defined('_JEXEC') or die; ?> <div class="tab-pane" id="mainComponentInfo"> <?php echo RComponentHelper::displayComponentInfo($this->component->option); ?> </div>