TYPO3 CMS  TYPO3_6-2
AbstractDriver.php
Go to the documentation of this file.
1 <?php
3 
20 
25 abstract class AbstractDriver implements DriverInterface {
26 
27  /*******************
28  * CAPABILITIES
29  *******************/
36  protected $capabilities = 0;
37 
38 
44  protected $storageUid;
45 
53  protected $supportedHashAlgorithms = array();
54 
60  protected $configuration = array();
61 
67  public function __construct(array $configuration = array()) {
68  $this->configuration = $configuration;
69  }
70 
78  protected function isValidFilename($fileName) {
79  if (strpos($fileName, '/') !== FALSE) {
80  return FALSE;
81  }
82  if (!preg_match('/^[\\pL\\d[:blank:]._-]*$/u', $fileName)) {
83  return FALSE;
84  }
85  return TRUE;
86  }
87 
94  public function setStorageUid($storageUid) {
95  $this->storageUid = $storageUid;
96  }
97 
104  public function getCapabilities() {
105  return $this->capabilities;
106  }
107 
114  public function hasCapability($capability) {
115  return $this->capabilities & $capability == $capability;
116  }
117 
118  /*******************
119  * FILE FUNCTIONS
120  *******************/
121 
128  protected function getTemporaryPathForFile($fileIdentifier) {
129  return \TYPO3\CMS\Core\Utility\GeneralUtility::tempnam('fal-tempfile-', '.' . PathUtility::pathinfo($fileIdentifier, PATHINFO_EXTENSION));
130  }
131 
140  public function hashIdentifier($identifier) {
141  $identifier = $this->canonicalizeAndCheckFileIdentifier($identifier);
142  return sha1($identifier);
143  }
144 
153  public function sanitizeFileName($fileName, $charset = '') {
154  return $fileName;
155  }
156 
166  public function isCaseSensitiveFileSystem() {
167  if (isset($this->configuration['caseSensitive'])) {
168  return (bool)$this->configuration['caseSensitive'];
169  }
170  return TRUE;
171  }
172 
179  abstract protected function canonicalizeAndCheckFilePath($filePath);
180 
188  abstract protected function canonicalizeAndCheckFileIdentifier($fileIdentifier);
189 
196  abstract protected function canonicalizeAndCheckFolderIdentifier($folderIdentifier);
197 
198 }
__construct(array $configuration=array())
canonicalizeAndCheckFolderIdentifier($folderIdentifier)
static pathinfo($path, $options=NULL)