Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0-dev-chmst
Browse files Browse the repository at this point in the history
  • Loading branch information
chmst committed Jul 11, 2018
2 parents a9eaf4e + e989ee9 commit 5d17c4c
Show file tree
Hide file tree
Showing 75 changed files with 683 additions and 518 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
defined('_JEXEC') or die;

use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Router\Route;

/**
* User profile controller class.
Expand Down Expand Up @@ -48,14 +49,14 @@ protected function allowEdit($data = array(), $key = 'id')
*/
public function save($key = null, $urlVar = null)
{
$this->setRedirect(\JRoute::_('index.php?option=com_admin&view=profile&layout=edit&id=' . $this->app->getIdentity()->id, false));
$this->setRedirect(Route::_('index.php?option=com_admin&view=profile&layout=edit&id=' . $this->app->getIdentity()->id, false));

$return = parent::save();

if ($this->getTask() != 'apply')
{
// Redirect to the main page.
$this->setRedirect(\JRoute::_('index.php', false));
$this->setRedirect(Route::_('index.php', false));
}

return $return;
Expand All @@ -75,7 +76,7 @@ public function cancel($key = null)
$return = parent::cancel($key);

// Redirect to the main page.
$this->setRedirect(\JRoute::_('index.php', false));
$this->setRedirect(Route::_('index.php', false));

return $return;
}
Expand Down
19 changes: 11 additions & 8 deletions administrator/components/com_admin/Model/HelpModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

defined('_JEXEC') or die;

use Joomla\CMS\Help\Help as JHelp;
use Joomla\CMS\Help\Help;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\String\StringHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Factory;

/**
* Admin Component Help Model
Expand Down Expand Up @@ -72,7 +75,7 @@ public function &getHelpSearch()
{
if (is_null($this->help_search))
{
$this->help_search = \JFactory::getApplication()->input->getString('helpsearch');
$this->help_search = Factory::getApplication()->input->getString('helpsearch');
}

return $this->help_search;
Expand All @@ -89,7 +92,7 @@ public function &getPage()
{
if (is_null($this->page))
{
$this->page = JHelp::createUrl(\JFactory::getApplication()->input->get('page', 'JHELP_START_HERE'));
$this->page = Help::createUrl(Factory::getApplication()->input->get('page', 'JHELP_START_HERE'));
}

return $this->page;
Expand All @@ -106,7 +109,7 @@ public function getLangTag()
{
if (is_null($this->lang_tag))
{
$this->lang_tag = \JFactory::getLanguage()->getTag();
$this->lang_tag = Factory::getLanguage()->getTag();

if (!is_dir(JPATH_BASE . '/help/' . $this->lang_tag))
{
Expand Down Expand Up @@ -142,7 +145,7 @@ public function &getToc()
// Loop through the data array
foreach ($data as $key => $value)
{
$this->toc[$key] = \JText::_('COM_ADMIN_HELP_' . $value);
$this->toc[$key] = Text::_('COM_ADMIN_HELP_' . $value);
}

// Sort the Table of Contents
Expand All @@ -153,7 +156,7 @@ public function &getToc()

// Get Help files
jimport('joomla.filesystem.folder');
$files = \JFolder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$');
$files = Folder::files(JPATH_BASE . '/help/' . $lang_tag, '\.xml$|\.html$');
$this->toc = array();

foreach ($files as $file)
Expand All @@ -173,7 +176,7 @@ public function &getToc()
}

// Translate the page title
$title = \JText::_($title);
$title = Text::_($title);

// Strip the extension
$file = preg_replace('#\.xml$|\.html$#', '', $file);
Expand Down Expand Up @@ -204,7 +207,7 @@ public function &getLatestVersionCheck()
{
$override = 'https://help.joomla.org/proxy/index.php?keyref=Help{major}{minor}:'
. 'Joomla_Version_{major}_{minor}_{maintenance}/{langcode}&lang={langcode}';
$this->latest_version_check = JHelp::createUrl('JVERSION', false, $override);
$this->latest_version_check = Help::createUrl('JVERSION', false, $override);
}

return $this->latest_version_check;
Expand Down
9 changes: 5 additions & 4 deletions administrator/components/com_admin/Model/ProfileModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Component\Users\Administrator\Model\UserModel;
use Joomla\CMS\Factory;

/**
* User model.
Expand Down Expand Up @@ -68,7 +69,7 @@ public function getForm($data = array(), $loadData = true)
}

// If the user needs to change their password, mark the password fields as required
if (\JFactory::getUser()->requireReset)
if (Factory::getUser()->requireReset)
{
$form->setFieldAttribute('password', 'required', 'true');
$form->setFieldAttribute('password2', 'required', 'true');
Expand All @@ -87,7 +88,7 @@ public function getForm($data = array(), $loadData = true)
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = \JFactory::getApplication()->getUserState('com_users.edit.user.data', array());
$data = Factory::getApplication()->getUserState('com_users.edit.user.data', array());

if (empty($data))
{
Expand All @@ -113,7 +114,7 @@ protected function loadFormData()
*/
public function getItem($pk = null)
{
return parent::getItem(\JFactory::getUser()->id);
return parent::getItem(Factory::getUser()->id);
}

