‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser Class Reference
Inheritance diagram for TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser:
TYPO3\CMS\Core\Localization\Parser\LocalizationParserInterface TYPO3\CMS\Core\Localization\Parser\XliffParser

Public Member Functions

 parseExtensionResource (string $sourcePath, string $languageKey, string $fileNamePattern)
 
array getParsedData ($sourcePath, $languageKey)
 

Protected Member Functions

array _getParsedData ($sourcePath, $languageKey, ?string $labelsPath)
 
array parseXmlFile ()
 
string getLocalizedFileName (string $fileRef, string $language, bool $sameLocation=false)
 
array doParsingFromRoot (\SimpleXMLElement $root)
 

Protected Attributes

string $sourcePath
 
string $languageKey
 

Detailed Description

Abstract class for XML based parser.

This class is a concrete implementation and is not part of the TYPO3 Core API.

Definition at line 30 of file AbstractXmlParser.php.

Member Function Documentation

◆ _getParsedData()

array TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::_getParsedData (   $sourcePath,
  $languageKey,
?string  $labelsPath 
)
protected

◆ doParsingFromRoot()

array TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::doParsingFromRoot ( \SimpleXMLElement  $root)
abstractprotected

Returns array representation of XML data, starting from a root node.

Parameters
\SimpleXMLElement$root‪A root node
Returns
‪array An array representing the parsed XML file

Reimplemented in TYPO3\CMS\Core\Localization\Parser\XliffParser.

Referenced by TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\parseXmlFile().

◆ getLocalizedFileName()

string TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::getLocalizedFileName ( string  $fileRef,
string  $language,
bool  $sameLocation = false 
)
protected

Checks if a localized file is found in labels pack (e.g. a language pack was downloaded in the backend) or if $sameLocation is set, then checks for a file located in "{language}.locallang.xlf" at the same directory

Parameters
string$fileRef‪Absolute file reference to locallang file
string$language‪Language key
bool$sameLocation‪If TRUE, then locallang localization file name will be returned with same directory as $fileRef
Returns
‪string Absolute path to the language file

Definition at line 126 of file AbstractXmlParser.php.

References TYPO3\CMS\Core\Utility\PathUtility\basename(), TYPO3\CMS\Core\Core\Environment\getExtensionsPath(), TYPO3\CMS\Core\Core\Environment\getFrameworkBasePath(), TYPO3\CMS\Core\Core\Environment\getLabelsPath(), and TYPO3\CMS\Core\Utility\GeneralUtility\revExplode().

Referenced by TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\_getParsedData().

◆ getParsedData()

array TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::getParsedData (   $sourcePath,
  $languageKey 
)

Returns parsed representation of XML file.

Parameters
string$sourcePath‪Source file path
string$languageKey‪Language key
Returns
‪array
Exceptions

Implements TYPO3\CMS\Core\Localization\Parser\LocalizationParserInterface.

Definition at line 59 of file AbstractXmlParser.php.

References TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\$languageKey, and TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\_getParsedData().

◆ parseExtensionResource()

TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::parseExtensionResource ( string  $sourcePath,
string  $languageKey,
string  $fileNamePattern 
)

New method for parsing xml files, not part of an interface as the plan is to replace the entire API for labels with something different in TYPO3 12

Definition at line 44 of file AbstractXmlParser.php.

References TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\$languageKey, TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\_getParsedData(), and TYPO3\CMS\Core\Core\Environment\getLabelsPath().

◆ parseXmlFile()

array TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::parseXmlFile ( )
protected

Loads the current XML file before processing.

Returns
‪array An array representing parsed XML file (structure depends on concrete parser)
Exceptions

Definition at line 97 of file AbstractXmlParser.php.

References TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\doParsingFromRoot().

Referenced by TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser\_getParsedData().

Member Data Documentation

◆ $languageKey

◆ $sourcePath

string TYPO3\CMS\Core\Localization\Parser\AbstractXmlParser::$sourcePath
protected