[BUGFIX] Warnings in BE when using "Update reference index"
[Packages/TYPO3.CMS.git] / typo3 / sysext / linkvalidator / classes / linktype / class.tx_linkvalidator_linktype_file.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
6 * (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 *
18 * This script is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * This copyright notice MUST APPEAR in all copies of the script!
24 ***************************************************************/
25 /**
26 * This class provides Check File Links plugin implementation
27 *
28 * @author Dimitri K├Ânig <dk@cabag.ch>
29 * @author Michael Miousse <michael.miousse@infoglobe.ca>
30 * @package TYPO3
31 * @subpackage linkvalidator
32 */
33 class tx_linkvalidator_linktype_File extends tx_linkvalidator_linktype_Abstract {
34
35 /**
36 * Checks a given URL + /path/filename.ext for validity
37 *
38 * @param string $url Url to check
39 * @param array $softRefEntry The soft reference entry which builds the context of that url
40 * @param tx_linkvalidator_Processor $reference Parent instance of tx_linkvalidator_Processor
41 * @return boolean TRUE on success or FALSE on error
42 */
43 public function checkLink($url, $softRefEntry, $reference) {
44 if (!@file_exists(PATH_site . rawurldecode($url))) {
45 return FALSE;
46 }
47
48 return TRUE;
49 }
50
51 /**
52 * Generate the localized error message from the error params saved from the parsing
53 *
54 * @param array $errorParams All parameters needed for the rendering of the error message
55 * @return string Validation error message
56 */
57 public function getErrorMessage($errorParams) {
58 $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
59 return $response;
60 }
61
62
63 /**
64 * Construct a valid Url for browser output
65 *
66 * @param array $row Broken link record
67 * @return string Parsed broken url
68 */
69 public function getBrokenUrl($row) {
70 $brokenUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
71 return $brokenUrl;
72 }
73 }
74
75
76 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php'])) {
77 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php']);
78 }
79
80 ?>