Example #1
0
 /**
  * Dispatch the application
  *
  * @param   string  $component  The component which is being rendered.
  *
  * @return  void
  *
  * @since   3.2
  */
 public function dispatch($component = null)
 {
     if ($component === null) {
         $component = JAdministratorHelper::findOption();
     }
     // Load the document to the API
     $this->loadDocument();
     // Set up the params
     $document = JFactory::getDocument();
     // Register the document object with JFactory
     JFactory::$document = $document;
     switch ($document->getType()) {
         case 'html':
             $document->setMetaData('keywords', $this->get('MetaKeys'));
             // Get the template
             $template = $this->getTemplate(true);
             // Store the template and its params to the config
             $this->set('theme', $template->template);
             $this->set('themeParams', $template->params);
             break;
         default:
             break;
     }
     $document->setTitle($this->get('sitename') . ' - ' . JText::_('JADMINISTRATION'));
     $document->setDescription($this->get('MetaDesc'));
     $document->setGenerator('Joomla! - Open Source Content Management');
     $contents = JComponentHelper::renderComponent($component);
     $document->setBuffer($contents, 'component');
     // Trigger the onAfterDispatch event.
     JPluginHelper::importPlugin('system');
     $this->triggerEvent('onAfterDispatch');
 }
 /**
  * @covers JAdministratorHelper::findOption
  */
 public function testFindOptionCanLoginAdminOptionSet()
 {
     $this->user->expects($this->once())->method('get')->with($this->equalTo('guest'))->will($this->returnValue(false));
     $this->user->expects($this->once())->method('authorise')->with($this->equalTo('core.login.admin'))->will($this->returnValue(true));
     JFactory::$application->input->set('option', 'foo');
     $this->assertEquals('foo', JAdministratorHelper::findOption());
     $this->assertEquals('foo', JFactory::$application->input->get('option'));
 }
Example #3
0
 function onAfterRoute()
 {
     include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.legacy.php';
     $mainframe =& JFactory::getApplication('site');
     $mainframe->getRouter();
     $document =& JFactory::getDocument();
     if ($document->getType() == 'pdf') {
         return;
     }
     if ($mainframe->isAdmin()) {
         $document->addStyleSheet(JURI::base() . 'components/com_jcomments/assets/icon.css?v=2');
         $option = JAdministratorHelper::findOption();
         $task = JRequest::getCmd('task');
         $type = JRequest::getCmd('type', '', 'post');
         // remove comments if content item deleted from trash
         if ($option == 'com_trash' && $task == 'delete' && $type == 'content') {
             $cid = JRequest::getVar('cid', array(0), 'post', 'array');
             JArrayHelper::toInteger($cid, array(0));
             include_once JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
             JComments::deleteComments($cid, 'com_content');
         }
     } else {
         $option = JRequest::getCmd('option');
         if ($option == 'com_content' || $option == 'com_alphacontent') {
             include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
             include_once JCOMMENTS_BASE . DS . 'jcomments.config.php';
             include_once JCOMMENTS_HELPERS . DS . 'system.php';
             // include JComments CSS
             if ($this->params->get('disable_template_css', 0) == 0) {
                 $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
                 $language =& JFactory::getLanguage();
                 if ($language->isRTL()) {
                     $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                     if ($rtlCSS != '') {
                         $document->addStyleSheet($rtlCSS);
                     }
                 }
             }
             if (!defined('JCOMMENTS_CSS')) {
                 define('JCOMMENTS_CSS', 1);
             }
             $config =& JCommentsCfg::getInstance();
             // include JComments JavaScript library
             $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
             if (!defined('JOOMLATUNE_AJAX_JS')) {
                 $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                 define('JOOMLATUNE_AJAX_JS', 1);
             }
             if (!defined('JCOMMENTS_JS')) {
                 define('JCOMMENTS_JS', 1);
             }
         }
     }
 }
Example #4
0
 /**
  * This method is called when the Quick Icons module is constructing its set
  * of icons. You can return an array which defines a single icon and it will
  * be rendered right after the stock Quick Icons.
  *
  * @param   $context  The calling context
  *
  * @return  array  A list of icon definition associative arrays, consisting of the
  *				   keys link, image, text and access.
  *
  * @since   2.5.28
  */
 public function onGetIcons($context)
 {
     if (!JFactory::getApplication()->isAdmin() || version_compare(JVERSION, '3.0', '>=')) {
         return;
     }
     $text = JText::_('PLG_EOSNOTIFY_SUPPORT_ENDING');
     if (JFactory::getDate() >= '2015-01-01') {
         $text = JText::_('PLG_EOSNOTIFY_SUPPORT_ENDED');
     }
     if (JAdministratorHelper::findOption() == 'com_cpanel') {
         JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_EOSNOTIFY_CLICK_FOR_INFORMATION_WITH_LINK', $text), 'error');
     }
 }
