[TASK] Cleanup new files
authorPhilipp Gampe <dev@philippgampe.info>
Fri, 28 Sep 2012 14:33:35 +0000 (16:33 +0200)
committerPhilipp Gampe <philipp.gampe@typo3.org>
Sun, 30 Sep 2012 14:47:37 +0000 (16:47 +0200)
Fix CGL issues and namespace typehints including:
* Long running lines
* Not lower camelcase variables
* Copyright year
* Cleanup Comments

Resolves: #41453
Releases: 6.0

Change-Id: I39bccb17f5bebf457051b86a5a69ec54a8bb9f19
Reviewed-on: http://review.typo3.org/15143
Reviewed-by: Wouter Wolters
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
typo3/sysext/linkvalidator/Classes/LinkAnalyzer.php
typo3/sysext/linkvalidator/Classes/Linktype/AbstractLinktype.php
typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php
typo3/sysext/linkvalidator/Classes/Linktype/FileLinktype.php
typo3/sysext/linkvalidator/Classes/Linktype/InternalLinktype.php
typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php
typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php
typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
typo3/sysext/linkvalidator/Classes/Task/ValidatorTaskAdditionalFieldProvider.php

index b21ec66..d2ef2fd 100644 (file)
@@ -74,7 +74,7 @@ class LinkAnalyzer {
        /**
         * Array for hooks for own checks
         *
-        * @var tx_linkvalidator_linktype_Abstract[]
+        * @var \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype[]
         */
        protected $hookObjectsArr = array();
 
@@ -130,7 +130,7 @@ class LinkAnalyzer {
         * Find all supported broken links and store them in tx_linkvalidator_link
         *
         * @param array $checkOptions List of hook object to activate
-        * @param boolean $considerHidden Defines whether to look into hidden fields or not
+        * @param boolean $considerHidden Defines whether to look into hidden fields
         * @return void
         */
        public function getLinkStatistics($checkOptions = array(), $considerHidden = FALSE) {
@@ -149,7 +149,8 @@ class LinkAnalyzer {
                                if (!$considerHidden) {
                                        $where .= \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($table);
                                }
-                               // If table is not configured, assume the extension is not installed and therefore no need to check it
+                               // If table is not configured, assume the extension is not installed
+                               // and therefore no need to check it
                                if (!is_array($GLOBALS['TCA'][$table])) {
                                        continue;
                                }
@@ -240,7 +241,7 @@ class LinkAnalyzer {
                                // Traverse soft references
                                foreach ($softRefs as $spKey => $spParams) {
                                        /** @var \TYPO3\CMS\Core\Database\SoftReferenceIndex $softRefObj Create or get the soft reference object */
-                                       $softRefObj =& \TYPO3\CMS\Backend\Utility\BackendUtility::softRefParserObj($spKey);
+                                       $softRefObj = \TYPO3\CMS\Backend\Utility\BackendUtility::softRefParserObj($spKey);
                                        // If there is an object returned...
                                        if (is_object($softRefObj)) {
                                                // Do processing
@@ -362,7 +363,11 @@ class LinkAnalyzer {
                if (empty($this->pidList)) {
                        $this->pidList = $curPage;
                }
-               if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(uid) as nbBrokenLinks,link_type', 'tx_linkvalidator_link', 'record_pid in (' . $this->pidList . ')', 'link_type')) {
+               if (($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                       'count(uid) as nbBrokenLinks,link_type',
+                       'tx_linkvalidator_link',
+                       'record_pid in (' . $this->pidList . ')', 'link_type')
+               )) {
                        while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
                                $markerArray[$row['link_type']] = $row['nbBrokenLinks'];
                                $markerArray['brokenlinkCount'] += $row['nbBrokenLinks'];
@@ -393,7 +398,10 @@ class LinkAnalyzer {
                $id = intval($id);
                $theList = '';
                if ($depth > 0) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,title,hidden,extendToSubpages', 'pages', 'pid=' . $id . ' AND deleted=0 AND ' . $permsClause);
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                               'uid,title,hidden,extendToSubpages',
+                               'pages', 'pid=' . $id . ' AND deleted=0 AND ' . $permsClause
+                       );
                        while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
                                if ($begin <= 0 && ($row['hidden'] == 0 || $considerHidden == 1)) {
                                        $theList .= $row['uid'] . ',';
index 4836daa..9511a9c 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
index 9fdf610..b61d39d 100644 (file)
@@ -4,8 +4,8 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 - 2009 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2010 - 2012 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -79,18 +79,18 @@ class ExternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
                        'follow_redirects' => TRUE,
                        'strict_redirects' => TRUE
                );
-               /** @var t3lib_http_Request|HTTP_Request2 $request */
+               /** @var \TYPO3\CMS\Core\Http\HttpRequest|\HTTP_Request2 $request */
                $request = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Http\\HttpRequest', $url, 'HEAD', $config);
                // Observe cookies
                $request->setCookieJar(TRUE);
                try {
-                       /** @var HTTP_Request2_Response $response */
+                       /** @var \HTTP_Request2_Response $response */
                        $response = $request->send();
                        // HEAD was not allowed, now trying GET
                        if (isset($response) && $response->getStatus() === 405) {
                                $request->setMethod('GET');
                                $request->setHeader('Range', 'bytes = 0 - 4048');
-                               /** @var HTTP_Request2_Response $response */
+                               /** @var \HTTP_Request2_Response $response */
                                $response = $request->send();
                        }
                } catch (\Exception $e) {
index 915aa21..3f0be63 100644 (file)
@@ -4,8 +4,8 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2005 - 2012 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -38,8 +38,8 @@ class FileLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
         * Checks a given URL + /path/filename.ext for validity
         *
         * @param string $url Url to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
+        * @param array $softRefEntry The soft reference entry which builds the context of the url
+        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance
         * @return boolean TRUE on success or FALSE on error
         */
        public function checkLink($url, $softRefEntry, $reference) {
index 16e7af1..fe78e1b 100644 (file)
@@ -4,8 +4,8 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2005 - 2012 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -72,7 +72,7 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
                $this->responseContent = TRUE;
                // Might already contain values - empty it
                unset($this->errorParams);
-               // defines the linked page and anchor (if any).
+               // Defines the linked page and anchor (if any).
                if (strpos($url, '#c') !== FALSE) {
                        $parts = explode('#c', $url);
                        $page = $parts[0];
@@ -81,13 +81,15 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
                        $page = $url;
                }
                // Check if the linked page is OK
-               $this->responsePage = $this->checkPage($page, $softRefEntry, $reference);
+               $this->responsePage = $this->checkPage($page);
                // Check if the linked content element is OK
                if ($anchor) {
                        // Check if the content element is OK
-                       $this->responseContent = $this->checkContent($page, $anchor, $softRefEntry, $reference);
+                       $this->responseContent = $this->checkContent($page, $anchor);
                }
-               if (is_array($this->errorParams['page']) && !$this->responsePage || is_array($this->errorParams['content']) && !$this->responseContent) {
+               if (is_array($this->errorParams['page']) && !$this->responsePage
+                       || is_array($this->errorParams['content']) && !$this->responseContent
+               ) {
                        $this->setErrorParams($this->errorParams);
                }
                if ($this->responsePage === TRUE && $this->responseContent === TRUE) {
@@ -102,11 +104,9 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
         * Checks a given page uid for validity
         *
         * @param string $page Page uid to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
         * @return boolean TRUE on success or FALSE on error
         */
-       protected function checkPage($page, $softRefEntry, $reference) {
+       protected function checkPage($page) {
                $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, title, deleted, hidden, starttime, endtime', 'pages', 'uid = ' . intval($page));
                $this->responsePage = TRUE;
                if ($row) {
@@ -134,11 +134,9 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
         *
         * @param string $page Uid of the page to which the link is pointing
         * @param string $anchor Uid of the content element to check
-        * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
         * @return boolean TRUE on success or FALSE on error
         */
-       protected function checkContent($page, $anchor, $softRefEntry, $reference) {
+       protected function checkContent($page, $anchor) {
                // Get page ID on which the content element in fact is located
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid, pid, header, deleted, hidden, starttime, endtime', 'tt_content', 'uid = ' . intval($anchor));
                $this->responseContent = TRUE;
@@ -178,7 +176,7 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
        }
 
        /**
-        * Generate the localized error message from the error params saved from the parsing
+        * Generates the localized error message from the error params saved from the parsing
         *
         * @param array $errorParams All parameters needed for the rendering of the error message
         * @return string Validation error message
@@ -240,7 +238,7 @@ class InternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
        }
 
        /**
-        * Construct a valid Url for browser output
+        * Constructs a valid Url for browser output
         *
         * @param array $row Broken link record
         * @return string Parsed broken url
index 9a858d3..049f27b 100644 (file)
@@ -4,8 +4,8 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2005 - 2012 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -56,7 +56,7 @@ class LinkHandler extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
         *
         * @param string $url Url to check
         * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
+        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance
         * @return boolean TRUE on success or FALSE on error
         */
        public function checkLink($url, $softRefEntry, $reference) {
@@ -82,7 +82,7 @@ class LinkHandler extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
                }
 
                if (!$response) {
-                       $this->setErrorParams();
+                       $this->setErrorParams($errorParams);
                }
                return $response;
        }
index 51a59ce..e336c0c 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -37,7 +37,7 @@ interface LinktypeInterface
         *
         * @param string $url Url to check
         * @param array $softRefEntry The soft reference entry which builds the context of that url
-        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
+        * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance
         * @return string Validation error message or success code
         */
        public function checkLink($url, $softRefEntry, $reference);
index d80bca1..91c3c2b 100644 (file)
@@ -4,8 +4,8 @@ namespace TYPO3\CMS\Linkvalidator\Report;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2005 - 2012 Jochen Rieger (j.rieger@connecta.ag)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -132,7 +132,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
        protected $content;
 
        /**
-        * @var t3lib_pageRenderer $pageRenderer
+        * @var \TYPO3\CMS\Core\Page\PageRenderer
         */
        protected $pageRenderer;
 
@@ -142,7 +142,7 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
        protected $resPath = '';
 
        /**
-        * @var tx_linkvalidator_linktype_Interface[] $hookObjectsArr
+        * @var \TYPO3\CMS\Linkvalidator\Linktype\LinktypeInterface[]
         */
        protected $hookObjectsArr = array();
 
@@ -352,7 +352,12 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                } else {
                        // If no access or if ID == zero
                        /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
-                       $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('no.access'), $GLOBALS['LANG']->getLL('no.access.title'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                       $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                               'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
+                               $GLOBALS['LANG']->getLL('no.access'),
+                               $GLOBALS['LANG']->getLL('no.access.title'),
+                               \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+                       );
                        $this->content .= $message->render();
                }
        }
@@ -364,7 +369,11 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
         * @return string $content
         */
        protected function flush($form = FALSE) {
-               $content = $this->doc->moduleBody($this->pageRecord, $this->getDocHeaderButtons(), $form ? $this->getTemplateMarkers() : $this->getTemplateMarkersCheck());
+               $content = $this->doc->moduleBody(
+                       $this->pageRecord,
+                       $this->getDocHeaderButtons(),
+                       $form ? $this->getTemplateMarkers() : $this->getTemplateMarkersCheck()
+               );
                return $content;
        }
 
@@ -405,10 +414,22 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                }
                $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo);
                if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) {
-                       $pageList = $this->processor->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS['checkhidden']);
+                       $pageList = $this->processor->extGetTreeList(
+                               $this->pObj->id,
+                               $this->searchLevel,
+                               0,
+                               $GLOBALS['BE_USER']->getPagePermsClause(1),
+                               $this->modTS['checkhidden']
+                       );
                        // Always add the current page, because we are just displaying the results
                        $pageList .= $this->pObj->id;
-                       if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_linkvalidator_link', 'record_pid in (' . $pageList . ') and link_type in (\'' . implode('\',\'', $keyOpt) . '\')', '', 'record_uid ASC, uid ASC')) {
+                       if (($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                               '*',
+                               'tx_linkvalidator_link',
+                               'record_pid in (' . $pageList . ') and link_type in (\'' . implode('\',\'', $keyOpt) . '\')',
+                               '',
+                               'record_uid ASC, uid ASC')
+                       )) {
                                // Display table with broken links
                                if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
                                        $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_CONTENT###');
@@ -427,7 +448,11 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                } else {
                        $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
                }
-               $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($brokenLinksTemplate, $brokenLinksMarker, '###|###', TRUE);
+               $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray(
+                       $brokenLinksTemplate,
+                       $brokenLinksMarker, '###|###',
+                       TRUE
+               );
                $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($brokenLinksTemplate, '###BROKENLINKS_ITEM', $brokenLinkItems);
                return $content;
        }
@@ -441,7 +466,12 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
        protected function getNoBrokenLinkMessage(array $brokenLinksMarker) {
                $brokenLinksMarker['LIST_HEADER'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
                /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $message */
-               $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('list.no.broken.links'), $GLOBALS['LANG']->getLL('list.no.broken.links.title'), \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
+               $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                       'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
+                       $GLOBALS['LANG']->getLL('list.no.broken.links'),
+                       $GLOBALS['LANG']->getLL('list.no.broken.links.title'),
+                       \TYPO3\CMS\Core\Messaging\FlashMessage::OK
+               );
                $brokenLinksMarker['NO_BROKEN_LINKS'] = $message->render();
                return $brokenLinksMarker;
        }
@@ -484,8 +514,20 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                // Restore the linktype object
                $hookObj = $this->hookObjectsArr[$row['link_type']];
                $brokenUrl = $hookObj->getBrokenUrl($row);
+               // Construct link to edit the content element
                $params = '&edit[' . $table . '][' . $row['record_uid'] . ']=edit';
-               $actionLinks = '<a href="#" onclick="' . \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick($params, $GLOBALS['BACK_PATH'], (\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') . '?id=' . $this->pObj->id . '&search_levels=' . $this->searchLevel)) . '"' . ' title="' . $GLOBALS['LANG']->getLL('list.edit') . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open') . '</a>';
+               $requestUri = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') .
+                       '?id=' . $this->pObj->id .
+                       '&search_levels=' . $this->searchLevel;
+               $actionLink = '<a href="#" onclick="';
+               $actionLink .= \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick(
+                       $params,
+                       $GLOBALS['BACK_PATH'],
+                       $requestUri
+               );
+               $actionLink .= '" title="' . $GLOBALS['LANG']->getLL('list.edit') . '">';
+               $actionLink .= \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open');
+               $actionLink .= '</a>';
                $elementHeadline = $row['headline'];
                if (empty($elementHeadline)) {
                        $elementHeadline = '<i>' . $GLOBALS['LANG']->getLL('list.no.headline') . '</i>';
@@ -502,10 +544,14 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                // Fallback, if there is no label
                $fieldName = !empty($fieldName) ? $fieldName : $row['field'];
                // column "Element"
-               $element = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => $table . ':' . $row['record_uid']));
+               $element = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord(
+                       $table,
+                       $row,
+                       array('title' => $table . ':' . $row['record_uid'])
+               );
                $element .= $elementHeadline;
                $element .= ' ' . sprintf($GLOBALS['LANG']->getLL('list.field'), $fieldName);
-               $markerArray['actionlink'] = $actionLinks;
+               $markerArray['actionlink'] = $actionLink;
                $markerArray['path'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordPath($row['record_pid'], '', 0, 0);
                $markerArray['element'] = $element;
                $markerArray['headlink'] = $row['link_title'];
@@ -554,7 +600,8 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                $linktypes = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->modTS['linktypes'], 1);
                $hookSectionContent = '';
                if (is_array($linktypes)) {
-                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                       if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])
+                               && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
                                foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
                                        if (in_array($type, $linktypes)) {
                                                $hookSectionMarker = array();
@@ -567,12 +614,20 @@ class LinkValidatorReport extends \TYPO3\CMS\Backend\Module\AbstractFunctionModu
                                                $translation = $translation ? $translation : $type;
                                                $option = '<input type="checkbox" ' . $additionalAttr . '  id="' . $prefix . 'SET_' . $type . '" name="' . $prefix . 'SET[' . $type . ']" value="1"' . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '') . '/>' . '<label for="' . $prefix . 'SET[' . $type . ']">' . htmlspecialchars($translation) . '</label>';
                                                $hookSectionMarker['option'] = $option;
-                                               $hookSectionContent .= \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
+                                               $hookSectionContent .= \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray(
+                                                       $hookSectionTemplate,
+                                                       $hookSectionMarker, '###|###',
+                                                       TRUE,
+                                                       TRUE
+                                               );
                                        }
                                }
                        }
                }
-               $checkOptionsTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent);
+               $checkOptionsTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart(
+                       $checkOptionsTemplate,
+                       '###HOOK_SECTION###', $hookSectionContent
+               );
                return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
        }
 
index eb32c51..5747eaa 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Linkvalidator\Task;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -76,11 +76,11 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
        protected $configuration = array();
 
        /**
-        * Shows if number of result was different from the result of the last check or not
+        * Shows if number of result was different from the result of the last check
         *
         * @var boolean
         */
-       protected $dif;
+       protected $isDifferentToLastRun;
 
        /**
         * Template to be used for the email
@@ -234,12 +234,14 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
        /**
         * Function execute from the Scheduler
         *
+        * @throws \Exception if the email templale file can not be read
         * @return boolean TRUE on successful execution, FALSE on error
         */
        public function execute() {
                $this->setCliArguments();
                $successfullyExecuted = TRUE;
-               if (!file_exists(($file = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->emailTemplateFile))) && !empty($this->email)) {
+               if (!file_exists(($file = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($this->emailTemplateFile)))
+                       && !empty($this->email)) {
                        throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidEmailTemplateFile'), '1295476972');
                }
                $htmlFile = \TYPO3\CMS\Core\Utility\GeneralUtility::getURL($file);
@@ -247,18 +249,18 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                // The array to put the content into
                $html = array();
                $pageSections = '';
-               $this->dif = FALSE;
+               $this->isDifferentToLastRun = FALSE;
                $pageList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->page, 1);
-               $modTS = $this->loadModTSconfig($this->page);
+               $modTS = $this->loadModTsConfig($this->page);
                if (is_array($pageList)) {
                        foreach ($pageList as $page) {
                                $pageSections .= $this->checkPageLinks($page);
                        }
                }
                if ($this->totalBrokenLink != $this->oldTotalBrokenLink) {
-                       $this->dif = TRUE;
+                       $this->isDifferentToLastRun = TRUE;
                }
-               if ($this->totalBrokenLink > 0 && (!$this->emailOnBrokenLinkOnly || $this->dif) && !empty($this->email)) {
+               if ($this->totalBrokenLink > 0 && (!$this->emailOnBrokenLinkOnly || $this->isDifferentToLastRun) && !empty($this->email)) {
                        $successfullyExecuted = $this->reportEmail($pageSections, $modTS);
                }
                return $successfullyExecuted;
@@ -275,7 +277,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                $pageSections = '';
                $pageIds = '';
                $oldLinkCounts = array();
-               $modTS = $this->loadModTSconfig($page);
+               $modTS = $this->loadModTsConfig($page);
                $searchFields = $this->getSearchField($modTS);
                $linkTypes = $this->getLinkTypes($modTS);
                /** @var \TYPO3\CMS\Linkvalidator\LinkAnalyzer $processor */
@@ -288,8 +290,8 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                }
                if (!$rootLineHidden || $modTS['checkhidden'] == 1) {
                        $pageIds = $processor->extGetTreeList($page, $this->depth, 0, '1=1', $modTS['checkhidden']);
-                       if ($pageRow['hidden'] == 0 || $modTS['checkhidden'] == 1) {
-                               // tx_linkvalidator_Processor::extGetTreeList always adds trailing comma:
+                       if (isset($pageRow) && $pageRow['hidden'] == 0 || $modTS['checkhidden'] == 1) {
+                               // \TYPO3\CMS\Linkvalidator\LinkAnalyzer->extGetTreeList() always adds trailing comma
                                $pageIds .= $page;
                        }
                }
@@ -313,10 +315,11 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
         * Get the linkvalidator modTSconfig for a page
         *
         * @param integer $page Uid of the page
-        * @return array $modTS mod.linkvalidator TSconfig array
+        * @throws \Exception
+        * @return array $modTsConfig mod.linkvalidator TSconfig array
         */
-       protected function loadModTSconfig($page) {
-               $modTS = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page, 'mod.linkvalidator');
+       protected function loadModTsConfig($page) {
+               $modTs = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page, 'mod.linkvalidator');
                $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser');
                $parseObj->parse($this->configuration);
                if (count($parseObj->errors) > 0) {
@@ -326,13 +329,13 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                        }
                        throw new \Exception($parseErrorMessage, '1295476989');
                }
-               $TSconfig = $parseObj->setup;
-               $modTS = $modTS['properties'];
-               $overrideTs = $TSconfig['mod.']['tx_linkvalidator.'];
+               $tsConfig = $parseObj->setup;
+               $modTs = $modTs['properties'];
+               $overrideTs = $tsConfig['mod.']['tx_linkvalidator.'];
                if (is_array($overrideTs)) {
-                       $modTS = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($modTS, $overrideTs);
+                       $modTs = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($modTs, $overrideTs);
                }
-               return $modTS;
+               return $modTs;
        }
 
        /**
@@ -377,10 +380,11 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
         * Build and send warning email when new broken links were found
         *
         * @param string $pageSections Content of page section
-        * @param array $modTS TSconfig array
+        * @param array $modTsConfig TSconfig array
+        * @throws \Exception if required modTsConfig settings are missing
         * @return boolean TRUE if mail was sent, FALSE if or not
         */
