TYPO3 CMS  TYPO3_8-7
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 
71  public function getErrorMessage($errorParams)
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 }
checkLink($url, $softRefEntry, $reference)
static makeInstance($className,... $constructorArguments)