Skip to content

Commit

Permalink
Merge pull request #179 from Uhor/rmv-deprecated-tags
Browse files Browse the repository at this point in the history
remove caption and title tags of the images
  • Loading branch information
Hlavtox authored Feb 8, 2024
2 parents 9ba8c74 + 0391180 commit 4507655
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
20 changes: 3 additions & 17 deletions gsitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,6 @@ protected function getProductLink(&$link_sitemap, $lang, &$index, &$i, $id_produ
], $image_link) : $image_link;

$images_product[] = [
'title_img' => htmlspecialchars(strip_tags($product->name)),
'caption' => htmlspecialchars(strip_tags($product->meta_description)),
'link' => $image_link,
];
}
Expand Down Expand Up @@ -547,8 +545,6 @@ protected function getCategoryLink(&$link_sitemap, $lang, &$index, &$i, $id_cate
], $image_link) : $image_link;

$image_category = [
'title_img' => htmlspecialchars(strip_tags($category->name)),
'caption' => Tools::substr(htmlspecialchars(strip_tags($category->description)), 0, 350),
'link' => $image_link,
];
}
Expand Down Expand Up @@ -612,8 +608,6 @@ protected function getManufacturerLink(&$link_sitemap, $lang, &$index, &$i, $id_
], $image_link) : $image_link;

$manufacturer_image = [
'title_img' => htmlspecialchars(strip_tags($manufacturer->name)),
'caption' => htmlspecialchars(strip_tags($manufacturer->short_description)),
'link' => $image_link,
];

Expand Down Expand Up @@ -820,15 +814,7 @@ protected function recursiveSitemapCreator($link_sitemap, $lang, &$index)
$images = array_merge($images, $file['images']);
}
foreach ($images as $image) {
$this->addSitemapNodeImage($write_fd, htmlspecialchars(strip_tags($image['link'])), isset($image['title_img']) ? htmlspecialchars(str_replace([
"\r\n",
"\r",
"\n",
], '', $this->removeControlCharacters(strip_tags($image['title_img'])))) : '', isset($image['caption']) ? htmlspecialchars(str_replace([
"\r\n",
"\r",
"\n",
], '', strip_tags($image['caption']))) : '');
$this->addSitemapNodeImage($write_fd, htmlspecialchars(strip_tags($image['link'])));
}
fwrite($write_fd, '</url>' . PHP_EOL);
}
Expand Down Expand Up @@ -870,9 +856,9 @@ protected function addSitemapNode($fd, $loc, $priority, $change_freq, $last_mod
);
}

protected function addSitemapNodeImage($fd, $link, $title, $caption)
protected function addSitemapNodeImage($fd, $link)
{
fwrite($fd, '<image:image>' . PHP_EOL . '<image:loc>' . (Configuration::get('PS_REWRITING_SETTINGS') ? '<![CDATA[' . $link . ']]>' : $link) . '</image:loc>' . PHP_EOL . '<image:caption><![CDATA[' . $caption . ']]></image:caption>' . PHP_EOL . '<image:title><![CDATA[' . $title . ']]></image:title>' . PHP_EOL . '</image:image>' . PHP_EOL);
fwrite($fd, '<image:image>' . PHP_EOL . '<image:loc>' . (Configuration::get('PS_REWRITING_SETTINGS') ? '<![CDATA[' . $link . ']]>' : $link) . '</image:loc>' . PHP_EOL . '</image:image>' . PHP_EOL);
}

/**
Expand Down
1 change: 0 additions & 1 deletion tests/phpstan/phpstan-1.7.8.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property Cookie\:\:\$id_lang.#'
- '#Parameter \#1 \$str of function strip_tags expects string, array<string> given.#'

0 comments on commit 4507655

Please sign in to comment.