Rename classes according to naming conventions
authormichael.miousse <michael.miousse@infoglobe.ca>
Fri, 21 Jan 2011 05:52:37 +0000 (05:52 +0000)
committermichael.miousse <michael.miousse@infoglobe.ca>
Fri, 21 Jan 2011 05:52:37 +0000 (05:52 +0000)
part1 still folder to fix

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/linkvalidator/trunk@42424 735d13b6-9817-0410-8766-e36946ffe9aa

23 files changed:
typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processing.php [deleted file]
typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_abstract.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_external.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_file.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_interface.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_internal.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_linkhandler.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php [deleted file]
typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php [deleted file]
typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php [deleted file]
typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_interface.php [deleted file]
typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php [deleted file]
typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php [deleted file]
typo3/sysext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validator.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php [new file with mode: 0644]
typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php [deleted file]
typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php [deleted file]
typo3/sysext/linkvalidator/ext_autoload.php
typo3/sysext/linkvalidator/ext_emconf.php
typo3/sysext/linkvalidator/ext_localconf.php
typo3/sysext/linkvalidator/ext_tables.php
typo3/sysext/linkvalidator/modfuncreport/class.tx_linkvalidator_modfuncreport.php

diff --git a/typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processing.php b/typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processing.php
deleted file mode 100644 (file)
index 22da9e4..0000000
+++ /dev/null
@@ -1,387 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class provides Processing plugin implementation.
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @author Jochen Rieger <j.rieger@connecta.ag>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-
-$GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/modfuncreport/locallang.xml');
-
-class tx_linkvalidator_processing {
-
-       /**
-        * Array of tables and fields to search for broken links.
-        *
-        * @var array
-        */
-       protected $searchFields = array();
-
-       /**
-        * List of comma seperated page uids (rootline downwards).
-        *
-        * @var string
-        */
-       protected $pidList = '';
-
-       /**
-        * Array of tables and the number of external links they contain.
-        *
-        * @var array
-        */
-       protected $linkCounts = array();
-
-       /**
-        * Array of tables and the number of broken external links they contain.
-        *
-        * @var array
-        */
-       protected $brokenLinkCounts = array();
-
-       /**
-        * Array of tables and records containing broken links.
-        *
-        * @var array
-        */
-       protected $recordsWithBrokenLinks = array();
-
-       /**
-        * Array for hooks for own checks.
-        *
-        * @var array
-        */
-       protected $hookObjectsArr = array();
-
-       /**
-        * Array with information about the current page.
-        *
-        * @var array
-        */
-       protected $extPageInTreeInfo = array();
-
-       /**
-        * Fill hookObjectsArr with different link types and possible XClasses.
-        */
-       public function __construct() {
-                       // Hook to handle own checks
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
-                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $key => $classRef) {
-                               $this->hookObjectsArr[$key] = &t3lib_div::getUserObj($classRef);
-                       }
-               }
-       }
-
-       /**
-        * Init Function: Here all the needed configuration values are stored in class variables.
-        *
-        * @param       array           $searchField: list of fields in which to search for links
-        * @param       string          $pid: list of comma separated page uids in which to search for links
-        * @return      void
-        */
-       public function init($searchField, $pid) {
-               $this->searchFields = $searchField;
-               $this->pidList = $pid;
-       }
-
-       /**
-        * 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
-        * @return      void
-        */
-       public function getLinkStatistics($checkOptions = array(), $considerHidden = FALSE) {
-               $results = array();
-               $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_linkvalidator_link', 'record_pid in (' . $this->pidList . ')');
-
-                       // let's traverse all configured tables
-               foreach ($this->searchFields as $table => $fields) {
-                       $where = 'deleted = 0 AND pid IN (' . $this->pidList . ')';
-                       if (!$considerHidden) {
-                               $where .= t3lib_BEfunc::BEenableFields($table);
-                       }
-                               // if table is not configured, we assume the ext is not installed and therefore no need to check it
-                       if (!is_array($GLOBALS['TCA'][$table])) continue;
-
-                               // re-init selectFields for table
-                       $selectFields = 'uid, pid';
-                       $selectFields .= ', ' . $GLOBALS['TCA'][$table]['ctrl']['label'] . ', ' . implode(', ', $fields);
-                       
-                               // TODO: only select rows that have content in at least one of the relevant fields (via OR)
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $where);
-                               // Get record rows of table
-                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                               // Analyse each record
-                               $this->analyzeRecord($results, $table, $fields, $row);
-                       }
-               }
-
-               foreach ($this->hookObjectsArr as $key => $hookObj) {
-                       if ((is_array($results[$key])) && empty($checkOptions) || (is_array($results[$key]) && $checkOptions[$key])) {
-                                       //  check'em!
-                               foreach ($results[$key] as $entryKey => $entryValue) {
-                                       $table = $entryValue['table'];
-                                       $record = array();
-                                       $record['headline'] = $entryValue['row'][$GLOBALS['TCA'][$table]['ctrl']['label']];
-                                       $record['record_pid'] = $entryValue['row']['pid'];
-                                       $record['record_uid'] = $entryValue['uid'];
-                                       $record['table_name'] = $table;
-                                       $record['link_title'] = $entryValue['link_title'];
-                                       $record['field'] = $entryValue['field'];
-                                       $record['last_check'] = time();
-
-                                       $this->recordReference = $entryValue['substr']['recordRef'];
-
-                                       $this->pageWithAnchor = $entryValue['pageAndAnchor'];
-                                       
-                                       if (!empty($this->pageWithAnchor)) {
-                                                       // page with anchor, e.g. 18#1580
-                                               $url = $this->pageWithAnchor;
-                                       } else {
-                                               $url = $entryValue['substr']['tokenValue'];
-                                       }
-
-                                       $this->linkCounts[$table]++;
-                                       $checkURL = $hookObj->checkLink($url, $entryValue, $this);
-                                               // broken link found!
-                                       if (!$checkURL) {
-                                               $response = array();
-                                               $response['valid'] = FALSE;
-                                               $response['errorParams'] = $hookObj->getErrorParams();
-                                               $this->brokenLinkCounts[$table]++;
-                                               $record['link_type'] = $key;
-                                               $record['url'] = $url;
-                                               $record['url_response'] = serialize($response);
-                                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
-                                       } elseif (t3lib_div::_GP('showalllinks')) {
-                                               $response = array();
-                                               $response['valid'] = TRUE;
-                                               $this->brokenLinkCounts[$table]++;
-                                               $record['url'] = $url;
-                                               $record['link_type'] = $key;
-                                               $record['url_response'] = serialize($response);
-                                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
-                                       }
-                               }
-                       }
-               }
-       }
-
-
-       /**
-        * Find all supported broken links for a specific record.
-        *
-        * @param       array           $results: array of broken links
-        * @param       string          $table: table name of the record
-        * @param       array           $fields: array of fields to analyze
-        * @param       array           $record: record to analyse
-        * @return      void
-        */
-       public function analyzeRecord(&$results, $table, $fields, $record) {
-               
-                       // array to store urls from relevant field contents
-               $urls = array();
-
-               $referencedRecordType = '';
-                       // last-parsed link element was a page.
-               $wasPage = TRUE;
-
-                       // flag whether row contains a broken link in some field or not
-               $rowContainsBrokenLink = FALSE;
-               
-                       // put together content of all relevant fields
-               $haystack = '';
-               $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
-               
-               $idRecord = $record['uid'];
-               
-                       // get all references
-               foreach ($fields as $field) {
-                       $haystack .= $record[$field] . ' --- ';
-                       $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
-                       
-                       $valueField = $record[$field];
-                       
-                               // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document)
-                       if ($conf['softref'] && strlen($valueField)) {
-                                       // Explode the list of softreferences/parameters
-                               $softRefs = t3lib_BEfunc::explodeSoftRefParserList($conf['softref']);
-                                       // Traverse soft references
-                               foreach ($softRefs as $spKey => $spParams) {
-                                               // create / get object
-                                       $softRefObj = &t3lib_BEfunc::softRefParserObj($spKey);
-
-                                               // If there was an object returned...:
-                                       if (is_object($softRefObj)) {
-
-                                                       // Do processing
-                                               $resultArray = $softRefObj->findRef($table, $field, $idRecord, $valueField, $spKey, $spParams);
-                                               if (!empty($resultArray['elements'])) {
-
-                                                       if ($spKey == 'typolink_tag') {
-                                                               $linkTags = $htmlParser->splitIntoBlock('link', $resultArray['content']);
-
-                                                               for ($i = 1; $i < count($linkTags); $i += 2) {
-                                                                       $referencedRecordType = '';
-                                                                       foreach($resultArray['elements'] as $element) {
-                                                                                       $type = '';
-                                                                                       $r = $element['subst'];
-
-                                                                                       if (!empty($r['tokenID'])) {
-                                                                                               if (substr_count($linkTags[$i], $r['tokenID'])) {
-                                                                                                               // Type of referenced record
-                                                                                                       if (strpos($r['recordRef'], 'pages') !== FALSE) {
-                                                                                                               $currentR = $r;
-                                                                                                                       // contains number of the page
-                                                                                                               $referencedRecordType = $r['tokenValue'];
-                                                                                                               $wasPage = TRUE;
-                                                                                                       }
-                                                                                                               // append number of content element to the page saved in the last loop
-                                                                                                       elseif ((strpos($r['recordRef'], 'tt_content') !== FALSE) && ($wasPage === TRUE)) {
-                                                                                                               $referencedRecordType = $referencedRecordType . '#c' . $r['tokenValue'];
-                                                                                                               $wasPage = FALSE;
-                                                                                                       } else {
-                                                                                                               $currentR = $r;
-                                                                                                       }
-                                                                                                       $title = strip_tags($linkTags[$i]);
-                                                                                               }
-                                                                                       }
-                                                                       }
-                                                                       foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
-                                                                               $type = $hookObj->fetchType($currentR, $type, $keyArr);
-                                                                       }
-
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["substr"] = $currentR;
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["row"] = $record;
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["table"] = $table;
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["field"] = $field;
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["uid"] = $idRecord;
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["link_title"] = $title;
-                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["pageAndAnchor"] = $referencedRecordType;
-
-                                                               }
-                                                       } else {
-
-                                                               foreach ($resultArray['elements'] as $element) {
-                                                                       $r = $element['subst'];
-                                                                       $title = '';
-                                                                       $type = '';
-
-                                                                       if (!empty($r)) {
-                                                                                       // Parse string for special TYPO3 <link> tag:
-
-                                                                               foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
-                                                                                       $type = $hookObj->fetchType($r, $type, $keyArr);
-                                                                               }
-                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["substr"] = $r;
-                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["row"] = $record;
-                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["table"] = $table;
-                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["field"] = $field;
-                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["uid"] = $idRecord;
-
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Fill a markerarray with the number of links found in a list of pages.
-        *
-        * @param   string         $curPage: comma separated list of page uids
-        * @return  array          markerarray with the number of links found
-        */
-       public function getLinkCounts($curPage) {
-               $markerArray = array();
-               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))) {
-                               $markerArray[$row['link_type']] = $row['nbBrokenLinks'];
-                               $markerArray['brokenlinkCount'] += $row['nbBrokenLinks'];
-                       }
-               }
-               return $markerArray;
-       }
-       
-       /**
-        * Calls t3lib_tsfeBeUserAuth::extGetTreeList.
-        * Although this duplicates the function t3lib_tsfeBeUserAuth::extGetTreeList
-        * this is necessary to create the object that is used recursively by the original function.
-        *
-        * Generates a list of page uids from $id. List does not include $id itself.
-        * The only pages excluded from the list are deleted pages.
-        *
-        *                                                        level in the tree to start collecting uids. Zero means
-        *                                                        'start right away', 1 = 'next level and out'
-        *
-        * @param       integer         Start page id
-        * @param       integer         Depth to traverse down the page tree.
-        * @param       integer         $begin is an optional integer that determines at which
-        * @param       string          Perms clause
-        * @return      string          Returns the list with a comma in the end (if any pages selected!)
-        */
-       public function extGetTreeList($id, $depth, $begin = 0, $perms_clause) {
-               $depth = intval($depth);
-               $begin = intval($begin);
-               $id = intval($id);
-               $theList = '';
-
-               if ($depth > 0) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'uid,title',
-                               'pages',
-                               'pid=' . $id . ' AND deleted=0 AND ' . $perms_clause
-                       );
-                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                               if ($begin <= 0) {
-                                       $theList .= $row['uid'] . ',';
-                                       $this->extPageInTreeInfo[] = array($row['uid'], htmlspecialchars($row['title'], $depth));
-                               }
-                               if ($depth > 1) {
-                                       $theList .= $this->extGetTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause);
-                               }
-                       }
-               }
-               return $theList;
-       }
-       
-
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/class.tx_linkvalidator_processing.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/class.tx_linkvalidator_processing.php']);
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php b/typo3/sysext/linkvalidator/classes/class.tx_linkvalidator_processor.php
new file mode 100644 (file)
index 0000000..e1a9a7a
--- /dev/null
@@ -0,0 +1,387 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * This class provides Processing plugin implementation.
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @author Jochen Rieger <j.rieger@connecta.ag>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+
+$GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/modfuncreport/locallang.xml');
+
+class tx_linkvalidator_Processor {
+
+       /**
+        * Array of tables and fields to search for broken links.
+        *
+        * @var array
+        */
+       protected $searchFields = array();
+
+       /**
+        * List of comma seperated page uids (rootline downwards).
+        *
+        * @var string
+        */
+       protected $pidList = '';
+
+       /**
+        * Array of tables and the number of external links they contain.
+        *
+        * @var array
+        */
+       protected $linkCounts = array();
+
+       /**
+        * Array of tables and the number of broken external links they contain.
+        *
+        * @var array
+        */
+       protected $brokenLinkCounts = array();
+
+       /**
+        * Array of tables and records containing broken links.
+        *
+        * @var array
+        */
+       protected $recordsWithBrokenLinks = array();
+
+       /**
+        * Array for hooks for own checks.
+        *
+        * @var array
+        */
+       protected $hookObjectsArr = array();
+
+       /**
+        * Array with information about the current page.
+        *
+        * @var array
+        */
+       protected $extPageInTreeInfo = array();
+
+       /**
+        * Fill hookObjectsArr with different link types and possible XClasses.
+        */
+       public function __construct() {
+                       // Hook to handle own checks
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $key => $classRef) {
+                               $this->hookObjectsArr[$key] = &t3lib_div::getUserObj($classRef);
+                       }
+               }
+       }
+
+       /**
+        * Init Function: Here all the needed configuration values are stored in class variables.
+        *
+        * @param       array           $searchField: list of fields in which to search for links
+        * @param       string          $pid: list of comma separated page uids in which to search for links
+        * @return      void
+        */
+       public function init($searchField, $pid) {
+               $this->searchFields = $searchField;
+               $this->pidList = $pid;
+       }
+
+       /**
+        * 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
+        * @return      void
+        */
+       public function getLinkStatistics($checkOptions = array(), $considerHidden = FALSE) {
+               $results = array();
+               $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_linkvalidator_link', 'record_pid in (' . $this->pidList . ')');
+
+                       // let's traverse all configured tables
+               foreach ($this->searchFields as $table => $fields) {
+                       $where = 'deleted = 0 AND pid IN (' . $this->pidList . ')';
+                       if (!$considerHidden) {
+                               $where .= t3lib_BEfunc::BEenableFields($table);
+                       }
+                               // if table is not configured, we assume the ext is not installed and therefore no need to check it
+                       if (!is_array($GLOBALS['TCA'][$table])) continue;
+
+                               // re-init selectFields for table
+                       $selectFields = 'uid, pid';
+                       $selectFields .= ', ' . $GLOBALS['TCA'][$table]['ctrl']['label'] . ', ' . implode(', ', $fields);
+                       
+                               // TODO: only select rows that have content in at least one of the relevant fields (via OR)
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $where);
+                               // Get record rows of table
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                               // Analyse each record
+                               $this->analyzeRecord($results, $table, $fields, $row);
+                       }
+               }
+
+               foreach ($this->hookObjectsArr as $key => $hookObj) {
+                       if ((is_array($results[$key])) && empty($checkOptions) || (is_array($results[$key]) && $checkOptions[$key])) {
+                                       //  check'em!
+                               foreach ($results[$key] as $entryKey => $entryValue) {
+                                       $table = $entryValue['table'];
+                                       $record = array();
+                                       $record['headline'] = $entryValue['row'][$GLOBALS['TCA'][$table]['ctrl']['label']];
+                                       $record['record_pid'] = $entryValue['row']['pid'];
+                                       $record['record_uid'] = $entryValue['uid'];
+                                       $record['table_name'] = $table;
+                                       $record['link_title'] = $entryValue['link_title'];
+                                       $record['field'] = $entryValue['field'];
+                                       $record['last_check'] = time();
+
+                                       $this->recordReference = $entryValue['substr']['recordRef'];
+
+                                       $this->pageWithAnchor = $entryValue['pageAndAnchor'];
+                                       
+                                       if (!empty($this->pageWithAnchor)) {
+                                                       // page with anchor, e.g. 18#1580
+                                               $url = $this->pageWithAnchor;
+                                       } else {
+                                               $url = $entryValue['substr']['tokenValue'];
+                                       }
+
+                                       $this->linkCounts[$table]++;
+                                       $checkURL = $hookObj->checkLink($url, $entryValue, $this);
+                                               // broken link found!
+                                       if (!$checkURL) {
+                                               $response = array();
+                                               $response['valid'] = FALSE;
+                                               $response['errorParams'] = $hookObj->getErrorParams();
+                                               $this->brokenLinkCounts[$table]++;
+                                               $record['link_type'] = $key;
+                                               $record['url'] = $url;
+                                               $record['url_response'] = serialize($response);
+                                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
+                                       } elseif (t3lib_div::_GP('showalllinks')) {
+                                               $response = array();
+                                               $response['valid'] = TRUE;
+                                               $this->brokenLinkCounts[$table]++;
+                                               $record['url'] = $url;
+                                               $record['link_type'] = $key;
+                                               $record['url_response'] = serialize($response);
+                                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_linkvalidator_link', $record);
+                                       }
+                               }
+                       }
+               }
+       }
+
+
+       /**
+        * Find all supported broken links for a specific record.
+        *
+        * @param       array           $results: array of broken links
+        * @param       string          $table: table name of the record
+        * @param       array           $fields: array of fields to analyze
+        * @param       array           $record: record to analyse
+        * @return      void
+        */
+       public function analyzeRecord(&$results, $table, $fields, $record) {
+               
+                       // array to store urls from relevant field contents
+               $urls = array();
+
+               $referencedRecordType = '';
+                       // last-parsed link element was a page.
+               $wasPage = TRUE;
+
+                       // flag whether row contains a broken link in some field or not
+               $rowContainsBrokenLink = FALSE;
+               
+                       // put together content of all relevant fields
+               $haystack = '';
+               $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml');
+               
+               $idRecord = $record['uid'];
+               
+                       // get all references
+               foreach ($fields as $field) {
+                       $haystack .= $record[$field] . ' --- ';
+                       $conf = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
+                       
+                       $valueField = $record[$field];
+                       
+                               // Check if a TCA configured field has softreferences defined (see TYPO3 Core API document)
+                       if ($conf['softref'] && strlen($valueField)) {
+                                       // Explode the list of softreferences/parameters
+                               $softRefs = t3lib_BEfunc::explodeSoftRefParserList($conf['softref']);
+                                       // Traverse soft references
+                               foreach ($softRefs as $spKey => $spParams) {
+                                               // create / get object
+                                       $softRefObj = &t3lib_BEfunc::softRefParserObj($spKey);
+
+                                               // If there was an object returned...:
+                                       if (is_object($softRefObj)) {
+
+                                                       // Do processing
+                                               $resultArray = $softRefObj->findRef($table, $field, $idRecord, $valueField, $spKey, $spParams);
+                                               if (!empty($resultArray['elements'])) {
+
+                                                       if ($spKey == 'typolink_tag') {
+                                                               $linkTags = $htmlParser->splitIntoBlock('link', $resultArray['content']);
+
+                                                               for ($i = 1; $i < count($linkTags); $i += 2) {
+                                                                       $referencedRecordType = '';
+                                                                       foreach($resultArray['elements'] as $element) {
+                                                                                       $type = '';
+                                                                                       $r = $element['subst'];
+
+                                                                                       if (!empty($r['tokenID'])) {
+                                                                                               if (substr_count($linkTags[$i], $r['tokenID'])) {
+                                                                                                               // Type of referenced record
+                                                                                                       if (strpos($r['recordRef'], 'pages') !== FALSE) {
+                                                                                                               $currentR = $r;
+                                                                                                                       // contains number of the page
+                                                                                                               $referencedRecordType = $r['tokenValue'];
+                                                                                                               $wasPage = TRUE;
+                                                                                                       }
+                                                                                                               // append number of content element to the page saved in the last loop
+                                                                                                       elseif ((strpos($r['recordRef'], 'tt_content') !== FALSE) && ($wasPage === TRUE)) {
+                                                                                                               $referencedRecordType = $referencedRecordType . '#c' . $r['tokenValue'];
+                                                                                                               $wasPage = FALSE;
+                                                                                                       } else {
+                                                                                                               $currentR = $r;
+                                                                                                       }
+                                                                                                       $title = strip_tags($linkTags[$i]);
+                                                                                               }
+                                                                                       }
+                                                                       }
+                                                                       foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
+                                                                               $type = $hookObj->fetchType($currentR, $type, $keyArr);
+                                                                       }
+
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["substr"] = $currentR;
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["row"] = $record;
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["table"] = $table;
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["field"] = $field;
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["uid"] = $idRecord;
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["link_title"] = $title;
+                                                                       $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR["tokenID"]]["pageAndAnchor"] = $referencedRecordType;
+
+                                                               }
+                                                       } else {
+
+                                                               foreach ($resultArray['elements'] as $element) {
+                                                                       $r = $element['subst'];
+                                                                       $title = '';
+                                                                       $type = '';
+
+                                                                       if (!empty($r)) {
+                                                                                       // Parse string for special TYPO3 <link> tag:
+
+                                                                               foreach ($this->hookObjectsArr as $keyArr => $hookObj) {
+                                                                                       $type = $hookObj->fetchType($r, $type, $keyArr);
+                                                                               }
+                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["substr"] = $r;
+                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["row"] = $record;
+                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["table"] = $table;
+                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["field"] = $field;
+                                                                               $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $r["tokenID"]]["uid"] = $idRecord;
+
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Fill a markerarray with the number of links found in a list of pages.
+        *
+        * @param   string         $curPage: comma separated list of page uids
+        * @return  array          markerarray with the number of links found
+        */
+       public function getLinkCounts($curPage) {
+               $markerArray = array();
+               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))) {
+                               $markerArray[$row['link_type']] = $row['nbBrokenLinks'];
+                               $markerArray['brokenlinkCount'] += $row['nbBrokenLinks'];
+                       }
+               }
+               return $markerArray;
+       }
+       
+       /**
+        * Calls t3lib_tsfeBeUserAuth::extGetTreeList.
+        * Although this duplicates the function t3lib_tsfeBeUserAuth::extGetTreeList
+        * this is necessary to create the object that is used recursively by the original function.
+        *
+        * Generates a list of page uids from $id. List does not include $id itself.
+        * The only pages excluded from the list are deleted pages.
+        *
+        *                                                        level in the tree to start collecting uids. Zero means
+        *                                                        'start right away', 1 = 'next level and out'
+        *
+        * @param       integer         Start page id
+        * @param       integer         Depth to traverse down the page tree.
+        * @param       integer         $begin is an optional integer that determines at which
+        * @param       string          Perms clause
+        * @return      string          Returns the list with a comma in the end (if any pages selected!)
+        */
+       public function extGetTreeList($id, $depth, $begin = 0, $perms_clause) {
+               $depth = intval($depth);
+               $begin = intval($begin);
+               $id = intval($id);
+               $theList = '';
+
+               if ($depth > 0) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
+                               'uid,title',
+                               'pages',
+                               'pid=' . $id . ' AND deleted=0 AND ' . $perms_clause
+                       );
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                               if ($begin <= 0) {
+                                       $theList .= $row['uid'] . ',';
+                                       $this->extPageInTreeInfo[] = array($row['uid'], htmlspecialchars($row['title'], $depth));
+                               }
+                               if ($depth > 1) {
+                                       $theList .= $this->extGetTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause);
+                               }
+                       }
+               }
+               return $theList;
+       }
+       
+
+}
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/class.tx_linkvalidator_processor.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/class.tx_linkvalidator_processor.php']);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_abstract.php b/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_abstract.php
new file mode 100644 (file)
index 0000000..e45d361
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * This class provides Check Base plugin implementation.
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+abstract class tx_linkvalidator_linktype_Abstract implements tx_linkvalidator_linktype_Interface {
+
+       /**
+        * Contains parameters needed for the rendering of the error message
+        *
+        * @var array
+        */
+       protected $errorParams = array();
+
+       /**
+        * Base type fetching method, based on the type that softRefParserObj returns.
+        *
+        * @param   array        $value: reference properties
+        * @param   string       $type: current type
+        * @param   string       $key: validator hook name
+        * @return  string       fetched type
+        */
+       public function fetchType($value, $type, $key) {
+               if ($value['type'] == $key) {
+                       $type = $value['type'];
+               }
+               return $type;
+       }
+
+       /**
+        * Set the value of the private property errorParams.
+        *
+        * @param  array      all parameters needed for the rendering of the error message
+        * @return void
+        */
+       protected function setErrorParams(array $value) {
+               $this->errorParams = $value;
+       }
+
+       /**
+        * Get the value of the private property errorParams.
+        *
+        * @return  array      all parameters needed for the rendering of the error message
+        */
+       public function getErrorParams() {
+               return $this->errorParams;
+       }
+
+       /**
+        * Base url parsing
+        *
+        * @param       array           $row: broken link record
+        * @return      string          parsed broken url
+        */
+       public function getBrokenUrl($row) {
+               return $row['url'];
+       }
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_external.php b/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_external.php
new file mode 100644 (file)
index 0000000..5d9cd3c
--- /dev/null
@@ -0,0 +1,220 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2009 Jochen Rieger (j.rieger@connecta.ag) 
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check External Links plugin implementation.
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class tx_linkvalidator_linktype_External extends tx_linkvalidator_linktype_Abstract {
+
+       /**
+        * Cached list of the URLs, which were already checked for the current processing.
+        *
+        * @var array
+        */
+       protected $url_reports = array();
+
+       /**
+        * Cached list of all error parameters of the URLs, which were already checked for the current processing.
+        *
+        * @var array
+        */
+       protected $url_error_params = array();
+
+       /**
+        * Checks a given URL + /path/filename.ext for validity
+        *
+        * @param       string          $url: url to check
+        * @param        array     $softRefEntry: the softref entry which builds the context of that url
+        * @param       object          $reference:  parent instance of tx_linkvalidator_Processor
+        * @return      string          TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               $errorParams = array();
+               if (isset($this->url_reports[$url])) {
+                       if(!$this->url_reports[$url]) {
+                               if(is_array($this->url_error_params[$url])) {
+                                   $this->setErrorParams($this->url_error_params[$url]);
+                               }
+                       }
+                       return $this->url_reports[$url];
+               }
+
+                       // remove possible anchor from the url
+               if (strrpos($url, '#') !== FALSE) {
+                       $url = substr($url, 0, strrpos($url, '#'));
+               }
+
+                       // try to fetch the content of the URL (headers only)
+               $report = array();
+
+                       // try fetching the content of the URL (just fetching the headers does not work correctly)
+               $content = '';
+               $content = t3lib_div::getURL($url, 1, FALSE, $report);
+
+               $tries = 0;
+               while (($report['http_code'] == 301 || $report['http_code'] == 302
+                       || $report['http_code'] == 303 || $report['http_code'] == 307)
+                       && ($tries < 5)) {
+                               $isCodeRedirect = preg_match('/Location: (.*)/', $content, $location);
+                               if (isset($location[1])) {
+                                       $content = t3lib_div::getURL($location[1], 2, FALSE, $report);
+                               }
+                               $tries++;
+               }
+
+               $response = TRUE;
+
+                       // analyze the response
+               if ($report['error']) {
+                               // More cURL error codes can be found here:
+                               // http://curl.haxx.se/libcurl/c/libcurl-errors.html
+                       if ($report['lib'] === 'cURL' && $report['error'] === 28) {
+                               $errorParams['errorType'] = 'cURL28';
+                       } elseif ($report['lib'] === 'cURL' && $report['error'] === 22) {
+                               if (strstr($report['message'], '404')) {
+                                       $errorParams['errorType'] = 404;
+                               } elseif(strstr($report['message'], '403')) {
+                                       $errorParams['errorType'] = 403;
+                               } elseif(strstr($report['message'], '500')) {
+                                       $errorParams['errorType'] = 500;
+                               }
+                       } elseif ($report['lib'] === 'cURL' && $report['error'] === 6) {
+                               $errorParams['errorType'] = 'cURL6';
+                       } elseif ($report['lib'] === 'cURL' && $report['error'] === 56) {
+                               $errorParams['errorType'] = 'cURL56';
+                       }
+
+                       $response = FALSE;
+               }
+
+
+                       // special handling for more information
+               if (($report['http_code'] == 301) || ($report['http_code'] == 302)
+                       || ($report['http_code'] == 303) || ($report['http_code'] == 307)) {
+                               $errorParams['errorType'] = $report['http_code'];
+                               $errorParams['location'] = $location[1];
+                               $response = FALSE;
+               }
+
+               if ($report['http_code'] == 404 || $report['http_code'] == 403) {
+                       $errorParams['errorType'] = $report['http_code'];
+                       $response = FALSE;
+               }
+
+               if ($report['http_code'] >= 300 && $response) {
+                       $errorParams['errorType'] = $report['http_code'];
+                       $response = FALSE;
+               }
+
+               if(!$response) {
+                       $this->setErrorParams($errorParams);
+               }
+
+               $this->url_reports[$url] = $response;
+               $this->url_error_params[$url] = $errorParams;
+
+               return $response;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing.
+        *
+        * @param   array    all parameters needed for the rendering of the error message
+        * @return  string    validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $errorType = $errorParams['errorType'];
+               switch ($errorType) {
+                       case 300:
+                               $response = sprintf($GLOBALS['LANG']->getLL('list.report.externalerror'), $errorType);
+                               break;
+
+                       case 301:
+                       case 302:
+                       case 303:
+                       case 307:
+                               $response = sprintf($GLOBALS['LANG']->getLL('list.report.redirectloop'), $errorType, $errorParams['location']);
+                               break;
+
+                       case 404:
+                               $response = $GLOBALS['LANG']->getLL('list.report.pagenotfound404');
+                               break;
+
+                       case 403:
+                               $response = $GLOBALS['LANG']->getLL('list.report.pageforbidden403');
+                               break;
+
+                       case 500:
+                               $response = $GLOBALS['LANG']->getLL('list.report.internalerror500');
+                               break;
+
+                       case 'cURL6':
+                               $response = $GLOBALS['LANG']->getLL('list.report.couldnotresolvehost');
+                               break;
+
+                       case 'cURL28':
+                               $response = $GLOBALS['LANG']->getLL('list.report.timeout');
+                               break;
+
+                       case 'cURL56':
+                               $response = $GLOBALS['LANG']->getLL('list.report.errornetworkdata');
+                               break;
+
+                       default:
+                               $response = $GLOBALS['LANG']->getLL('list.report.noresponse');
+               }
+
+               return $response;
+       }
+
+       /**
+        * get the external type from the softRefParserObj result.
+        *
+        * @param   array         $value: reference properties
+        * @param   string       $type: current type
+        * @param   string       $key: validator hook name
+        * @return  string       fetched type
+        */
+       public function fetchType($value, $type, $key) {
+               preg_match_all('/((?:http|https|ftp|ftps))(?::\/\/)(?:[^\s<>]+)/i', $value['tokenValue'], $urls, PREG_PATTERN_ORDER);
+
+               if (!empty($urls[0][0])) {
+                       $type = "external";
+               }
+
+               return $type;
+       }
+
+}
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_file.php b/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_file.php
new file mode 100644 (file)
index 0000000..9bc3928
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check File Links plugin implementation.
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class tx_linkvalidator_linktype_File extends tx_linkvalidator_linktype_Abstract {
+
+       /**
+        * Checks a given URL + /path/filename.ext for validity.
+        *
+        * @param   string        $url: url to check
+        * @param        array     $softRefEntry: the softref entry which builds the context of that url
+        * @param   object        $reference:  parent instance of tx_linkvalidator_Processor
+        * @return  string        TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               if (!@file_exists(PATH_site . rawurldecode($url))) {
+                       return FALSE;
+               }
+
+               return TRUE;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing. 
+        *
+        * @param   array    all parameters needed for the rendering of the error message
+        * @return  string    validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
+               return $response;
+       }
+
+
+       /**
+        * Url parsing
+        *
+        * @param   array          $row: broken link record
+        * @return  string        parsed broken url
+        */
+       public function getBrokenUrl($row) {
+               $brokenUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
+               return $brokenUrl;
+       }
+}
+
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_interface.php b/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_interface.php
new file mode 100644 (file)
index 0000000..ee3128d
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * This class provides interface implementation.
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+interface tx_linkvalidator_linktype_Interface {
+
+       /**
+        * Checks a given URL + /path/filename.ext for validity
+        *
+        * @param   string        $url: url to check
+        * @param        array     $softRefEntry: the softref entry which builds the context of that url
+        * @param   object        $reference:  parent instance of tx_linkvalidator_Processor
+        * @return  string        validation error message or succes code
+        */
+       public function checkLink($url, $softRefEntry, $reference);
+
+       /**
+        * Base type fetching method, based on the type that softRefParserObj returns.
+        *
+        * @param   array        $value: reference properties
+        * @param   string       $type: current type
+        * @param   string       $key: validator hook name
+        * @return  string       fetched type
+        */
+       public function fetchType($value, $type, $key);
+
+       /**
+        * Get the value of the private property errorParams.
+        *
+        * @return  array      all parameters needed for the rendering of the error message
+        */
+       public function getErrorParams();
+
+       /**
+        * Base url parsing
+        *
+        * @param       array           $row: broken link record
+        * @return      string          parsed broken url
+        */
+       public function getBrokenUrl($row);
+
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_internal.php b/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_internal.php
new file mode 100644 (file)
index 0000000..93ff21c
--- /dev/null
@@ -0,0 +1,303 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check Internal Links plugin implementation.
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class tx_linkvalidator_linktype_Internal extends tx_linkvalidator_linktype_Abstract {
+
+       const DELETED = 'deleted';
+       const HIDDEN = 'hidden';
+       const MOVED = 'moved';
+       const NOTEXISTING = 'notExisting';
+
+       /**
+        * All parameters needed for rendering the error message.
+        *
+        * @var array
+        */
+       protected $errorParams = array();
+
+       /**
+        * Result of the check, if the current page uid is valid or not.
+        *
+        * @var boolean
+        */
+       protected $responsePage = TRUE;
+
+       /**
+        * Result of the check, if the current content uid is valid or not.
+        *
+        * @var boolean
+        */
+       protected $responseContent = TRUE;
+
+       /**
+        * Checks a given URL + /path/filename.ext for validity
+        *
+        * @param   string        $url: url to check as page-id or page-id#anchor (if anchor is present)
+        * @param        array    $softRefEntry: the softref entry which builds the context of that url
+        * @param   object        $reference:  parent instance of tx_linkvalidator_Processor
+        * @return  string        TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               $page = '';
+               $anchor = '';
+               $response = TRUE;
+               $this->responseContent = TRUE;
+
+                       // Might already contain values - empty it.
+               unset($this->errorParams);
+
+                       // defines the linked page and anchor (if any).
+               if (strpos($url, '#c') !== FALSE) {
+                       $parts = explode('#c', $url);
+                       $page = $parts[0];
+                       $anchor = $parts[1];
+               } else {
+                       $page = $url;
+               }
+
+                       // Check if the linked page is OK.
+               $this->responsePage = $this->checkPage($page, $softRefEntry, $reference);
+
+                       // 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);
+
+               }
+
+               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)) {
+                       $response = TRUE;
+               } else {
+                       $response = FALSE;
+               }
+
+               return $response;
+       }
+
+       /**
+        * Checks a given page uid for validity
+        *
+        * @param   string        $page: page uid to check
+        * @param        array    $softRefEntry: the softref entry which builds the context of that url
+        * @param   object        $reference:  parent instance of tx_linkvalidator_Processor
+        * @return  string        TRUE on success or FALSE on error
+        */
+       protected function checkPage($page, $softRefEntry, $reference) {
+               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       'uid, title, deleted, hidden, starttime, endtime',
+                       'pages',
+                       'uid = ' . intval($page)
+               );
+               $this->responsePage = TRUE;
+
+               if ($rows[0]) {
+                       if ($rows[0]['deleted'] == '1') {
+                               $this->errorParams['errorType']['page'] = DELETED;
+                               $this->errorParams['page']['title'] = $rows[0]['title'];
+                               $this->errorParams['page']['uid'] = $rows[0]['uid'];
+                               $this->responsePage = FALSE;
+                       } elseif ($rows[0]['hidden'] == '1'
+                               || $GLOBALS['EXEC_TIME'] < intval($rows[0]['starttime'])
+                               || ($rows[0]['endtime'] && intval($rows[0]['endtime']) < $GLOBALS['EXEC_TIME'])) {
+                               $this->errorParams['errorType']['page'] = HIDDEN;
+                               $this->errorParams['page']['title'] = $rows[0]['title'];
+                               $this->errorParams['page']['uid'] = $rows[0]['uid'];
+                               $this->responsePage = FALSE;
+                       }
+               } else {
+                       $this->errorParams['errorType']['page'] = NOTEXISTING;
+                       $this->errorParams['page']['uid'] = intval($page);
+                       $this->responsePage = FALSE;
+               }
+
+               return $this->responsePage;
+       }
+
+       /**
+        * Checks a given content uid for validity
+        *
+        * @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 softref entry which builds the context of that url
+        * @param   object        $reference:  parent instance of tx_linkvalidator_Processor
+        * @return  string        TRUE on success or FALSE on error
+        */
+       protected function checkContent($page, $anchor, $softRefEntry, $reference) {
+                       // Get page ID on which the content element in fact is located
+               $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                       'uid, pid, header, deleted, hidden, starttime, endtime',
+                       'tt_content',
+                       'uid = ' . intval($anchor)
+               );
+               $this->responseContent = TRUE;
+
+                       // this content element exists
+               if ($res[0]) {
+                               // page ID on which this CE is in fact located.
+                       $correctPageID = $res[0]['pid'];
+
+                               // check if the element is on the linked page
+                               // (the element might have been moved to another page)
+                       if (!($correctPageID === $page)) {
+                               $this->errorParams['errorType']['content'] = MOVED;
+                               $this->errorParams['content']['uid'] = intval($anchor);
+                               $this->errorParams['content']['wrongPage'] = intval($page);
+                               $this->errorParams['content']['rightPage'] = intval($correctPageID);
+                               $this->responseContent = FALSE;
+
+                       } else {
+                                       // the element is located on the page to which the link is pointing
+                               if ($res[0]['deleted'] == '1') {
+                                       $this->errorParams['errorType']['content'] = DELETED;
+                                       $this->errorParams['content']['title'] = $res[0]['header'];
+                                       $this->errorParams['content']['uid'] = $res[0]['uid'];
+                                       $this->responseContent = FALSE;
+                               } elseif ($res[0]['hidden'] == '1'
+                                       || $GLOBALS['EXEC_TIME'] < intval($res[0]['starttime'])
+                                       || ($res[0]['endtime'] && intval($res[0]['endtime']) < $GLOBALS['EXEC_TIME'])) {
+                                       $this->errorParams['errorType']['content'] = HIDDEN;
+                                       $this->errorParams['content']['title'] = $res[0]['header'];
+                                       $this->errorParams['content']['uid'] = $res[0]['uid'];
+                                       $this->responseContent = FALSE;
+                               }
+                       }
+
+               } else {
+                               // content element does not exist
+                       $this->errorParams['errorType']['content'] = NOTEXISTING;
+                       $this->errorParams['content']['uid'] = intval($anchor);
+                       $this->responseContent = FALSE;
+               }
+
+               return $this->responseContent;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing. 
+        *
+        * @param   array    all parameters needed for the rendering of the error message
+        * @return  string    validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $errorType = $errorParams['errorType'];
+
+               if (is_array($errorParams['page'])) {
+                       switch ($errorType['page']) {
+                               case DELETED:
+                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagedeleted');
+                                       $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
+                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                                       break;
+
+                               case HIDDEN:
+                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotvisible');
+                                       $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
+                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                                       break;
+            
+                               default:
+                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotexisting');
+                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
+                       }
+               }
+
+               if (is_array($errorParams['content'])) {
+                       switch ($errorType['content']) {
+                               case DELETED:
+                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentdeleted');
+                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
+                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                                       break;
+
+                               case HIDDEN:
+                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotvisible');
+                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
+                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                                       break;
+
+                               case MOVED:
+                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentmoved');
+                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
+                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                                       $errorContent = str_replace('###wrongpage###', $errorParams['content']['wrongPage'], $errorContent);
+                                       $errorContent = str_replace('###rightpage###', $errorParams['content']['rightPage'], $errorContent);
+                                       break;
+
+                               default:
+                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotexisting');
+                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
+                       }
+               }
+
+               if ($errorPage && $errorContent) {
+                       $response = $errorPage . '<br />' . $errorContent;
+               } elseif ($errorPage) {
+                       $response = $errorPage;
+               } elseif ($errorContent) {
+                       $response = $errorContent; 
+               }
+
+               return $response;
+       }
+
+       /**
+        * Url parsing
+        *
+        * @param   array          $row: broken link record
+        * @return  string        parsed broken url
+        */
+       public function getBrokenUrl($row) {
+               $domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
+               $rootLine = t3lib_BEfunc::BEgetRootLine($row['record_pid']);
+                       // checks alternate domains
+               if (count($rootLine) > 0) {
+                               $protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
+                               $domainRecord = t3lib_BEfunc::firstDomainRecord($rootLine);
+                               if(!empty($domainRecord)) {
+                                       $domain = $protocol . $domainRecord;
+                               }
+               }
+               return $domain . '/index.php?id=' . $row['url'];
+       }
+}
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php']);
+}
+
+?>
diff --git a/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_linkhandler.php b/typo3/sysext/linkvalidator/classes/linktype/class.tx_linkvalidator_linktype_linkhandler.php
new file mode 100644 (file)
index 0000000..cdfccb6
--- /dev/null
@@ -0,0 +1,145 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Check Link Handler plugin implementation.
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class tx_linkvalidator_linktype_LinkHandler extends tx_linkvalidator_linktype_Abstract {
+
+       const DELETED = 'deleted';
+
+       /**
+        * TSconfig of the module tx_linkhandler.
+        *
+        * @var array
+        */
+       protected $tsconfig;
+
+       /**
+        * Get TSconfig when loading the class.
+        */
+       function __construct() {
+               $this->tsconfig = t3lib_BEfunc::getModTSconfig(1, 'mod.tx_linkhandler');
+       }
+
+       /**
+        * Checks a given URL + /path/filename.ext for validity
+        *
+        * @param   string        $url: url to check
+        * @param        array     $softRefEntry: the softref entry which builds the context of that url
+        * @param   object        $reference:  parent instance of tx_linkvalidator_Processor
+        * @return  string        TRUE on success or FALSE on error
+        */
+       public function checkLink($url, $softRefEntry, $reference) {
+               $response = TRUE;
+               $errorParams = array();
+               $parts = explode(":", $url);
+               if (count($parts) == 3) {
+                       $tablename = htmlspecialchars($parts[1]);
+                       $rowid = intval($parts[2]);
+                       $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
+                               '*',
+                               $tablename,
+                               'uid = ' . intval($rowid)
+                       );
+
+                       if ($rows[0]) {
+                               if ($rows[0]['deleted'] == '1') {
+                                       $errorParams['errorType'] = DELETED;
+                                       $errorParams['tablename'] = $tablename;
+                                       $errorParams['uid'] = $rowid;
+                                       $response =  FALSE;
+                               }
+                       } else {
+                               $errorParams['tablename'] = $tablename;
+                               $errorParams['uid'] = $rowid;
+                               $response =  FALSE;
+                       }
+               }
+
+               if(!$response) {
+                       $this->setErrorParams();
+               }
+
+               return $response;
+       }
+
+       /**
+        * type fetching method, based on the type that softRefParserObj returns.
+        *
+        * @param   array         $value: reference properties
+        * @param   string       $type: current type
+        * @param   string       $key: validator hook name
+        * @return  string       fetched type
+        */
+       public function fetchType($value, $type, $key) {
+               if ($type == 'string' && strtolower(substr($value['tokenValue'], 0, 7)) == 'record:') {
+                       $type = 'linkhandler';
+               }
+               return $type;
+       }
+
+       /**
+        * Generate the localized error message from the error params saved from the parsing. 
+        *
+        * @param   array    all parameters needed for the rendering of the error message
+        * @return  string    validation error message
+        */
+       public function getErrorMessage($errorParams) {
+               $errorType = $errorParams['errorType'];
+               $tablename = $errorParams['tablename'];
+               $title = $GLOBALS['LANG']->getLL('list.report.rowdeleted.default.title');
+
+               if ($this->tsconfig['properties'][$tablename . '.']) {
+                       $title = $this->tsconfig['properties'][$tablename . '.']['label'];
+               }
+
+               switch ($errorType) {
+                       case DELETED:
+                               $response = $GLOBALS['LANG']->getLL('list.report.rowdeleted');
+                               $response = str_replace('###title###', $title, $response);
+                               $response = str_replace('###uid###', $errorParams['uid'], $response);
+                               break;
+
+                       default:
+                               $response = $GLOBALS['LANG']->getLL('list.report.rownotexisting');
+                               $response = str_replace('###uid###', $errorParams['uid'], $response);
+                               break;
+               }
+
+               return $response;
+       }
+}
+
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php b/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php
deleted file mode 100644 (file)
index b91d3da..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class provides Check Base plugin implementation.
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-abstract class tx_linkvalidator_linkTypes_Abstract implements tx_linkvalidator_linkTypes_Interface {
-
-       /**
-        * Contains parameters needed for the rendering of the error message
-        *
-        * @var array
-        */
-       protected $errorParams = array();
-
-       /**
-        * Base type fetching method, based on the type that softRefParserObj returns.
-        *
-        * @param   array        $value: reference properties
-        * @param   string       $type: current type
-        * @param   string       $key: validator hook name
-        * @return  string       fetched type
-        */
-       public function fetchType($value, $type, $key) {
-               if ($value['type'] == $key) {
-                       $type = $value['type'];
-               }
-               return $type;
-       }
-
-       /**
-        * Set the value of the private property errorParams.
-        *
-        * @param  array      all parameters needed for the rendering of the error message
-        * @return void
-        */
-       protected function setErrorParams(array $value) {
-               $this->errorParams = $value;
-       }
-
-       /**
-        * Get the value of the private property errorParams.
-        *
-        * @return  array      all parameters needed for the rendering of the error message
-        */
-       public function getErrorParams() {
-               return $this->errorParams;
-       }
-
-       /**
-        * Base url parsing
-        *
-        * @param       array           $row: broken link record
-        * @return      string          parsed broken url
-        */
-       public function getBrokenUrl($row) {
-               return $row['url'];
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php b/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php
deleted file mode 100644 (file)
index 1986c72..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2009 Jochen Rieger (j.rieger@connecta.ag) 
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check External Links plugin implementation.
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linkTypes_External extends tx_linkvalidator_linkTypes_Abstract {
-
-       /**
-        * Cached list of the URLs, which were already checked for the current processing.
-        *
-        * @var array
-        */
-       protected $url_reports = array();
-
-       /**
-        * Cached list of all error parameters of the URLs, which were already checked for the current processing.
-        *
-        * @var array
-        */
-       protected $url_error_params = array();
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity
-        *
-        * @param       string          $url: url to check
-        * @param        array     $softRefEntry: the softref entry which builds the context of that url
-        * @param       object          $reference:  parent instance of tx_linkvalidator_processing
-        * @return      string          TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               $errorParams = array();
-               if (isset($this->url_reports[$url])) {
-                       if(!$this->url_reports[$url]) {
-                               if(is_array($this->url_error_params[$url])) {
-                                   $this->setErrorParams($this->url_error_params[$url]);
-                               }
-                       }
-                       return $this->url_reports[$url];
-               }
-
-                       // remove possible anchor from the url
-               if (strrpos($url, '#') !== FALSE) {
-                       $url = substr($url, 0, strrpos($url, '#'));
-               }
-
-                       // try to fetch the content of the URL (headers only)
-               $report = array();
-
-                       // try fetching the content of the URL (just fetching the headers does not work correctly)
-               $content = '';
-               $content = t3lib_div::getURL($url, 1, FALSE, $report);
-
-               $tries = 0;
-               while (($report['http_code'] == 301 || $report['http_code'] == 302
-                       || $report['http_code'] == 303 || $report['http_code'] == 307)
-                       && ($tries < 5)) {
-                               $isCodeRedirect = preg_match('/Location: (.*)/', $content, $location);
-                               if (isset($location[1])) {
-                                       $content = t3lib_div::getURL($location[1], 2, FALSE, $report);
-                               }
-                               $tries++;
-               }
-
-               $response = TRUE;
-
-                       // analyze the response
-               if ($report['error']) {
-                               // More cURL error codes can be found here:
-                               // http://curl.haxx.se/libcurl/c/libcurl-errors.html
-                       if ($report['lib'] === 'cURL' && $report['error'] === 28) {
-                               $errorParams['errorType'] = 'cURL28';
-                       } elseif ($report['lib'] === 'cURL' && $report['error'] === 22) {
-                               if (strstr($report['message'], '404')) {
-                                       $errorParams['errorType'] = 404;
-                               } elseif(strstr($report['message'], '403')) {
-                                       $errorParams['errorType'] = 403;
-                               } elseif(strstr($report['message'], '500')) {
-                                       $errorParams['errorType'] = 500;
-                               }
-                       } elseif ($report['lib'] === 'cURL' && $report['error'] === 6) {
-                               $errorParams['errorType'] = 'cURL6';
-                       } elseif ($report['lib'] === 'cURL' && $report['error'] === 56) {
-                               $errorParams['errorType'] = 'cURL56';
-                       }
-
-                       $response = FALSE;
-               }
-
-
-                       // special handling for more information
-               if (($report['http_code'] == 301) || ($report['http_code'] == 302)
-                       || ($report['http_code'] == 303) || ($report['http_code'] == 307)) {
-                               $errorParams['errorType'] = $report['http_code'];
-                               $errorParams['location'] = $location[1];
-                               $response = FALSE;
-               }
-
-               if ($report['http_code'] == 404 || $report['http_code'] == 403) {
-                       $errorParams['errorType'] = $report['http_code'];
-                       $response = FALSE;
-               }
-
-               if ($report['http_code'] >= 300 && $response) {
-                       $errorParams['errorType'] = $report['http_code'];
-                       $response = FALSE;
-               }
-
-               if(!$response) {
-                       $this->setErrorParams($errorParams);
-               }
-
-               $this->url_reports[$url] = $response;
-               $this->url_error_params[$url] = $errorParams;
-
-               return $response;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing.
-        *
-        * @param   array    all parameters needed for the rendering of the error message
-        * @return  string    validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $errorType = $errorParams['errorType'];
-               switch ($errorType) {
-                       case 300:
-                               $response = sprintf($GLOBALS['LANG']->getLL('list.report.externalerror'), $errorType);
-                               break;
-
-                       case 301:
-                       case 302:
-                       case 303:
-                       case 307:
-                               $response = sprintf($GLOBALS['LANG']->getLL('list.report.redirectloop'), $errorType, $errorParams['location']);
-                               break;
-
-                       case 404:
-                               $response = $GLOBALS['LANG']->getLL('list.report.pagenotfound404');
-                               break;
-
-                       case 403:
-                               $response = $GLOBALS['LANG']->getLL('list.report.pageforbidden403');
-                               break;
-
-                       case 500:
-                               $response = $GLOBALS['LANG']->getLL('list.report.internalerror500');
-                               break;
-
-                       case 'cURL6':
-                               $response = $GLOBALS['LANG']->getLL('list.report.couldnotresolvehost');
-                               break;
-
-                       case 'cURL28':
-                               $response = $GLOBALS['LANG']->getLL('list.report.timeout');
-                               break;
-
-                       case 'cURL56':
-                               $response = $GLOBALS['LANG']->getLL('list.report.errornetworkdata');
-                               break;
-
-                       default:
-                               $response = $GLOBALS['LANG']->getLL('list.report.noresponse');
-               }
-
-               return $response;
-       }
-
-       /**
-        * get the external type from the softRefParserObj result.
-        *
-        * @param   array         $value: reference properties
-        * @param   string       $type: current type
-        * @param   string       $key: validator hook name
-        * @return  string       fetched type
-        */
-       public function fetchType($value, $type, $key) {
-               preg_match_all('/((?:http|https|ftp|ftps))(?::\/\/)(?:[^\s<>]+)/i', $value['tokenValue'], $urls, PREG_PATTERN_ORDER);
-
-               if (!empty($urls[0][0])) {
-                       $type = "external";
-               }
-
-               return $type;
-       }
-
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php']);
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php b/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php
deleted file mode 100644 (file)
index 4440743..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check File Links plugin implementation.
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linkTypes_File extends tx_linkvalidator_linkTypes_Abstract {
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity.
-        *
-        * @param   string        $url: url to check
-        * @param        array     $softRefEntry: the softref entry which builds the context of that url
-        * @param   object        $reference:  parent instance of tx_linkvalidator_processing
-        * @return  string        TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               if (!@file_exists(PATH_site . rawurldecode($url))) {
-                       return FALSE;
-               }
-
-               return TRUE;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing. 
-        *
-        * @param   array    all parameters needed for the rendering of the error message
-        * @return  string    validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
-               return $response;
-       }
-
-
-       /**
-        * Url parsing
-        *
-        * @param   array          $row: broken link record
-        * @return  string        parsed broken url
-        */
-       public function getBrokenUrl($row) {
-               $brokenUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
-               return $brokenUrl;
-       }
-}
-
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php']);
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_interface.php b/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_interface.php
deleted file mode 100644 (file)
index c6478c6..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class provides interface implementation.
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-interface tx_linkvalidator_linkTypes_Interface {
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity
-        *
-        * @param   string        $url: url to check
-        * @param        array     $softRefEntry: the softref entry which builds the context of that url
-        * @param   object        $reference:  parent instance of tx_linkvalidator_processing
-        * @return  string        validation error message or succes code
-        */
-       public function checkLink($url, $softRefEntry, $reference);
-
-       /**
-        * Base type fetching method, based on the type that softRefParserObj returns.
-        *
-        * @param   array        $value: reference properties
-        * @param   string       $type: current type
-        * @param   string       $key: validator hook name
-        * @return  string       fetched type
-        */
-       public function fetchType($value, $type, $key);
-
-       /**
-        * Get the value of the private property errorParams.
-        *
-        * @return  array      all parameters needed for the rendering of the error message
-        */
-       public function getErrorParams();
-
-       /**
-        * Base url parsing
-        *
-        * @param       array           $row: broken link record
-        * @return      string          parsed broken url
-        */
-       public function getBrokenUrl($row);
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php b/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php
deleted file mode 100644 (file)
index 8d16ea2..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check Internal Links plugin implementation.
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linkTypes_Internal extends tx_linkvalidator_linkTypes_Abstract {
-
-       const DELETED = 'deleted';
-       const HIDDEN = 'hidden';
-       const MOVED = 'moved';
-       const NOTEXISTING = 'notExisting';
-
-       /**
-        * All parameters needed for rendering the error message.
-        *
-        * @var array
-        */
-       protected $errorParams = array();
-
-       /**
-        * Result of the check, if the current page uid is valid or not.
-        *
-        * @var boolean
-        */
-       protected $responsePage = TRUE;
-
-       /**
-        * Result of the check, if the current content uid is valid or not.
-        *
-        * @var boolean
-        */
-       protected $responseContent = TRUE;
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity
-        *
-        * @param   string        $url: url to check as page-id or page-id#anchor (if anchor is present)
-        * @param        array    $softRefEntry: the softref entry which builds the context of that url
-        * @param   object        $reference:  parent instance of tx_linkvalidator_processing
-        * @return  string        TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               $page = '';
-               $anchor = '';
-               $response = TRUE;
-               $this->responseContent = TRUE;
-
-                       // Might already contain values - empty it.
-               unset($this->errorParams);
-
-                       // defines the linked page and anchor (if any).
-               if (strpos($url, '#c') !== FALSE) {
-                       $parts = explode('#c', $url);
-                       $page = $parts[0];
-                       $anchor = $parts[1];
-               } else {
-                       $page = $url;
-               }
-
-                       // Check if the linked page is OK.
-               $this->responsePage = $this->checkPage($page, $softRefEntry, $reference);
-
-                       // 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);
-
-               }
-
-               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)) {
-                       $response = TRUE;
-               } else {
-                       $response = FALSE;
-               }
-
-               return $response;
-       }
-
-       /**
-        * Checks a given page uid for validity
-        *
-        * @param   string        $page: page uid to check
-        * @param        array    $softRefEntry: the softref entry which builds the context of that url
-        * @param   object        $reference:  parent instance of tx_linkvalidator_processing
-        * @return  string        TRUE on success or FALSE on error
-        */
-       protected function checkPage($page, $softRefEntry, $reference) {
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid, title, deleted, hidden, starttime, endtime',
-                       'pages',
-                       'uid = ' . intval($page)
-               );
-               $this->responsePage = TRUE;
-
-               if ($rows[0]) {
-                       if ($rows[0]['deleted'] == '1') {
-                               $this->errorParams['errorType']['page'] = DELETED;
-                               $this->errorParams['page']['title'] = $rows[0]['title'];
-                               $this->errorParams['page']['uid'] = $rows[0]['uid'];
-                               $this->responsePage = FALSE;
-                       } elseif ($rows[0]['hidden'] == '1'
-                               || $GLOBALS['EXEC_TIME'] < intval($rows[0]['starttime'])
-                               || ($rows[0]['endtime'] && intval($rows[0]['endtime']) < $GLOBALS['EXEC_TIME'])) {
-                               $this->errorParams['errorType']['page'] = HIDDEN;
-                               $this->errorParams['page']['title'] = $rows[0]['title'];
-                               $this->errorParams['page']['uid'] = $rows[0]['uid'];
-                               $this->responsePage = FALSE;
-                       }
-               } else {
-                       $this->errorParams['errorType']['page'] = NOTEXISTING;
-                       $this->errorParams['page']['uid'] = intval($page);
-                       $this->responsePage = FALSE;
-               }
-
-               return $this->responsePage;
-       }
-
-       /**
-        * Checks a given content uid for validity
-        *
-        * @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 softref entry which builds the context of that url
-        * @param   object        $reference:  parent instance of tx_linkvalidator_processing
-        * @return  string        TRUE on success or FALSE on error
-        */
-       protected function checkContent($page, $anchor, $softRefEntry, $reference) {
-                       // Get page ID on which the content element in fact is located
-               $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'uid, pid, header, deleted, hidden, starttime, endtime',
-                       'tt_content',
-                       'uid = ' . intval($anchor)
-               );
-               $this->responseContent = TRUE;
-
-                       // this content element exists
-               if ($res[0]) {
-                               // page ID on which this CE is in fact located.
-                       $correctPageID = $res[0]['pid'];
-
-                               // check if the element is on the linked page
-                               // (the element might have been moved to another page)
-                       if (!($correctPageID === $page)) {
-                               $this->errorParams['errorType']['content'] = MOVED;
-                               $this->errorParams['content']['uid'] = intval($anchor);
-                               $this->errorParams['content']['wrongPage'] = intval($page);
-                               $this->errorParams['content']['rightPage'] = intval($correctPageID);
-                               $this->responseContent = FALSE;
-
-                       } else {
-                                       // the element is located on the page to which the link is pointing
-                               if ($res[0]['deleted'] == '1') {
-                                       $this->errorParams['errorType']['content'] = DELETED;
-                                       $this->errorParams['content']['title'] = $res[0]['header'];
-                                       $this->errorParams['content']['uid'] = $res[0]['uid'];
-                                       $this->responseContent = FALSE;
-                               } elseif ($res[0]['hidden'] == '1'
-                                       || $GLOBALS['EXEC_TIME'] < intval($res[0]['starttime'])
-                                       || ($res[0]['endtime'] && intval($res[0]['endtime']) < $GLOBALS['EXEC_TIME'])) {
-                                       $this->errorParams['errorType']['content'] = HIDDEN;
-                                       $this->errorParams['content']['title'] = $res[0]['header'];
-                                       $this->errorParams['content']['uid'] = $res[0]['uid'];
-                                       $this->responseContent = FALSE;
-                               }
-                       }
-
-               } else {
-                               // content element does not exist
-                       $this->errorParams['errorType']['content'] = NOTEXISTING;
-                       $this->errorParams['content']['uid'] = intval($anchor);
-                       $this->responseContent = FALSE;
-               }
-
-               return $this->responseContent;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing. 
-        *
-        * @param   array    all parameters needed for the rendering of the error message
-        * @return  string    validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $errorType = $errorParams['errorType'];
-
-               if (is_array($errorParams['page'])) {
-                       switch ($errorType['page']) {
-                               case DELETED:
-                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagedeleted');
-                                       $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
-                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
-                                       break;
-
-                               case HIDDEN:
-                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotvisible');
-                                       $errorPage = str_replace('###title###', $errorParams['page']['title'], $errorPage);
-                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
-                                       break;
-            
-                               default:
-                                       $errorPage = $GLOBALS['LANG']->getLL('list.report.pagenotexisting');
-                                       $errorPage = str_replace('###uid###', $errorParams['page']['uid'], $errorPage);
-                       }
-               }
-
-               if (is_array($errorParams['content'])) {
-                       switch ($errorType['content']) {
-                               case DELETED:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentdeleted');
-                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                                       break;
-
-                               case HIDDEN:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotvisible');
-                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                                       break;
-
-                               case MOVED:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentmoved');
-                                       $errorContent = str_replace('###title###', $errorParams['content']['title'], $errorContent);
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                                       $errorContent = str_replace('###wrongpage###', $errorParams['content']['wrongPage'], $errorContent);
-                                       $errorContent = str_replace('###rightpage###', $errorParams['content']['rightPage'], $errorContent);
-                                       break;
-
-                               default:
-                                       $errorContent = $GLOBALS['LANG']->getLL('list.report.contentnotexisting');
-                                       $errorContent = str_replace('###uid###', $errorParams['content']['uid'], $errorContent);
-                       }
-               }
-
-               if ($errorPage && $errorContent) {
-                       $response = $errorPage . '<br />' . $errorContent;
-               } elseif ($errorPage) {
-                       $response = $errorPage;
-               } elseif ($errorContent) {
-                       $response = $errorContent; 
-               }
-
-               return $response;
-       }
-
-       /**
-        * Url parsing
-        *
-        * @param   array          $row: broken link record
-        * @return  string        parsed broken url
-        */
-       public function getBrokenUrl($row) {
-               $domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
-               $rootLine = t3lib_BEfunc::BEgetRootLine($row['record_pid']);
-                       // checks alternate domains
-               if (count($rootLine) > 0) {
-                               $protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
-                               $domainRecord = t3lib_BEfunc::firstDomainRecord($rootLine);
-                               if(!empty($domainRecord)) {
-                                       $domain = $protocol . $domainRecord;
-                               }
-               }
-               return $domain . '/index.php?id=' . $row['url'];
-       }
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php']);
-}
-
-?>
diff --git a/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php b/typo3/sysext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php
deleted file mode 100644 (file)
index fd830bc..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Check Link Handler plugin implementation.
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_linkTypes_LinkHandler extends tx_linkvalidator_linkTypes_Abstract {
-
-       const DELETED = 'deleted';
-
-       /**
-        * TSconfig of the module tx_linkhandler.
-        *
-        * @var array
-        */
-       protected $tsconfig;
-
-       /**
-        * Get TSconfig when loading the class.
-        */
-       function __construct() {
-               $this->tsconfig = t3lib_BEfunc::getModTSconfig(1, 'mod.tx_linkhandler');
-       }
-
-       /**
-        * Checks a given URL + /path/filename.ext for validity
-        *
-        * @param   string        $url: url to check
-        * @param        array     $softRefEntry: the softref entry which builds the context of that url
-        * @param   object        $reference:  parent instance of tx_linkvalidator_processing
-        * @return  string        TRUE on success or FALSE on error
-        */
-       public function checkLink($url, $softRefEntry, $reference) {
-               $response = TRUE;
-               $errorParams = array();
-               $parts = explode(":", $url);
-               if (count($parts) == 3) {
-                       $tablename = htmlspecialchars($parts[1]);
-                       $rowid = intval($parts[2]);
-                       $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                               '*',
-                               $tablename,
-                               'uid = ' . intval($rowid)
-                       );
-
-                       if ($rows[0]) {
-                               if ($rows[0]['deleted'] == '1') {
-                                       $errorParams['errorType'] = DELETED;
-                                       $errorParams['tablename'] = $tablename;
-                                       $errorParams['uid'] = $rowid;
-                                       $response =  FALSE;
-                               }
-                       } else {
-                               $errorParams['tablename'] = $tablename;
-                               $errorParams['uid'] = $rowid;
-                               $response =  FALSE;
-                       }
-               }
-
-               if(!$response) {
-                       $this->setErrorParams();
-               }
-
-               return $response;
-       }
-
-       /**
-        * type fetching method, based on the type that softRefParserObj returns.
-        *
-        * @param   array         $value: reference properties
-        * @param   string       $type: current type
-        * @param   string       $key: validator hook name
-        * @return  string       fetched type
-        */
-       public function fetchType($value, $type, $key) {
-               if ($type == 'string' && strtolower(substr($value['tokenValue'], 0, 7)) == 'record:') {
-                       $type = 'linkhandler';
-               }
-               return $type;
-       }
-
-       /**
-        * Generate the localized error message from the error params saved from the parsing. 
-        *
-        * @param   array    all parameters needed for the rendering of the error message
-        * @return  string    validation error message
-        */
-       public function getErrorMessage($errorParams) {
-               $errorType = $errorParams['errorType'];
-               $tablename = $errorParams['tablename'];
-               $title = $GLOBALS['LANG']->getLL('list.report.rowdeleted.default.title');
-
-               if ($this->tsconfig['properties'][$tablename . '.']) {
-                       $title = $this->tsconfig['properties'][$tablename . '.']['label'];
-               }
-
-               switch ($errorType) {
-                       case DELETED:
-                               $response = $GLOBALS['LANG']->getLL('list.report.rowdeleted');
-                               $response = str_replace('###title###', $title, $response);
-                               $response = str_replace('###uid###', $errorParams['uid'], $response);
-                               break;
-
-                       default:
-                               $response = $GLOBALS['LANG']->getLL('list.report.rownotexisting');
-                               $response = str_replace('###uid###', $errorParams['uid'], $response);
-                               break;
-               }
-
-               return $response;
-       }
-}
-
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php']);
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validator.php b/typo3/sysext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validator.php
new file mode 100644 (file)
index 0000000..dcae8fb
--- /dev/null
@@ -0,0 +1,475 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * This class provides Scheduler plugin implementation.
+ *
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class tx_linkvalidator_tasks_Validator extends tx_scheduler_Task {
+
+       /**
+        * @var integer
+        */
+       protected $sleepTime;
+
+       /**
+        * @var integer
+        */
+       protected $sleepAfterFinish;
+
+       /**
+        * @var integer
+        */
+       protected $countInARun;
+
+       /**
+        * Total number of broken links.
+        *
+        * @var integer
+        */
+       protected $totalBrokenLink = 0;
+
+       /**
+        * Total number of broken links from the last run.
+        *
+        * @var integer
+        */
+       protected $oldTotalBrokenLink = 0;
+
+       /**
+        * Mail template fetched from the given template file.
+        *
+        * @var string
+        */
+       protected $templateMail;
+       
+       /**
+        * specific TSconfig for this task.
+        *
+        * @var array
+        */
+       protected $configuration = array();
+
+       /**
+        * Shows if number of result was diferent from the result of the last check or not.
+        *
+        * @var boolean
+        */
+       protected $dif;
+
+       /**
+        * Template to be used for the email.
+        *
+        * @var string
+        */
+       protected $emailTemplateFile;
+
+       /**
+        * Level of pages the task should check.
+        *
+        * @var integer
+        */
+       protected $depth;
+
+       /**
+        * UID of the start page for this task.
+        *
+        * @var integer
+        */
+       protected $page;
+
+       /**
+        * Email address to which an email report is sent.
+        *
+        * @var string
+        */
+       protected $email;
+       
+       /**
+        * Only send an email, if new broken links were found.
+        *
+        * @var boolean
+        */
+       protected $emailOnBrokenLinkOnly;
+
+       /**
+        * Get the value of the protected property email.
+        *
+        * @return  string      Email address to which an email report is sent
+        */
+       public function getEmail() {
+               return $this->email;
+       }
+       
+       /**
+        * Set the value of the private property email.
+        *
+        * @param  string       Email address to which an email report is sent
+        * @return void
+        */
+       public function setEmail($email) {
+               $this->email=$email;
+       }
+       
+       /**
+        * Get the value of the protected property emailOnBrokenLinkOnly.
+        *
+        * @return  boolean      Only send an email, if new broken links were found.
+        */
+       public function getEmailOnBrokenLinkOnly() {
+               return $this->emailOnBrokenLinkOnly;
+       }
+       
+       /**
+        * Set the value of the private property emailOnBrokenLinkOnly.
+        *
+        * @param  boolean      Only send an email, if new broken links were found.
+        * @return void
+        */
+       public function setEmailOnBrokenLinkOnly($emailOnBrokenLinkOnly) {
+               $this->emailOnBrokenLinkOnly = $emailOnBrokenLinkOnly;
+       }
+       
+       /**
+        * Get the value of the protected property page.
+        *
+        * @return  integer      UID of the start page for this task.
+        */
+       public function getPage() {
+               return $this->page;
+       }
+       
+       /**
+        * Set the value of the private property page.
+        *
+        * @param  integer      UID of the start page for this task.
+        * @return void
+        */
+       public function setPage($page) {
+               $this->page =$page;
+       }
+       
+       /**
+        * Get the value of the protected property depth.
+        *
+        * @return  integer     Level of pages the task should check.
+        */
+       public function getDepth() {
+               return $this->depth;
+       }
+       
+       /**
+        * Set the value of the private property depth.
+        *
+        * @param  integer     Level of pages the task should check.
+        * @return void
+        */
+       public function setDepth($depth) {
+               $this->depth = $depth;
+       }
+       
+       /**
+        * Get the value of the protected property emailTemplateFile.
+        *
+        * @return  string    Template to be used for the email.
+        */
+       public function getEmailTemplateFile() {
+               return $this->emailTemplateFile;
+       }
+       
+       /**
+        * Set the value of the private property emailTemplateFile.
+        *
+        * @param  string    Template to be used for the email.
+        * @return void
+        */
+       public function setEmailTemplateFile($emailTemplateFile) {
+               $this->emailTemplateFile = $emailTemplateFile;
+       }
+       
+       /**
+        * Get the value of the protected property configuration.
+        *
+        * @return  array    specific TSconfig for this task.
+        */
+       public function getConfiguration() {
+               return $this->configuration;
+       }
+       
+       /**
+        * Set the value of the private property configuration.
+        *
+        * @param  array    specific TSconfig for this task.
+        * @return void
+        */
+       public function setConfiguration($configuration) {
+               $this->configuration = $configuration;
+       }
+       
+       
+       /**
+        * Function executed from the Scheduler.
+        *
+        * @return      void
+        */
+       public function execute() {
+               $this->setCliArguments();
+               $successfullyExecuted = TRUE;
+               if (!file_exists($file = t3lib_div::getFileAbsFileName($this->emailTemplateFile)) && !empty($this->email)) {
+                       throw new Exception(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidEmailTemplateFile'),
+                               '1295476972'
+                       );
+               }
+               $htmlFile = t3lib_div::getURL($file);
+               $this->templateMail = t3lib_parsehtml::getSubpart($htmlFile, '###REPORT_TEMPLATE###');
+
+                       // The array to put the content into
+               $html = array();
+               $pageSections = '';
+               $this->dif = FALSE;
+               $pageList = t3lib_div::trimExplode(',', $this->page, 1);
+               if (is_array($pageList)) {
+                       foreach ($pageList as $page) {
+                               $modTS = t3lib_BEfunc::getModTSconfig($page, 'mod.linkvalidator');
+                               $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
+                               $parseObj->parse($this->configuration);
+                               if(count($parseObj->errors) > 0){
+                                       $parseErrorMessage = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidTSconfig') . '<br />';
+                                       foreach($parseObj->errors as $errorInfo){
+                                               $parseErrorMessage .= $errorInfo[0] . '<br />';
+                                       }
+                                       throw new Exception(
+                                               $parseErrorMessage,
+                                               '1295476989'
+                                       );
+                               }
+                               $TSconfig = $parseObj->setup;
+                               $modTS = $modTS['properties'];
+                               $overrideTs = $TSconfig['mod.']['tx_linkvalidator.'];
+                               if (is_array($overrideTs)) {
+                                       $modTS = t3lib_div::array_merge_recursive_overrule($modTS, $overrideTs);
+                               }
+
+                                       // get the searchFields from TCA
+                               foreach ($GLOBALS['TCA'] as $tablename => $table) {
+                                       if (!empty($table['columns'])) {
+                                               foreach ($table['columns'] as $columnname => $column) {
+                                                       if ($column['config']['type'] == 'text' || $column['config']['type'] == 'input') {
+                                                               if (!empty($column['config']['softref']) && (stripos($column['config']['softref'], "typolink")
+                                                                               !== FALSE || stripos($column['config']['softref'], "url") !== FALSE)) {
+
+                                                                       $searchFields[$tablename][] = $columnname;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+
+                                       // get the searchFields from TypoScript
+                               foreach ($modTS['searchFields.'] as $table => $fieldList) {
+                                       $fields = t3lib_div::trimExplode(',', $fieldList);
+                                       foreach ($fields as $field) {
+                                               if (is_array($searchFields[$table])) {
+                                                       if (array_search($field, $searchFields[$table]) === FALSE) {
+                                                               $searchFields[$table][] = $field;
+                                                       }
+                                               }
+                                       }
+                               }
+                               $linktypes = t3lib_div::trimExplode(',', $modTS['linktypes'], 1);
+                               if (is_array($linktypes)) {
+                                       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)) {
+                                                               $array[$type] = 1;
+                                                       }
+                                               }
+                                       }
+                               }
+                               $processor = t3lib_div::makeInstance('tx_linkvalidator_Processor');
+                               $pageIds = $processor->extGetTreeList($page, $this->depth, 0, '1=1');
+                               $pageIds .= $page;
+                               $processor->init($searchFields, $pageIds);
+                               if (!empty($this->email)) {
+                                       $oldLinkCounts = $processor->getLinkCounts($page);
+                                       $this->oldTotalBrokenLink += $oldLinkCounts['brokenlinkCount'];
+                               }
+
+                               $processor->getLinkStatistics($array, $modTS['checkhidden']);
+
+                               if (!empty($this->email)) {
+                                       $linkCounts = $processor->getLinkCounts($page);
+                                       $this->totalBrokenLink += $linkCounts['brokenlinkCount'];
+                                       $pageSections .= $this->buildMail($page, $pageIds, $linkCounts, $oldLinkCounts);
+                               }
+
+                       }
+               }
+               if ($this->totalBrokenLink != $this->oldTotalBrokenLink) {
+                       $this->dif = TRUE;
+               }
+               if ($this->totalBrokenLink > 0
+                       && (!$this->emailOnBrokenLinkOnly || $this->dif)
+                       && !empty($this->email)
+               ) {
+                       $successfullyExecuted = $this->reportEmail($pageSections, $modTS);
+               }
+               return $successfullyExecuted;
+       }
+
+
+       /**
+        * Build and send warning email when new broken links were found.
+        *
+        * @param       string          $pageSections: Content of page section
+        * @param       string          $modTS: TSconfig array
+        * @return      bool            TRUE if mail was sent, FALSE if or not
+        */
+       protected function reportEmail($pageSections, $modTS) {
+               $content = t3lib_parsehtml::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
+               /** @var array $markerArray */
+               $markerArray = array();
+               /** @var array $validEmailList */
+               $validEmailList = array();
+               /** @var boolean $sendEmail */
+               $sendEmail = TRUE;
+
+               $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
+               $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
+               $content = t3lib_parsehtml::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
+
+               /** @var t3lib_mail_Message $mail */
+               $mail = t3lib_div::makeInstance('t3lib_mail_Message');
+               if (t3lib_div::validEmail($modTS['mail.']['fromemail'])) {
+                       $mail->setFrom(array($modTS['mail.']['fromemail'] => $modTS['mail.']['fromname']));
+               } else {
+                       throw new Exception(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidFromEmail'),
+                               '1295476760'
+                       );
+               }
+               if(t3lib_div::validEmail($modTS['mail.']['replytoemail'])) {
+                       $mail->setReplyTo(array($modTS['mail.']['replytoemail'] => $modTS['mail.']['replytoname']));
+               }
+
+               if(!empty($modTS['mail.']['subject'])) {
+                       $mail->setSubject($modTS['mail.']['subject']);
+               } else {
+                       throw new Exception(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.noSubject'),
+                               '1295476808'
+                       );
+               }
+               if (!empty($this->email)) {
+                       $emailList = t3lib_div::trimExplode(',', $this->email);
+                       foreach ($emailList as $emailAdd) {
+                               if (!t3lib_div::validEmail($emailAdd)) {
+                                       throw new Exception(
+                                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidToEmail'),
+                                               '1295476821'
+                                       );
+                               } else {
+                                       $validEmailList[] = $emailAdd;
+                               }
+                       }
+               }
+               if (is_array($validEmailList) && !empty($validEmailList)) {
+                       $mail->setTo($this->email);
+               } else {
+                       $sendEmail = FALSE;
+               }
+
+               if($sendEmail) {
+                       $mail->setBody($content,'text/html');
+                       $mail->send();
+               }
+
+               return $sendEmail;
+       }
+
+
+       /**
+        * Build the mail content.
+        *
+        * @param       int                     $curPage: id of the current page
+        * @param       string          $pageList: list of pages id
+        * @param       array           $markerArray: array of markers
+        * @param       array           $oldBrokenLink: markerarray with the number of link found
+        * @return      string          Content of the mail
+        */
+       protected function buildMail($curPage, $pageList, $markerArray, $oldBrokenLink) {
+               $pageSectionHTML = t3lib_parsehtml::getSubpart($this->templateMail, '###PAGE_SECTION###');
+
+               if (is_array($markerArray)) {
+                       foreach ($markerArray as $markerKey => $markerValue) {
+                               if (empty($oldBrokenLink[$markerKey])) {
+                                       $oldBrokenLink[$markerKey] = 0;
+                               }
+                               if ($markerValue != $oldBrokenLink[$markerKey]) {
+                                       $this->dif = TRUE;
+                               }
+                               $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey];
+                       }
+               }
+               $markerArray['title'] = t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecord('pages', $curPage));
+
+               $content = '';
+               if ($markerArray['brokenlinkCount'] > 0) {
+                       $content = t3lib_parsehtml::substituteMarkerArray($pageSectionHTML, $markerArray, '###|###', TRUE, TRUE);
+               }
+               return $content;
+       }
+
+
+       /**
+        * Simulate cli call with setting the required options to the $_SERVER['argv']
+        *
+        * @return      void
+        * @access protected
+        */
+       protected function setCliArguments() {
+               $_SERVER['argv'] = array(
+                       $_SERVER['argv'][0],
+                       'tx_link_scheduler_link',
+                       '0',
+                       '-ss',
+                       '--sleepTime',
+                       $this->sleepTime,
+                       '--sleepAfterFinish',
+                       $this->sleepAfterFinish,
+                       '--countInARun',
+                       $this->countInARun
+               );
+       }
+}
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validator.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validator.php']);
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php b/typo3/sysext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php
new file mode 100644 (file)
index 0000000..bba2279
--- /dev/null
@@ -0,0 +1,277 @@
+<?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+/**
+ * This class provides Scheduler Additional Field plugin implementation.
+ *
+ * @author Dimitri König <dk@cabag.ch>
+ * @author Michael Miousse <michael.miousse@infoglobe.ca>
+ * @package TYPO3
+ * @subpackage linkvalidator
+ */
+class tx_linkvalidator_tasks_ValidatorAdditionalFieldProvider implements tx_scheduler_AdditionalFieldProvider {
+
+       /**
+        * Render additional information fields within the scheduler backend.
+        *
+        * @param       array           $taksInfo: array information of task to return
+        * @param       task            $task: task object
+        * @param       tx_scheduler_Module             $schedulerModule: reference to the calling object (BE module of the Scheduler)
+        * @return      array           additional fields
+        * @see interfaces/tx_scheduler_AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
+        */
+       public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule) {
+               $additionalFields = array();
+               if (empty($taskInfo['configuration'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['configuration'] = '';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['configuration'] = $task->getConfiguration();
+                       } else {
+                               $taskInfo['configuration'] = $task->getConfiguration();
+                       }
+               }
+
+               if (empty($taskInfo['depth'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['depth'] = array();
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['depth'] = $task->getDepth();
+                       } else {
+                               $taskInfo['depth'] = $task->getDepth();
+                       }
+               }
+
+               if (empty($taskInfo['page'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['page'] = '';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['page'] = $task->getPage();
+                       } else {
+                               $taskInfo['page'] = $task->getPage();
+                       }
+               }
+               if (empty($taskInfo['email'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['email'] = '';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['email'] = $task->getEmail();
+                       } else {
+                               $taskInfo['email'] = $task->getEmail();
+                       }
+               }
+
+               if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['emailOnBrokenLinkOnly'] = 1;
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
+                       } else {
+                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
+                       }
+               }
+               if (empty($taskInfo['emailTemplateFile'])) {
+                       if ($schedulerModule->CMD == 'add') {
+                               $taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/res/mailtemplate.html';
+                       } elseif ($schedulerModule->CMD == 'edit') {
+                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
+                       } else {
+                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
+                       }
+               }
+
+
+               $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 = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+
+                       // input for 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'),
+                       '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
+                       '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
+                       '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 . '">';
+
+               foreach ($fieldValueArray as $depth => $label) {
+                       $fieldCode .= "\t" . '<option value="' . $depth . '"' . (($depth == htmlspecialchars($taskInfo['depth'])) ? ' selected="selected"' : '') . '>' . $label . '</option>';
+               }
+
+               $fieldCode .= '</select>';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.depth');
+               $label = t3lib_BEfunc::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>';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.conf');
+               $label = t3lib_BEfunc::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']) . '" />';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.email');
+               $label = t3lib_BEfunc::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"' : '') . ' />';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
+               $label = t3lib_BEfunc::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']) . '" />';
+               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
+               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
+               $additionalFields[$fieldID] = array(
+                       'code' => $fieldCode,
+                       'label' => $label
+               );
+
+               return $additionalFields;
+       }
+
+
+       /**
+        * Mark current value as selected by returning the "selected" attribute.
+        *
+        * @param       array           $configurationArray: array of configuration
+        * @param       string          $currentValue: value of selector object
+        * @return      string          Html fragment for a selected option or empty
+        * @access protected
+        */
+       protected function getSelectedState($configurationArray, $currentValue) {
+               $selected = '';
+               for ($i = 0; $i < count($configurationArray); $i++) {
+                       if (strcmp($configurationArray[$i], $currentValue) === 0) {
+                               $selected = 'selected="selected" ';
+                       }
+               }
+               return $selected;
+       }
+
+
+       /**
+        * This method checks any additional data that is relevant to the specific task.
+        * 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       tx_scheduler_module1            $parentObject: reference to the calling object (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, tx_scheduler_Module $schedulerModule) {
+               $isValid = TRUE;
+
+               //!TODO add validation to validate the $submittedData['configuration'] wich is normally a comma seperated string
+               if (!empty($submittedData['linkvalidator']['email'])) {
+                       $emailList = t3lib_div::trimExplode(',', $submittedData['linkvalidator']['email']);
+                       foreach ($emailList as $emailAdd) {
+                               if (!t3lib_div::validEmail($emailAdd)) {
+                                       $isValid = FALSE;
+                                       $schedulerModule->addMessage(
+                                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidEmail'),
+                                               t3lib_FlashMessage::ERROR
+                                       );
+                               }
+                       }
+               }
+
+               if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = ' . $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'),
+                                       t3lib_FlashMessage::ERROR
+                               );
+                       }
+               } else {
+                       $isValid = FALSE;
+                       $schedulerModule->addMessage(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'),
+                               t3lib_FlashMessage::ERROR
+                       );
+               }
+
+               if ($submittedData['linkvalidator']['depth'] < 0) {
+                       $isValid = FALSE;
+                       $schedulerModule->addMessage(
+                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'),
+                               t3lib_FlashMessage::ERROR
+                       );
+               }
+
+               return $isValid;
+       }
+
+
+       /**
+        * This method is used to save any additional input into the current task object
+        * if the task class matches.
+        *
+        * @param       array           $submittedData: array containing the data submitted by the user
+        * @param       tx_scheduler_Task               $task: reference to the current task object
+        * @return      void
+        */
+       public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) {
+               $task->setDepth($submittedData['linkvalidator']['depth']);
+               $task->setPage($submittedData['linkvalidator']['page']);
+               $task->setEmail($submittedData['linkvalidator']['email']);
+               if($submittedData['linkvalidator']['emailOnBrokenLinkOnly']){
+                       $task->setEmailOnBrokenLinkOnly(1);
+               }
+               else{
+                       $task->setEmailOnBrokenLinkOnly(0);
+               }
+               $task->setConfiguration($submittedData['linkvalidator']['configuration']);
+               $task->setEmailTemplateFile($submittedData['linkvalidator']['emailTemplateFile']);
+       }
+
+
+}
+
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/task/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php']);
+}
+
+?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php b/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php
deleted file mode 100644 (file)
index d00b198..0000000
+++ /dev/null
@@ -1,475 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * This class provides Scheduler plugin implementation.
- *
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_tasks_Validate extends tx_scheduler_Task {
-
-       /**
-        * @var integer
-        */
-       protected $sleepTime;
-
-       /**
-        * @var integer
-        */
-       protected $sleepAfterFinish;
-
-       /**
-        * @var integer
-        */
-       protected $countInARun;
-
-       /**
-        * Total number of broken links.
-        *
-        * @var integer
-        */
-       protected $totalBrokenLink = 0;
-
-       /**
-        * Total number of broken links from the last run.
-        *
-        * @var integer
-        */
-       protected $oldTotalBrokenLink = 0;
-
-       /**
-        * Mail template fetched from the given template file.
-        *
-        * @var string
-        */
-       protected $templateMail;
-       
-       /**
-        * specific TSconfig for this task.
-        *
-        * @var array
-        */
-       protected $configuration = array();
-
-       /**
-        * Shows if number of result was diferent from the result of the last check or not.
-        *
-        * @var boolean
-        */
-       protected $dif;
-
-       /**
-        * Template to be used for the email.
-        *
-        * @var string
-        */
-       protected $emailTemplateFile;
-
-       /**
-        * Level of pages the task should check.
-        *
-        * @var integer
-        */
-       protected $depth;
-
-       /**
-        * UID of the start page for this task.
-        *
-        * @var integer
-        */
-       protected $page;
-
-       /**
-        * Email address to which an email report is sent.
-        *
-        * @var string
-        */
-       protected $email;
-       
-       /**
-        * Only send an email, if new broken links were found.
-        *
-        * @var boolean
-        */
-       protected $emailOnBrokenLinkOnly;
-
-       /**
-        * Get the value of the protected property email.
-        *
-        * @return  string      Email address to which an email report is sent
-        */
-       public function getEmail() {
-               return $this->email;
-       }
-       
-       /**
-        * Set the value of the private property email.
-        *
-        * @param  string       Email address to which an email report is sent
-        * @return void
-        */
-       public function setEmail($email) {
-               $this->email=$email;
-       }
-       
-       /**
-        * Get the value of the protected property emailOnBrokenLinkOnly.
-        *
-        * @return  boolean      Only send an email, if new broken links were found.
-        */
-       public function getEmailOnBrokenLinkOnly() {
-               return $this->emailOnBrokenLinkOnly;
-       }
-       
-       /**
-        * Set the value of the private property emailOnBrokenLinkOnly.
-        *
-        * @param  boolean      Only send an email, if new broken links were found.
-        * @return void
-        */
-       public function setEmailOnBrokenLinkOnly($emailOnBrokenLinkOnly) {
-               $this->emailOnBrokenLinkOnly = $emailOnBrokenLinkOnly;
-       }
-       
-       /**
-        * Get the value of the protected property page.
-        *
-        * @return  integer      UID of the start page for this task.
-        */
-       public function getPage() {
-               return $this->page;
-       }
-       
-       /**
-        * Set the value of the private property page.
-        *
-        * @param  integer      UID of the start page for this task.
-        * @return void
-        */
-       public function setPage($page) {
-               $this->page =$page;
-       }
-       
-       /**
-        * Get the value of the protected property depth.
-        *
-        * @return  integer     Level of pages the task should check.
-        */
-       public function getDepth() {
-               return $this->depth;
-       }
-       
-       /**
-        * Set the value of the private property depth.
-        *
-        * @param  integer     Level of pages the task should check.
-        * @return void
-        */
-       public function setDepth($depth) {
-               $this->depth = $depth;
-       }
-       
-       /**
-        * Get the value of the protected property emailTemplateFile.
-        *
-        * @return  string    Template to be used for the email.
-        */
-       public function getEmailTemplateFile() {
-               return $this->emailTemplateFile;
-       }
-       
-       /**
-        * Set the value of the private property emailTemplateFile.
-        *
-        * @param  string    Template to be used for the email.
-        * @return void
-        */
-       public function setEmailTemplateFile($emailTemplateFile) {
-               $this->emailTemplateFile = $emailTemplateFile;
-       }
-       
-       /**
-        * Get the value of the protected property configuration.
-        *
-        * @return  array    specific TSconfig for this task.
-        */
-       public function getConfiguration() {
-               return $this->configuration;
-       }
-       
-       /**
-        * Set the value of the private property configuration.
-        *
-        * @param  array    specific TSconfig for this task.
-        * @return void
-        */
-       public function setConfiguration($configuration) {
-               $this->configuration = $configuration;
-       }
-       
-       
-       /**
-        * Function executed from the Scheduler.
-        *
-        * @return      void
-        */
-       public function execute() {
-               $this->setCliArguments();
-               $successfullyExecuted = TRUE;
-               if (!file_exists($file = t3lib_div::getFileAbsFileName($this->emailTemplateFile)) && !empty($this->email)) {
-                       throw new Exception(
-                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidEmailTemplateFile'),
-                               '1295476972'
-                       );
-               }
-               $htmlFile = t3lib_div::getURL($file);
-               $this->templateMail = t3lib_parsehtml::getSubpart($htmlFile, '###REPORT_TEMPLATE###');
-
-                       // The array to put the content into
-               $html = array();
-               $pageSections = '';
-               $this->dif = FALSE;
-               $pageList = t3lib_div::trimExplode(',', $this->page, 1);
-               if (is_array($pageList)) {
-                       foreach ($pageList as $page) {
-                               $modTS = t3lib_BEfunc::getModTSconfig($page, 'mod.linkvalidator');
-                               $parseObj = t3lib_div::makeInstance('t3lib_TSparser');
-                               $parseObj->parse($this->configuration);
-                               if(count($parseObj->errors) > 0){
-                                       $parseErrorMessage = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidTSconfig') . '<br />';
-                                       foreach($parseObj->errors as $errorInfo){
-                                               $parseErrorMessage .= $errorInfo[0] . '<br />';
-                                       }
-                                       throw new Exception(
-                                               $parseErrorMessage,
-                                               '1295476989'
-                                       );
-                               }
-                               $TSconfig = $parseObj->setup;
-                               $modTS = $modTS['properties'];
-                               $overrideTs = $TSconfig['mod.']['tx_linkvalidator.'];
-                               if (is_array($overrideTs)) {
-                                       $modTS = t3lib_div::array_merge_recursive_overrule($modTS, $overrideTs);
-                               }
-
-                                       // get the searchFields from TCA
-                               foreach ($GLOBALS['TCA'] as $tablename => $table) {
-                                       if (!empty($table['columns'])) {
-                                               foreach ($table['columns'] as $columnname => $column) {
-                                                       if ($column['config']['type'] == 'text' || $column['config']['type'] == 'input') {
-                                                               if (!empty($column['config']['softref']) && (stripos($column['config']['softref'], "typolink")
-                                                                               !== FALSE || stripos($column['config']['softref'], "url") !== FALSE)) {
-
-                                                                       $searchFields[$tablename][] = $columnname;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-
-                                       // get the searchFields from TypoScript
-                               foreach ($modTS['searchFields.'] as $table => $fieldList) {
-                                       $fields = t3lib_div::trimExplode(',', $fieldList);
-                                       foreach ($fields as $field) {
-                                               if (is_array($searchFields[$table])) {
-                                                       if (array_search($field, $searchFields[$table]) === FALSE) {
-                                                               $searchFields[$table][] = $field;
-                                                       }
-                                               }
-                                       }
-                               }
-                               $linktypes = t3lib_div::trimExplode(',', $modTS['linktypes'], 1);
-                               if (is_array($linktypes)) {
-                                       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)) {
-                                                               $array[$type] = 1;
-                                                       }
-                                               }
-                                       }
-                               }
-                               $processing = t3lib_div::makeInstance('tx_linkvalidator_processing');
-                               $pageIds = $processing->extGetTreeList($page, $this->depth, 0, '1=1');
-                               $pageIds .= $page;
-                               $processing->init($searchFields, $pageIds);
-                               if (!empty($this->email)) {
-                                       $oldLinkCounts = $processing->getLinkCounts($page);
-                                       $this->oldTotalBrokenLink += $oldLinkCounts['brokenlinkCount'];
-                               }
-
-                               $processing->getLinkStatistics($array, $modTS['checkhidden']);
-
-                               if (!empty($this->email)) {
-                                       $linkCounts = $processing->getLinkCounts($page);
-                                       $this->totalBrokenLink += $linkCounts['brokenlinkCount'];
-                                       $pageSections .= $this->buildMail($page, $pageIds, $linkCounts, $oldLinkCounts);
-                               }
-
-                       }
-               }
-               if ($this->totalBrokenLink != $this->oldTotalBrokenLink) {
-                       $this->dif = TRUE;
-               }
-               if ($this->totalBrokenLink > 0
-                       && (!$this->emailOnBrokenLinkOnly || $this->dif)
-                       && !empty($this->email)
-               ) {
-                       $successfullyExecuted = $this->reportEmail($pageSections, $modTS);
-               }
-               return $successfullyExecuted;
-       }
-
-
-       /**
-        * Build and send warning email when new broken links were found.
-        *
-        * @param       string          $pageSections: Content of page section
-        * @param       string          $modTS: TSconfig array
-        * @return      bool            TRUE if mail was sent, FALSE if or not
-        */
-       protected function reportEmail($pageSections, $modTS) {
-               $content = t3lib_parsehtml::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections);
-               /** @var array $markerArray */
-               $markerArray = array();
-               /** @var array $validEmailList */
-               $validEmailList = array();
-               /** @var boolean $sendEmail */
-               $sendEmail = TRUE;
-
-               $markerArray['totalBrokenLink'] = $this->totalBrokenLink;
-               $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink;
-               $content = t3lib_parsehtml::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE);
-
-               /** @var t3lib_mail_Message $mail */
-               $mail = t3lib_div::makeInstance('t3lib_mail_Message');
-               if (t3lib_div::validEmail($modTS['mail.']['fromemail'])) {
-                       $mail->setFrom(array($modTS['mail.']['fromemail'] => $modTS['mail.']['fromname']));
-               } else {
-                       throw new Exception(
-                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidFromEmail'),
-                               '1295476760'
-                       );
-               }
-               if(t3lib_div::validEmail($modTS['mail.']['replytoemail'])) {
-                       $mail->setReplyTo(array($modTS['mail.']['replytoemail'] => $modTS['mail.']['replytoname']));
-               }
-
-               if(!empty($modTS['mail.']['subject'])) {
-                       $mail->setSubject($modTS['mail.']['subject']);
-               } else {
-                       throw new Exception(
-                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.noSubject'),
-                               '1295476808'
-                       );
-               }
-               if (!empty($this->email)) {
-                       $emailList = t3lib_div::trimExplode(',', $this->email);
-                       foreach ($emailList as $emailAdd) {
-                               if (!t3lib_div::validEmail($emailAdd)) {
-                                       throw new Exception(
-                                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidToEmail'),
-                                               '1295476821'
-                                       );
-                               } else {
-                                       $validEmailList[] = $emailAdd;
-                               }
-                       }
-               }
-               if (is_array($validEmailList) && !empty($validEmailList)) {
-                       $mail->setTo($this->email);
-               } else {
-                       $sendEmail = FALSE;
-               }
-
-               if($sendEmail) {
-                       $mail->setBody($content,'text/html');
-                       $mail->send();
-               }
-
-               return $sendEmail;
-       }
-
-
-       /**
-        * Build the mail content.
-        *
-        * @param       int                     $curPage: id of the current page
-        * @param       string          $pageList: list of pages id
-        * @param       array           $markerArray: array of markers
-        * @param       array           $oldBrokenLink: markerarray with the number of link found
-        * @return      string          Content of the mail
-        */
-       protected function buildMail($curPage, $pageList, $markerArray, $oldBrokenLink) {
-               $pageSectionHTML = t3lib_parsehtml::getSubpart($this->templateMail, '###PAGE_SECTION###');
-
-               if (is_array($markerArray)) {
-                       foreach ($markerArray as $markerKey => $markerValue) {
-                               if (empty($oldBrokenLink[$markerKey])) {
-                                       $oldBrokenLink[$markerKey] = 0;
-                               }
-                               if ($markerValue != $oldBrokenLink[$markerKey]) {
-                                       $this->dif = TRUE;
-                               }
-                               $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey];
-                       }
-               }
-               $markerArray['title'] = t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecord('pages', $curPage));
-
-               $content = '';
-               if ($markerArray['brokenlinkCount'] > 0) {
-                       $content = t3lib_parsehtml::substituteMarkerArray($pageSectionHTML, $markerArray, '###|###', TRUE, TRUE);
-               }
-               return $content;
-       }
-
-
-       /**
-        * Simulate cli call with setting the required options to the $_SERVER['argv']
-        *
-        * @return      void
-        * @access protected
-        */
-       protected function setCliArguments() {
-               $_SERVER['argv'] = array(
-                       $_SERVER['argv'][0],
-                       'tx_link_scheduler_link',
-                       '0',
-                       '-ss',
-                       '--sleepTime',
-                       $this->sleepTime,
-                       '--sleepAfterFinish',
-                       $this->sleepAfterFinish,
-                       '--countInARun',
-                       $this->countInARun
-               );
-       }
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php']);
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php b/typo3/sysext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php
deleted file mode 100644 (file)
index 509c46e..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-/**
- * This class provides Scheduler Additional Field plugin implementation.
- *
- * @author Dimitri König <dk@cabag.ch>
- * @author Michael Miousse <michael.miousse@infoglobe.ca>
- * @package TYPO3
- * @subpackage linkvalidator
- */
-class tx_linkvalidator_tasks_ValidateAdditionalFieldProvider implements tx_scheduler_AdditionalFieldProvider {
-
-       /**
-        * Render additional information fields within the scheduler backend.
-        *
-        * @param       array           $taksInfo: array information of task to return
-        * @param       task            $task: task object
-        * @param       tx_scheduler_Module             $schedulerModule: reference to the calling object (BE module of the Scheduler)
-        * @return      array           additional fields
-        * @see interfaces/tx_scheduler_AdditionalFieldProvider#getAdditionalFields($taskInfo, $task, $schedulerModule)
-        */
-       public function getAdditionalFields(array &$taskInfo, $task, tx_scheduler_Module $schedulerModule) {
-               $additionalFields = array();
-               if (empty($taskInfo['configuration'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['configuration'] = '';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['configuration'] = $task->getConfiguration();
-                       } else {
-                               $taskInfo['configuration'] = $task->getConfiguration();
-                       }
-               }
-
-               if (empty($taskInfo['depth'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['depth'] = array();
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['depth'] = $task->getDepth();
-                       } else {
-                               $taskInfo['depth'] = $task->getDepth();
-                       }
-               }
-
-               if (empty($taskInfo['page'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['page'] = '';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['page'] = $task->getPage();
-                       } else {
-                               $taskInfo['page'] = $task->getPage();
-                       }
-               }
-               if (empty($taskInfo['email'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['email'] = '';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['email'] = $task->getEmail();
-                       } else {
-                               $taskInfo['email'] = $task->getEmail();
-                       }
-               }
-
-               if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['emailOnBrokenLinkOnly'] = 1;
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
-                       } else {
-                               $taskInfo['emailOnBrokenLinkOnly'] = $task->getEmailOnBrokenLinkOnly();
-                       }
-               }
-               if (empty($taskInfo['emailTemplateFile'])) {
-                       if ($schedulerModule->CMD == 'add') {
-                               $taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/res/mailtemplate.html';
-                       } elseif ($schedulerModule->CMD == 'edit') {
-                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
-                       } else {
-                               $taskInfo['emailTemplateFile'] = $task->getEmailTemplateFile();
-                       }
-               }
-
-
-               $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 = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-
-                       // input for 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'),
-                       '2' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_2'),
-                       '3' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.depth_3'),
-                       '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 . '">';
-
-               foreach ($fieldValueArray as $depth => $label) {
-                       $fieldCode .= "\t" . '<option value="' . $depth . '"' . (($depth == htmlspecialchars($taskInfo['depth'])) ? ' selected="selected"' : '') . '>' . $label . '</option>';
-               }
-
-               $fieldCode .= '</select>';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.depth');
-               $label = t3lib_BEfunc::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>';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.conf');
-               $label = t3lib_BEfunc::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']) . '" />';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.email');
-               $label = t3lib_BEfunc::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"' : '') . ' />';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
-               $label = t3lib_BEfunc::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']) . '" />';
-               $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
-               $label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
-               $additionalFields[$fieldID] = array(
-                       'code' => $fieldCode,
-                       'label' => $label
-               );
-
-               return $additionalFields;
-       }
-
-
-       /**
-        * Mark current value as selected by returning the "selected" attribute.
-        *
-        * @param       array           $configurationArray: array of configuration
-        * @param       string          $currentValue: value of selector object
-        * @return      string          Html fragment for a selected option or empty
-        * @access protected
-        */
-       protected function getSelectedState($configurationArray, $currentValue) {
-               $selected = '';
-               for ($i = 0; $i < count($configurationArray); $i++) {
-                       if (strcmp($configurationArray[$i], $currentValue) === 0) {
-                               $selected = 'selected="selected" ';
-                       }
-               }
-               return $selected;
-       }
-
-
-       /**
-        * This method checks any additional data that is relevant to the specific task.
-        * 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       tx_scheduler_module1            $parentObject: reference to the calling object (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, tx_scheduler_Module $schedulerModule) {
-               $isValid = TRUE;
-
-               //!TODO add validation to validate the $submittedData['configuration'] wich is normally a comma seperated string
-               if (!empty($submittedData['linkvalidator']['email'])) {
-                       $emailList = t3lib_div::trimExplode(',', $submittedData['linkvalidator']['email']);
-                       foreach ($emailList as $emailAdd) {
-                               if (!t3lib_div::validEmail($emailAdd)) {
-                                       $isValid = FALSE;
-                                       $schedulerModule->addMessage(
-                                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidEmail'),
-                                               t3lib_FlashMessage::ERROR
-                                       );
-                               }
-                       }
-               }
-
-               if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid = ' . $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'),
-                                       t3lib_FlashMessage::ERROR
-                               );
-                       }
-               } else {
-                       $isValid = FALSE;
-                       $schedulerModule->addMessage(
-                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidPage'),
-                               t3lib_FlashMessage::ERROR
-                       );
-               }
-
-               if ($submittedData['linkvalidator']['depth'] < 0) {
-                       $isValid = FALSE;
-                       $schedulerModule->addMessage(
-                               $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.invalidDepth'),
-                               t3lib_FlashMessage::ERROR
-                       );
-               }
-
-               return $isValid;
-       }
-
-
-       /**
-        * This method is used to save any additional input into the current task object
-        * if the task class matches.
-        *
-        * @param       array           $submittedData: array containing the data submitted by the user
-        * @param       tx_scheduler_Task               $task: reference to the current task object
-        * @return      void
-        */
-       public function saveAdditionalFields(array $submittedData, tx_scheduler_Task $task) {
-               $task->setDepth($submittedData['linkvalidator']['depth']);
-               $task->setPage($submittedData['linkvalidator']['page']);
-               $task->setEmail($submittedData['linkvalidator']['email']);
-               if($submittedData['linkvalidator']['emailOnBrokenLinkOnly']){
-                       $task->setEmailOnBrokenLinkOnly(1);
-               }
-               else{
-                       $task->setEmailOnBrokenLinkOnly(0);
-               }
-               $task->setConfiguration($submittedData['linkvalidator']['configuration']);
-               $task->setEmailTemplateFile($submittedData['linkvalidator']['emailTemplateFile']);
-       }
-
-
-}
-
-if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php'])) {
-       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php']);
-}
-
-?>
\ No newline at end of file
index 4df9468..1e6e790 100644 (file)
@@ -2,16 +2,16 @@
 $extensionPath = t3lib_extMgm::extPath('linkvalidator');
 
 return array(
-       'tx_linkvalidator_linktypes_abstract' => $extensionPath . 'classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php',
-       'tx_linkvalidator_linktypes_interface' => $extensionPath . 'classes/linktypes/class.tx_linkvalidator_linktypes_interface.php',
-       'tx_linkvalidator_linktypes_external' => $extensionPath . 'classes/linktypes/class.tx_linkvalidator_linktypes_external.php',
-       'tx_linkvalidator_linktypes_file' => $extensionPath . 'classes/linktypes/class.tx_linkvalidator_linktypes_file.php',
-       'tx_linkvalidator_linktypes_internal' => $extensionPath . 'classes/linktypes/class.tx_linkvalidator_linktypes_internal.php',
-       'tx_linkvalidator_linktypes_linkhandler' => $extensionPath . 'classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php',
+       'tx_linkvalidator_linktype_abstract' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_abstract.php',
+       'tx_linkvalidator_linktype_interface' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_interface.php',
+       'tx_linkvalidator_linktype_external' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_external.php',
+       'tx_linkvalidator_linktype_file' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_file.php',
+       'tx_linkvalidator_linktype_internal' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_internal.php',
+       'tx_linkvalidator_linktype_linkhandler' => $extensionPath . 'classes/linktype/class.tx_linkvalidator_linktype_linkhandler.php',
 
-       'tx_linkvalidator_processing' => $extensionPath . 'classes/class.tx_linkvalidator_processing.php',
+       'tx_linkvalidator_processor' => $extensionPath . 'classes/class.tx_linkvalidator_processor.php',
 
-       'tx_linkvalidator_tasks_validate'  => $extensionPath . 'classes/tasks/class.tx_linkvalidator_tasks_validate.php',
-       'tx_linkvalidator_tasks_validateadditionalfieldprovider' => $extensionPath . 'classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php',
+       'tx_linkvalidator_tasks_validator'  => $extensionPath . 'classes/task/class.tx_linkvalidator_tasks_validator.php',
+       'tx_linkvalidator_tasks_validatoradditionalfieldprovider' => $extensionPath . 'classes/task/class.tx_linkvalidator_tasks_validatoradditionalfieldprovider.php',
 );
 ?>
