TYPO3 API  SVNRelease
class.tx_linkvalidator_linktype_file.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003  *  Copyright notice
00004  *
00005  *  (c) 2005 - 2010 Jochen Rieger (j.rieger@connecta.ag) 
00006  *  (c) 2010 - 2011 Michael Miousse (michael.miousse@infoglobe.ca)
00007  *  All rights reserved
00008  *
00009  *  This script is part of the TYPO3 project. The TYPO3 project is
00010  *  free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  The GNU General Public License can be found at
00016  *  http://www.gnu.org/copyleft/gpl.html.
00017  *
00018  *  This script is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU General Public License for more details.
00022  *
00023  *  This copyright notice MUST APPEAR in all copies of the script!
00024  ***************************************************************/
00025 /**
00026  * This class provides Check File Links plugin implementation.
00027  *
00028  * @author Dimitri König <dk@cabag.ch>
00029  * @author Michael Miousse <michael.miousse@infoglobe.ca>
00030  * @package TYPO3
00031  * @subpackage linkvalidator
00032  */
00033 class tx_linkvalidator_linktype_File extends tx_linkvalidator_linktype_Abstract {
00034 
00035     /**
00036      * Checks a given URL + /path/filename.ext for validity.
00037      *
00038      * @param   string    $url: url to check
00039      * @param    array     $softRefEntry: the softref entry which builds the context of that url
00040      * @param   object    $reference:  parent instance of tx_linkvalidator_Processor
00041      * @return  string    TRUE on success or FALSE on error
00042      */
00043     public function checkLink($url, $softRefEntry, $reference) {
00044         if (!@file_exists(PATH_site . rawurldecode($url))) {
00045             return FALSE;
00046         }
00047 
00048         return TRUE;
00049     }
00050 
00051     /**
00052      * Generate the localized error message from the error params saved from the parsing. 
00053      *
00054      * @param   array    all parameters needed for the rendering of the error message
00055      * @return  string    validation error message
00056      */
00057     public function getErrorMessage($errorParams) {
00058         $response = $GLOBALS['LANG']->getLL('list.report.filenotexisting');
00059         return $response;
00060     }
00061 
00062 
00063     /**
00064      * Url parsing
00065      *
00066      * @param   array      $row: broken link record
00067      * @return  string    parsed broken url
00068      */
00069     public function getBrokenUrl($row) {
00070         $brokenUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
00071         return $brokenUrl;
00072     }
00073 }
00074 
00075 
00076 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php'])) {
00077     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/linkvalidator/classes/linktypes/class.tx_linkvalidator_linktypes_file.php']);
00078 }
00079 
00080 ?>