Skip to content

Commit

Permalink
Merge branch '4.0-dev' into 4.0_sticky-header
Browse files Browse the repository at this point in the history
  • Loading branch information
infograf768 committed Jan 26, 2020
2 parents 236c7d3 + 9daead9 commit ee5db3d
Show file tree
Hide file tree
Showing 141 changed files with 3,083 additions and 3,183 deletions.
3,129 changes: 1,596 additions & 1,533 deletions administrator/components/com_admin/script.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<?php echo $key; ?>
</th>
<td>
<?php if (is_bool($value)) : ?>
<?php $value = $value === true ? 'true' : 'false'; ?>
<?php endif; ?>
<?php echo htmlspecialchars($value, ENT_QUOTES); ?>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public static function getAssociationHtmlList($extensionName, $typeName, $itemId
. htmlspecialchars($title, ENT_QUOTES, 'UTF-8') . '<br><br>' . $additional;
$classes = 'badge ' . $labelClass;

$items[$langCode]['link'] = '<a href="' . $url . '" title="' . $language->title . '" class="' . $classes . '">' . $text . '</a>'
$items[$langCode]['link'] = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>'
. '<div role="tooltip">' . $tooltip . '</div>';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function association($catid, $extension = 'com_content')
. htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8');
$classes = 'badge badge-secondary';

$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '">' . $text . '</a>'
$item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>'
. '<div role="tooltip" id="tip-' . (int) $catid . '-' . (int) $item->id . '">' . $tooltip . '</div>';
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,25 @@
</th>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=1' . '&filter[level]=1'); ?>">
<a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=1&filter[level]=1'); ?>">
<?php echo $item->count_published; ?></a>
</td>
<?php endif; ?>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_unpublished > 0) ? 'btn-danger' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=0' . '&filter[level]=1'); ?>">
<a class="btn <?php echo ($item->count_unpublished > 0) ? 'btn-danger' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=0&filter[level]=1'); ?>">
<?php echo $item->count_unpublished; ?></a>
</td>
<?php endif; ?>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_archived > 0) ? 'btn-info' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=2' . '&filter[level]=1'); ?>">
<a class="btn <?php echo ($item->count_archived > 0) ? 'btn-info' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=2&filter[level]=1'); ?>">
<?php echo $item->count_archived; ?></a>
</td>
<?php endif; ?>
<?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
<td class="text-center btns d-none d-md-table-cell itemnumber">
<a class="btn <?php echo ($item->count_trashed > 0) ? 'btn-dark' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=-2' . '&filter[level]=1'); ?>">
<a class="btn <?php echo ($item->count_trashed > 0) ? 'btn-dark' : 'btn-secondary'; ?>" title="<?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>" href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[' . $status . ']=-2&filter[level]=1'); ?>">
<?php echo $item->count_trashed; ?></a>
</td>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_config/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>COM_CONFIG_XML_DESCRIPTION</description>
<namespace>Joomla\Component\Config</namespace>
<namespace path="src">Joomla\Component\Config</namespace>
<files folder="site">
<folder>Controller</folder>
<folder>Dispatcher</folder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,28 @@
*/
class HtmlView extends BaseHtmlView
{
/**
* The model state
*
* @var \Joomla\CMS\Object\CMSObject
* @since 3.2
*/
public $state;

/**
* The form object
*
* @var \Joomla\CMS\Form\Form
* @since 3.2
*/
public $form;

/**
* The data to be displayed in the form
*
* @var array
* @since 3.2
*/
public $data;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,28 @@
*/
class HtmlView extends BaseHtmlView
{
/**
* The model state
*
* @var \Joomla\CMS\Object\CMSObject
* @since 3.2
*/
public $state;

/**
* The form object
*
* @var \Joomla\CMS\Form\Form
* @since 3.2
*/
public $form;

/**
* An object with the information for the component
*
* @var \Joomla\CMS\Component\ComponentRecord
* @since 3.2
*/
public $component;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
<!-- End Sidebar -->
<!-- Begin Content -->
<div class="col-lg-9 mt-2">
<div class="col-md-9 mt-2">
<?php echo HTMLHelper::_('uitab.startTabSet', 'configTabs', array('active' => 'page-site')); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'configTabs', 'page-site', Text::_('JSITE')); ?>
<?php echo $this->loadTemplate('site'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</div>
<?php // End Sidebar ?>

<div class="col-md-9" id="config">
<div class="col-md-9 mt-2" id="config">
<?php if ($this->fieldsets) : ?>
<?php $opentab = 0; ?>

Expand All @@ -75,7 +75,7 @@
<?php $label = empty($fieldSet->label) ? 'COM_CONFIG_' . $name . '_FIELDSET_LABEL' : $fieldSet->label; ?>

<?php if (!$isGrandchild && $hasParent) : ?>
<fieldset id="fieldset-<?php echo $this->escape($name); ?>" class="options-grid-form options-grid-form-full options-menu">
<fieldset id="fieldset-<?php echo $this->escape($name); ?>" class="options-menu options-form">
<legend><?php echo Text::_($fieldSet->label); ?></legend>
<div>
<?php elseif (!$hasParent) : ?>
Expand All @@ -96,7 +96,7 @@

<?php if (!$hasChildren) : ?>

<fieldset id="fieldset-<?php echo $this->escape($name); ?>" class="options-grid-form options-grid-form-full options-menu">
<fieldset id="fieldset-<?php echo $this->escape($name); ?>" class="options-menu options-form">
<legend><?php echo Text::_($fieldSet->label); ?></legend>
<div>
<?php $opentab = 2; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function association($contactid)
. htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'badge badge-secondary';

$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '">' . $text . '</a>'
$item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>'
. '<div role="tooltip" id="tip-' . (int) $contactid . '-' . (int) $item->id . '">' . $tooltip . '</div>';
}
else
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_contact/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
label="COM_CONTACT_FIELD_SHOW_INFO_LABEL"
default="1"
>
<option value="1">JSHOW</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>

<field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ protected function getTableNameForSection(string $section = null)
*
* @since 4.0.0
*/
public function getWorkflowTableBySection(string $section = null) : string
public function getWorkflowTableBySection(?string $section = null): string
{
return '#__content';
}
Expand All @@ -204,7 +204,7 @@ public function getWorkflowTableBySection(string $section = null) : string
*
* @since 4.0.0
*/
public function filterTransitions($transitions, $pk): array
public function filterTransitions(array $transitions, int $pk): array
{
return ContentHelper::filterTransitions($transitions, $pk);
}
Expand Down Expand Up @@ -283,7 +283,7 @@ public function prepareForm(Form $form, $data)
*
* @since 4.0.0
*/
public static function updateContentState($pks, $condition): bool
public static function updateContentState(array $pks, int $condition): bool
{
return ContentHelper::updateContentState($pks, $condition);
}
Expand Down
10 changes: 5 additions & 5 deletions administrator/components/com_content/Helper/ContentHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ class ContentHelper extends \Joomla\CMS\Helper\ContentHelper
/**
* Check if state can be deleted
*
* @param int $stateID Id of state to delete
* @param int $id Id of state to delete
*
* @return boolean
*
* @since 4.0.0
*/
public static function canDeleteState($stateID)
public static function canDeleteState(int $id): bool
{
$db = Factory::getDbo();
$query = $db->getQuery(true);

$query->select('id')
->from($db->quoteName('#__content'))
->where('state = ' . (int) $stateID);
->where('state = ' . $id);
$db->setQuery($query);
$states = $db->loadResult();

Expand All @@ -58,7 +58,7 @@ public static function canDeleteState($stateID)
*
* @since 4.0.0
*/
public static function filterTransitions($transitions, $pk, $workflow_id = 0): array
public static function filterTransitions(array $transitions, int $pk, int $workflow_id = 0): array
{
return array_values(
array_filter(
Expand All @@ -81,7 +81,7 @@ function ($var) use ($pk, $workflow_id)
*
* @since 4.0.0
*/
public static function updateContentState($pks, $condition): bool
public static function updateContentState(array $pks, int $condition): bool
{
if (empty($pks))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected function batchWorkflowStage(int $value, array $pks, array $contexts)
$workflow = new Workflow(['extension' => 'com_content']);

// Update content state value and workflow associations
return ContentHelper::updateContentState($pks, $stage->condition)
return ContentHelper::updateContentState($pks, (int) $stage->condition)
&& $workflow->updateAssociations($pks, $value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function association($articleid)
. htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8') . '<br>' . Text::sprintf('JCATEGORY_SPRINTF', $item->category_title);
$classes = 'badge badge-secondary';

$item->link = '<a href="' . $url . '" title="' . $item->language_title . '" class="' . $classes . '">' . $text . '</a>'
$item->link = '<a href="' . $url . '" class="' . $classes . '">' . $text . '</a>'
. '<div role="tooltip" id="tip-' . (int) $articleid . '-' . (int) $item->id . '">' . $tooltip . '</div>';
}
else
Expand Down
1 change: 0 additions & 1 deletion administrator/components/com_content/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@
name="record_hits"
type="radio"
label="JGLOBAL_RECORD_HITS_LABEL"
description="JGLOBAL_RECORD_HITS_DESC"
class="switcher"
default="1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
$canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id);
$canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId;

$transitions = ContentHelper::filterTransitions($this->transitions, $item->stage_id, $item->workflow_id);
$transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id);

$publish = 0;
$unpublish = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
$canEditParCat = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id);
$canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId;

$transitions = ContentHelper::filterTransitions($this->transitions, $item->stage_id, $item->workflow_id);
$transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id);

$publish = 0;
$unpublish = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Session\Session;
use Joomla\Component\Finder\Administrator\Response\Response;

// Register dependent classes.
\JLoader::register('FinderIndexer', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/indexer.php');
Expand Down Expand Up @@ -316,7 +317,7 @@ public static function sendResponse($data = null)
}

// Create the response object.
$response = new FinderIndexerResponse($data);
$response = new Response($data);

// Add the buffer.
$response->buffer = \JDEBUG ? ob_get_contents() : ob_end_clean();
Expand All @@ -325,83 +326,3 @@ public static function sendResponse($data = null)
echo json_encode($response);
}
}

