public function display($tpl = null) { // Get the message if (interface_exists('JModel')) { $cparams = JModelLegacy::getInstance('Storage', 'AdmintoolsModel'); } else { $cparams = JModel::getInstance('Storage', 'AdmintoolsModel'); } $message = JFactory::getSession()->get('message', null, 'com_admintools'); if (empty($message)) { $customMessage = $cparams->getValue('custom403msg', ''); if (!empty($customMessage)) { $message = $customMessage; } else { $message = 'ADMINTOOLS_BLOCKED_MESSAGE'; } } // Merge the default translation with the current translation $jlang = JFactory::getLanguage(); // Front-end translation $jlang->load('plg_system_admintools', JPATH_ADMINISTRATOR, 'en-GB', true); $jlang->load('plg_system_admintools', JPATH_ADMINISTRATOR, $jlang->getDefault(), true); $jlang->load('plg_system_admintools', JPATH_ADMINISTRATOR, null, true); if (JText::_('ADMINTOOLS_BLOCKED_MESSAGE') == 'ADMINTOOLS_BLOCKED_MESSAGE' && $message == 'ADMINTOOLS_BLOCKED_MESSAGE') { $message = "Access Denied"; } else { $message = JText::_($message); } $this->message = $message; parent::display($tpl); JFactory::getApplication()->close(); }
/** * Displays the view * * @param string $tpl The template to use * * @return boolean|null False if we can't render anything */ public function display($tpl = null) { // Get the task set in the model $model = $this->getModel(); $task = $model->getState('task', 'browse'); // Call the relevant method $method_name = 'on' . ucfirst($task); if (method_exists($this, $method_name)) { $result = $this->{$method_name}($tpl); } else { $result = $this->onDisplay(); } if ($result === false) { return; } // Show the view if ($this->doPreRender) { $this->preRender(); } parent::display($tpl); if ($this->doPostRender) { $this->postRender(); } }