\ No newline at end of file
index 31c4f8b..9aa34f8 100644 (file)
@@ -41,7 +41,7 @@ $EM_CONF[$_EXTKEY] = array(
                'suggests' => array(
                ),
        ),
-       '_md5_values_when_last_written' => 'a:26:{s:9:"ChangeLog";s:4:"ed60";s:16:"ext_autoload.php";s:4:"619e";s:12:"ext_icon.gif";s:4:"6bc7";s:17:"ext_localconf.php";s:4:"0598";s:14:"ext_tables.php";s:4:"6d40";s:14:"ext_tables.sql";s:4:"317e";s:13:"locallang.xml";s:4:"ec0a";s:45:"classes/class.tx_linkvalidator_processing.php";s:4:"611a";s:63:"classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php";s:4:"7f7e";s:63:"classes/linktypes/class.tx_linkvalidator_linktypes_external.php";s:4:"bdfa";s:59:"classes/linktypes/class.tx_linkvalidator_linktypes_file.php";s:4:"ee97";s:64:"classes/linktypes/class.tx_linkvalidator_linktypes_interface.php";s:4:"c385";s:63:"classes/linktypes/class.tx_linkvalidator_linktypes_internal.php";s:4:"6bf5";s:66:"classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php";s:4:"cef8";s:55:"classes/tasks/class.tx_linkvalidator_tasks_validate.php";s:4:"d684";s:78:"classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php";s:4:"12af";s:14:"doc/manual.sxw";s:4:"6694";s:14:"doc/manual.txt";s:4:"d46d";s:44:"modfuncreport/class.tx_linkvalidator_modfuncreport.php";s:4:"cb5b";s:22:"modfuncreport/locallang.xml";s:4:"2319";s:26:"modfuncreport/locallang_csh.xml";s:4:"efa4";s:26:"modfuncreport/locallang_mod.xml";s:4:"e370";s:26:"modfuncreport/mod_template.html";s:4:"7ed2";s:21:"res/linkvalidator.css";s:4:"2f4e";s:21:"res/mailtemplate.html";s:4:"c425";s:20:"res/pagetsconfig.txt";s:4:"ab0f";}',
+       '_md5_values_when_last_written' => 'a:26:{s:9:"ChangeLog";s:4:"ed60";s:16:"ext_autoload.php";s:4:"619e";s:12:"ext_icon.gif";s:4:"6bc7";s:17:"ext_localconf.php";s:4:"0598";s:14:"ext_tables.php";s:4:"6d40";s:14:"ext_tables.sql";s:4:"317e";s:13:"locallang.xml";s:4:"ec0a";s:45:"classes/class.tx_linkvalidator_processor.php";s:4:"611a";s:63:"classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php";s:4:"7f7e";s:63:"classes/linktypes/class.tx_linkvalidator_linktypes_external.php";s:4:"bdfa";s:59:"classes/linktypes/class.tx_linkvalidator_linktypes_file.php";s:4:"ee97";s:64:"classes/linktypes/class.tx_linkvalidator_linktypes_interface.php";s:4:"c385";s:63:"classes/linktypes/class.tx_linkvalidator_linktypes_internal.php";s:4:"6bf5";s:66:"classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php";s:4:"cef8";s:55:"classes/tasks/class.tx_linkvalidator_tasks_validate.php";s:4:"d684";s:78:"classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php";s:4:"12af";s:14:"doc/manual.sxw";s:4:"6694";s:14:"doc/manual.txt";s:4:"d46d";s:44:"modfuncreport/class.tx_linkvalidator_modfuncreport.php";s:4:"cb5b";s:22:"modfuncreport/locallang.xml";s:4:"2319";s:26:"modfuncreport/locallang_csh.xml";s:4:"efa4";s:26:"modfuncreport/locallang_mod.xml";s:4:"e370";s:26:"modfuncreport/mod_template.html";s:4:"7ed2";s:21:"res/linkvalidator.css";s:4:"2f4e";s:21:"res/mailtemplate.html";s:4:"c425";s:20:"res/pagetsconfig.txt";s:4:"ab0f";}',
        'suggests' => array(
        ),
 );