/**
* Finder Indexer JSON Response Class
*
* @since 2.5
*/
class FinderIndexerResponse
{
/**
* Class Constructor
*
* @param mixed $state The processing state for the indexer
*
* @since 2.5
*/
public function __construct($state)
{
$params = ComponentHelper::getParams('com_finder');

if ($params->get('enable_logging', '0'))
{
$options['format'] = '{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}';
$options['text_file'] = 'indexer.php';
Log::addLogger($options);
}

// The old token is invalid so send a new one.
$this->token = Factory::getSession()->getFormToken();

// Check if we are dealing with an error.
if ($state instanceof \Exception)
{
// Log the error
try
{
Log::add($state->getMessage(), Log::ERROR);
}
catch (\RuntimeException $exception)
{
// Informational log only
}

// Prepare the error response.
$this->error = true;
$this->header = Text::_('COM_FINDER_INDEXER_HEADER_ERROR');
$this->message = $state->getMessage();
}
else
{
// Prepare the response data.
$this->batchSize = (int) $state->batchSize;
$this->batchOffset = (int) $state->batchOffset;
$this->totalItems = (int) $state->totalItems;
$this->pluginState = $state->pluginState;

$this->startTime = $state->startTime;
$this->endTime = Factory::getDate()->toSql();

$this->start = !empty($state->start) ? (int) $state->start : 0;
$this->complete = !empty($state->complete) ? (int) $state->complete : 0;

// Set the appropriate messages.
if ($this->totalItems <= 0 && $this->complete)
{
$this->header = Text::_('COM_FINDER_INDEXER_HEADER_COMPLETE');
$this->message = Text::_('COM_FINDER_INDEXER_MESSAGE_COMPLETE');
}
elseif ($this->totalItems <= 0)
{
$this->header = Text::_('COM_FINDER_INDEXER_HEADER_OPTIMIZE');
$this->message = Text::_('COM_FINDER_INDEXER_MESSAGE_OPTIMIZE');
}
else
{
$this->header = Text::_('COM_FINDER_INDEXER_HEADER_RUNNING');
$this->message = Text::_('COM_FINDER_INDEXER_MESSAGE_RUNNING');
}
}
}
}

0 comments on commit ee5db3d

Please sign in to comment.