‪TYPO3CMS  11.5
TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype Class Reference
Inheritance diagram for TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype:
TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype TYPO3\CMS\Linkvalidator\Linktype\LinktypeInterface

Public Member Functions

 __construct (RequestFactory $requestFactory=null)
 
 setAdditionalConfig (array $config)
 
bool checkLink ($origUrl, $softRefEntry, $reference)
 
string getErrorMessage ($errorParams)
 
string fetchType ($value, $type, $key)
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype
array getErrorParams ()
 
string getBrokenUrl ($row)
 

Protected Member Functions

bool requestUrl (string $url, string $method, array $options)
 
string preprocessUrl (string $url)
 
- ‪Protected Member Functions inherited from ‪TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype
 setErrorParams ($value)
 
LanguageService getLanguageService ()
 

Protected Attributes

const ERROR_TYPE_HTTP_STATUS_CODE = 'httpStatusCode'
 
const ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO = 'libcurlErrno'
 
const ERROR_TYPE_GENERIC_EXCEPTION = 'exception'
 
const ERROR_TYPE_UNKNOWN = 'unknown'
 
array $urlReports = array( )
 
array $urlErrorParams = array( )
 
array $headers
 
string $method = 'HEAD'
 
string $range = '0-4048'
 
int $timeout = 0
 
RequestFactory $requestFactory
 
array $errorParams = array( )
 
- ‪Protected Attributes inherited from ‪TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype
array $errorParams = array( )
 

Detailed Description

This class provides Check External Links plugin implementation

Definition at line 31 of file ExternalLinktype.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::__construct ( RequestFactory  $requestFactory = null)

Member Function Documentation

◆ checkLink()

bool TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::checkLink (   $origUrl,
  $softRefEntry,
  $reference 
)

Checks a given URL for validity

Parameters
string$origUrl‪The URL to check
array$softRefEntry‪The soft reference entry which builds the context of that URL
\TYPO3\CMS\Linkvalidator\LinkAnalyzer$reference‪Parent instance
Returns
‪bool TRUE on success or FALSE on error
Exceptions

Implements TYPO3\CMS\Linkvalidator\Linktype\LinktypeInterface.

Definition at line 143 of file ExternalLinktype.php.

References TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\$errorParams, TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\$headers, TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\$range, TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\$timeout, TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\preprocessUrl(), TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\requestUrl(), and TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype\setErrorParams().

◆ fetchType()

string TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::fetchType (   $value,
  $type,
  $key 
)

Get the external type from the softRefParserObj result

Parameters
array$value‪Reference properties
string$type‪Current type
string$key‪Validator hook name
Returns
‪string Fetched type

Reimplemented from TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype.

Definition at line 326 of file ExternalLinktype.php.

◆ getErrorMessage()

string TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::getErrorMessage (   $errorParams)

Generate the localized error message from the error params saved from the parsing

Parameters
array$errorParams‪All parameters needed for the rendering of the error message
Returns
‪string Validation error message
Todo:
‪change input parameter type to array in TYPO3 v13

Implements TYPO3\CMS\Linkvalidator\Linktype\LinktypeInterface.

Definition at line 250 of file ExternalLinktype.php.

References TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\$errorParams, TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\ERROR_TYPE_HTTP_STATUS_CODE, TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO, and TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype\getLanguageService().

Referenced by TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\requestUrl().

◆ preprocessUrl()

string TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::preprocessUrl ( string  $url)
protected

Convert domain to punycode to handle domains with non-ASCII characters

Parameters
string$url
Returns
‪string

Definition at line 341 of file ExternalLinktype.php.

References TYPO3\CMS\Core\Utility\HttpUtility\buildUrl().

Referenced by TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\checkLink().

◆ requestUrl()

◆ setAdditionalConfig()

TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::setAdditionalConfig ( array  $config)

Function to override config of Linktype. Should be used only if necessary. Add additional configuration to TSconfig.

Parameters
array$config

Reimplemented from TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype.

Definition at line 99 of file ExternalLinktype.php.

References $GLOBALS.

Member Data Documentation

◆ $errorParams

array TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$errorParams = array( )
protected

◆ $headers

array TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$headers
protected
Initial value:
= array(
'User-Agent' => 'TYPO3 linkvalidator',
'Accept' => '*/*',
'Accept-Language' => '*',
'Accept-Encoding' => '*',
)

List of HTTP request headers to use for checking a URL

Definition at line 56 of file ExternalLinktype.php.

Referenced by TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\checkLink().

◆ $method

string TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$method = 'HEAD'
protected

Preferred method of fetching (HEAD | GET). If HEAD is used, we fallback to GET

Definition at line 68 of file ExternalLinktype.php.

Referenced by TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\requestUrl().

◆ $range

string TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$range = '0-4048'
protected

For GET method, set number of bytes returned.

This limits the payload, but may fail for some sites.

Definition at line 76 of file ExternalLinktype.php.

Referenced by TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype\checkLink().

◆ $requestFactory

RequestFactory TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$requestFactory
protected

◆ $timeout

int TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$timeout = 0
protected

◆ $urlErrorParams

array TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$urlErrorParams = array( )
protected

Cached list of all error parameters of the URLs, which were already checked for the current processing

Definition at line 50 of file ExternalLinktype.php.

◆ $urlReports

array TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::$urlReports = array( )
protected

Cached list of the URLs, which were already checked for the current processing

Definition at line 44 of file ExternalLinktype.php.

◆ ERROR_TYPE_GENERIC_EXCEPTION

const TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::ERROR_TYPE_GENERIC_EXCEPTION = 'exception'
protected

◆ ERROR_TYPE_HTTP_STATUS_CODE

const TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::ERROR_TYPE_HTTP_STATUS_CODE = 'httpStatusCode'
protected

◆ ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO

const TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::ERROR_TYPE_LOWLEVEL_LIBCURL_ERRNO = 'libcurlErrno'
protected

◆ ERROR_TYPE_UNKNOWN

const TYPO3\CMS\Linkvalidator\Linktype\ExternalLinktype::ERROR_TYPE_UNKNOWN = 'unknown'
protected