index 167acf5..5250d47 100644 (file)
@@ -5,20 +5,20 @@ if (!defined ('TYPO3_MODE')) {
 
 t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:linkvalidator/res/pagetsconfig.txt">');
 
-$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_linkvalidator_tasks_Validate'] = array(
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['tx_linkvalidator_tasks_Validator'] = array(
     'extension'        => $_EXTKEY,
     'title'            => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tasks.validate.name',
     'description'      => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tasks.validate.description',
-    'additionalFields' => 'tx_linkvalidator_tasks_ValidateAdditionalFieldProvider'
+    'additionalFields' => 'tx_linkvalidator_tasks_ValidatorAdditionalFieldProvider'
 );
 
 if (!is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] = array();
 }
 
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = 'tx_linkvalidator_linkTypes_Internal';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['file'] = 'tx_linkvalidator_linkTypes_File';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['external'] = 'tx_linkvalidator_linkTypes_External';
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['linkhandler'] = 'tx_linkvalidator_linkTypes_LinkHandler';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['db'] = 'tx_linkvalidator_linktype_Internal';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['file'] = 'tx_linkvalidator_linktype_File';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['external'] = 'tx_linkvalidator_linktype_External';
+$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']['linkhandler'] = 'tx_linkvalidator_linktype_LinkHandler';
 
 ?>