Example #5
0
$mainframe->triggerEvent('onAfterInitialise');
/**
 * ROUTE THE APPLICATION
 *
 * NOTE :
 */
$mainframe->route();
// trigger the onAfterRoute events
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
$mainframe->triggerEvent('onAfterRoute');
/**
 * DISPATCH THE APPLICATION
 *
 * NOTE :
 */
$option = JAdministratorHelper::findOption();
$mainframe->dispatch($option);
// trigger the onAfterDispatch events
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
$mainframe->triggerEvent('onAfterDispatch');
/**
 * RENDER THE APPLICATION
 *
 * NOTE :
 */
$mainframe->render();
// trigger the onAfterRender events
JDEBUG ? $_PROFILER->mark('afterRender') : null;
$mainframe->triggerEvent('onAfterRender');
/**
 * RETURN THE RESPONSE
 /**
  * Dispatch the application
  *
  * @param	string	$component	The component to dispatch.
  *
  * @return	void
  * @since	1.5
  */
 public function dispatch($component = null)
 {
     try {
         if ($component === null) {
             $component = JAdministratorHelper::findOption();
         }
         $document = JFactory::getDocument();
         $user = JFactory::getUser();
         switch ($document->getType()) {
             case 'html':
                 $document->setMetaData('keywords', $this->getCfg('MetaKeys'));
                 break;
             default:
                 break;
         }
         $document->setTitle($this->getCfg('sitename') . ' - ' . JText::_('JADMINISTRATION'));
         $document->setDescription($this->getCfg('MetaDesc'));
         $document->setGenerator('Jokte! - CMS Lationamericano Cien por Ciento Libre');
         $contents = JComponentHelper::renderComponent($component);
         $document->setBuffer($contents, 'component');
         // Trigger the onAfterDispatch event.
         JPluginHelper::importPlugin('system');
         $this->triggerEvent('onAfterDispatch');
     } catch (Exception $e) {
         $code = $e->getCode();
         JError::raiseError($code ? $code : 500, $e->getMessage());
     }
 }
Example #7
0
 private function getOption()
 {
     $app = JFactory::getApplication();
     $option = $app->input->get('option');
     if (!empty($option)) {
         return $option;
     }
     if ($app->isAdmin()) {
         return JAdministratorHelper::findOption();
     }
     $menu = $app->getMenu();
     if (!$menu) {
         return null;
     }
     $active = $menu->getActive();
     if ($active && isset($active->component)) {
         return $active->component;
     }
     $default = $menu->getDefault();
     if ($default && isset($default->component)) {
         return $default->component;
     }
     return null;
 }
