29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-07-12 15:03:39 +00:00

[4.0] Codestyle fixes for new CMS codestyle Batch 5/16 (#25456)

This commit is contained in:
Hannes Papenberg 2019-07-11 22:44:58 +02:00 committed by George Wilson
parent 556a2b301a
commit 8ab6fe0c90
20 changed files with 116 additions and 94 deletions

View File

@ -51,7 +51,8 @@ class TagsController extends AdminController
$this->setRedirect(Route::_('index.php?option=com_tags&view=tags', false));
/* @var \Joomla\Component\Tags\Administrator\Model\TagModel $model */
/** @var \Joomla\Component\Tags\Administrator\Model\TagModel $model */
$model = $this->getModel();
if ($model->rebuild())

View File

@ -243,7 +243,8 @@ class TagModel extends AdminModel
*/
public function save($data)
{
/* @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
/** @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
$table = $this->getTable();
$input = Factory::getApplication()->input;
$pk = (!empty($data['id'])) ? $data['id'] : (int) $this->getState($this->getName() . '.id');
@ -364,7 +365,8 @@ class TagModel extends AdminModel
public function rebuild()
{
// Get an instance of the table object.
/* @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
/** @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
$table = $this->getTable();
if (!$table->rebuild())
@ -395,7 +397,8 @@ class TagModel extends AdminModel
public function saveorder($idArray = null, $lft_array = null)
{
// Get an instance of the table object.
/* @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
/** @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
$table = $this->getTable();
if (!$table->saveorder($idArray, $lft_array))
@ -425,7 +428,8 @@ class TagModel extends AdminModel
protected function generateNewTitle($parent_id, $alias, $title)
{
// Alter the title & alias
/* @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
/** @var \Joomla\Component\Tags\Administrator\Table\Tag $table */
$table = $this->getTable();
while ($table->load(array('alias' => $alias, 'parent_id' => $parent_id)))

View File

@ -135,11 +135,11 @@ class HtmlView extends BaseHtmlView
if ($canDo->get('core.edit.state') || $canDo->get('core.admin'))
{
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fa fa-globe')
->buttonClass('btn btn-info')
->listCheck(true);
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fa fa-globe')
->buttonClass('btn btn-info')
->listCheck(true);
$childBar = $dropdown->getChildToolbar();

View File

@ -136,20 +136,20 @@ class HtmlView extends BaseHtmlView
if ($canDo->get('core.edit.state') || $canDo->get('core.admin'))
{
$dropdown = $toolbar->dropdownButton('status-group')
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fa fa-globe')
->buttonClass('btn btn-info')
->listCheck(true);
->text('JTOOLBAR_CHANGE_STATUS')
->toggleSplit(false)
->icon('fa fa-globe')
->buttonClass('btn btn-info')
->listCheck(true);
$childBar = $dropdown->getChildToolbar();
$childBar->publish('users.activate', 'COM_USERS_TOOLBAR_ACTIVATE', true);
$childBar->unpublish('users.block', 'COM_USERS_TOOLBAR_BLOCK', true);
$childBar->standardButton('unblock')
->text('COM_USERS_TOOLBAR_UNBLOCK')
->task('users.unblock')
->listCheck(true);
->text('COM_USERS_TOOLBAR_UNBLOCK')
->task('users.unblock')
->listCheck(true);
}
// Add a batch button

View File

@ -59,6 +59,7 @@ class WorkflowsController extends AdminController
throw new \InvalidArgumentException(Text::_('COM_WORKFLOW_ERROR_EXTENSION_NOT_SET'));
}
}
$this->registerTask('unsetDefault', 'setDefault');
}

View File

