‪TYPO3CMS  ‪main
TYPO3\CMS\Linkvalidator\LinkAnalyzer Class Reference

Public Member Functions

 __construct (protected readonly EventDispatcherInterface $eventDispatcher, protected readonly BrokenLinkRepository $brokenLinkRepository, protected readonly SoftReferenceParserFactory $softReferenceParserFactory, protected readonly LinktypeRegistry $linktypeRegistry,)
 
 init (array $searchFields, array $pidList, $tsConfig)
 
 getLinkStatistics (array $linkTypes=[], $considerHidden=false)
 
 recheckLinks (array $checkOptions, string|int $recordUid, string $table, string $field, int $timestamp, bool $considerHidden=true)
 
 analyzeRecord (array &$results, $table, array $fields, array $record)
 
array getLinkCounts ()
 

Protected Member Functions

 checkLinks (array $links, array $linkTypes)
 
 analyzeLinks (SoftReferenceParserResult $parserResult, array &$results, array $record, $field, $table)
 
 analyzeTypoLinks (SoftReferenceParserResult $parserResult, array &$results, $htmlParser, array $record, $field, $table)
 
 getLanguageService ()
 

Protected Attributes

array $searchFields = []
 
array $pids = []
 
array $linkCounts = []
 
array $brokenLinkCounts = []
 
array $tsConfig = array( )
 

Detailed Description

This class provides Processing plugin implementation

Definition at line 38 of file LinkAnalyzer.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::__construct ( protected readonly EventDispatcherInterface  $eventDispatcher,
protected readonly BrokenLinkRepository  $brokenLinkRepository,
protected readonly SoftReferenceParserFactory  $softReferenceParserFactory,
protected readonly LinktypeRegistry  $linktypeRegistry 
)

Definition at line 70 of file LinkAnalyzer.php.

Member Function Documentation

◆ analyzeLinks()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::analyzeLinks ( SoftReferenceParserResult  $parserResult,
array &  $results,
array  $record,
  $field,
  $table 
)
protected

Find all supported broken links for a specific link list

Parameters
SoftReferenceParserResult$parserResult‪findRef parsed records
array$results‪Array of broken links
array$record‪UID of the current record
string$field‪The current field
string$table‪The current table

Definition at line 348 of file LinkAnalyzer.php.

References TYPO3\CMS\Webhooks\Message\$record, and TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\getMatchedElements().

Referenced by TYPO3\CMS\Linkvalidator\LinkAnalyzer\analyzeRecord().

◆ analyzeRecord()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::analyzeRecord ( array &  $results,
  $table,
array  $fields,
array  $record 
)

Find all supported broken links for a specific record

Parameters
array$results‪Array of broken links
string$table‪Table name of the record
array$fields‪Array of fields to analyze
array$record‪Record to analyze

Definition at line 297 of file LinkAnalyzer.php.

References $fields, $GLOBALS, TYPO3\CMS\Webhooks\Message\$record, TYPO3\CMS\Linkvalidator\LinkAnalyzer\analyzeLinks(), and TYPO3\CMS\Linkvalidator\LinkAnalyzer\analyzeTypoLinks().

Referenced by TYPO3\CMS\Linkvalidator\LinkAnalyzer\getLinkStatistics(), and TYPO3\CMS\Linkvalidator\LinkAnalyzer\recheckLinks().

◆ analyzeTypoLinks()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::analyzeTypoLinks ( SoftReferenceParserResult  $parserResult,
array &  $results,
  $htmlParser,
array  $record,
  $field,
  $table 
)
protected

Find all supported broken links for a specific typoLink

Parameters
SoftReferenceParserResult$parserResult‪findRef parsed records
array$results‪Array of broken links
HtmlParser$htmlParser‪Instance of html parser
array$record‪The current record
string$field‪The current field
string$table‪The current table

Definition at line 384 of file LinkAnalyzer.php.

