‪TYPO3CMS  9.5
FileLinktype.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 
26 {
35  public function ‪fetchType($value, $type, $key)
36  {
37  if (strpos(strtolower($value['tokenValue']), 'file:') === 0) {
38  $type = 'file';
39  }
40  return $type;
41  }
42 
51  public function ‪checkLink($url, $softRefEntry, $reference)
52  {
53  $resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
54  try {
55  $file = $resourceFactory->retrieveFileOrFolderObject($url);
56  } catch (‪FileDoesNotExistException $e) {
57  return false;
58  } catch (‪FolderDoesNotExistException $e) {
59  return false;
60  }
61 
62  return ($file !== null) ? !$file->isMissing() : false;
63  }
64 
72  {
73  return $this->‪getLanguageService()->‪getLL('list.report.filenotexisting');
74  }
75 
82  public function ‪getBrokenUrl($row)
83  {
84  return GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . $row['url'];
85  }
86 }
‪TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype\$errorParams
‪array $errorParams
Definition: AbstractLinktype.php:27
‪TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype\getLanguageService
‪LanguageService getLanguageService()
Definition: AbstractLinktype.php:79
‪TYPO3\CMS\Linkvalidator\Linktype\FileLinktype\getErrorMessage
‪string getErrorMessage($errorParams)
Definition: FileLinktype.php:71
‪TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
Definition: FileDoesNotExistException.php:21
‪TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype
Definition: AbstractLinktype.php:22
‪TYPO3\CMS\Linkvalidator\Linktype
Definition: AbstractLinktype.php:2
‪TYPO3\CMS\Linkvalidator\Linktype\FileLinktype
Definition: FileLinktype.php:26
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:33
‪TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException
Definition: FolderDoesNotExistException.php:21
‪TYPO3\CMS\Linkvalidator\Linktype\FileLinktype\fetchType
‪string fetchType($value, $type, $key)
Definition: FileLinktype.php:35
‪TYPO3\CMS\Core\Localization\LanguageService\getLL
‪string getLL($index)
Definition: LanguageService.php:118
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Linkvalidator\Linktype\FileLinktype\getBrokenUrl
‪string getBrokenUrl($row)
Definition: FileLinktype.php:82
‪TYPO3\CMS\Linkvalidator\Linktype\FileLinktype\checkLink
‪bool checkLink($url, $softRefEntry, $reference)
Definition: FileLinktype.php:51