Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
Expand All @@ -9,8 +10,6 @@

namespace Joomla\Component\Actionlogs\Administrator\View\Actionlogs;

\defined('_JEXEC') or die;

use Exception;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Form\Form;
Expand All @@ -23,6 +22,10 @@
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
use Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* View class for a list of logs.
*
Expand Down Expand Up @@ -110,8 +113,7 @@ public function display($tpl = null)
$this->showIpColumn = (bool) $params->get('ip_logging', 0);
$this->dateRelative = (bool) $params->get('date_relative', 1);

if (\count($errors = $model->getErrors()))
{
if (\count($errors = $model->getErrors())) {
throw new GenericDataException(implode("\n", $errors), 500);
}

Expand Down
189 changes: 95 additions & 94 deletions administrator/components/com_actionlogs/tmpl/actionlogs/default.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_actionlogs
Expand All @@ -24,106 +25,106 @@
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = $this->document->getWebAssetManager();
$wa->useScript('keepalive')
->useScript('table.columns')
->useScript('multiselect')
->useScript('com_actionlogs.admin-actionlogs');
->useScript('table.columns')
->useScript('multiselect')
->useScript('com_actionlogs.admin-actionlogs');

?>

<form action="<?php echo Route::_('index.php?option=com_actionlogs&view=actionlogs'); ?>" method="post" name="adminForm" id="adminForm">
<div id="j-main-container" class="j-main-container">
<?php // Search tools bar ?>
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table" id="logsList">
<caption class="visually-hidden">
<?php echo Text::_('COM_ACTIONLOGS_TABLE_CAPTION'); ?>,
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
</caption>
<thead>
<tr>
<td class="w-1 text-center">
<?php echo HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" class="d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_ACTION', 'a.message', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-15 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_EXTENSION', 'a.extension', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-15 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_DATE', 'a.log_date', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-10 d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_NAME', 'a.user_id', $listDirn, $listOrder); ?>
</th>
<?php if ($this->showIpColumn) : ?>
<th scope="col" class="w-10 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_IP_ADDRESS', 'a.ip_address', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th scope="col" class="w-1 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $item) :
$extension = strtok($item->extension, '.');
ActionlogsHelper::loadTranslationFiles($extension); ?>
<tr class="row<?php echo $i % 2; ?>">
<td class="text-center">
<?php echo HTMLHelper::_('grid.id', $i, $item->id); ?>
</td>
<th scope="row" class="d-md-table-cell">
<?php echo ActionlogsHelper::getHumanReadableLogMessage($item); ?>
</th>
<td class="d-none d-md-table-cell">
<?php echo $this->escape(Text::_($extension)); ?>
</td>
<td class="d-none d-md-table-cell">
<?php if ($this->dateRelative) : ?>
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
<div class="small">
<?php endif; ?>
<?php echo HTMLHelper::_('date', $item->log_date, Text::_('DATE_FORMAT_LC6')); ?>
<?php if ($this->dateRelative) : ?>
</div>
<?php endif; ?>
</td>
<td class="d-md-table-cell">
<?php echo $this->escape($item->name); ?>
</td>
<?php if ($this->showIpColumn) : ?>
<td class="d-none d-md-table-cell">
<?php echo Text::_($this->escape($item->ip_address)); ?>
</td>
<?php endif;?>
<td class="d-none d-md-table-cell">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div id="j-main-container" class="j-main-container">
<?php // Search tools bar ?>
<?php echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]); ?>
<?php if (empty($this->items)) : ?>
<div class="alert alert-info">
<span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
</div>
<?php else : ?>
<table class="table" id="logsList">
<caption class="visually-hidden">
<?php echo Text::_('COM_ACTIONLOGS_TABLE_CAPTION'); ?>,
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
</caption>
<thead>
<tr>
<td class="w-1 text-center">
<?php echo HTMLHelper::_('grid.checkall'); ?>
</td>
<th scope="col" class="d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_ACTION', 'a.message', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-15 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_EXTENSION', 'a.extension', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-15 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_DATE', 'a.log_date', $listDirn, $listOrder); ?>
</th>
<th scope="col" class="w-10 d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_NAME', 'a.user_id', $listDirn, $listOrder); ?>
</th>
<?php if ($this->showIpColumn) : ?>
<th scope="col" class="w-10 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'COM_ACTIONLOGS_IP_ADDRESS', 'a.ip_address', $listDirn, $listOrder); ?>
</th>
<?php endif; ?>
<th scope="col" class="w-1 d-none d-md-table-cell">
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->items as $i => $item) :
$extension = strtok($item->extension, '.');
ActionlogsHelper::loadTranslationFiles($extension); ?>
<tr class="row<?php echo $i % 2; ?>">
<td class="text-center">
<?php echo HTMLHelper::_('grid.id', $i, $item->id); ?>
</td>
<th scope="row" class="d-md-table-cell">
<?php echo ActionlogsHelper::getHumanReadableLogMessage($item); ?>
</th>
<td class="d-none d-md-table-cell">
<?php echo $this->escape(Text::_($extension)); ?>
</td>
<td class="d-none d-md-table-cell">
<?php if ($this->dateRelative) : ?>
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
<div class="small">
<?php endif; ?>
<?php echo HTMLHelper::_('date', $item->log_date, Text::_('DATE_FORMAT_LC6')); ?>
<?php if ($this->dateRelative) : ?>
</div>
<?php endif; ?>
</td>
<td class="d-md-table-cell">
<?php echo $this->escape($item->name); ?>
</td>
<?php if ($this->showIpColumn) : ?>
<td class="d-none d-md-table-cell">
<?php echo Text::_($this->escape($item->ip_address)); ?>
</td>
<?php endif;?>
<td class="d-none d-md-table-cell">
<?php echo (int) $item->id; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

