ExternalLinktype
class \
- Extends
- AbstractLinktype
This class provides Check External Links plugin implementation
Table of Contents
Constants
- ERROR_TYPE_GENERIC_EXCEPTION : mixed = 'exception'
- ERROR_TYPE_HTTP_STATUS_CODE : mixed = 'httpStatusCode'
- ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO : mixed = 'libcurlErrno'
- ERROR_TYPE_UNKNOWN : mixed = 'unknown'
Properties
- $errorParams : array
- Contains parameters needed for the rendering of the error message
- $headers : array
- List of HTTP request headers to use for checking a URL
- $method : string
- Preferred method of fetching (HEAD | GET).
- $range : string
- For GET method, set number of bytes returned.
- $requestFactory : RequestFactory
- $timeout : int
- Total timeout of the request in seconds. Using 0 (which is usually the default) may cause the request to take indefinitely, which means the scheduler task never ends.
- $urlErrorParams : array
- Cached list of all error parameters of the URLs, which were already checked for the current processing
- $urlReports : array
- Cached list of the URLs, which were already checked for the current processing
Methods
- __construct() : mixed
- checkLink() : bool
- Checks a given URL for validity
- fetchType() : string
- Get the external type from the softRefParserObj result
- getBrokenUrl() : string
- Construct a valid Url for browser output
- getErrorMessage() : string
- Generate the localized error message from the error params saved from the parsing
- getErrorParams() : array
- Get the value of the private property errorParams
- setAdditionalConfig() : void
- Function to override config of Linktype. Should be used only if necessary. Add additional configuration to TSconfig.
- getLanguageService() : LanguageService
- preprocessUrl() : string
- Convert domain to punycode to handle domains with non-ASCII characters
- requestUrl() : bool
- Check URL using the specified request methods
- setErrorParams() : mixed
- Set the value of the protected property errorParams
Constants
ERROR_TYPE_GENERIC_EXCEPTION
protected
mixed
ERROR_TYPE_GENERIC_EXCEPTION
= 'exception'
ERROR_TYPE_HTTP_STATUS_CODE
protected
mixed
ERROR_TYPE_HTTP_STATUS_CODE
= 'httpStatusCode'
ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO
protected
mixed
ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO
= 'libcurlErrno'
ERROR_TYPE_UNKNOWN
protected
mixed
ERROR_TYPE_UNKNOWN
= 'unknown'
Properties
$errorParams
Contains parameters needed for the rendering of the error message
protected
array
$errorParams
= []
$headers
List of HTTP request headers to use for checking a URL
protected
array
$headers
= ['User-Agent' => 'TYPO3 linkvalidator', 'Accept' => '*/*', '…Show the full value
['User-Agent' => 'TYPO3 linkvalidator', 'Accept' => '*/*', 'Accept-Language' => '*', 'Accept-Encoding' => '*']
$method
Preferred method of fetching (HEAD | GET).
protected
string
$method
= 'HEAD'
If HEAD is used, we fallback to GET
$range
For GET method, set number of bytes returned.
protected
string
$range
= '0-4048'
This limits the payload, but may fail for some sites.
$requestFactory
protected
RequestFactory
$requestFactory
$timeout
Total timeout of the request in seconds. Using 0 (which is usually the default) may cause the request to take indefinitely, which means the scheduler task never ends.
protected
int
$timeout
= 0
$urlErrorParams
Cached list of all error parameters of the URLs, which were already checked for the current processing
protected
array
$urlErrorParams
= []
$urlReports
Cached list of the URLs, which were already checked for the current processing
protected
array
$urlReports
= []
Methods
__construct()
public
__construct([RequestFactory|null $requestFactory = null ]) : mixed
Parameters
- $requestFactory : RequestFactory|null = null
checkLink()
Checks a given URL for validity
public
checkLink(string $origUrl, array $softRefEntry, LinkAnalyzer $reference) : bool
Parameters
- $origUrl : string
-
The URL to check
- $softRefEntry : array
-
The soft reference entry which builds the context of that URL
- $reference : LinkAnalyzer
-
Parent instance
Tags
Return values
bool —TRUE on success or FALSE on error
fetchType()
Get the external type from the softRefParserObj result
public
fetchType(array $value, string $type, string $key) : string
Parameters
- $value : array
-
Reference properties
- $type : string
-
Current type
- $key : string
-
Validator hook name
Return values
string —Fetched type
getBrokenUrl()
Construct a valid Url for browser output
public
getBrokenUrl(array $row) : string
Parameters
- $row : array
-
Broken link record
Return values
string —Parsed broken url
getErrorMessage()
Generate the localized error message from the error params saved from the parsing
public
getErrorMessage(array $errorParams) : string
Parameters
- $errorParams : array
-
All parameters needed for the rendering of the error message
Tags
Return values
string —Validation error message
getErrorParams()
Get the value of the private property errorParams
public
getErrorParams() : array
Tags
Return values
array —All parameters needed for the rendering of the error message
setAdditionalConfig()
Function to override config of Linktype. Should be used only if necessary. Add additional configuration to TSconfig.
public
setAdditionalConfig(array $config) : void
Parameters
- $config : array
getLanguageService()
protected
getLanguageService() : LanguageService
Return values
LanguageServicepreprocessUrl()
Convert domain to punycode to handle domains with non-ASCII characters
protected
preprocessUrl(string $url) : string
Parameters
- $url : string
Return values
stringrequestUrl()
Check URL using the specified request methods
protected
requestUrl(string $url, string $method, array $options) : bool
Parameters
- $url : string
- $method : string
- $options : array
Return values
boolsetErrorParams()
Set the value of the protected property errorParams
protected
setErrorParams(array $value) : mixed
Parameters
- $value : array
-
All parameters needed for the rendering of the error message