\ No newline at end of file
index f0686d8..6e804f4 100644 (file)
@@ -7,7 +7,7 @@ if (TYPO3_MODE == 'BE') {
                // add module
        t3lib_extMgm::insertModuleFunction(
                'web_info',
-               'tx_linkvalidator_modfuncreport',
+               'tx_linkvalidator_ModFuncReport',
                t3lib_extMgm::extPath('linkvalidator') . 'modfuncreport/class.tx_linkvalidator_modfuncreport.php',
                'LLL:EXT:linkvalidator/locallang.xml:mod_linkvalidator'
        );
index d9a2088..b49eabf 100644 (file)
@@ -31,7 +31,7 @@
  * @package TYPO3
  * @subpackage linkvalidator
  */
-class tx_linkvalidator_modfuncreport extends t3lib_extobjbase {
+class tx_linkvalidator_ModFuncReport extends t3lib_extobjbase {
 
        /**
         * @var template
@@ -67,9 +67,9 @@ class tx_linkvalidator_modfuncreport extends t3lib_extobjbase {
        /**
         * Link validation class.
         *
-        * @var tx_linkvalidator_processing
+        * @var tx_linkvalidator_Processor
         */
-       protected $processing;
+       protected $processor;
 
        /**
         * TSconfig of the current module.
@@ -178,10 +178,10 @@ class tx_linkvalidator_modfuncreport extends t3lib_extobjbase {
 
                $this->refreshListHtml = '<input type="submit" name="refreshLinkList" value="' . $GLOBALS['LANG']->getLL('label_refresh') . '"/>';
 
-               $this->processing = t3lib_div::makeInstance('tx_linkvalidator_processing');
+               $this->processor = t3lib_div::makeInstance('tx_linkvalidator_Processor');
                $this->updateBrokenLinks();
 
-               $brokenLinkOverView = $this->processing->getLinkCounts($this->pObj->id);
+               $brokenLinkOverView = $this->processor->getLinkCounts($this->pObj->id);
                $this->checkOptHtml = $this->getCheckOptions($brokenLinkOverView);
 
                $this->render();
@@ -262,7 +262,7 @@ class tx_linkvalidator_modfuncreport extends t3lib_extobjbase {
                        }
                }
                        // get children pages
-               $pageList = $this->processing->extGetTreeList(
+               $pageList = $this->processor->extGetTreeList(
                        $this->pObj->id,
                        $this->search_level,
                        0,
@@ -270,13 +270,13 @@ class tx_linkvalidator_modfuncreport extends t3lib_extobjbase {
                );
                $pageList .= $this->pObj->id;
 
-               $this->processing->init($searchFields, $pageList);
+               $this->processor->init($searchFields, $pageList);
 
                        // check if button press
                $update = t3lib_div::_GP('updateLinkList');
 
                if (!empty($update)) {
-                       $this->processing->getLinkStatistics($this->availableOptions, $this->modTS['checkhidden']);
+                       $this->processor->getLinkStatistics($this->availableOptions, $this->modTS['checkhidden']);
                }
        }
 
@@ -356,7 +356,7 @@ class tx_linkvalidator_modfuncreport extends t3lib_extobjbase {
                        $keyOpt = array_keys($this->checkOpt);
                }
 
-               $pageList = $this->processing->extGetTreeList(
+               $pageList = $this->processor->extGetTreeList(
                        $this->pObj->id,
                        $this->search_level,
                        0,