[TASK] Linkvalidator should have a hook for report markers
authorSoren Malling <soren.malling@gmail.com>
Wed, 28 Sep 2011 04:56:17 +0000 (06:56 +0200)
committerPhilipp Gampe <dev@philippgampe.info>
Mon, 19 Mar 2012 15:32:08 +0000 (16:32 +0100)
The Linkvalidator scheduler task should provide hooks within the
markers, in order for administrators to create more detailed reports.

This hook gives the possibility to get the information about a page, and
use it for any data purpose (user in charge, last update etc.)

Change-Id: Ib1bd45513be765e223ee2dcff35301d423b84a1a
Resolves: #30296
Releases: 4.7, 4.8

typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validator.php

index d0e2970..5fb308f 100644 (file)
@@ -411,6 +411,22 @@ class tx_linkvalidator_tasks_Validator extends tx_scheduler_Task {
 
                $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
                $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
+
+                       // Hook
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['reportEmailMarkers'] as $userFunc) {
+                               $params = array(
+                                       'pObj' => &$this,
+                                       'markerArray' => $markerArray,
+                               );
+                               $newMarkers = t3lib_div::callUserFunction($userFunc, $params, $this);
+                               if (is_array($newMarkers)) {
+                                       $markerArray = t3lib_div::array_merge($markerArray, $newMarkers);
+                               }
+                               reset($params);
+                       }
+               }
+
                $content = t3lib_parsehtml::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
 
                /** @var t3lib_mail_Message $mail */
@@ -481,6 +497,24 @@ class tx_linkvalidator_tasks_Validator extends tx_scheduler_Task {
        protected function buildMail($curPage, $pageList, array $markerArray, array $oldBrokenLink) {
                $pageSectionHTML = t3lib_parsehtml::getSubpart($this->templateMail, '###PAGE_SECTION###');
 
+                       // Hook
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'] as $userFunc) {
+                               $params = array(
+                                       'curPage' => $curPage,
+                                       'pageList' => $pageList,
+                                       'markerArray' => $markerArray,
+                                       'oldBrokenLink' => $oldBrokenLink,
+                                       'pObj' => &$this,
+                               );
+                               $newMarkers = t3lib_div::callUserFunction($userFunc, $params, $this);
+                               if (is_array($newMarkers)) {
+                                       $markerArray = t3lib_div::array_merge($markerArray, $newMarkers);
+                               }
+                               reset($params);
+                       }
+               }
+
                if (is_array($markerArray)) {
                        foreach ($markerArray as $markerKey => $markerValue) {
                                if (empty($oldBrokenLink[$markerKey])) {