diff --git a/components/com_content/src/View/Category/FeedView.php b/components/com_content/src/View/Category/FeedView.php index 57e3f913e1e31..744b51c585845 100644 --- a/components/com_content/src/View/Category/FeedView.php +++ b/components/com_content/src/View/Category/FeedView.php @@ -13,6 +13,7 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\MVC\View\CategoryFeedView; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; @@ -53,8 +54,9 @@ protected function reconcileNames($item) if (isset($introImage) && ($introImage != '')) { - $image = preg_match('/http/', $introImage) ? $introImage : Uri::root() . $introImage; - $item->description = '
'; + $item->description = '' + . LayoutHelper::render('joomla.html.image', ['src' => preg_match('/http/', $introImage) ? $introImage : Uri::root() . $introImage]) + . '
'; } $item->description .= ($params->get('feed_summary', 0) ? $item->introtext . $item->fulltext : $item->introtext); diff --git a/components/com_content/src/View/Featured/FeedView.php b/components/com_content/src/View/Featured/FeedView.php index 10266eff34407..66572e2f6a8d0 100644 --- a/components/com_content/src/View/Featured/FeedView.php +++ b/components/com_content/src/View/Featured/FeedView.php @@ -15,6 +15,7 @@ use Joomla\CMS\Document\Feed\FeedItem; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\MVC\View\AbstractView; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; @@ -67,8 +68,9 @@ public function display($tpl = null) if (isset($introImage) && ($introImage != '')) { - $image = preg_match('/http/', $introImage) ? $introImage : Uri::root() . $introImage; - $description = ''; + $description = '' + . LayoutHelper::render('joomla.html.image', ['src' => preg_match('/http/', $introImage) ? $introImage : Uri::root() . $introImage]) + . '
'; } $description .= ($params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext); diff --git a/components/com_content/tmpl/categories/default_items.php b/components/com_content/tmpl/categories/default_items.php index 51eecd476d966..08f08e8410e9f 100644 --- a/components/com_content/tmpl/categories/default_items.php +++ b/components/com_content/tmpl/categories/default_items.php @@ -11,6 +11,7 @@ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\Component\Content\Site\Helper\RouteHelper; @@ -45,7 +46,7 @@ class="btn btn-secondary btn-sm" params->get('show_description_image') && $item->getParams()->get('image')) : ?> - + $item->getParams()->get('image'), 'alt' => $item->getParams()->get('image_alt')]); ?> params->get('show_subcat_desc_cat') == 1) : ?> description) : ?> diff --git a/components/com_finder/tmpl/search/default_result.php b/components/com_finder/tmpl/search/default_result.php index 475118e35ffc0..39ec4b28051c1 100644 --- a/components/com_finder/tmpl/search/default_result.php +++ b/components/com_finder/tmpl/search/default_result.php @@ -12,15 +12,14 @@ use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Router\Route; use Joomla\Component\Finder\Administrator\Helper\LanguageHelper; use Joomla\Component\Finder\Administrator\Indexer\Helper; use Joomla\Component\Finder\Administrator\Indexer\Taxonomy; use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -$user = Factory::getApplication()->getIdentity(); +$user = Factory::getApplication()->getIdentity(); $show_description = $this->params->get('show_description', 1); if ($show_description) @@ -50,47 +49,38 @@ $description = HTMLHelper::_('string.truncate', StringHelper::substr($full_description, $start), $desc_length, true); } -$showImage = $this->params->get('show_image', 0); +$showImage = $this->params->get('show_image', 0); +$imageClass = $this->params->get('image_class', ''); +$extraAttr = []; -if ($showImage && !empty($this->result->imageUrl)) +if ($showImage && !empty($this->result->imageUrl) && $imageClass !== '') { - $imageclass = $this->params->get('image_class', ''); - $image = HTMLHelper::cleanImageURL($this->result->imageUrl); - $extraAttr = ''; - - // Set lazyloading only for images which have width and height attributes - if ((isset($image->attributes['width']) && (int) $image->attributes['width'] > 0) - && (isset($image->attributes['height']) && (int) $image->attributes['height'] > 0)) - { - $extraAttr = ArrayHelper::toString($image->attributes) . ' loading="lazy"'; - } + $extraAttr['class'] = $imageClass; } $icon = ''; -if (!empty($this->result->mime)) : +if (!empty($this->result->mime)) +{ $icon = ' '; -endif; +} + $show_url = ''; -if ($this->params->get('show_url', 1)) : +if ($this->params->get('show_url', 1)) +{ $show_url = '' . $this->baseUrl . Route::_($this->result->cleanURL) . ''; -endif; +} ?>