-       protected function reportEmail($pageSections, array $modTS) {
+       protected function reportEmail($pageSections, array $modTsConfig) {
                $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
                /** @var array $markerArray */
                $markerArray = array();
@@ -407,22 +411,22 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
                /** @var \TYPO3\CMS\Core\Mail\MailMessage $mail */
                $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
-               if (empty($modTS['mail.']['fromemail'])) {
-                       $modTS['mail.']['fromemail'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress();
+               if (empty($modTsConfig['mail.']['fromemail'])) {
+                       $modTsConfig['mail.']['fromemail'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromAddress();
                }
-               if (empty($modTS['mail.']['fromname'])) {
-                       $modTS['mail.']['fromname'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromName();
+               if (empty($modTsConfig['mail.']['fromname'])) {
+                       $modTsConfig['mail.']['fromname'] = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFromName();
                }
-               if (\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($modTS['mail.']['fromemail'])) {
-                       $mail->setFrom(array($modTS['mail.']['fromemail'] => $modTS['mail.']['fromname']));
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($modTsConfig['mail.']['fromemail'])) {
+                       $mail->setFrom(array($modTsConfig['mail.']['fromemail'] => $modTsConfig['mail.']['fromname']));
                } else {
                        throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidFromEmail'), '1295476760');
                }
-               if (\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($modTS['mail.']['replytoemail'])) {
-                       $mail->setReplyTo(array($modTS['mail.']['replytoemail'] => $modTS['mail.']['replytoname']));
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::validEmail($modTsConfig['mail.']['replytoemail'])) {
+                       $mail->setReplyTo(array($modTsConfig['mail.']['replytoemail'] => $modTsConfig['mail.']['replytoname']));
                }
-               if (!empty($modTS['mail.']['subject'])) {
-                       $mail->setSubject($modTS['mail.']['subject']);
+               if (!empty($modTsConfig['mail.']['subject'])) {
+                       $mail->setSubject($modTsConfig['mail.']['subject']);
                } else {
                        throw new \Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.noSubject'), '1295476808');
                }
@@ -458,7 +462,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
         * @return string Content of the mail
         */
        protected function buildMail($curPage, $pageList, array $markerArray, array $oldBrokenLink) {
-               $pageSectionHTML = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->templateMail, '###PAGE_SECTION###');
+               $pageSectionHtml = \TYPO3\CMS\Core\Html\HtmlParser::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) {
@@ -482,7 +486,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                                        $oldBrokenLink[$markerKey] = 0;
                                }
                                if ($markerValue != $oldBrokenLink[$markerKey]) {
-                                       $this->dif = TRUE;
+                                       $this->isDifferentToLastRun = TRUE;
                                }
                                $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey];
                        }
@@ -490,7 +494,7 @@ class ValidatorTask extends \TYPO3\CMS\Scheduler\Task {
                $markerArray['title'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $curPage));
                $content = '';
                if ($markerArray['brokenlinkCount'] > 0) {
-                       $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($pageSectionHTML, $markerArray, '###|###', TRUE, TRUE);
+                       $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($pageSectionHtml, $markerArray, '###|###', TRUE, TRUE);
                }
                return $content;
        }
index 964fe19..e7e6193 100644 (file)
@@ -4,7 +4,7 @@ namespace TYPO3\CMS\Linkvalidator\Task;
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  (c) 2010 - 2012 Michael Miousse (michael.miousse@infoglobe.ca)
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -37,10 +37,10 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
         * Render additional information fields within the scheduler backend.
         *
         * @param array $taskInfo Array information of task to return
-        * @param task $task Task object
-        * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the calling object (BE module of the Scheduler)
+        * @param ValidatorTask $task Task object
+        * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the BE module of the Scheduler
         * @return array Additional fields
-        * @see interfaces/tx_scheduler_AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
+        * @see \TYPO3\CMS\Scheduler\AdditionalFieldProviderInterface->getAdditionalFields($taskInfo, $task, $schedulerModule)
         */
        public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) {
                $additionalFields = array();
@@ -98,16 +98,16 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
                                $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
                        }
                }
-               $fieldID = 'task_page';
-               $fieldCode = '<input type="text" name="tx_scheduler[linkvalidator][page]"  id="' . $fieldID . '" value="' . htmlspecialchars($taskInfo['page']) . '"/>';
+               $fieldId = 'task_page';
+               $fieldCode = '<input type="text" name="tx_scheduler[linkvalidator][page]"  id="' . $fieldId . '" value="' . htmlspecialchars($taskInfo['page']) . '"/>';
                $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.page');
-               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
+               $additionalFields[$fieldId] = array(
                        'code' => $fieldCode,
                        'label' => $label
                );
                // input for depth
-               $fieldID = 'task_depth';
+               $fieldId = 'task_depth';
                $fieldValueArray = array(
                        '0' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_0'),
                        '1' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_1'),
@@ -116,52 +116,52 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
                        '4' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_4'),
                        '999' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_infi')
                );
-               $fieldCode = '<select name="tx_scheduler[linkvalidator][depth]" id="' . $fieldID . '">';
+               $fieldCode = '<select name="tx_scheduler[linkvalidator][depth]" id="' . $fieldId . '">';
                foreach ($fieldValueArray as $depth => $label) {
-                       $fieldCode .= "\t" . '<option value="' . htmlspecialchars($depth) . '"'
-                                               . (($depth == $taskInfo['depth']) ? ' selected="selected"' : '')
-                                               '>' . $label . '</option>';
+                       $fieldCode .= "\t" . '<option value="' . htmlspecialchars($depth) . '"' .
+                                               (($depth == $taskInfo['depth']) ? ' selected="selected"' : '') .
+                                               '>' . $label . '</option>';
                }
                $fieldCode .= '</select>';
                $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.depth');
-               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
+               $additionalFields[$fieldId] = array(
                        'code' => $fieldCode,
                        'label' => $label
                );
-               $fieldID = 'task_configuration';
-               $fieldCode = '<textarea  name="tx_scheduler[linkvalidator][configuration]" id="' . $fieldID . '" >'
-                                       htmlspecialchars($taskInfo['configuration']) . '</textarea>';
+               $fieldId = 'task_configuration';
+               $fieldCode = '<textarea  name="tx_scheduler[linkvalidator][configuration]" id="' . $fieldId . '" >' .
+                                       htmlspecialchars($taskInfo['configuration']) . '</textarea>';
                $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.conf');
-               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
+               $additionalFields[$fieldId] = array(
                        'code' => $fieldCode,
                        'label' => $label
                );
-               $fieldID = 'task_email';
-               $fieldCode = '<input type="text"  name="tx_scheduler[linkvalidator][email]" id="' . $fieldID . '" value="'
-                                       htmlspecialchars($taskInfo['email']) . '" />';
+               $fieldId = 'task_email';
+               $fieldCode = '<input type="text"  name="tx_scheduler[linkvalidator][email]" id="' . $fieldId . '" value="' .
+                                       htmlspecialchars($taskInfo['email']) . '" />';
                $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.email');
-               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
+               $additionalFields[$fieldId] = array(
                        'code' => $fieldCode,
                        'label' => $label
                );
-               $fieldID = 'task_emailOnBrokenLinkOnly';
-               $fieldCode = '<input type="checkbox"  name="tx_scheduler[linkvalidator][emailOnBrokenLinkOnly]" id="' . $fieldID . '" '
-                                       (htmlspecialchars($taskInfo['emailOnBrokenLinkOnly']) ? 'checked="checked"' : '') . ' />';
+               $fieldId = 'task_emailOnBrokenLinkOnly';
+               $fieldCode = '<input type="checkbox"  name="tx_scheduler[linkvalidator][emailOnBrokenLinkOnly]" id="' . $fieldId . '" ' .
+                                       (htmlspecialchars($taskInfo['emailOnBrokenLinkOnly']) ? 'checked="checked"' : '') . ' />';
                $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
-               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
+               $additionalFields[$fieldId] = array(
                        'code' => $fieldCode,
                        'label' => $label
                );
-               $fieldID = 'task_emailTemplateFile';
-               $fieldCode = '<input type="text"  name="tx_scheduler[linkvalidator][emailTemplateFile]" id="' . $fieldID
-                                       '" value="' . htmlspecialchars($taskInfo['emailTemplateFile']) . '" />';
+               $fieldId = 'task_emailTemplateFile';
+               $fieldCode = '<input type="text"  name="tx_scheduler[linkvalidator][emailTemplateFile]" id="' . $fieldId .
+                                       '" value="' . htmlspecialchars($taskInfo['emailTemplateFile']) . '" />';
                $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
-               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
+               $label = \TYPO3\CMS\Backend\Utility\BackendUtility::wrapInHelp('linkvalidator', $fieldId, $label);
+               $additionalFields[$fieldId] = array(
                        'code' => $fieldCode,
                        'label' => $label
                );
@@ -177,10 +177,8 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
         */
        protected function getSelectedState(array $configurationArray, $currentValue) {
                $selected = '';
-               for ($i = 0; $i < count($configurationArray); $i++) {
-                       if (strcmp($configurationArray[$i], $currentValue) === 0) {
-                               $selected = 'selected="selected" ';
-                       }
+               if (in_array($currentValue, $configurationArray, TRUE)) {
+                       $selected = 'selected="selected" ';
                }
                return $selected;
        }
@@ -190,7 +188,7 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
         * If the task class is not relevant, the method is expected to return TRUE.
         *
         * @param array $submittedData Reference to the array containing the data submitted by the user
-        * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the calling object (BE module of the Scheduler)
+        * @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the BE module of the Scheduler
         * @return boolean TRUE if validation was ok (or selected class is not relevant), FALSE otherwise
         */
        public function validateAdditionalFields(array &$submittedData, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule) {
@@ -208,16 +206,25 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
                if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = ' . intval($submittedData['linkvalidator']['page']))) {
                        if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) == 0 && $submittedData['linkvalidator']['page'] > 0) {
                                $isValid = FALSE;
-                               $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                               $schedulerModule->addMessage(
+                                       $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'),
+                                       \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+                               );
                        }
                        $GLOBALS['TYPO3_DB']->sql_free_result($res);
                } else {
                        $isValid = FALSE;
-                       $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                       $schedulerModule->addMessage(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'),
+                               \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+                       );
                }
                if ($submittedData['linkvalidator']['depth'] < 0) {
                        $isValid = FALSE;
-                       $schedulerModule->addMessage($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
+                       $schedulerModule->addMessage(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'),
+                               \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+                       );
                }
                return $isValid;
        }
@@ -231,6 +238,7 @@ class ValidatorTaskAdditionalFieldProvider implements \TYPO3\CMS\Scheduler\Addit
         * @return void
         */
        public function saveAdditionalFields(array $submittedData, \TYPO3\CMS\Scheduler\Task $task) {
+               /** @var $task ValidatorTask */
                $task->setDepth($submittedData['linkvalidator']['depth']);
                $task->setPage($submittedData['linkvalidator']['page']);
                $task->setEmail($submittedData['linkvalidator']['email']);