Skip to content

Commit

Permalink
fix: Eliminate false-positives by using explode() and in_array()
Browse files Browse the repository at this point in the history
…rather than `str_contains()` ([#1378](#1378))
  • Loading branch information
khalwat committed Nov 10, 2023
1 parent 83834f9 commit aaf8ea4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/metalink/CanonicalLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public function prepForRender(&$data): bool
$robots = Seomatic::$seomaticVariable->tag->get('robots');
if ($robots !== null && $robots->include && !Seomatic::$previewingMetaContainers && !Seomatic::$settings->alwaysIncludeCanonicalUrls) {
$robotsArray = $robots->renderAttributes();
$content = $robotsArray['content'] ?? '';
if (str_contains($content, 'noindex') || str_contains($content, 'none')) {
$contentArray = explode(',', $robotsArray['content'] ?? '');
if (in_array('noindex', $contentArray, true) || in_array('none', $contentArray, true)) {
return false;
}
}
Expand Down

0 comments on commit aaf8ea4

Please sign in to comment.