Skip to content

Commit

Permalink
Admin app - Use the autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Babker committed Jun 20, 2016
1 parent b982eec commit 5f19de3
Show file tree
Hide file tree
Showing 47 changed files with 52 additions and 67 deletions.
2 changes: 1 addition & 1 deletion administrator/components/com_admin/models/profile.php
Expand Up @@ -9,7 +9,7 @@

defined('_JEXEC') or die;

require_once JPATH_ADMINISTRATOR . '/components/com_users/models/user.php';
JLoader::register('UsersModelUser', JPATH_ADMINISTRATOR . '/components/com_users/models/user.php');

/**
* User model.
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<fields name="filter" addfieldpath="/administrator/components/com_banners/models/fields">
<field
name="search"
type="text"
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="filter">
<fields name="filter" addfieldpath="/administrator/components/com_banners/models/fields">
<field
name="search"
type="text"
Expand Down
Expand Up @@ -73,7 +73,6 @@ public function display($tpl = null)
BannersHelper::addSubmenu('banners');

$this->addToolbar();
require_once JPATH_COMPONENT . '/models/fields/bannerclient.php';

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Expand All @@ -92,7 +91,7 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/banners.php';
JLoader::register('BannersHelper', JPATH_COMPONENT . '/helpers/banners.php');

$canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
$user = JFactory::getUser();
Expand Down
Expand Up @@ -66,8 +66,6 @@ public function display($tpl = null)

$this->addToolbar();

require_once JPATH_COMPONENT . '/models/fields/bannerclient.php';

$this->sidebar = JHtmlSidebar::render();

return parent::display($tpl);
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_cache/controller.php
Expand Up @@ -28,7 +28,7 @@ class CacheController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/cache.php';
JLoader::register('CacheHelper', JPATH_COMPONENT . '/helpers/cache.php');

// Get the document object.
$document = JFactory::getDocument();
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_categories/controller.php
Expand Up @@ -89,7 +89,7 @@ public function display($cachable = false, $urlparams = array())
$view->document = $document;

// Load the submenu.
require_once JPATH_COMPONENT . '/helpers/categories.php';
JLoader::register('CategoriesHelper', JPATH_COMPONENT . '/helpers/categories.php');

CategoriesHelper::addSubmenu($model->getState('filter.extension'));
$view->display();
Expand Down
Expand Up @@ -16,7 +16,7 @@
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}

require_once JPATH_ROOT . '/components/com_content/helpers/route.php';
JLoader::register('ContentHelperRoute', JPATH_ROOT . '/components/com_content/helpers/route.php');

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Expand Down
Expand Up @@ -163,7 +163,7 @@ protected function addToolbar()
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true);

// Load the category helper.
require_once JPATH_COMPONENT . '/helpers/categories.php';
JLoader::register('CategoriesHelper', JPATH_COMPONENT . '/helpers/categories.php');

// If a component categories title string is present, let's use it.
if ($lang->hasKey($component_title_key = strtoupper($component . ($section ? "_$section" : '')) . '_CATEGORIES_TITLE'))
Expand Down
Expand Up @@ -129,7 +129,7 @@ protected function addToolbar()
|| $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true);

// Load the category helper.
require_once JPATH_COMPONENT . '/helpers/categories.php';
JLoader::register('CategoriesHelper', JPATH_COMPONENT . '/helpers/categories.php');

// Get the results for each action.
$canDo = $this->canDo;
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_contact/controller.php
Expand Up @@ -36,7 +36,7 @@ class ContactController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = array())
{
require_once JPATH_COMPONENT . '/helpers/contact.php';
JLoader::register('ContactHelper', JPATH_COMPONENT . '/helpers/contact.php');

$view = $this->input->get('view', 'contacts');
$layout = $this->input->get('layout', 'default');
Expand Down
Expand Up @@ -9,7 +9,7 @@

defined('_JEXEC') or die;

require_once JPATH_ROOT . '/components/com_contact/helpers/route.php';
JLoader::register('ContactHelperRoute', JPATH_ROOT . '/components/com_contact/helpers/route.php');

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

Expand Down
Expand Up @@ -16,7 +16,7 @@
JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}

require_once JPATH_ROOT . '/components/com_content/helpers/route.php';
JLoader::register('ContentHelperRoute', JPATH_ROOT . '/components/com_content/helpers/route.php');

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
Expand Down
Expand Up @@ -47,12 +47,6 @@ public function display($tpl = null)
// Display the cpanel modules
$this->modules = JModuleHelper::getModules('cpanel');

// Load the RAD layer and count the number of post-installation messages
if (!defined('FOF_INCLUDED'))
{
require_once JPATH_LIBRARIES . '/fof/include.php';
}

try
{
$messages_model = FOFModel::getTmpInstance('Messages', 'PostinstallModel')->eid(700);
Expand Down
Expand Up @@ -12,7 +12,7 @@
JFormHelper::loadFieldClass('list');

// Load the base adapter.
require_once JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php';
JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php');

/**
* Renders a list of directories.
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_installer/controller.php
Expand Up @@ -28,7 +28,7 @@ class InstallerController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php';
JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php');

// Get the document object.
$document = JFactory::getDocument();
Expand Down
Expand Up @@ -12,7 +12,7 @@
JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.tooltip');

require_once JPATH_ADMINISTRATOR . '/modules/mod_login/helper.php';
JLoader::register('ModLoginHelper', JPATH_ADMINISTRATOR . '/modules/mod_login/helper.php');

$twofactormethods = ModLoginHelper::getTwoFactorMethods();

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_languages/controller.php
Expand Up @@ -34,7 +34,7 @@ class LanguagesController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');

$view = $this->input->get('view', 'languages');
$layout = $this->input->get('layout', 'default');
Expand Down
Expand Up @@ -94,7 +94,7 @@ public function save($key = null, $urlVar = null)
}

// Require helper for filter functions called by JForm.
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');

// Test whether the data is valid.
$validData = $model->validate($form, $data);
Expand Down
7 changes: 4 additions & 3 deletions administrator/components/com_languages/models/override.php
Expand Up @@ -89,7 +89,7 @@ protected function loadFormData()
*/
public function getItem($pk = null)
{
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');

$input = JFactory::getApplication()->input;
$pk = (!empty($pk)) ? $pk : $input->get('id');
Expand Down Expand Up @@ -122,10 +122,11 @@ public function getItem($pk = null)
*/
public function save($data, $opposite_client = false)
{
$app = JFactory::getApplication();
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');
jimport('joomla.filesystem.file');

$app = JFactory::getApplication();

$client = $app->getUserState('com_languages.overrides.filter.client', 0);
$language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB');

Expand Down
Expand Up @@ -247,7 +247,7 @@ public function delete($cids)
}

jimport('joomla.filesystem.file');
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');

$filterclient = JFactory::getApplication()->getUserState('com_languages.overrides.filter.client');
$client = $filterclient == 0 ? 'SITE' : 'ADMINISTRATOR';
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_languages/models/strings.php
Expand Up @@ -25,7 +25,7 @@ class LanguagesModelStrings extends JModelLegacy
*/
public function refresh()
{
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');

$app = JFactory::getApplication();

Expand Down
Expand Up @@ -57,7 +57,7 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/languages.php';
JLoader::register('LanguagesHelper', JPATH_COMPONENT . '/helpers/languages.php');

JFactory::getApplication()->input->set('hidemainmenu', 1);
$isNew = empty($this->item->lang_id);
Expand Down
Expand Up @@ -25,7 +25,7 @@ class LanguagesViewMultilangstatus extends JViewLegacy
*/
public function display($tpl = null)
{
require_once JPATH_COMPONENT . '/helpers/multilangstatus.php';
JLoader::register('MultilangstatusHelper', JPATH_COMPONENT . '/helpers/multilangstatus.php');

$this->homes = MultilangstatusHelper::getHomes();
$this->language_filter = JLanguageMultilang::isEnabled();
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_media/media.php
Expand Up @@ -26,7 +26,7 @@
$params = JComponentHelper::getParams('com_media');

// Load the helper class
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/media.php';
JLoader::register('MediaHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/media.php');

// Set the path definitions
$popup_upload = $input->get('pop_up', null);
Expand Down
6 changes: 2 additions & 4 deletions administrator/components/com_menus/controller.php
Expand Up @@ -28,10 +28,8 @@ class MenusController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/menus.php';
JLoader::register('MenusHelper', JPATH_COMPONENT . '/helpers/menus.php');

parent::display();

return $this;
return parent::display();
}
}
2 changes: 1 addition & 1 deletion administrator/components/com_menus/models/item.php
Expand Up @@ -12,7 +12,7 @@
use Joomla\Registry\Registry;

jimport('joomla.filesystem.path');
require_once JPATH_COMPONENT . '/helpers/menus.php';
JLoader::register('MenusHelper', JPATH_COMPONENT . '/helpers/menus.php');

/**
* Menu Item Model for Menus.
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_messages/controller.php
Expand Up @@ -28,7 +28,7 @@ class MessagesController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/messages.php';
JLoader::register('MessagesHelper', JPATH_COMPONENT . '/helpers/messages.php');

$view = $this->input->get('view', 'messages');
$layout = $this->input->get('layout', 'default');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_modules/controller.php
Expand Up @@ -57,7 +57,7 @@ public function display($cachable = false, $urlparams = false)
return $view->display();
}

require_once JPATH_COMPONENT . '/helpers/modules.php';
JLoader::register('ModulesHelper', JPATH_COMPONENT . '/helpers/modules.php');

$layout = $this->input->get('layout', 'edit');
$id = $this->input->getInt('id');
Expand Down
Expand Up @@ -136,7 +136,8 @@ public static function state($value, $i, $enabled = true, $checkbox = 'cb')

public static function positions($clientId, $state = 1, $selectedPosition = '')
{
require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php');

$templates = array_keys(ModulesHelper::getTemplates($clientId, $state));
$templateGroups = array();

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_modules/models/module.php
Expand Up @@ -872,7 +872,7 @@ protected function preprocessForm(JForm $form, $data, $group = 'content')
*/
public function validate($form, $data, $group = null)
{
require_once JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php';
JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php');

return parent::validate($form, $data, $group);
}
Expand Down
Expand Up @@ -9,8 +9,8 @@

defined('_JEXEC') or die;

// Initiasile related data.
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
// Initialise related data.
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
$menuTypes = MenusHelper::getMenuLinks();

JHtml::_('script', 'jui/treeselectmenu.jquery.min.js', false, true);
Expand Down
Expand Up @@ -9,7 +9,7 @@

defined('_JEXEC') or die;

require_once JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php';
JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php');

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
$clientId = $this->item->client_id;
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_newsfeeds/controller.php
Expand Up @@ -28,7 +28,7 @@ class NewsfeedsController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = array())
{
require_once JPATH_COMPONENT . '/helpers/newsfeeds.php';
JLoader::register('NewsfeedsHelper', JPATH_COMPONENT . '/helpers/newsfeeds.php');

$view = $this->input->get('view', 'newsfeeds');
$layout = $this->input->get('layout', 'default');
Expand Down
Expand Up @@ -9,7 +9,7 @@

defined('_JEXEC') or die;

require_once JPATH_ROOT . '/components/com_newsfeeds/helpers/route.php';
JLoader::register('NewsfeedsHelperRoute', JPATH_ROOT . '/components/com_newsfeeds/helpers/route.php');

JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_plugins/controller.php
Expand Up @@ -28,7 +28,7 @@ class PluginsController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/plugins.php';
JLoader::register('PluginsHelper', JPATH_COMPONENT . '/helpers/plugins.php');

// Load the submenu.
PluginsHelper::addSubmenu($this->input->get('view', 'plugins'));
Expand Down
6 changes: 0 additions & 6 deletions administrator/components/com_postinstall/postinstall.php
Expand Up @@ -9,11 +9,5 @@

defined('_JEXEC') or die;

// Load the RAD layer.
if (!defined('FOF_INCLUDED'))
{
require_once JPATH_LIBRARIES . '/fof/include.php';
}

// Dispatch the component.
FOFDispatcher::getTmpInstance('com_postinstall')->dispatch();
2 changes: 1 addition & 1 deletion administrator/components/com_redirect/controller.php
Expand Up @@ -34,7 +34,7 @@ class RedirectController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/redirect.php';
JLoader::register('RedirectHelper', JPATH_COMPONENT . '/helpers/redirect.php');

// Load the submenu.
RedirectHelper::addSubmenu($this->input->get('view', 'links'));
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_search/controller.php
Expand Up @@ -34,7 +34,7 @@ class SearchController extends JControllerLegacy
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/search.php';
JLoader::register('SearchHelper', JPATH_COMPONENT . '/helpers/search.php');

// Load the submenu.
SearchHelper::addSubmenu($this->input->get('view', 'searches'));
Expand Down
Expand Up @@ -10,7 +10,7 @@
defined('_JEXEC') or die;

// Initiasile related data.
require_once JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php';
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
$menuTypes = MenusHelper::getMenuLinks();
$user = JFactory::getUser();
?>
Expand Down

0 comments on commit 5f19de3

Please sign in to comment.