31
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-06-03 22:20:48 +00:00
patchtester/administrator/components/com_patchtester/patchtester.php

37 lines
1.2 KiB
PHP
Raw Normal View History

2011-10-11 13:02:57 +00:00
<?php
2011-10-11 13:02:57 +00:00
/**
2015-12-05 17:43:54 +00:00
* Patch testing component for the Joomla! CMS
2013-07-13 02:26:21 +00:00
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
2013-07-13 02:26:21 +00:00
* @license GNU General Public License version 2 or later
2011-10-11 13:02:57 +00:00
*/
\defined('_JEXEC') or die;
use Joomla\CMS\Factory;
2019-08-28 01:20:49 +00:00
use Joomla\CMS\Language\Text;
if (!Factory::getUser()->authorise('core.manage', 'com_patchtester')) {
throw new RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
2011-10-11 13:02:57 +00:00
}
// Application reference
$app = Factory::getApplication();
2017-01-21 19:37:31 +00:00
// Import our Composer autoloader to load the component classes
require_once __DIR__ . '/vendor/autoload.php';
// Build the controller class name based on task
$task = $app->input->getCmd('task', 'display');
// If $task is an empty string, apply our default since JInput might not
if ($task === '') {
$task = 'display';
}
$class = '\\PatchTester\\Controller\\' . ucfirst(strtolower($task)) . 'Controller';
if (!class_exists($class)) {
throw new InvalidArgumentException(Text::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $class), 404);
}
// Instantiate and execute the controller
/** @var \PatchTester\Controller\AbstractController $controller */
2019-08-28 00:50:21 +00:00
$controller = new $class($app);
$controller->execute();