TYPO3
7.6
|
Public Member Functions | |
__construct () | |
findRef ($table, $field, $uid, $content, $spKey, $spParams, $structurePath= '') | |
findRef_images ($content, $spParams) | |
findRef_typolink ($content, $spParams) | |
findRef_typolink_tag ($content, $spParams) | |
findRef_TStemplate ($content, $spParams) | |
findRef_TSconfig ($content, $spParams) | |
findRef_email ($content, $spParams) | |
findRef_url ($content, $spParams) | |
findRef_extension_fileref ($content, $spParams) | |
fileadminReferences ($content, &$elements) | |
getTypoLinkParts ($typolinkValue) | |
setTypoLinkPartsElement ($tLP, &$elements, $content, $idx) | |
getPageIdFromAlias ($link_param) | |
makeTokenID ($index= '') | |
Public Attributes | |
$fileAdminDir = '' | |
$tokenID_basePrefix = '' | |
Protected Member Functions | |
getSignalSlotDispatcher () | |
emitGetTypoLinkParts ($linkHandlerFound, $finalTagParts, $linkHandlerKeyword, $linkHandlerValue) | |
emitSetTypoLinkPartsElement ($linkHandlerFound, $tLP, $content, $elements, $idx, $tokenID) | |
Soft Reference processing class "Soft References" are references to database elements, files, email addresses, URls etc. which are found in-text in content. The <link [page_id]> tag from typical bodytext fields are an example of this. This class contains generic parsers for the most well-known types which are default for most TYPO3 installations. Soft References can also be userdefined. The Soft Reference parsers are used by the system to find these references and process them accordingly in import/export actions and copy operations.
Example of usage Soft References: if ($conf['softref'] && (strong)$value !== '')) { // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document) $softRefs = ::explodeSoftRefParserList($conf['softref']); // Explode the list of softreferences/parameters if ($softRefs !== FALSE) { // If there are soft references foreach($softRefs as $spKey => $spParams) { // Traverse soft references $softRefObj = ::softRefParserObj($spKey); // create / get object if (is_object($softRefObj)) { // If there was an object returned...: $resultArray = $softRefObj->findRef($table, $field, $uid, $softRefValue, $spKey, $spParams); // Do processing
Result Array: The Result array should contain two keys: "content" and "elements". "content" is a string containing the input content but possibly with tokens inside. Tokens are strings like {softref:[tokenID]} which is a placeholder for a value extracted by a softref parser For each token there MUST be an entry in the "elements" key which has a "subst" key defining the tokenID and the tokenValue. See below. "elements" is an array where the keys are insignificant, but the values are arrays with these keys: "matchString" => The value of the match. This is only for informational purposes to show what was found. "error" => An error message can be set here, like "file not found" etc. "subst" => array( // If this array is found there MUST be a token in the output content as well! "tokenID" => The tokenID string corresponding to the token in output content, {softref:[tokenID]}. This is typically an md5 hash of a string defining uniquely the position of the element. "tokenValue" => The value that the token substitutes in the text. Basically, if this value is inserted instead of the token the content should match what was inputted originally. "type" => file / db / string = the type of substitution. "file" means it is a relative file [automatically mapped], "db" means a database record reference [automatically mapped], "string" means it is manually modified string content (eg. an email address) "relFileName" => (for "file" type): Relative filename. May not necessarily exist. This could be noticed in the error key. "recordRef" => (for "db" type) : Reference to DB record on the form [table]:[uid]. May not necessarily exist. "title" => Title of element (for backend information) "description" => Description of element (for backend information) ) Class for processing of the default soft reference types for CMS:
Definition at line 70 of file SoftReferenceIndex.php.
__construct | ( | ) |
Class construct to set global variable
Definition at line 85 of file SoftReferenceIndex.php.
References $GLOBALS.
|
protected |
bool | $linkHandlerFound | |
array | $finalTagParts | |
string | $linkHandlerKeyword | |
string | $linkHandlerValue |
Definition at line 817 of file SoftReferenceIndex.php.
References SoftReferenceIndex\getSignalSlotDispatcher().
Referenced by SoftReferenceIndex\getTypoLinkParts().
|
protected |
bool | $linkHandlerFound | |
array | $tLP | |
string | $content | |
array | $elements | |
int | $idx | |
string | $tokenID |
Definition at line 831 of file SoftReferenceIndex.php.
References SoftReferenceIndex\getSignalSlotDispatcher().
Referenced by SoftReferenceIndex\setTypoLinkPartsElement().
fileadminReferences | ( | $content, | |
& | $elements | ||
) |
Searches the content for a reference to a file in "fileadmin/". When a match is found it will get substituted with a token.
string | $content | Input content to analyse |
array | $elements | Element array to be modified with new entries. Passed by reference. |
Definition at line 514 of file SoftReferenceIndex.php.
References GeneralUtility\getFileAbsFileName(), and SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef_TSconfig(), and SoftReferenceIndex\findRef_TStemplate().
findRef | ( | $table, | |
$field, | |||
$uid, | |||
$content, | |||
$spKey, | |||
$spParams, | |||
$structurePath = '' |
|||
) |
Main function through which all processing happens
string | $table | Database table name |
string | $field | Field name for which processing occurs |
int | $uid | UID of the record |
string | $content | The content/value of the field |
string | $spKey | The softlink parser key. This is only interesting if more than one parser is grouped in the same class. That is the case with this parser. |
array | $spParams | Parameters of the softlink parser. Basically this is the content inside optional []-brackets after the softref keys. Parameters are exploded by "; |
string | $structurePath | If running from inside a FlexForm structure, this is the path of the tag. |
Definition at line 102 of file SoftReferenceIndex.php.
References SoftReferenceIndex\findRef_email(), SoftReferenceIndex\findRef_extension_fileref(), SoftReferenceIndex\findRef_images(), SoftReferenceIndex\findRef_TSconfig(), SoftReferenceIndex\findRef_TStemplate(), SoftReferenceIndex\findRef_typolink(), SoftReferenceIndex\findRef_typolink_tag(), SoftReferenceIndex\findRef_url(), and SoftReferenceIndex\makeTokenID().
findRef_email | ( | $content, | |
$spParams | |||
) |
Finding email addresses in content and making them substitutable.
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns |
Definition at line 402 of file SoftReferenceIndex.php.
References SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef().
findRef_extension_fileref | ( | $content, | |
$spParams | |||
) |
Finding reference to files from extensions in content, but only to notify about their existence. No substitution
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns |
Definition at line 479 of file SoftReferenceIndex.php.
References SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef().
findRef_images | ( | $content, | |
$spParams | |||
) |
Finding image tags in the content. All images that are not from external URLs will be returned with an info text Will only return files in fileadmin/ and files in uploads/ folders which are prefixed with "RTEmagic[C|P]_" for substitution Any "clear.gif" images are ignored.
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns |
Definition at line 175 of file SoftReferenceIndex.php.
References GeneralUtility\getFileAbsFileName(), GeneralUtility\isFirstPartOfStr(), GeneralUtility\makeInstance(), and SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef().
findRef_TSconfig | ( | $content, | |
$spParams | |||
) |
Processes possible references inside of Page and User TSconfig fields. Currently this only includes file references to fileadmin/ but in fact there are currently no properties that supports such references.
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns |
Definition at line 380 of file SoftReferenceIndex.php.
References SoftReferenceIndex\fileadminReferences().
Referenced by SoftReferenceIndex\findRef().
findRef_TStemplate | ( | $content, | |
$spParams | |||
) |
Processing the content expected from a TypoScript template This content includes references to files in fileadmin/ folders and file references in HTML tags like , and string $content The input content to analyse array $spParams Parameters set for the softref parser key in TCA/columns array Result array on positive matches, see description above. Otherwise FALSE
Definition at line 306 of file SoftReferenceIndex.php.
References SoftReferenceIndex\fileadminReferences(), GeneralUtility\getFileAbsFileName(), GeneralUtility\isFirstPartOfStr(), GeneralUtility\makeInstance(), and SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef().
findRef_typolink | ( | $content, | |
$spParams | |||
) |
TypoLink value processing. Will process input value as a TypoLink value.
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns. value "linkList" will split the string by comma before processing. |
Definition at line 238 of file SoftReferenceIndex.php.
References SoftReferenceIndex\getTypoLinkParts(), and SoftReferenceIndex\setTypoLinkPartsElement().
Referenced by SoftReferenceIndex\findRef().
findRef_typolink_tag | ( | $content, | |
$spParams | |||
) |
TypoLink tag processing. Will search for <link ...> tags in the content string and process any found.
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns |
Definition at line 274 of file SoftReferenceIndex.php.
References SoftReferenceIndex\getTypoLinkParts(), GeneralUtility\makeInstance(), and SoftReferenceIndex\setTypoLinkPartsElement().
Referenced by SoftReferenceIndex\findRef().
findRef_url | ( | $content, | |
$spParams | |||
) |
Finding URLs in content
string | $content | The input content to analyse |
array | $spParams | Parameters set for the softref parser key in TCA/columns |
Definition at line 439 of file SoftReferenceIndex.php.
References SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef().
getPageIdFromAlias | ( | $link_param | ) |
Look up and return page uid for alias
int | $link_param | Page alias string value |
Definition at line 785 of file SoftReferenceIndex.php.
Referenced by SoftReferenceIndex\getTypoLinkParts().
|
protected |
Definition at line 805 of file SoftReferenceIndex.php.
References GeneralUtility\makeInstance().
Referenced by SoftReferenceIndex\emitGetTypoLinkParts(), and SoftReferenceIndex\emitSetTypoLinkPartsElement().
getTypoLinkParts | ( | $typolinkValue | ) |
Analyse content as a TypoLink value and return an array with properties. TypoLinks format is: <link [typolink] [browser target] [css class] [title attribute] [additionalParams]>. See TYPO3::typolink() The syntax of the [typolink] part is: [typolink] = [page id or alias][,[type value]][#[anchor, if integer = tt_content uid]] The extraction is based on how ::typolink() behaves.
string | $typolinkValue | TypoLink value. |
Definition at line 554 of file SoftReferenceIndex.php.
References MathUtility\canBeInterpretedAsInteger(), elseif, SoftReferenceIndex\emitGetTypoLinkParts(), SoftReferenceIndex\getPageIdFromAlias(), GeneralUtility\inList(), GeneralUtility\makeInstance(), and GeneralUtility\trimExplode().
Referenced by SoftReferenceIndex\findRef_typolink(), and SoftReferenceIndex\findRef_typolink_tag().
makeTokenID | ( | $index = '' | ) |
Make Token ID for input index.
string | $index | Suffix value. |
Definition at line 797 of file SoftReferenceIndex.php.
Referenced by SoftReferenceIndex\fileadminReferences(), SoftReferenceIndex\findRef(), SoftReferenceIndex\findRef_email(), SoftReferenceIndex\findRef_extension_fileref(), SoftReferenceIndex\findRef_images(), SoftReferenceHook\findRef_rtehtmlarea_images(), SoftReferenceIndex\findRef_TStemplate(), SoftReferenceIndex\findRef_url(), and SoftReferenceIndex\setTypoLinkPartsElement().
setTypoLinkPartsElement | ( | $tLP, | |
& | $elements, | ||
$content, | |||
$idx | |||
) |
Recompile a TypoLink value from the array of properties made with getTypoLinkParts() into an elements array
array | $tLP | TypoLink properties |
array | $elements | Array of elements to be modified with substitution / information entries. |
string | $content | The content to process. |
int | $idx | Index value of the found element - user to make unique but stable tokenID |
Definition at line 657 of file SoftReferenceIndex.php.
References MathUtility\canBeInterpretedAsInteger(), elseif, SoftReferenceIndex\emitSetTypoLinkPartsElement(), GeneralUtility\getFileAbsFileName(), GeneralUtility\isFirstPartOfStr(), GeneralUtility\makeInstance(), and SoftReferenceIndex\makeTokenID().
Referenced by SoftReferenceIndex\findRef_typolink(), and SoftReferenceIndex\findRef_typolink_tag().
$fileAdminDir = '' |
Definition at line 75 of file SoftReferenceIndex.php.
$tokenID_basePrefix = '' |
Definition at line 80 of file SoftReferenceIndex.php.