LinkAnalyzer
This class provides Processing plugin implementation
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Properties
- $brokenLinkCounts : array<string|int, mixed>
- Array of tables and the number of broken external links they contain
- $brokenLinkRepository : BrokenLinkRepository
- $eventDispatcher : EventDispatcherInterface
- $linkCounts : array<string|int, mixed>
- Array of tables and the number of external links they contain
- $linktypeRegistry : LinktypeRegistry
- $pids : array<string|int, int>
- List of page uids (rootline downwards)
- $searchFields : array<string, array<int, string>>
- Array of tables and fields to search for broken links
- $softReferenceParserFactory : SoftReferenceParserFactory
- $tcaSchemaFactory : TcaSchemaFactory
- $tsConfig : array<string|int, mixed>
- The currently active TSconfig. Will be passed to the init function.
- $visibleSchemaFieldsCollector : VisibleSchemaFieldsCollector
Methods
- __construct() : mixed
- analyzeRecord() : mixed
- Find all supported broken links for a specific record
- getLinkCounts() : array<string|int, mixed>
- Fill a marker array with the number of links found in a list of pages
- getLinkStatistics() : mixed
- Find all supported broken links and store them in tx_linkvalidator_link
- init() : mixed
- Store all the needed configuration values in class variables
- recheckLinks() : void
- Recheck for broken links for one field in table for record.
- analyzeLinks() : mixed
- Find all supported broken links for a specific link list
- analyzeTypolink() : void
- Find all supported broken links for one link, contained directly in $content (e.g. TCA type "link" fields such as tt_content.header_link).
- analyzeTypoLinks() : mixed
- Find all supported broken links for a specific typoLink
- checkLinks() : mixed
- getLanguageService() : LanguageService
Properties
$brokenLinkCounts
Array of tables and the number of broken external links they contain
protected
array<string|int, mixed>
$brokenLinkCounts
= []
$brokenLinkRepository read-only
protected
BrokenLinkRepository
$brokenLinkRepository
$eventDispatcher read-only
protected
EventDispatcherInterface
$eventDispatcher
$linkCounts
Array of tables and the number of external links they contain
protected
array<string|int, mixed>
$linkCounts
= []
$linktypeRegistry read-only
protected
LinktypeRegistry
$linktypeRegistry
$pids
List of page uids (rootline downwards)
protected
array<string|int, int>
$pids
= []
$searchFields
Array of tables and fields to search for broken links
protected
array<string, array<int, string>>
$searchFields
= []
$softReferenceParserFactory read-only
protected
SoftReferenceParserFactory
$softReferenceParserFactory
$tcaSchemaFactory read-only
protected
TcaSchemaFactory
$tcaSchemaFactory
$tsConfig
The currently active TSconfig. Will be passed to the init function.
protected
array<string|int, mixed>
$tsConfig
= []
$visibleSchemaFieldsCollector read-only
protected
VisibleSchemaFieldsCollector
$visibleSchemaFieldsCollector
Methods
__construct()
public
__construct(EventDispatcherInterface $eventDispatcher, BrokenLinkRepository $brokenLinkRepository, SoftReferenceParserFactory $softReferenceParserFactory, LinktypeRegistry $linktypeRegistry, TcaSchemaFactory $tcaSchemaFactory, VisibleSchemaFieldsCollector $visibleSchemaFieldsCollector) : mixed
Parameters
- $eventDispatcher : EventDispatcherInterface
- $brokenLinkRepository : BrokenLinkRepository
- $softReferenceParserFactory : SoftReferenceParserFactory
- $linktypeRegistry : LinktypeRegistry
- $tcaSchemaFactory : TcaSchemaFactory
- $visibleSchemaFieldsCollector : VisibleSchemaFieldsCollector
analyzeRecord()
Find all supported broken links for a specific record
public
analyzeRecord(array<string|int, mixed> &$results, string $table, array<string|int, mixed> $fields, array<string|int, mixed> $record) : mixed
Parameters
- $results : array<string|int, mixed>
-
Array of broken links
- $table : string
-
Table name of the record
- $fields : array<string|int, mixed>
-
Array of fields to analyze
- $record : array<string|int, mixed>
-
Record to analyze
getLinkCounts()
Fill a marker array with the number of links found in a list of pages
public
getLinkCounts() : array<string|int, mixed>
Return values
array<string|int, mixed> —array with the number of links found
getLinkStatistics()
Find all supported broken links and store them in tx_linkvalidator_link
public
getLinkStatistics([array<int, string> $linkTypes = [] ][, bool $considerHidden = false ]) : mixed
Parameters
- $linkTypes : array<int, string> = []
-
List of hook object to activate
- $considerHidden : bool = false
-
Defines whether to look into hidden fields
init()
Store all the needed configuration values in class variables
public
init(array<string|int, mixed> $searchFields, array<string|int, int> $pidList, array<string|int, mixed> $tsConfig) : mixed
Parameters
- $searchFields : array<string|int, mixed>
-
List of fields in which to search for links
- $pidList : array<string|int, int>
-
List of page uids in which to search for links
- $tsConfig : array<string|int, mixed>
-
The currently active TSconfig.
recheckLinks()
Recheck for broken links for one field in table for record.
public
recheckLinks(array<string|int, mixed> $checkOptions, string|int $recordUid, string $table, string $field, int $timestamp[, bool $considerHidden = true ]) : void
Parameters
- $checkOptions : array<string|int, mixed>
- $recordUid : string|int
-
uid of record to check
- $table : string
- $field : string
- $timestamp : int
-
- only recheck if timestamp changed
- $considerHidden : bool = true
analyzeLinks()
Find all supported broken links for a specific link list
protected
analyzeLinks(SoftReferenceParserResult $parserResult, array<string|int, mixed> &$results, array<string|int, mixed> $record, string $field, string $table[, array<string|int, mixed> &$foundTokenValues = [] ]) : mixed
Parameters
- $parserResult : SoftReferenceParserResult
-
findRef parsed records
- $results : array<string|int, mixed>
-
Array of broken links
- $record : array<string|int, mixed>
-
UID of the current record
- $field : string
-
The current field
- $table : string
-
The current table
- $foundTokenValues : array<string|int, mixed> = []
-
Link targets already found for this record/field by a previous soft reference parser, to avoid reporting the same link twice when it is matched by more than one parser (e.g. an URL used as its own link text)
analyzeTypolink()
Find all supported broken links for one link, contained directly in $content (e.g. TCA type "link" fields such as tt_content.header_link).
protected
analyzeTypolink(string $content, array<string|int, mixed> &$results, array<string|int, mixed> $record, string $field, string $table) : void
Reuses the "typolink" soft reference parser to resolve the link (page, file, external URL, ...), instead of re-implementing that resolution here. That parser returns a page reference and a content element reference as two separate matches for a link to a content element (e.g. t3://page?uid=1#20), which are merged into a single "pageAndAnchor" entry here, the same way analyzeTypoLinks() merges them for typolink_tag matches.
Parameters
- $content : string
- $results : array<string|int, mixed>
-
Array of broken links
- $record : array<string|int, mixed>
-
The current record
- $field : string
-
The current field
- $table : string
-
The current table
analyzeTypoLinks()
Find all supported broken links for a specific typoLink
protected
analyzeTypoLinks(SoftReferenceParserResult $parserResult, array<string|int, mixed> &$results, HtmlParser $htmlParser, array<string|int, mixed> $record, string $field, string $table[, array<string|int, mixed> &$foundTokenValues = [] ]) : mixed
Parameters
- $parserResult : SoftReferenceParserResult
-
findRef parsed records
- $results : array<string|int, mixed>
-
Array of broken links
- $htmlParser : HtmlParser
-
Instance of html parser
- $record : array<string|int, mixed>
-
The current record
- $field : string
-
The current field
- $table : string
-
The current table
- $foundTokenValues : array<string|int, mixed> = []
-
Link targets already found for this record/field by a previous soft reference parser, to avoid reporting the same link twice when it is matched by more than one parser (e.g. an URL used as its own link text)
checkLinks()
protected
checkLinks(array<string|int, mixed> $links, array<int, string> $linkTypes) : mixed
Parameters
- $links : array<string|int, mixed>
- $linkTypes : array<int, string>
getLanguageService()
protected
getLanguageService() : LanguageService