Index: /home/miousse/typo3svn/linkvalidator/classes/class.tx_linkvalidator_processing.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/class.tx_linkvalidator_processing.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/class.tx_linkvalidator_processing.php (working copy)
@@ -35,12 +35,54 @@
class tx_linkvalidator_processing {
- protected $searchFields = array(); // array of tables and fields to search for broken links
- protected $pidList = ''; // list of pidlist (rootline downwards)
- protected $linkCounts = array(); // array of tables containing number of external link
- protected $brokenLinkCounts = array(); // array of tables containing number of broken external link
- protected $recordsWithBrokenLinks = array(); // array of tables and records containing broken links
- protected $hookObjectsArr = array(); // array for hooks for own checks
+ /**
+ * 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.
Index: /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php (working copy)
@@ -29,7 +29,7 @@
* @package TYPO3
* @subpackage linkvalidator
*/
-abstract class tx_linkvalidator_linkTypes_Abstract {
+abstract class tx_linkvalidator_linkTypes_Abstract implements tx_linkvalidator_linkTypes_Interface {
/**
* Contains parameters needed for the rendering of the error message
@@ -36,7 +36,7 @@
*
* @var array
*/
- private $errorParams = array();
+ protected $errorParams = array();
/**
* Base type fetching method, based on the type that softRefParserObj returns.
@@ -59,7 +59,7 @@
* @param array all parameters needed for the rendering of the error message
* @return void
*/
- public function setErrorParams(array $value) {
+ protected function setErrorParams(array $value) {
$this->errorParams = $value;
}
Index: /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_external.php (working copy)
@@ -29,10 +29,21 @@
* @package TYPO3
* @subpackage linkvalidator
*/
-class tx_linkvalidator_linkTypes_External extends tx_linkvalidator_linkTypes_Abstract implements tx_linkvalidator_linkTypes_Interface {
+class tx_linkvalidator_linkTypes_External extends tx_linkvalidator_linkTypes_Abstract {
- var $url_reports = array();
- var $url_error_params = array();
+ /**
+ * 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
@@ -186,9 +197,10 @@
*
* @param array $value: reference properties
* @param string $type: current type
- * @return string fetched type
+ * @param string $key: validator hook name
+ * @return string fetched type
*/
- public function fetchType($value, $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])) {
Index: /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php (working copy)
@@ -29,7 +29,7 @@
* @package TYPO3
* @subpackage linkvalidator
*/
-class tx_linkvalidator_linkTypes_File extends tx_linkvalidator_linkTypes_Abstract implements tx_linkvalidator_linkTypes_Interface {
+class tx_linkvalidator_linkTypes_File extends tx_linkvalidator_linkTypes_Abstract {
/**
* Checks a given URL + /path/filename.ext for validity.
Index: /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_interface.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_interface.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_interface.php (working copy)
@@ -41,6 +41,31 @@
*/
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
Index: /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_internal.php (working copy)
@@ -29,7 +29,7 @@
* @package TYPO3
* @subpackage linkvalidator
*/
-class tx_linkvalidator_linkTypes_Internal extends tx_linkvalidator_linkTypes_Abstract implements tx_linkvalidator_linkTypes_Interface {
+class tx_linkvalidator_linkTypes_Internal extends tx_linkvalidator_linkTypes_Abstract {
const DELETED = 'deleted';
const HIDDEN = 'hidden';
@@ -36,10 +36,26 @@
const MOVED = 'moved';
const NOTEXISTING = 'notExisting';
- var $errorParams = array();
+ /**
+ * 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;
- var $responsePage = TRUE;
- var $responseContent = 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
@@ -100,7 +116,7 @@
* @param object $reference: parent instance of tx_linkvalidator_processing
* @return string TRUE on success or FALSE on error
*/
- public function checkPage($page, $softRefEntry, $reference) {
+ protected function checkPage($page, $softRefEntry, $reference) {
$rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
'uid, title, deleted, hidden, starttime, endtime',
'pages',
@@ -140,7 +156,7 @@
* @param object $reference: parent instance of tx_linkvalidator_processing
* @return string TRUE on success or FALSE on error
*/
- public function checkContent($page, $anchor, $softRefEntry, $reference) {
+ 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',
Index: /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php (working copy)
@@ -29,13 +29,19 @@
* @package TYPO3
* @subpackage linkvalidator
*/
-class tx_linkvalidator_linkTypes_LinkHandler extends tx_linkvalidator_linkTypes_Abstract implements tx_linkvalidator_linkTypes_Interface {
+class tx_linkvalidator_linkTypes_LinkHandler extends tx_linkvalidator_linkTypes_Abstract {
- public $tsconfig;
const DELETED = 'deleted';
/**
- * Get TsConfig on loading of the class
+ * 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');
@@ -88,9 +94,10 @@
*
* @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) {
+ public function fetchType($value, $type, $key) {
if ($type == 'string' && strtolower(substr($value['tokenValue'], 0, 7)) == 'record:') {
$type = 'linkhandler';
}
Index: /home/miousse/typo3svn/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validate.php (working copy)
@@ -47,6 +47,8 @@
public $countInARun;
/**
+ * Total number of broken links.
+ *
* @var integer
*/
public $totalBrokenLink = 0;
@@ -52,6 +54,8 @@
public $totalBrokenLink = 0;
/**
+ * Total number of broken links from the last run.
+ *
* @var integer
*/
public $oldTotalBrokenLink = 0;
@@ -56,6 +60,61 @@
*/
public $oldTotalBrokenLink = 0;
+ /**
+ * Mail template fetched from the given template file.
+ *
+ * @var string
+ */
+ public $templateMail;
+
+ /**
+ * specific TSconfig for this task.
+ *
+ * @var array
+ */
+ public $configuration = array();
+
+ /**
+ * Shows if number of result was diferent from the result of the last check or not.
+ *
+ * @var boolean
+ */
+ public $dif;
+
+ /**
+ * Template to be used for the email.
+ *
+ * @var string
+ */
+ public $emailTemplateFile;
+
+ /**
+ * Level of pages the task should check.
+ *
+ * @var integer
+ */
+ public $depth;
+
+ /**
+ * UID of the start page for this task.
+ *
+ * @var integer
+ */
+ public $page;
+
+ /**
+ * Email address to which an email report is sent.
+ *
+ * @var string
+ */
+ public $email;
+
+ /**
+ * Only send an email, if new broken links were found.
+ *
+ * @var boolean
+ */
+ public $emailOnBrokenLinkOnly;
/**
* Function executed from the Scheduler.
@@ -65,7 +124,12 @@
public function execute() {
$this->setCliArguments();
$successfullyExecuted = TRUE;
- $file = t3lib_div::getFileAbsFileName($this->emailfile);
+ 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###');
@@ -79,6 +143,16 @@
$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') . '
';
+ foreach($parseObj->errors as $errorInfo){
+ $parseErrorMessage .= $errorInfo[0] . '
';
+ }
+ throw new Exception(
+ $parseErrorMessage,
+ '1295476989'
+ );
+ }
$TSconfig = $parseObj->setup;
$modTS = $modTS['properties'];
$overrideTs = $TSconfig['mod.']['tx_linkvalidator.'];
@@ -146,7 +220,7 @@
$this->dif = TRUE;
}
if ($this->totalBrokenLink > 0
- && (!$this->emailonbrokenlinkonly || $this->dif)
+ && (!$this->emailOnBrokenLinkOnly || $this->dif)
&& !empty($this->email)
) {
$successfullyExecuted = $this->reportEmail($pageSections, $modTS);
Index: /home/miousse/typo3svn/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/classes/tasks/class.tx_linkvalidator_tasks_validateadditionalfieldprovider.php (working copy)
@@ -81,23 +81,23 @@
}
}
- if (empty($taskInfo['emailonbrokenlinkonly'])) {
+ if (empty($taskInfo['emailOnBrokenLinkOnly'])) {
if ($schedulerModule->CMD == 'add') {
- $taskInfo['emailonbrokenlinkonly'] = 1;
- $task->emailonbrokenlinkonly = 1;
+ $taskInfo['emailOnBrokenLinkOnly'] = 1;
+ $task->emailOnBrokenLinkOnly = 1;
} elseif ($schedulerModule->CMD == 'edit') {
- $taskInfo['emailonbrokenlinkonly'] = $task->emailonbrokenlinkonly;
+ $taskInfo['emailOnBrokenLinkOnly'] = $task->emailOnBrokenLinkOnly;
} else {
- $taskInfo['emailonbrokenlinkonly'] = $task->emailonbrokenlinkonly;
+ $taskInfo['emailOnBrokenLinkOnly'] = $task->emailOnBrokenLinkOnly;
}
}
- if (empty($taskInfo['emailfile'])) {
+ if (empty($taskInfo['emailTemplateFile'])) {
if ($schedulerModule->CMD == 'add') {
- $taskInfo['emailfile'] = 'EXT:linkvalidator/res/mailtemplate.html';
+ $taskInfo['emailTemplateFile'] = 'EXT:linkvalidator/res/mailtemplate.html';
} elseif ($schedulerModule->CMD == 'edit') {
- $taskInfo['emailfile'] = $task->emailfile;
+ $taskInfo['emailTemplateFile'] = $task->emailTemplateFile;
} else {
- $taskInfo['emailfile'] = $task->emailfile;
+ $taskInfo['emailTemplateFile'] = $task->emailTemplateFile;
}
}
@@ -152,9 +152,9 @@
'code' => $fieldCode,
'label' => $label
);
- $fieldID = 'task_emailonbrokenlinkonly';
- $fieldCode = '';
- $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailonbrokenlinkonly');
+ $fieldID = 'task_emailOnBrokenLinkOnly';
+ $fieldCode = '';
+ $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailOnBrokenLinkOnly');
$label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
$additionalFields[$fieldID] = array(
'code' => $fieldCode,
@@ -161,9 +161,9 @@
'label' => $label
);
- $fieldID = 'task_emailfile';
- $fieldCode = '';
- $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailfile');
+ $fieldID = 'task_emailTemplateFile';
+ $fieldCode = '';
+ $label = $GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.validate.emailTemplateFile');
$label = t3lib_BEfunc::wrapInHelp('linkvalidator', $fieldID, $label);
$additionalFields[$fieldID] = array(
'code' => $fieldCode,
@@ -258,9 +258,9 @@
$task->depth = $submittedData['depth'];
$task->page = $submittedData['page'];
$task->email = $submittedData['email'];
- $task->emailonbrokenlinkonly = $submittedData['emailonbrokenlinkonly'];
+ $task->emailOnBrokenLinkOnly = $submittedData['emailOnBrokenLinkOnly'];
$task->configuration = $submittedData['configuration'];
- $task->emailfile = $submittedData['emailfile'];
+ $task->emailTemplateFile = $submittedData['emailTemplateFile'];
}
Index: /home/miousse/typo3svn/linkvalidator/locallang.xml
===================================================================
--- /home/miousse/typo3svn/linkvalidator/locallang.xml (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/locallang.xml (working copy)
@@ -16,8 +16,8 @@
-
-
+
+
@@ -24,6 +24,8 @@
+
+
Index: /home/miousse/typo3svn/linkvalidator/modfunc1/class.tx_linkvalidator_modfunc1.php
===================================================================
--- /home/miousse/typo3svn/linkvalidator/modfunc1/class.tx_linkvalidator_modfunc1.php (revision 42363)
+++ /home/miousse/typo3svn/linkvalidator/modfunc1/class.tx_linkvalidator_modfunc1.php (working copy)
@@ -43,6 +43,8 @@
protected $relativePath;
/**
+ * Information about the current page record.
+ *
* @var array
*/
protected $pageRecord = array();
@@ -48,6 +50,8 @@
protected $pageRecord = array();
/**
+ * Information, if the module is accessible for the current user or not.
+ *
* @var boolean
*/
protected $isAccessibleForCurrentUser = FALSE;
@@ -53,6 +57,15 @@
protected $isAccessibleForCurrentUser = FALSE;
/**
+ * Depth for the recursivity of the link validation.
+ *
+ * @var integer
+ */
+ protected $search_level;
+
+ /**
+ * Link validation class.
+ *
* @var tx_linkvalidator_processing
*/
protected $processing;
@@ -58,6 +71,63 @@
protected $processing;
/**
+ * TSconfig of the current module.
+ *
+ * @var array
+ */
+ protected $modTS = array();
+
+ /**
+ * List of available link types to check defined in the TSconfig.
+ *
+ * @var array
+ */
+ protected $availableOptions = array();
+
+ /**
+ * List of link types currently chosen in the Statistics table.
+ * Used to show broken links of these types only.
+ *
+ * @var array
+ */
+ protected $checkOpt = array();
+
+ /**
+ * Hint message displayed on top of the module.
+ *
+ * @var string
+ */
+ protected $firstSteps;
+
+ /**
+ * Html for the button "Check Links".
+ *
+ * @var string
+ */
+ protected $updateListHtml;
+
+ /**
+ * Html for the button "Refresh Display".
+ *
+ * @var string
+ */
+ protected $refreshListHtml;
+
+ /**
+ * Html for the Statistics table with the checkboxes of the link types and the numbers of broken links.
+ *
+ * @var string
+ */
+ protected $checkOptHtml;
+
+ /**
+ * Complete content (html) to be displayed.
+ *
+ * @var string
+ */
+ protected $content;
+
+ /**
* Main method of modfunc1
*
* @return string Module content