/**
Expand All @@ -127,7 +128,7 @@ public function getItem($pk = null)
*/
public function save($data)
{
$user = \JFactory::getUser();
$user = Factory::getUser();

unset($data['id']);
unset($data['groups']);
Expand Down
19 changes: 11 additions & 8 deletions administrator/components/com_admin/Model/SysinfoModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\CMS\Version;
use Joomla\Registry\Registry;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Factory;

/**
* Model for the display of system information.
Expand Down Expand Up @@ -372,7 +375,7 @@ public function &getPHPInfo()
{
if (!$this->phpinfoEnabled())
{
$this->php_info = \JText::_('COM_ADMIN_PHPINFO_DISABLED');
$this->php_info = Text::_('COM_ADMIN_PHPINFO_DISABLED');

return $this->php_info;
}
Expand Down Expand Up @@ -432,7 +435,7 @@ public function getPhpInfoArray()
public function getExtensions()
{
$installed = array();
$db = \JFactory::getDbo();
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select('*')
->from($db->qn('#__extensions'));
Expand All @@ -446,12 +449,12 @@ public function getExtensions()
{
try
{
\JLog::add(\JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), \JLog::WARNING, 'jerror');
Log::add(Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()), Log::WARNING, 'jerror');
}
catch (\RuntimeException $exception)
{
\JFactory::getApplication()->enqueueMessage(
\JText::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()),
Factory::getApplication()->enqueueMessage(
Text::sprintf('JLIB_DATABASE_ERROR_FUNCTION_FAILED', $e->getCode(), $e->getMessage()),
'warning'
);
}
Expand All @@ -474,7 +477,7 @@ public function getExtensions()
$installed[$extension->name] = array(
'name' => $extension->name,
'type' => $extension->type,
'state' => $extension->enabled ? \JText::_('JENABLED') : \JText::_('JDISABLED'),
'state' => $extension->enabled ? Text::_('JENABLED') : Text::_('JDISABLED'),
'author' => 'unknown',
'version' => 'unknown',
'creationDate' => 'unknown',
Expand Down Expand Up @@ -514,7 +517,7 @@ public function getDirectory($public = false)

$this->directories = array();

$registry = \JFactory::getApplication()->getConfig();
$registry = Factory::getApplication()->getConfig();
$cparams = ComponentHelper::getParams('com_media');

$this->addDirectory('administrator/components', JPATH_ADMINISTRATOR . '/components');
Expand Down Expand Up @@ -685,7 +688,7 @@ public function &getEditor()
return $this->editor;
}

$this->editor = \JFactory::getApplication()->get('editor');
$this->editor = Factory::getApplication()->get('editor');

return $this->editor;
}
Expand Down
4 changes: 3 additions & 1 deletion administrator/components/com_admin/View/Help/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
defined('_JEXEC') or die;

use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;

/**
* HTML View class for the Admin component
Expand Down Expand Up @@ -98,6 +100,6 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
\JToolbarHelper::title(\JText::_('COM_ADMIN_HELP'), 'support help_header');
ToolbarHelper::title(Text::_('COM_ADMIN_HELP'), 'support help_header');
}
}
6 changes: 4 additions & 2 deletions administrator/components/com_admin/View/Profile/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

/**
* View class to allow users edit their own profile.
Expand Down Expand Up @@ -82,9 +84,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
\JFactory::getApplication()->input->set('hidemainmenu', 1);
Factory::getApplication()->input->set('hidemainmenu', 1);

ToolbarHelper::title(\JText::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile');
ToolbarHelper::title(Text::_('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user user-profile');

ToolbarHelper::saveGroup(
[
Expand Down
13 changes: 8 additions & 5 deletions administrator/components/com_admin/View/Sysinfo/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Joomla\CMS\Access\Exception\Notallowed;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Factory;

/**
* Sysinfo View class for the Admin component
Expand Down Expand Up @@ -73,9 +76,9 @@ class HtmlView extends BaseHtmlView
public function display($tpl = null)
{
// Access check.
if (!\JFactory::getUser()->authorise('core.admin'))
if (!Factory::getUser()->authorise('core.admin'))
{
throw new Notallowed(\JText::_('JERROR_ALERTNOAUTHOR'), 403);
throw new Notallowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}

$this->php_settings = $this->get('PhpSettings');
Expand All @@ -98,9 +101,9 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
ToolbarHelper::title(\JText::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-2 systeminfo');
ToolbarHelper::link(\JRoute::_('index.php?option=com_admin&view=sysinfo&format=text'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT', 'download');
ToolbarHelper::link(\JRoute::_('index.php?option=com_admin&view=sysinfo&format=json'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON', 'download');
ToolbarHelper::title(Text::_('COM_ADMIN_SYSTEM_INFORMATION'), 'info-2 systeminfo');
ToolbarHelper::link(Route::_('index.php?option=com_admin&view=sysinfo&format=text'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_TEXT', 'download');
ToolbarHelper::link(Route::_('index.php?option=com_admin&view=sysinfo&format=json'), 'COM_ADMIN_DOWNLOAD_SYSTEM_INFORMATION_JSON', 'download');
ToolbarHelper::help('JHELP_SITE_SYSTEM_INFORMATION');
}
}
8 changes: 5 additions & 3 deletions administrator/components/com_admin/View/Sysinfo/JsonView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

use Joomla\CMS\Access\Exception\Notallowed;
use Joomla\CMS\MVC\View\AbstractView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

/**
* Sysinfo View class for the Admin component
Expand All @@ -32,9 +34,9 @@ class JsonView extends AbstractView
public function display($tpl = null)
{
// Access check.
if (!\JFactory::getUser()->authorise('core.admin'))
if (!Factory::getUser()->authorise('core.admin'))
{
throw new Notallowed(\JText::_('JERROR_ALERTNOAUTHOR'), 403);
throw new Notallowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}

header('MIME-Version: 1.0');
Expand All @@ -45,7 +47,7 @@ public function display($tpl = null)

echo json_encode($data);

\JFactory::getApplication()->close();
Factory::getApplication()->close();
}

/**
Expand Down
20 changes: 11 additions & 9 deletions administrator/components/com_admin/View/Sysinfo/TextView.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

use Joomla\CMS\Access\Exception\Notallowed;
use Joomla\CMS\MVC\View\AbstractView;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;

/**
* Sysinfo View class for the Admin component
Expand All @@ -32,9 +34,9 @@ class TextView extends AbstractView
public function display($tpl = null)
{
// Access check.
if (!\JFactory::getUser()->authorise('core.admin'))
if (!Factory::getUser()->authorise('core.admin'))
{
throw new Notallowed(\JText::_('JERROR_ALERTNOAUTHOR'), 403);
throw new Notallowed(Text::_('JERROR_ALERTNOAUTHOR'), 403);
}

header('Content-Type: text/plain; charset=utf-8');
Expand Down Expand Up @@ -62,7 +64,7 @@ public function display($tpl = null)

echo str_replace(JPATH_ROOT, 'xxxxxx', implode("\n\n", $lines));

\JFactory::getApplication()->close();
Factory::getApplication()->close();
}

/**
Expand All @@ -79,27 +81,27 @@ protected function getLayoutData()

return array(
'info' => array(
'title' => \JText::_('COM_ADMIN_SYSTEM_INFORMATION', true),
'title' => Text::_('COM_ADMIN_SYSTEM_INFORMATION', true),
'data' => $model->getSafeData('info')
),
'phpSettings' => array(
'title' => \JText::_('COM_ADMIN_PHP_SETTINGS', true),
'title' => Text::_('COM_ADMIN_PHP_SETTINGS', true),
'data' => $model->getSafeData('phpSettings')
),
'config' => array(
'title' => \JText::_('COM_ADMIN_CONFIGURATION_FILE', true),
'title' => Text::_('COM_ADMIN_CONFIGURATION_FILE', true),
'data' => $model->getSafeData('config')
),
'directories' => array(
'title' => \JText::_('COM_ADMIN_DIRECTORY_PERMISSIONS', true),
'title' => Text::_('COM_ADMIN_DIRECTORY_PERMISSIONS', true),
'data' => $model->getSafeData('directory', true)
),
'phpInfo' => array(
'title' => \JText::_('COM_ADMIN_PHP_INFORMATION', true),
'title' => Text::_('COM_ADMIN_PHP_INFORMATION', true),
'data' => $model->getSafeData('phpInfoArray')
),
'extensions' => array(
'title' => \JText::_('COM_ADMIN_EXTENSIONS', true),
'title' => Text::_('COM_ADMIN_EXTENSIONS', true),
'data' => $model->getSafeData('extensions')
)
);
Expand Down

0 comments on commit 5d17c4c

Please sign in to comment.