References TYPO3\CMS\Webhooks\Message\$record, TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\getContent(), and TYPO3\CMS\Core\DataHandling\SoftReference\SoftReferenceParserResult\getMatchedElements().

Referenced by TYPO3\CMS\Linkvalidator\LinkAnalyzer\analyzeRecord().

◆ checkLinks()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::checkLinks ( array  $links,
array  $linkTypes 
)
protected

◆ getLanguageService()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::getLanguageService ( )
protected

Definition at line 449 of file LinkAnalyzer.php.

References $GLOBALS.

◆ getLinkCounts()

array TYPO3\CMS\Linkvalidator\LinkAnalyzer::getLinkCounts ( )

Fill a marker array with the number of links found in a list of pages

Returns
‪array array with the number of links found

Definition at line 444 of file LinkAnalyzer.php.

◆ getLinkStatistics()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::getLinkStatistics ( array  $linkTypes = [],
  $considerHidden = false 
)

Find all supported broken links and store them in tx_linkvalidator_link

Parameters
array<int,string>‪$linkTypes List of hook object to activate
bool$considerHidden‪Defines whether to look into hidden fields

Definition at line 104 of file LinkAnalyzer.php.

References $fields, $GLOBALS, TYPO3\CMS\Linkvalidator\LinkAnalyzer\analyzeRecord(), TYPO3\CMS\Linkvalidator\LinkAnalyzer\checkLinks(), and TYPO3\CMS\Core\Database\Platform\PlatformInformation\getMaxBindParameters().

◆ init()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::init ( array  $searchFields,
array  $pidList,
  $tsConfig 
)

Store all the needed configuration values in class variables

Parameters
array$searchFields‪List of fields in which to search for links
int[]$pidList‪List of page uids in which to search for links
array$tsConfig‪The currently active TSconfig.

Definition at line 84 of file LinkAnalyzer.php.

References TYPO3\CMS\Webhooks\Message\$identifier, TYPO3\CMS\Linkvalidator\LinkAnalyzer\$searchFields, and TYPO3\CMS\Linkvalidator\LinkAnalyzer\$tsConfig.

◆ recheckLinks()

TYPO3\CMS\Linkvalidator\LinkAnalyzer::recheckLinks ( array  $checkOptions,
string|int  $recordUid,
string  $table,
string  $field,
int  $timestamp,
bool  $considerHidden = true 
)

Recheck for broken links for one field in table for record.

Parameters
string | int$recordUid‪uid of record to check
int$timestamp‪- only recheck if timestamp changed

Definition at line 238 of file LinkAnalyzer.php.

References $GLOBALS, TYPO3\CMS\Linkvalidator\LinkAnalyzer\analyzeRecord(), TYPO3\CMS\Linkvalidator\LinkAnalyzer\checkLinks(), and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Member Data Documentation

◆ $brokenLinkCounts

array TYPO3\CMS\Linkvalidator\LinkAnalyzer::$brokenLinkCounts = []
protected

Array of tables and the number of broken external links they contain

Definition at line 62 of file LinkAnalyzer.php.

◆ $linkCounts

array TYPO3\CMS\Linkvalidator\LinkAnalyzer::$linkCounts = []
protected

Array of tables and the number of external links they contain

Definition at line 57 of file LinkAnalyzer.php.

◆ $pids

array TYPO3\CMS\Linkvalidator\LinkAnalyzer::$pids = []
protected

Definition at line 52 of file LinkAnalyzer.php.

◆ $searchFields

array TYPO3\CMS\Linkvalidator\LinkAnalyzer::$searchFields = []
protected

Definition at line 45 of file LinkAnalyzer.php.

Referenced by TYPO3\CMS\Linkvalidator\LinkAnalyzer\init().

◆ $tsConfig

array TYPO3\CMS\Linkvalidator\LinkAnalyzer::$tsConfig = array( )
protected

The currently active TSconfig. Will be passed to the init function.

Definition at line 68 of file LinkAnalyzer.php.

Referenced by TYPO3\CMS\Linkvalidator\LinkAnalyzer\init().