Feature #12340 » 12340_v2.diff
classes/tasks/class.tx_linkvalidator_tasks_validate.php (working copy) | ||
---|---|---|
public $countInARun;
|
||
/**
|
||
* Total number of broken links.
|
||
*
|
||
* @var integer
|
||
*/
|
||
public $totalBrokenLink = 0;
|
||
protected $totalBrokenLink = 0;
|
||
/**
|
||
* Total number of broken links from the last run.
|
||
*
|
||
* @var integer
|
||
*/
|
||
public $oldTotalBrokenLink = 0;
|
||
protected $oldTotalBrokenLink = 0;
|
||
/**
|
||
* Mail template fetched from the given template file.
|
||
*
|
||
* @var string
|
||
*/
|
||
protected $templateMail;
|
||
/**
|
||
* 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 $emailfile;
|
||
/**
|
||
* 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;
|
||
/**
|
||
* Function executed from the Scheduler.
|
||
*
|
||
* @return void
|
classes/linktypes/class.tx_linkvalidator_linktypes_external.php (working copy) | ||
---|---|---|
* @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
|
||
*
|
||
* @param string $url: url to check
|
||
... | ... | |
}
|
||
/**
|
||
* get the external type from the softRefParserObj result.
|
||
* Base type fetching method, based on the type that softRefParserObj returns.
|
||
*
|
||
* @param array $value: reference properties
|
||
* @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])) {
|
classes/linktypes/class.tx_linkvalidator_linktypes_file.php (working copy) | ||
---|---|---|
* @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.
|
||
*
|
||
* @param string $url: url to check
|
||
* @param array $softRefEntry: the softref entry which builds the context of that url
|
||
* @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
|
||
*/
|
||
... | ... | |
* 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
|
||
* @return string validation error message
|
||
*/
|
||
public function getErrorMessage($errorParams) {
|
||
$response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
|
||
... | ... | |
/**
|
||
* Url parsing
|
||
*
|
||
* @param array $row: broken link record
|
||
* @param array $row: broken link record
|
||
* @return string parsed broken url
|
||
*/
|
||
public function getBrokenUrl($row) {
|
classes/linktypes/class.tx_linkvalidator_linktypes_linkhandler.php (working copy) | ||
---|---|---|
* @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');
|
||
}
|
||
... | ... | |
* 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 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
|
||
*/
|
||
... | ... | |
}
|
||
/**
|
||
* type fetching method, based on the type that softRefParserObj returns.
|
||
* Base type fetching method, based on the type that softRefParserObj returns.
|
||
*
|
||
* @param array $value: reference properties
|
||
* @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';
|
||
}
|
classes/linktypes/class.tx_linkvalidator_linktypes_internal.php (working copy) | ||
---|---|---|
* @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';
|
||
const MOVED = 'moved';
|
||
const NOTEXISTING = 'notExisting';
|
||
var $errorParams = array();
|
||
/**
|
||
* All parameters needed for rendering the error message.
|
||
*
|
||
* @var array
|
||
*/
|
||
protected $errorParams = array();
|
||
var $responsePage = TRUE;
|
||
var $responseContent = TRUE;
|
||
/**
|
||
* 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 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',
|
||
... | ... | |
* @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',
|
classes/linktypes/class.tx_linkvalidator_linktypes_interface.php (working copy) | ||
---|---|---|
*/
|
||
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);
|
||
}
|
||
?>
|
classes/linktypes/class.tx_linkvalidator_linktypes_abstract.php (working copy) | ||
---|---|---|
* @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
|
||
*
|
||
* @var array
|
||
*/
|
||
private $errorParams = array();
|
||
protected $errorParams = array();
|
||
/**
|
||
* Base type fetching method, based on the type that softRefParserObj returns.
|
||
... | ... | |
* @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;
|
||
}
|
||
classes/class.tx_linkvalidator_processing.php (working copy) | ||
---|---|---|
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.
|
||
*/
|
||
public function __construct() {
|
modfunc1/class.tx_linkvalidator_modfunc1.php (working copy) | ||
---|---|---|
protected $relativePath;
|
||
/**
|
||
* Information about the current page record.
|
||
*
|
||
* @var array
|
||
*/
|
||
protected $pageRecord = array();
|
||
/**
|
||
* Information, if the module is accessible for the current user or not.
|
||
*
|
||
* @var boolean
|
||
*/
|
||
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;
|
||
/**
|
||
* 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
|