EmailLinkBuilder implements LoggerAwareInterface, TypolinkBuilderInterface uses DefaultJavaScriptAssetTrait, LoggerAwareTrait

Builds a TypoLink to an email address, also takes care of additional functionality for the time being such as the infamous config.spamProtectedEmailAddresses option.

Table of Contents

Interfaces

LoggerAwareInterface
TypolinkBuilderInterface
Used to generate a link to a page or file, an external URL or any other protocol in the frontend or backend.

Properties

$defaultFrontendJavaScriptFile  : string

Methods

__construct()  : mixed
buildLink()  : LinkResultInterface
processEmailLink()  : array{0: string, 1: string, 2: array}
Creates a href attribute for given $mailAddress.
addDefaultFrontendJavaScript()  : void
encryptCharcode()  : string
Encryption (or decryption) of a single character.
encryptEmail()  : string
Encryption of email addresses for <A>-tags See the spam protection setup in TS 'config.'
shallExportDefaultFrontendJavaScript()  : bool
shallRemoveDefaultFrontendJavaScript()  : bool

Properties

$defaultFrontendJavaScriptFile

protected string $defaultFrontendJavaScriptFile = 'EXT:frontend/Resources/Public/JavaScript/default_frontend.js'

Methods

public buildLink(array<string|int, mixed> $linkDetails, array<string|int, mixed> $configuration, ServerRequestInterface $request[, string $linkText = '' ]) : LinkResultInterface
Parameters
$linkDetails : array<string|int, mixed>

parsed link details by the LinkService

$configuration : array<string|int, mixed>

the TypoLink configuration array

$request : ServerRequestInterface
$linkText : string = ''

the link text

Return values
LinkResultInterface

Creates a href attribute for given $mailAddress.

public processEmailLink(string $mailAddress, string $linkText, array<string|int, mixed> $linkDetails, ServerRequestInterface $request) : array{0: string, 1: string, 2: array}

The function uses spamProtectEmailAddresses for encoding the mailto statement. If spamProtectEmailAddresses is disabled, it'll just return a string like "mailto:user@example.tld".

Returns an array with three items (numeric index) #0: $mailToUrl (string), ready to be inserted into the href attribute of the tag #1: $linkText (string), content between starting and ending <a> tag #2: $attributes (array<string, string>), additional attributes for <a> tag

Parameters
$mailAddress : string

Email address

$linkText : string

Link text, default will be the email address.

$linkDetails : array<string|int, mixed>
$request : ServerRequestInterface
Internal

this method is not part of TYPO3's public API

Return values
array{0: string, 1: string, 2: array}

A numerical array with three items

encryptCharcode()

Encryption (or decryption) of a single character.

protected encryptCharcode(int $n, int $start, int $end, int $offset) : string

Within the given range the character is shifted with the supplied offset.

Parameters
$n : int

Ordinal of input character

$start : int

Start of range

$end : int

End of range

$offset : int

Offset

Return values
string

encoded/decoded version of character

encryptEmail()

Encryption of email addresses for <A>-tags See the spam protection setup in TS 'config.'

protected encryptEmail(string $string, int $offset) : string
Parameters
$string : string

Input string to en/decode: "mailto:some@example.com

$offset : int

a number between -10 and 10, taken from config.spamProtectEmailAddresses

Return values
string

encoded version of $string

shallExportDefaultFrontendJavaScript()

protected shallExportDefaultFrontendJavaScript(ServerRequestInterface $request) : bool
Parameters
$request : ServerRequestInterface
Return values
bool

shallRemoveDefaultFrontendJavaScript()

protected shallRemoveDefaultFrontendJavaScript(ServerRequestInterface $request) : bool
Parameters
$request : ServerRequestInterface
Return values
bool

        
On this page

Search results