@ -40,11 +40,11 @@ if ($saveOrder)
<form action="<?php echo Route::_('index.php?option=com_workflow&view=stages&workflow_id=' . (int) $this->workflowID . '&extension=' . $this->extension); ?>" method="post" name="adminForm" id="adminForm">
<div class="row">
<?php if (!empty($this->sidebar)) : ?>
<div id="j-sidebar-container" class="col-md-2">
<div id="j-sidebar-container" class="col-md-2">
<?php echo $this->sidebar; ?>
</div>
</div>
<?php endif; ?>
<div class="<?php if (!empty($this->sidebar)) {echo 'col-md-10'; } else { echo 'col-md-12'; } ?>">
<div class="<?php if (!empty($this->sidebar)) {echo 'col-md-10'; } else { echo 'col-md-12'; } ?>">
<div id="j-main-container" class="j-main-container">
<?php
// Search tools bar

View File

@ -44,7 +44,7 @@ if ($saveOrder)
<?php echo $this->sidebar; ?>
</div>
<?php endif; ?>
<div class="<?php if (!empty($this->sidebar)) {echo 'col-md-10'; } else { echo 'col-md-12'; } ?>">
<div class="<?php if (!empty($this->sidebar)) {echo 'col-md-10'; } else { echo 'col-md-12'; } ?>">
<div id="j-main-container" class="j-main-container">
<?php
// Search tools bar

View File

@ -47,11 +47,11 @@ $userId = $user->id;
<form action="<?php echo Route::_('index.php?option=com_workflow&view=workflows&extension=' . $extension); ?>" method="post" name="adminForm" id="adminForm">
<div class="row">
<?php if (!empty($this->sidebar)) : ?>
<div id="j-sidebar-container" class="col-md-2">
<div id="j-sidebar-container" class="col-md-2">
<?php echo $this->sidebar; ?>
</div>
</div>
<?php endif; ?>
<div class="<?php if (!empty($this->sidebar)) {echo 'col-md-10'; } else { echo 'col-md-12'; } ?>">
<div class="<?php if (!empty($this->sidebar)) {echo 'col-md-10'; } else { echo 'col-md-12'; } ?>">
<div id="j-main-container" class="j-main-container">
<?php
// Search tools bar

View File

@ -188,9 +188,11 @@ class CategoryModel extends ListModel
if ($this->getState('filter.publish_date'))
{
$query->where('(' . $query->isNullDatetime($db->quoteName('a.publish_up'))
. ' OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)')
. ' OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)'
)
->where('(' . $query->isNullDatetime($db->quoteName('a.publish_down'))
. ' OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)')
. ' OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)'
)
->bind(':publish_up', $nowDate)
->bind(':publish_down', $nowDate);
}
@ -222,7 +224,7 @@ class CategoryModel extends ListModel
elseif ($this->getState('list.ordering') === 'featuredordering')
{
$query->order($db->escape('a.featured') . ' DESC')
->order($db->escape('a.ordering') . ' ASC');
->order($db->escape('a.ordering') . ' ASC');
}
else
{
@ -436,16 +438,16 @@ class CategoryModel extends ListModel
}
/**
* Generate column expression for slug or catslug.
*
* @param \JDatabaseQuery $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
* @since 4.0.0
*/
* Generate column expression for slug or catslug.
*
* @param \JDatabaseQuery $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
* @since 4.0.0
*/
private function getSlugColumn($query, $id, $alias)
{
return 'CASE WHEN '

View File

@ -356,9 +356,11 @@ class ContactModel extends FormModel
{
$query->where('a.state IN (1,2)')
->where('(' . $db->quoteName('a.publish_up') . ' = :null' .
' OR ' . $db->quoteName('a.publish_up') . ' <= :now' . ')')
' OR ' . $db->quoteName('a.publish_up') . ' <= :now' . ')'
)
->where('(' . $db->quoteName('a.publish_down') . ' = :null' .
' OR ' . $db->quoteName('a.publish_down') . ' >= :now' . ')')
' OR ' . $db->quoteName('a.publish_down') . ' >= :now' . ')'
)
->bind(':null', $nullDate)
->bind(':now', $nowDate);
}
@ -410,16 +412,16 @@ class ContactModel extends FormModel
}
/**
* Generate column expression for slug or catslug.
*
* @param QueryInterface $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
* @since 4.0.0
*/
* Generate column expression for slug or catslug.
*
* @param QueryInterface $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
* @since 4.0.0
*/
private function getSlugColumn($query, $id, $alias)
{
return 'CASE WHEN '

View File

@ -122,9 +122,11 @@ class FeaturedModel extends ListModel
$nowDate = $db->quote($date->toSql());
$query->where('(' . $query->isNullDatetime($db->quoteName('a.publish_up')) .
' OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)')
' OR ' . $db->quoteName('a.publish_up') . ' <= :publish_up)'
)
->where('(' . $query->isNullDatetime($db->quoteName('a.publish_down')) .
' OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)')
' OR ' . $db->quoteName('a.publish_down') . ' >= :publish_down)'
)
->bind(':publish_up', $nowDate)
->bind(':publish_down', $nowDate);
}