<?php // Load the pagination. ?>
<?php echo $this->pagination->getListFooter(); ?>
<?php // Load the pagination. ?>
<?php echo $this->pagination->getListFooter(); ?>

<?php endif;?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo HTMLHelper::_('form.token'); ?>
</div>
<?php endif;?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>
<form action="<?php echo Route::_('index.php?option=com_actionlogs&view=actionlogs'); ?>" method="post" name="exportForm" id="exportForm">
<input type="hidden" name="task" value="" />
<input type="hidden" name="cids" value="" />
<?php echo HTMLHelper::_('form.token'); ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="cids" value="" />
<?php echo HTMLHelper::_('form.token'); ?>
</form>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_admin
Expand All @@ -9,7 +10,9 @@

namespace Joomla\Component\Admin\Administrator\Service\HTML;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* Class for rendering configuration values
Expand All @@ -29,13 +32,11 @@ class Configuration
*/
public function value($value): string
{
if (\is_bool($value))
{
if (\is_bool($value)) {
return $value ? 'true' : 'false';
}

if (\is_array($value))
{
if (\is_array($value)) {
$value = implode(', ', $value);
}

Expand Down
19 changes: 9 additions & 10 deletions administrator/components/com_cache/src/View/Cache/HtmlView.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package Joomla.Administrator
* @subpackage com_cache
Expand All @@ -9,8 +10,6 @@

namespace Joomla\Component\Cache\Administrator\View\Cache;

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
Expand All @@ -22,6 +21,10 @@
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\Cache\Administrator\Model\CacheModel;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
* HTML View class for the Cache component
*
Expand Down Expand Up @@ -100,13 +103,11 @@ public function display($tpl = null): void
$this->activeFilters = $model->getActiveFilters();

// Check for errors.
if (\count($errors = $this->get('Errors')))
{
if (\count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500);
}

if (!\count($this->data))
{
if (!\count($this->data)) {
$this->setLayout('emptystate');
}

Expand All @@ -129,16 +130,14 @@ protected function addToolbar(): void
// Get the toolbar object instance
$toolbar = Toolbar::getInstance('toolbar');

if (\count($this->data))
{
if (\count($this->data)) {
ToolbarHelper::custom('delete', 'delete', '', 'JTOOLBAR_DELETE', true);
ToolbarHelper::custom('deleteAll', 'remove', '', 'JTOOLBAR_DELETE_ALL', false);
$toolbar->appendButton('Confirm', 'COM_CACHE_RESOURCE_INTENSIVE_WARNING', 'delete', 'COM_CACHE_PURGE_EXPIRED', 'purge', false);
ToolbarHelper::divider();
}

if ($this->getCurrentUser()->authorise('core.admin', 'com_cache'))
{
if ($this->getCurrentUser()->authorise('core.admin', 'com_cache')) {
ToolbarHelper::preferences('com_cache');
ToolbarHelper::divider();
}
Expand Down
Loading