[TASK] Cleanup character after PHP closing tag
[Packages/TYPO3.CMS.git] / typo3 / sysext / linkvalidator / Classes / Linktype / FileLinktype.php
1 <?php
2 namespace TYPO3\CMS\Linkvalidator\Linktype;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag)
8 * (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
9 * All rights reserved
10 *
11 * This script is part of the TYPO3 project. The TYPO3 project is
12 * free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * The GNU General Public License can be found at
18 * http://www.gnu.org/copyleft/gpl.html.
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * This class provides Check File Links plugin implementation
29 *
30 * @author Dimitri K├Ânig <dk@cabag.ch>
31 * @author Michael Miousse <michael.miousse@infoglobe.ca>
32 * @package TYPO3
33 * @subpackage linkvalidator
34 */
35 class FileLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
36
37 /**
38 * Checks a given URL + /path/filename.ext for validity
39 *
40 * @param string $url Url to check
41 * @param array $softRefEntry The soft reference entry which builds the context of that url
42 * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance of tx_linkvalidator_Processor
43 * @return boolean TRUE on success or FALSE on error
44 */
45 public function checkLink($url, $softRefEntry, $reference) {
46 if (!@file_exists((PATH_site . rawurldecode($url)))) {
47 return FALSE;
48 }
49 return TRUE;
50 }
51
52 /**
53 * Generate the localized error message from the error params saved from the parsing
54 *
55 * @param array $errorParams All parameters needed for the rendering of the error message
56 * @return string Validation error message
57 */
58 public function getErrorMessage($errorParams) {
59 $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
60 return $response;
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 = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
71 return $brokenUrl;
72 }
73 }
74 ?>