Skip to content

Commit 82f4a25

Browse files
author
Andrew Welch
committed
Merge branch 'release/3.2.49' into v3
2 parents c35aad8 + 863ca55 commit 82f4a25

File tree

6 files changed

+33
-3
lines changed

6 files changed

+33
-3
lines changed

Diff for: CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# SEOmatic Changelog
22

3+
## 3.2.49 - 2020.03.24
4+
### Added
5+
* Aliases will now auto-suggest in the Site URL Override settings field
6+
* SEOmatic now will replace any stripped HTML tags with a space, so that the text is more readable
7+
8+
### Fixed
9+
* The Site URL Override is now parsed for both aliases and environment variables
10+
11+
### Security
12+
* Ensure that URLs are `urldecode`d before attempting to use a RegEx to strip tags from them
13+
314
## 3.2.48 - 2020.03.18
415
### Added
516
* Added batching to sitemap generation so that the memory used is fixed, and no longer dependent on how many sitemap entries are being processed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "nystudio107/craft-seomatic",
33
"description": "SEOmatic facilitates modern SEO best practices & implementation for Craft CMS 3. It is a turnkey SEO system that is comprehensive, powerful, and flexible.",
44
"type": "craft-plugin",
5-
"version": "3.2.48",
5+
"version": "3.2.49",
66
"keywords": [
77
"craft",
88
"cms",

Diff for: src/helpers/DynamicMeta.php

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public static function sanitizeUrl(string $url, bool $checkStatus = true): strin
8080
$url = UrlHelper::stripQueryString($url);
8181
// HTML decode the entities, then strip out any tags
8282
$url = html_entity_decode($url, ENT_NOQUOTES, 'UTF-8');
83+
$url = urldecode($url);
8384
$url = strip_tags($url);
8485

8586
// If this is a >= 400 status code, set the canonical URL to nothing
@@ -647,6 +648,7 @@ public static function getLocalizedUrls(string $uri = null, int $siteId = null):
647648
$url = UrlHelper::absoluteUrlWithProtocol($url);
648649

649650
$url = $url ?? '';
651+
$url = self::sanitizeUrl($url);
650652
$language = $site->language;
651653
$ogLanguage = LocalizationHelper::normalizeOgLocaleLanguage($language);
652654
$hreflangLanguage = $language;

Diff for: src/helpers/Text.php

+17-2
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,30 @@ public static function extractTextFromField($field): string
128128
$result = self::extractTextFromTags($field);
129129
} else {
130130
if (\is_array($field)) {
131-
$result = strip_tags((string)$field[0]);
131+
$result = self::smartStripTags((string)$field[0]);
132132
} else {
133-
$result = strip_tags((string)$field);
133+
$result = self::smartStripTags((string)$field);
134134
}
135135
}
136136

137137
return $result;
138138
}
139139

140+
/**
141+
* Strip HTML tags, but replace them with a space rather than just eliminating them
142+
*
143+
* @param $str
144+
* @return string
145+
*/
146+
public static function smartStripTags($str)
147+
{
148+
$str = str_replace('<', ' <', $str);
149+
$str = strip_tags($str);
150+
$str = str_replace(' ', ' ', $str);
151+
152+
return $str;
153+
}
154+
140155
/**
141156
* Extract concatenated text from all of the tags in the $tagElement and
142157
* return as a comma-delimited string

Diff for: src/helpers/UrlHelper.php

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static function siteUrl(string $path = '', $params = null, string $scheme
3939
{
4040
$siteUrl = Seomatic::$settings->siteUrlOverride;
4141
if (!empty($siteUrl)) {
42+
$siteUrl = MetaValue::parseString($siteUrl);
4243
return rtrim($siteUrl, '/').'/'.ltrim($path, '/');
4344
}
4445

Diff for: src/templates/settings/plugin/_includes/general.twig

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
label: "Site URL Override"|t("seomatic"),
120120
instructions: "SEOmatic uses the Craft `siteUrl` to generate the external URLs. If you are using it in a non-standard environment, such as a headless GraphQL or ElementAPI server, you can override what it uses for the `siteUrl` below."|t("seomatic"),
121121
suggestEnvVars: true,
122+
suggestAliases: true,
122123
id: "siteUrlOverride",
123124
name: "siteUrlOverride",
124125
value: settings.siteUrlOverride,

0 commit comments

Comments
 (0)