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')) : ?> - <?php echo htmlspecialchars($item->getParams()->get('image_alt'), ENT_COMPAT, 'UTF-8'); ?> + $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; +} ?>
  • + $image->url, 'alt' => $this->result->imageAlt]); ?> params->get('link_image') && $this->result->route) : ?> - <?php echo htmlspecialchars($this->result->imageAlt, ENT_COMPAT, 'UTF-8'); ?> - /> + - <?php echo htmlspecialchars($this->result->imageAlt, ENT_COMPAT, 'UTF-8'); ?> - /> +
    diff --git a/components/com_tags/tmpl/tag/default.php b/components/com_tags/tmpl/tag/default.php index 11c96104efdaa..5edf95dd0b20f 100644 --- a/components/com_tags/tmpl/tag/default.php +++ b/components/com_tags/tmpl/tag/default.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Layout\LayoutHelper; // Note that there are certain parts of this layout used only when there is exactly one tag. $isSingleTag = count($this->item) === 1; @@ -35,8 +36,7 @@
    item[0]->images); ?> params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?> - <?php echo htmlspecialchars($images->image_fulltext_alt, ENT_QUOTES, 'UTF-8'); ?> + $images->image_fulltext, 'alt' => $images->image_fulltext_alt]); ?> params->get('tag_list_show_tag_description') == 1 && $this->item[0]->description) : ?> item[0]->description, '', 'com_tags.tag'); ?> @@ -47,10 +47,7 @@ params->get('tag_list_show_tag_description', 1) || $this->params->get('show_description_image', 1)) : ?> params->get('show_description_image', 1) == 1 && $this->params->get('tag_list_image')) : ?> - params->get('tag_list_image_alt')) && empty($this->params->get('tag_list_image_alt_empty')) - ? '' - : 'alt="' . htmlspecialchars($this->params->get('tag_list_image_alt'), ENT_COMPAT, 'UTF-8') . '"'; ?> - > + $this->params->get('tag_list_image'), 'alt' => empty($this->params->get('tag_list_image_alt')) && empty($this->params->get('tag_list_image_alt_empty')) ? false : $this->params->get('tag_list_image_alt')]); ?> params->get('tag_list_description', '') > '') : ?> params->get('tag_list_description'), '', 'com_tags.tag'); ?> diff --git a/components/com_tags/tmpl/tag/default_items.php b/components/com_tags/tmpl/tag/default_items.php index 51fa823d1b512..b2e971847ae8c 100644 --- a/components/com_tags/tmpl/tag/default_items.php +++ b/components/com_tags/tmpl/tag/default_items.php @@ -12,6 +12,7 @@ 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\CMS\Uri\Uri; use Joomla\Component\Tags\Site\Helper\RouteHelper; @@ -92,8 +93,7 @@ class="inputbox" onchange="document.adminForm.submit();" core_images); ?> params->get('tag_list_show_item_image', 1) == 1 && !empty($images->image_intro)) : ?> - <?php echo htmlspecialchars($images->image_intro_alt); ?> + $images->image_intro, 'alt' => $images->image_intro_alt]); ?> params->get('tag_list_show_item_description', 1)) : ?> diff --git a/components/com_tags/tmpl/tag/list.php b/components/com_tags/tmpl/tag/list.php index 285af3bea70df..2bd7053471985 100644 --- a/components/com_tags/tmpl/tag/list.php +++ b/components/com_tags/tmpl/tag/list.php @@ -10,6 +10,7 @@ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Layout\LayoutHelper; // Note that there are certain parts of this layout used only when there is exactly one tag. $n = count($this->items); @@ -36,7 +37,7 @@
    item[0]->images); ?> params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?> - + $images->image_fulltext]); ?> params->get('tag_list_show_tag_description') == 1 && $this->item[0]->description) : ?> item[0]->description, '', 'com_tags.tag'); ?> @@ -47,10 +48,7 @@ params->get('tag_list_show_tag_description', 1) || $this->params->get('show_description_image', 1)) : ?> params->get('show_description_image', 1) == 1 && $this->params->get('tag_list_image')) : ?> - params->get('tag_list_image_alt')) && empty($this->params->get('tag_list_image_alt_empty')) - ? '' - : 'alt="' . htmlspecialchars($this->params->get('tag_list_image_alt'), ENT_COMPAT, 'UTF-8') . '"'; ?> - > + $this->params->get('tag_list_image'), 'alt' => empty($this->params->get('tag_list_image_alt')) && empty($this->params->get('tag_list_image_alt_empty')) ? false : $this->params->get('tag_list_image_alt')]); ?> params->get('tag_list_description', '') > '') : ?> params->get('tag_list_description'), '', 'com_tags.tag'); ?> diff --git a/components/com_tags/tmpl/tags/default.php b/components/com_tags/tmpl/tags/default.php index becc7ba22e3bf..6e3628cb7ca8a 100644 --- a/components/com_tags/tmpl/tags/default.php +++ b/components/com_tags/tmpl/tags/default.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\CMS\Layout\LayoutHelper; + // Note that there are certain parts of this layout used only when there is exactly one tag. $description = $this->params->get('all_tags_description'); $descriptionImage = $this->params->get('all_tags_description_image'); @@ -20,11 +22,8 @@ params->get('all_tags_show_description_image') && !empty($descriptionImage)) : ?> - params->get('all_tags_description_image_alt')) && empty($this->params->get('all_tags_description_image_alt_empty')) - ? '' - : 'alt="' . htmlspecialchars($this->params->get('all_tags_description_image_alt'), ENT_COMPAT, 'UTF-8') . '"'; ?>
    - > + $descriptionImage, 'alt' => empty($this->params->get('all_tags_description_image_alt')) && empty($this->params->get('all_tags_description_image_alt_empty')) ? false : $this->params->get('all_tags_description_image_alt')]); ?>
    diff --git a/components/com_tags/tmpl/tags/default_items.php b/components/com_tags/tmpl/tags/default_items.php index 8642e560c62cc..36fd189332223 100644 --- a/components/com_tags/tmpl/tags/default_items.php +++ b/components/com_tags/tmpl/tags/default_items.php @@ -12,6 +12,7 @@ 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\CMS\Uri\Uri; use Joomla\Component\Tags\Site\Helper\RouteHelper; @@ -107,12 +108,12 @@ class="inputbox" onchange="document.adminForm.submit();" image_intro)) : ?> float_intro) ? $this->params->get('float_intro') : $images->float_intro; ?>
    - image_intro_caption) : ?> - image_intro_caption, ENT_QUOTES, 'UTF-8') . '"'; ?> - - src="image_intro, ENT_QUOTES, 'UTF-8'); ?>" - alt="image_intro_alt, ENT_QUOTES, 'UTF-8'); ?>"> + $images->image_intro, 'alt' => $images->image_intro_alt]; ?> + image_intro_caption) : ?> + image_intro_caption; ?> + + +
    diff --git a/components/com_users/tmpl/login/default_login.php b/components/com_users/tmpl/login/default_login.php index e7380ec345bf6..3d2e509c39de2 100644 --- a/components/com_users/tmpl/login/default_login.php +++ b/components/com_users/tmpl/login/default_login.php @@ -12,6 +12,7 @@ use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Router\Route; @@ -39,10 +40,7 @@ params->get('login_image') != '') : ?> - params->get('login_image_alt')) && empty($this->params->get('login_image_alt_empty')) - ? '' - : 'alt="' . htmlspecialchars($this->params->get('login_image_alt'), ENT_COMPAT, 'UTF-8') . '"'; ?> - > + $this->params->get('login_image'), 'class' => 'com-users-login__image login-image', 'alt' => empty($this->params->get('login_image_alt')) && empty($this->params->get('login_image_alt_empty')) ? false : $this->params->get('login_image_alt')]); ?> params->get('logindescription_show') == 1 && str_replace(' ', '', $this->params->get('login_description')) != '') || $this->params->get('login_image') != '') : ?> diff --git a/components/com_users/tmpl/login/default_logout.php b/components/com_users/tmpl/login/default_logout.php index 8b3ac9a6bb38c..dcb130407ebc5 100644 --- a/components/com_users/tmpl/login/default_logout.php +++ b/components/com_users/tmpl/login/default_logout.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; ?> @@ -32,10 +33,7 @@ params->get('logout_image') != '') : ?> - params->get('logout_image_alt')) && empty($this->params->get('logout_image_alt_empty')) - ? '' - : 'alt="' . htmlspecialchars($this->params->get('logout_image_alt'), ENT_COMPAT, 'UTF-8') . '"'; ?> - > + $this->params->get('logout_image'), 'class' => 'com-users-logout__image thumbnail float-end logout-image', 'alt' => empty($this->params->get('logout_image_alt')) && empty($this->params->get('logout_image_alt_empty')) ? false : $this->params->get('logout_image_alt')]); ?> params->get('logoutdescription_show') == 1 && str_replace(' ', '', $this->params->get('logout_description')) != '')|| $this->params->get('logout_image') != '') : ?> diff --git a/modules/mod_feed/tmpl/default.php b/modules/mod_feed/tmpl/default.php index 7d2f47cd017a2..b315efe3080de 100644 --- a/modules/mod_feed/tmpl/default.php +++ b/modules/mod_feed/tmpl/default.php @@ -12,6 +12,7 @@ use Joomla\CMS\Filter\OutputFilter; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; +use Joomla\CMS\Layout\LayoutHelper; // Check if feed URL has been set if (empty ($rssurl)) @@ -93,7 +94,7 @@ // Feed image if ($feed->image && $params->get('rssimage', 1)) : ?> - <?php echo $feed->image->title; ?> + $feed->image->uri, 'alt' => $feed->image->title]); ?>