View File

@ -44,7 +44,7 @@ class HtmlView extends CategoryView
/**
* Run the standard Joomla plugins
*
* @var bool
* @var boolean
* @since 3.5
*/
protected $runPlugins = true;

View File

@ -65,7 +65,7 @@ class HtmlView extends BaseHtmlView
/**
* Should we show a captcha form for the submission of the contact request?
*
* @var bool
* @var boolean
* @since 3.6.3
*/
protected $captchaEnabled = false;

View File

@ -14,7 +14,7 @@ use Joomla\CMS\Layout\LayoutHelper;
?>
<div class="com-contact-category">
<?php
<?php
$this->subtemplatename = 'items';
echo LayoutHelper::render('joomla.content.category_default', $this);
?>

View File

@ -24,20 +24,20 @@ HTMLHelper::_('behavior.core');
<?php if ($this->params->get('filter_field')) : ?>
<div class="com-contact-category__filter btn-group">
<label class="filter-search-lbl sr-only" for="filter-search">
<span class="badge badge-warning">
<?php echo Text::_('JUNPUBLISHED'); ?>
</span>
<?php echo Text::_('COM_CONTACT_FILTER_LABEL') . '&#160;'; ?>
</label>
<span class="badge badge-warning">
<?php echo Text::_('JUNPUBLISHED'); ?>
</span>
<?php echo Text::_('COM_CONTACT_FILTER_LABEL') . '&#160;'; ?>
</label>
<input
type="text"
name="filter-search"
id="filter-search"
value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
class="inputbox" onchange="document.adminForm.submit();"
title="<?php echo Text::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo Text::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
>
type="text"
name="filter-search"
id="filter-search"
value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
class="inputbox" onchange="document.adminForm.submit();"
title="<?php echo Text::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
placeholder="<?php echo Text::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
>
</div>
<?php endif; ?>
@ -51,11 +51,11 @@ HTMLHelper::_('behavior.core');
<?php endif; ?>
</fieldset>
<?php endif; ?>
<?php if (empty($this->items)) : ?>
<p>
<?php echo Text::_('COM_CONTACT_NO_CONTACTS'); ?>
</p>
<?php else : ?>
<?php if (empty($this->items)) : ?>
<p>
<?php echo Text::_('COM_CONTACT_NO_CONTACTS'); ?>
</p>
<?php else : ?>
<ul class="com-contact-category__list category row-striped">
<?php foreach ($this->items as $i => $item) : ?>
@ -127,7 +127,7 @@ HTMLHelper::_('behavior.core');
<?php endif; ?>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
<?php if ($this->params->get('show_pagination', 2)) : ?>
<div class="com-contact-category__counter w-100">

View File

