-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from networkteam/30-fix-mail-display
fix: Mail obfuscation for links including additional tags
- Loading branch information
Showing
4 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,18 +77,18 @@ public function emailsAreConverted($rawText, $expectedText) | |
->will($this->returnValueMap([ | ||
['value', $rawText], | ||
['patternMailTo', '/(href=")mailto:([^"]*)/'], | ||
['patternMailDisplay', '/(href="mailto:[^>]*>)([^<]*)/'] | ||
['patternMailDisplay', '|(href="mailto:[^>]*>)(.*?)(<\/a>)|'] | ||
])); | ||
|
||
$actualResult = $this->convertEmailLinks->evaluate(); | ||
$this->assertSame($expectedText, $actualResult); | ||
} | ||
|
||
public function emailTexts(): array | ||
static public function emailTexts(): array | ||
{ | ||
|
||
$htmlEncodedDecryptionString = htmlspecialchars('javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\', -15)'); | ||
$htmlEncodedSecondDecryptionString = htmlspecialchars('javascript:linkTo_UnCryptMailto(\'uddqpgOtmpbeat-rdb\', -15)'); | ||
$htmlEncodedDecryptionString = htmlspecialchars('javascript:linkTo_UnCryptMailto(\'ithiOtmpbeat-rdb\',-15)', ENT_NOQUOTES); | ||
$htmlEncodedSecondDecryptionString = htmlspecialchars('javascript:linkTo_UnCryptMailto(\'uddqpgOtmpbeat-rdb\',-15)', ENT_NOQUOTES); | ||
|
||
return [ | ||
'just some text not to touch' => [ | ||
|
@@ -114,6 +114,14 @@ public function emailTexts(): array | |
'email address with attributes after href' => [ | ||
'Email <a href="mailto: [email protected]" itemprop="email">[email protected]</a>', | ||
'Email <a href="' . $htmlEncodedDecryptionString . '" itemprop="email">test (at) example.com</a>' | ||
], | ||
'email address enclosed by HTML tag' => [ | ||
'Email <a href="mailto: [email protected]" itemprop="email"><strong>[email protected]</strong></a>', | ||
'Email <a href="' . $htmlEncodedDecryptionString . '" itemprop="email"><strong>test (at) example.com</strong></a>' | ||
], | ||
'email address in link tag enclosed by multiple styling tags' => [ | ||
'Email <a href="mailto: [email protected]" itemprop="email"><i class="fa-light fa-paper-plane"></i><span class="btn__text">[email protected]</span></a>', | ||
'Email <a href="' . $htmlEncodedDecryptionString . '" itemprop="email"><i class="fa-light fa-paper-plane"></i><span class="btn__text">test (at) example.com</span></a>' | ||
] | ||
]; | ||
} | ||
|