Example #8
0
global $widgetkit;
if ($widgetkit) {
    return $widgetkit;
}
$loader = (require __DIR__ . '/vendor/autoload.php');
$config = (require __DIR__ . '/config.php');
$app = new Application($config);
$app['autoloader'] = $loader;
$app['path.cache'] = rtrim(JPATH_ROOT, '/') . '/cache/widgetkit';
$app['component'] = 'com_' . $app['name'];
$app['permissions'] = array('core.manage' => 'manage_widgetkit');
$app['templates'] = function () {
    return glob(rtrim(JPATH_ROOT, '/') . '/templates/*/widgetkit') ?: array();
};
$app->on('init', function ($event, $app) {
    if ($app['admin'] && $app['component'] == JAdministratorHelper::findOption()) {
        $app->trigger('init.admin', array($app));
    }
});
$app->on('init.admin', function ($event, $app) {
    JHtmlBehavior::keepalive();
    JHtml::_('jquery.framework');
    // don't check for component when installing
    if ($app['request']->get('option') != 'com_installer') {
        $app['config']->add(JComponentHelper::getParams($app['component'])->toArray());
    }
    $app['angular']->addTemplate('media', 'views/media.php', true);
    $app['angular']->set('token', JSession::getFormToken());
    $app['scripts']->add('widgetkit-joomla', 'assets/js/joomla.js', array('widgetkit-application'));
    $app['scripts']->add('widgetkit-joomla-media', 'assets/js/joomla.media.js', array('widgetkit-joomla'));
    $app['scripts']->add('uikit-upload');
Example #9
0
 /**
  * Dispatch the application
  *
  * @param	string	$component	The component to dispatch.
  *
  * @return	void
  * @since	1.5
  */
 public function dispatch($component = null)
 {
     /*try
     		{*/
     if ($component === null) {
         $component = JAdministratorHelper::findOption();
     }
     $document = JFactory::getDocument();
     $user = JFactory::getUser();
     switch ($document->getType()) {
         case 'html':
             $document->setMetaData('keywords', $this->getCfg('MetaKeys'));
             break;
         default:
             break;
     }
     $document->setTitle($this->getCfg('sitename') . ' - ' . JText::_('JADMINISTRATION'));
     $document->setDescription($this->getCfg('MetaDesc'));
     $document->setGenerator('HUBzero - The open source platform for scientific and educational collaboration');
     $contents = JComponentHelper::renderComponent($component);
     $document->setBuffer($contents, 'component');
     // Trigger the onAfterDispatch event.
     JPluginHelper::importPlugin('system');
     $this->triggerEvent('onAfterDispatch');
     /*}
     		// Mop up any uncaught exceptions.
     		catch (Exception $e)
     		{
     			$code = $e->getCode();
     			JError::raiseError($code ? $code : 500, $e->getMessage());
     		}*/
 }
Example #10
0
 /**
  * Dispatch the application
  *
  * @param   string    $component    The component to dispatch.
  *
  * @return  void
  * @since   1.5
  */
 public function dispatch($component = null)
 {
     if ($component === null) {
         $component = JAdministratorHelper::findOption();
     }
     $document = JFactory::getDocument();
     switch ($document->getType()) {
         case 'html':
             $document->setMetaData('keywords', $this->getCfg('MetaKeys'));
             break;
         default:
             break;
     }
     $document->setTitle($this->getCfg('sitename') . ' - ' . JText::_('JADMINISTRATION'));
     $document->setDescription($this->getCfg('MetaDesc'));
     $document->setGenerator('Joomla! - Open Source Content Management');
     $contents = JComponentHelper::renderComponent($component);
     $document->setBuffer($contents, 'component');
     // Trigger the onAfterDispatch event.
     JPluginHelper::importPlugin('system');
     $this->triggerEvent('onAfterDispatch');
 }
Example #11
0
 function onAfterRoute()
 {
     $legacyFile = JPATH_ROOT . '/components/com_jcomments/jcomments.legacy.php';
     if (!is_file($legacyFile)) {
         return;
     }
     include_once $legacyFile;
     $app = JFactory::getApplication('site');
     $app->getRouter();
     $document = JFactory::getDocument();
     if ($document->getType() == 'html') {
         if ($app->isAdmin()) {
             $document->addStyleSheet(JURI::root(true) . '/administrator/components/com_jcomments/assets/css/icon.css?v=2');
             JFactory::getLanguage()->load('com_jcomments.sys', JPATH_ROOT . '/administrator', 'en-GB', true);
             $option = JAdministratorHelper::findOption();
             $task = $app->input->get('task');
             $type = $app->input->post('type', '', 'post');
             // remove comments if content item deleted from trash
             if ($option == 'com_trash' && $task == 'delete' && $type == 'content') {
                 $cid = JRequest::getVar('cid', array(0), 'post', 'array');
                 JArrayHelper::toInteger($cid, array(0));
                 include_once JPATH_ROOT . '/components/com_jcomments/jcomments.php';
                 JCommentsModel::deleteComments($cid, 'com_content');
             }
         } else {
             $option = $app->input->get('option');
             if ($option == 'com_content' || $option == 'com_alphacontent' || $option == 'com_multicategories') {
                 include_once JPATH_ROOT . '/components/com_jcomments/jcomments.class.php';
                 include_once JPATH_ROOT . '/components/com_jcomments/helpers/system.php';
                 // include JComments CSS
                 if ($this->params->get('disable_template_css', 0) == 0) {
                     $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
                     $language = JFactory::getLanguage();
                     if ($language->isRTL()) {
                         $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                         if ($rtlCSS != '') {
                             $document->addStyleSheet($rtlCSS);
                         }
                     }
                 }
                 if (!defined('JCOMMENTS_CSS')) {
                     define('JCOMMENTS_CSS', 1);
                 }
                 // include JComments JavaScript library
                 $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
                 if (!defined('JOOMLATUNE_AJAX_JS')) {
                     $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
                     define('JOOMLATUNE_AJAX_JS', 1);
                 }
                 if (!defined('JCOMMENTS_JS')) {
                     define('JCOMMENTS_JS', 1);
                 }
             }
         }
     }
 }
Example #12
0
 /**
  * Dispatch the application
  *
  * @param	string	The component to dispatch.
  */
 public function dispatch($component = null)
 {
     if ($component === null) {
         $component = JAdministratorHelper::findOption();
     }
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     switch ($document->getType()) {
         case 'html':
             $document->setMetaData('keywords', $this->getCfg('MetaKeys'));
             JHtml::_('behavior.framework', true);
             break;
         default:
             break;
     }
     $document->setTitle(htmlspecialchars_decode($this->getCfg('sitename')) . ' - ' . JText::_('Administration'));
     $document->setDescription($this->getCfg('MetaDesc'));
     $contents = JComponentHelper::renderComponent($component);
     $document->setBuffer($contents, 'component');
     // Trigger the onAfterDispatch event.
     JPluginHelper::importPlugin('system');
     $this->triggerEvent('onAfterDispatch');
 }