@ -209,16 +209,16 @@ class ArchiveModel extends ArticlesModel
}
/**
* Generate column expression for slug or catslug.
*
* @param \JDatabaseQuery $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
* @since 4.0.0
*/
* Generate column expression for slug or catslug.
*
* @param \JDatabaseQuery $query Current query instance.
* @param string $id Column id name.
* @param string $alias Column alias name.
*
* @return string
*
* @since 4.0.0
*/
private function getSlugColumn($query, $id, $alias)
{
return 'CASE WHEN '

View File

@ -119,7 +119,8 @@ class ArticleModel extends ItemModel
// Join on category table.
$query->select('c.title AS category_title, c.alias AS category_alias, c.access AS category_access,' .
'c.language AS category_language')
'c.language AS category_language'
)
->innerJoin('#__categories AS c on c.id = a.catid')
->where('c.published > 0');
@ -135,7 +136,8 @@ class ArticleModel extends ItemModel
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route,' .
'parent.alias as parent_alias, parent.language as parent_language')
'parent.alias as parent_alias, parent.language as parent_language'
)
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
// Join on voting table

View File

@ -251,7 +251,8 @@ class ArticlesModel extends ListModel
// Join over the categories.
$query->select('c.title AS category_title, c.path AS category_route, c.access AS category_access, c.alias AS category_alias,' .
'c.language AS category_language')
'c.language AS category_language'
)
->select('c.published, c.published AS parents_published, c.lft')
->join('LEFT', '#__categories AS c ON c.id = a.catid');
@ -263,14 +264,16 @@ class ArticlesModel extends ListModel
// Join over the categories to get parent category titles
$query->select('parent.title as parent_title, parent.id as parent_id, parent.path as parent_route, parent.alias as parent_alias,' .
'parent.language as parent_language')
'parent.language as parent_language'
)
->join('LEFT', '#__categories as parent ON parent.id = c.parent_id');
if (PluginHelper::isEnabled('content', 'vote'))
{
// Join on voting table
$query->select('COALESCE(NULLIF(ROUND(v.rating_sum / v.rating_count, 0), 0), 0) AS rating,
COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count')
COALESCE(NULLIF(v.rating_count, 0), 0) as rating_count'
)
->join('LEFT', '#__content_rating AS v ON a.id = v.content_id');
}
@ -292,7 +295,8 @@ class ArticlesModel extends ListModel
* Or categogy is published then article has to be archived.
*/
$query->where('((c.published = 2 AND ws.condition > ' . (int) ContentComponent::CONDITION_UNPUBLISHED .
') OR (c.published = 1 AND ws.condition = ' . (int) ContentComponent::CONDITION_ARCHIVED . '))');
') OR (c.published = 1 AND ws.condition = ' . (int) ContentComponent::CONDITION_ARCHIVED . '))'
);
}
elseif (is_numeric($condition))
{

View File

@ -27,9 +27,9 @@ $listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$langFilter = false;
// Tags filtering based on language filter
// Tags filtering based on language filter
if (($this->params->get('filter_field') === 'tag') && (Multilanguage::isEnabled()))
{
{
$tagfilter = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter');
switch ($tagfilter)

View File

@ -429,7 +429,8 @@ class SearchModel extends ListModel
$this->setState('list.start', $input->get('limitstart', 0, 'uint'));
$this->setState('list.limit', $input->get('limit', $app->get('list_limit', 20), 'uint'));
/* Load the sort ordering.
/*
* Load the sort ordering.
* Currently this is 'hard' coded via menu item parameter but may not satisfy a users need.
* More flexibility was way more user friendly. So we allow the user to pass a custom value
* from the pool of fields that are indexed like the 'title' field.
@ -437,6 +438,7 @@ class SearchModel extends ListModel
*/
$order = $input->getWord('filter_order', $params->get('sort_order', 'relevance'));
$order = StringHelper::strtolower($order);
switch ($order)
{
case 'date':
@ -461,13 +463,15 @@ class SearchModel extends ListModel
break;
}
/* Load the sort direction.
/*
* Load the sort direction.
* Currently this is 'hard' coded via menu item parameter but may not satisfy a users need.
* More flexibility was way more user friendly. So we allow to be inverted.
* Also, we allow this parameter to be passed in either case (lower/upper).
*/
$dirn = $input->getWord('filter_order_Dir', $params->get('sort_direction', 'desc'));
$dirn = StringHelper::strtolower($dirn);
switch ($dirn)
{
case 'asc':